From 9a139cc25da8396c1b257ccf99eb8d2fedfbc94d Mon Sep 17 00:00:00 2001 From: Liuyi <candymxq888@outlook.com> Date: 星期三, 23 十月 2024 17:24:35 +0800 Subject: [PATCH] 添加校验,修改头像 --- pages/infoBreakdown/index.vue | 6 pages/userInfo/index.vue | 127 +++++++++--- pages/functionList/rechargeRecord/index.vue | 46 ++++ static/images/other/nodata.png | 0 pages/addCard/index.vue | 131 ++++++++----- unpackage/dist/dev/mp-weixin/pages/index/index.js | 3 pages/functionList/paymentRecord/index.vue | 48 ++++ pages/functionList/balanceRecord/index.vue | 30 ++ unpackage/dist/dev/mp-weixin/pages/addCard/index.wxml | 2 unpackage/dist/dev/mp-weixin/pages/addCard/index.wxss | 39 +-- unpackage/dist/dev/mp-weixin/pages/addCard/index.js | 112 ++++++++--- unpackage/dist/dev/mp-weixin/pages/addCard/index.json | 4 pages/index/index.vue | 5 unpackage/dist/dev/mp-weixin/common/assets.js | 18 + unpackage/dist/dev/mp-weixin/pages/address/index.js | 2 15 files changed, 404 insertions(+), 169 deletions(-) diff --git a/pages/addCard/index.vue b/pages/addCard/index.vue index 8e0ef25..c9bb53c 100644 --- a/pages/addCard/index.vue +++ b/pages/addCard/index.vue @@ -21,29 +21,51 @@ } }); } +//校验 +const formRef = ref() +const rules = ref({ + waterCardNumber: { + rules:[ + {required: true,errorMessage: '请输入卡号'}] + }, + userName: { + rules:[ + {required: true,errorMessage: '请输入姓名'}, + {pattern:/^[\u4e00-\u9fa5\\.]+$/, errorMessage: '请输入中文或" . "符号'} + ] + }, + userPhone: { + rules:[ + {required: true,errorMessage: '请输入您的手机号'}, + {pattern: /^1[3-9]\d{9}$/, errorMessage: '手机号格式不正确'} + ] + }, +}) async function submit(){ - await creatUserArchive(form.value).then((res) =>{ - if(res.code == 200){ - uni.showToast({ - title: '添加成功!', - image: '../../static/images/other/success.svg', - duration:2000 - }).then(() =>{ - uni.navigateBack() - }) - }else if(res.code == 300){ - uni.showToast({ - title: res.msg, - duration:2000, - icon:'none' - }) - }else{ - uni.showToast({ - title:'绑卡失败', - duration:2000, - icon:'none' - }) - } + formRef.value.validate().then(async() =>{ + await creatUserArchive(form.value).then((res) =>{ + if(res.code == 200){ + uni.showToast({ + title: '添加成功!', + image: '../../static/images/other/success.svg', + duration:2000 + }).then(() =>{ + uni.navigateBack() + }) + }else if(res.code == 300){ + uni.showToast({ + title: res.msg, + duration:2000, + icon:'none' + }) + }else{ + uni.showToast({ + title:'绑卡失败', + duration:2000, + icon:'none' + }) + } + }) }) } onMounted(() =>{ @@ -56,6 +78,25 @@ <view class="main"> <view class="title">请填写卡及个人信息</view> <view class="form"> + <uni-forms ref="formRef" :model="form" :rules="rules" label-width = 100> + <uni-forms-item class="form-item" label="卡号:" name="waterCardNumber"> + <view class="card-item"> + <input v-model="form.waterCardNumber" placeholder="请输入卡号或扫描二维码" /> + <image @click="toScan()" src="../../static/images/addCard/code.png" alt=""></image> + </view> + </uni-forms-item> + <uni-forms-item label="姓名:" name="userName"> + <input v-model="form.userName" placeholder="请输入姓名" /> + </uni-forms-item> + <uni-forms-item label="联系方式:" name="userPhone"> + <input type="textarea" v-model="form.userPhone" placeholder="请输入手机号" /> + </uni-forms-item> + <uni-forms-item label="备注:" name="remark"> + <input type="textarea" v-model="form.remark" placeholder="请输入内容" /> + </uni-forms-item> + </uni-forms> + </view> + <!-- <view class="form"> <view class="form-item card-item"> <text>卡号:</text> <input v-model="form.waterCardNumber" placeholder="请输入卡号"/> @@ -73,10 +114,10 @@ <text>备注:</text> <input v-model="form.remark" placeholder="请输入内容"/> </view> - </view> + </view> --> <view class="tips"> <text>1、完成实名认证,方便遗失挂失及补卡等。</text> - <text>2、绑卡后,运营商可以看到您实名时填写的 姓名和电话。</text> + <text>2、绑卡后,运营商可以看到您实名时填写的姓名和电话。</text> </view> <view class="subBtn" @click="submit()">提交信息</view> </view> @@ -95,7 +136,7 @@ width:100%; height: calc(100vh - 176rpx); background:linear-gradient(to top,#FFFFFF,#E8EFFF); - padding:0 32rpx 38rpx; + padding:0 50rpx 38rpx; box-sizing:border-box; .title{ width:100%; @@ -105,38 +146,26 @@ // background: #e6e6e6; } .form{ - height: 700rpx; + height: 600rpx; width:100%; background: #FFFFFF; border-radius: 24rpx; - .form-item{ - height:100rpx; - width:96%; - border-bottom:1px solid rgba(226,226,226,0.6); - display: flex; - justify-content:space-between; - align-items: center; - margin: 0 auto; - text{ - width:160rpx; - font-weight:400; - font-size: 32rpx; - color: #000000; - margin-left: 24rpx; - // margin-right: 82rpx; - } - input{ - width: 450rpx; - :deep(.uni-input-placeholder ){ - font-weight: 300; - font-size:32rpx; - color: #ccc; - } - } + padding:30rpx 50rpx 0; + box-sizing: border-box; + input{ + line-height:100%; + height:100%; } .card-item{ + display: flex; + justify-content: space-around; + height:100%; + align-items: center; input{ width:375rpx; + margin-right:20rpx; + line-height:100%; + height:100%; } image{ width:44rpx; @@ -154,7 +183,7 @@ flex-direction: column; margin-top:56rpx; font-weight: 300; - font-size: 32rpx; + font-size:28rpx; color: #484848; text:first-child{ margin-bottom:28rpx; diff --git a/pages/functionList/balanceRecord/index.vue b/pages/functionList/balanceRecord/index.vue index e02df72..be0136e 100644 --- a/pages/functionList/balanceRecord/index.vue +++ b/pages/functionList/balanceRecord/index.vue @@ -65,7 +65,7 @@ <picker mode="date" :value="datePay" :fields="'month'" @change="bindDateChange"> <view class="date-text"> <!-- <text>日期:</text> --> - <text class="uni-input">{{datePay}}</text> + <text class="uni-input">日期:{{datePay}}</text> <image src="../../../static/images/other/expand.png" alt=''></image> </view> </picker> @@ -75,7 +75,7 @@ <text>充值¥{{rechargeSta}}</text> </view> </view> - <view class="main"> + <view class="main" v-if="banlanceList.length > 0"> <block v-for="(item,index) in banlanceList"> <view class="item"> <view class="item-left"> @@ -92,6 +92,10 @@ </view> </view> </block> + </view> + <view v-else class="nodata"> + <image src="../../../static/images/other/nodata.png" alt=""></image> + <text>该月暂无记录</text> </view> </view> </template> @@ -130,8 +134,8 @@ } .date-money{ font-weight: 300; - font-size: 24rpx; - color: #7E7E7E; + font-size: 26rpx; + color: #3368bd; text:first-child{ margin-right:30rpx; } @@ -199,5 +203,23 @@ } } } + .nodata{ + width:100%; + height:1200rpx; + display: flex; + justify-content: center; + align-items: center; + padding-bottom:400rpx; + box-sizing: border-box; + flex-direction: column; + image{ + width:496rpx; + height:488rpx; + } + text{ + // color: rgba(111, 111, 111, 0.5); + color:#bed2fd; + } + } } </style> diff --git a/pages/functionList/paymentRecord/index.vue b/pages/functionList/paymentRecord/index.vue index eed3143..593be7b 100644 --- a/pages/functionList/paymentRecord/index.vue +++ b/pages/functionList/paymentRecord/index.vue @@ -1,6 +1,6 @@ <script setup> import { onMounted, ref } from 'vue' - import { paymentChangeApi } from '../../../api/index.js' + import { paymentChangeApi,balanceStatisticsApi } from '../../../api/index.js' //返回 function navBackTo(){ uni.navigateBack() @@ -30,10 +30,19 @@ //获取消费变动列表 const banlanceList = ref([]) async function getBalanceList(val){ - await paymentChangeApi(val).then((res) =>{ + await paymentChangeApi(val).then(async(res) =>{ if(res.code == 200){ banlanceList.value = res.data + await getStatistics(val) } + + }) + } + //消费统计 + const expendSta = ref() + async function getStatistics(val){ + await balanceStatisticsApi(val).then((res) =>{ + expendSta.value = res.data.expenditureAmount }) } onMounted(async() =>{ @@ -48,13 +57,14 @@ <view class="picker"> <picker mode="date" :value="datePay" :fields="'month'" @change="bindDateChange"> <view class="date-text"> - <text class="uni-input">{{datePay}}</text> + <text class="uni-input">日期:{{datePay}}</text> <image src="../../../static/images/other/expand.png" alt=''></image> </view> </picker> </view> + <view class="payAll">消费¥:{{expendSta}}</view> </view> - <view class="main"> + <view class="main" v-if="banlanceList.length > 0"> <block v-for="(item,index) in banlanceList"> <view class="item"> <view class="item-left"> @@ -68,6 +78,10 @@ </view> </view> </block> + </view> + <view v-else class="nodata"> + <image src="../../../static/images/other/nodata.png" alt=""></image> + <text>该月暂无记录</text> </view> </view> </template> @@ -83,7 +97,7 @@ display: flex; padding: 0 36rpx; box-sizing: border-box; - justify-content:flex-start; + justify-content:space-between; align-items: center; .picker{ .date-text{ @@ -103,6 +117,11 @@ // margin-top:10rpx; } } + } + .payAll{ + font-weight: 300; + font-size: 26rpx; + color: #3368bd; } } .main{ @@ -166,5 +185,24 @@ } } } + .nodata{ + + width:100%; + height:1200rpx; + display: flex; + justify-content: center; + align-items: center; + padding-bottom:400rpx; + box-sizing: border-box; + flex-direction: column; + image{ + width:496rpx; + height:488rpx; + } + + text{ + color:#bed2fd; + } + } } </style> diff --git a/pages/functionList/rechargeRecord/index.vue b/pages/functionList/rechargeRecord/index.vue index e794bab..200eccd 100644 --- a/pages/functionList/rechargeRecord/index.vue +++ b/pages/functionList/rechargeRecord/index.vue @@ -1,6 +1,6 @@ <script setup> import { onMounted, ref } from 'vue' - import { rechargeChangeApi } from '../../../api/index.js' + import { rechargeChangeApi,balanceStatisticsApi} from '../../../api/index.js' //返回 function navBackTo(){ uni.navigateBack() @@ -30,10 +30,19 @@ //获取消费变动列表 const banlanceList = ref([]) async function getBalanceList(val){ - await rechargeChangeApi(val).then((res) =>{ + await rechargeChangeApi(val).then(async(res) =>{ if(res.code == 200){ banlanceList.value = res.data } + await getStatistics(val) + }) + } + + //获取用户资金变动统计 + const rechargeSta = ref() + async function getStatistics(val){ + await balanceStatisticsApi(val).then((res) =>{ + rechargeSta.value = res.data.rechargeAmount }) } onMounted(async() =>{ @@ -48,13 +57,14 @@ <view class="picker"> <picker mode="date" :value="datePay" :fields="'month'" @change="bindDateChange"> <view class="date-text"> - <text class="uni-input">{{datePay}}</text> + <text class="uni-input">日期:{{datePay}}</text> <image src="../../../static/images/other/expand.png" alt=''></image> </view> </picker> </view> + <view class="rechargeAll">充值¥:{{rechargeSta}}</view> </view> - <view class="main"> + <view class="main" v-if="banlanceList.length > 0"> <block v-for="(item,index) in banlanceList"> <view class="item"> <view class="item-left"> @@ -68,6 +78,10 @@ </view> </view> </block> + </view> + <view v-else class="nodata"> + <image src="../../../static/images/other/nodata.png" alt=""></image> + <text>该月暂无记录</text> </view> </view> </template> @@ -83,7 +97,7 @@ display: flex; padding: 0 36rpx; box-sizing: border-box; - justify-content:flex-start; + justify-content:space-between; align-items: center; .picker{ .date-text{ @@ -103,6 +117,11 @@ // margin-top:10rpx; } } + } + .rechargeAll{ + font-weight: 300; + font-size: 26rpx; + color: #3368bd; } } .main{ @@ -166,5 +185,22 @@ } } } + .nodata{ + width:100%; + height:1200rpx; + display: flex; + justify-content: center; + align-items: center; + padding-bottom:400rpx; + box-sizing: border-box; + flex-direction: column; + image{ + width:496rpx; + height:488rpx; + } + text{ + color:#bed2fd; + } + } } </style> diff --git a/pages/index/index.vue b/pages/index/index.vue index 2603032..600aa26 100644 --- a/pages/index/index.vue +++ b/pages/index/index.vue @@ -1,5 +1,6 @@ <script setup> import { onMounted, ref } from "vue"; + import { BASE_URL } from '../../config/baseUrl'; import { getVipInfoApi,getUserInfo,reportLossApi,removeCardApi,buyWaterApi } from '../../api/index.js' import { onShow,getCurrentPages } from '@dcloudio/uni-app' //状态栏高度 @@ -25,6 +26,7 @@ state:'',//state:true:挂失,false:正常 userCardType:'',//userCardType:true:共享卡,false:正常卡 }) + // const showHeadImg = ref(BASE_URL + '/upload' + cardInfo.value.headImg) const isLoss = ref(false) const isVip = ref(false) const isShareCard = ref(false) @@ -56,6 +58,7 @@ if(res.code == 200){ cardInfo.value.userName = res.data.userInfo.userName ? res.data.userInfo.userName : cardInfo.value.userName cardInfo.value.headImg = res.data.userInfo.headImg + // showHeadImg.value = BASE_URL + '/upload' + cardInfo.value.headImg cardInfo.value.userPhone = res.data.userInfo.userPhone cardInfo.value.id = res.data.userInfo.id await getVipInfo() @@ -242,7 +245,7 @@ <view class="content"> <view class="card-box" :style="{paddingTop:topHeight + 'rpx'}"> <view class="user-info" > - <image v-if="cardInfo.headImg" class="user-img" :src='cardInfo.headImg' alt=''></image> + <image v-if="cardInfo.headImg" class="user-img" :src= "BASE_URL + '/upload' + cardInfo.headImg" alt=''></image> <image v-else class="user-img" src='../../static/images/index/head.png' alt=''></image> <text @click="navTo('/pages/userInfo/index')">{{cardInfo.userName}}</text> <image @click="navTo('/pages/userInfo/index')" class="user-more"src="../../static/images/index/back.png"></image> diff --git a/pages/infoBreakdown/index.vue b/pages/infoBreakdown/index.vue index 3209322..5d308e1 100644 --- a/pages/infoBreakdown/index.vue +++ b/pages/infoBreakdown/index.vue @@ -85,7 +85,7 @@ }); } async function submit(){ - if(formRef.value.validate()){ + formRef.value.validate().then(async() =>{ form.value.url = uploadList.value //去掉数组中空字符串,数组转字符串 form.value.url = form.value.url.filter(str => str !== '').join() @@ -103,11 +103,11 @@ describe:'', url:'', } - // uni.navigateBack() + uni.navigateBack() },1000) } }) - } + }) } </script> <template> diff --git a/pages/userInfo/index.vue b/pages/userInfo/index.vue index 90d1241..c1849a1 100644 --- a/pages/userInfo/index.vue +++ b/pages/userInfo/index.vue @@ -5,6 +5,7 @@ const isEdit = ref(false) const editForm = ref({id:'',userName:'',userPhone:''}) const userInfo = ref(JSON.parse(uni.getStorageSync('userInfo'))) + // const showHeadImg = ref(BASE_URL + '/upload' + userInfo.value.headImg) //修改用户头像 function changeImg(){ uni.chooseImage({ @@ -22,8 +23,8 @@ success: async(success) => { console.log('success',success); let dataObj = JSON.parse(success.data) - let headImgStatic = BASE_URL + '/upload' + dataObj.data.newFileName - await editUserInfoApi({id:userInfo.value.id,headImg:headImgStatic}).then(async(res) =>{ + // let headImgStatic = BASE_URL + '/upload' + dataObj.data.newFileName + await editUserInfoApi({id:userInfo.value.id,headImg:dataObj.data.newFileName}).then(async(res) =>{ if(res.code == 200){ uni.showToast({ title: '修改成功!', @@ -31,6 +32,9 @@ }); await getUserInfo().then((res) =>{ userInfo.value.headImg = res.data.userInfo.headImg + // showHeadImg.value = BASE_URL + '/upload' + userInfo.value.headImg + console.log('resheadImg',userInfo.value.headImg) + uni.setStorageSync('userInfo',JSON.stringify(userInfo.value)) }) }else{ @@ -54,8 +58,10 @@ } }); } - //修改用户信息 + //修改用户电话及名称 function edit(){ + validatePhone.value = true + validateUserName.value = true editForm.value.id = userInfo.value.id editForm.value.userName = userInfo.value.userName editForm.value.userPhone = userInfo.value.userPhone @@ -66,29 +72,65 @@ isEdit.value = false editForm.vlaue = {id:'',userName:'',userPhone:''} } + //添加校验 + const validateUserName = ref(true) + function onBlur1(event){ + const nameValue = event.target.value + const regExp =/^[\u4e00-\u9fa5\\.]+$/ + if(!regExp.test(nameValue)){ + validateUserName.value = false + }else{ + validateUserName.value = true + } + } + const validatePhone = ref(true) + function onBlur2(event){ + const nameValue = event.target.value + const regExp =/^1[3-9]\d{9}$/ + if(!regExp.test(nameValue)){ + validatePhone.value = false + }else{ + validatePhone.value = true + } + } + function validate(){ + if(validatePhone.value && validateUserName.value){ + return true + }else{ + return false + } + } + //提交修改表单 async function submitEdit(){ - await editUserInfoApi(editForm.value).then(async(res) =>{ - - if(res.code == 200){ - uni.showToast({ - title: '修改成功!', - duration: 2000, - }); - await getUserInfo().then((res) =>{ - userInfo.value.userName = res.data.userInfo.userName - userInfo.value.userPhone = res.data.userInfo.userPhone - uni.setStorageSync('userInfo',JSON.stringify(userInfo.value)) - }) - }else{ - uni.showToast({ - title: '网络错误!请重试', - duration: 2000, - icon:'none' - }); - } - isEdit.value = false - editForm.vlaue = {id:'',userName:'',userPhone:''} - }) + if(validate()){ + await editUserInfoApi(editForm.value).then(async(res) =>{ + + if(res.code == 200){ + uni.showToast({ + title: '修改成功!', + duration: 2000, + }); + await getUserInfo().then((res) =>{ + userInfo.value.userName = res.data.userInfo.userName + userInfo.value.userPhone = res.data.userInfo.userPhone + uni.setStorageSync('userInfo',JSON.stringify(userInfo.value)) + }) + }else{ + uni.showToast({ + title: '网络错误!请重试', + duration: 2000, + icon:'none' + }); + } + isEdit.value = false + editForm.vlaue = {id:'',userName:'',userPhone:''} + }) + }else{ + uni.showToast({ + title:'输入不符合格式', + icon:'none' + }) + } } </script> <template> @@ -100,7 +142,7 @@ <view class="info-img"> <text>头像</text> <view class="img-box" @click="changeImg"> - <image v-if="userInfo.headImg" :src='userInfo.headImg' alt=''></image> + <image v-if="userInfo.headImg" :src="BASE_URL + '/upload' + userInfo.headImg" alt=''></image> <image v-else src='../../static/images/index/head.png' alt=''></image> <image src='../../static/images/other/more.png' alt=''></image> </view> @@ -108,7 +150,10 @@ <view class="info-name"> <text>用户名称</text> <view> - <input v-if="isEdit" v-model="editForm.userName" placeholder="请输入新用户名"/> + <view v-if="isEdit"> + <input v-model="editForm.userName" @blur="onBlur1" placeholder="请输入新用户名"/> + <text class="validate-text" v-if="!validateUserName">请输入中文或" . "符号</text> + </view> <text v-else class="info-value">{{userInfo.userName}}</text> </view> </view> @@ -121,8 +166,11 @@ </view> <view class="item"> <text>联系方式</text> - <view> - <input v-if="isEdit" v-model="editForm.userPhone" placeholder="请输入新联系方式"/> + <view class="item-change"> + <view v-if="isEdit"> + <input v-model="editForm.userPhone" @blur="onBlur2" placeholder="请输入新联系方式"/> + <text v-if="!validatePhone">请输入正确的手机号格式</text> + </view> <text v-if="userInfo.userPhone && !isEdit">{{userInfo.userPhone}}</text> <text v-if="!userInfo.userPhone && !isEdit">未添加联系方式</text> <!-- <image class="edit"src="../../static/images//other/more.png" alt=''></image> --> @@ -161,10 +209,11 @@ width: 100%; //该页面公用input样式 input{ - border-radius: 10rpx; - border:1px solid rgba(101, 156, 244, 0.2); + border-radius:5rpx; + border-bottom: 1px solid rgba(83, 131, 203, 0.5); + // border:1px solid rgba(101, 156, 244, 0.2); padding:5rpx 10rpx; - box-shadow: 0 0 12rpx 1rpx rgba(101, 156, 244, 0.2); + // box-shadow: 0 0 12rpx 1rpx rgba(101, 156, 244, 0.2); color: #777777; height:50rpx; line-height:50rpx; @@ -208,6 +257,10 @@ display: flex; justify-content:space-between; align-items:center; + .validate-text{ + color:#f56c6c; + font-size:24rpx; + } } } .info-list{ @@ -230,11 +283,19 @@ text:last-child{ color: #777777; } - view{ + .item-change{ height: 116rpx; display: flex; justify-content:flex-end; align-items: center; + view{ + display: flex; + flex-direction: column; + text{ + color:#f56c6c; + font-size:24rpx; + } + } text{ color: #777777; } diff --git a/static/images/other/nodata.png b/static/images/other/nodata.png new file mode 100644 index 0000000..fd46421 --- /dev/null +++ b/static/images/other/nodata.png Binary files differ diff --git a/unpackage/dist/dev/mp-weixin/common/assets.js b/unpackage/dist/dev/mp-weixin/common/assets.js index ea05cb6..652f1bf 100644 --- a/unpackage/dist/dev/mp-weixin/common/assets.js +++ b/unpackage/dist/dev/mp-weixin/common/assets.js @@ -1,19 +1,20 @@ "use strict"; const _imports_0$a = "/static/images/index/head.png"; -const _imports_1$4 = "/static/images/index/back.png"; +const _imports_1$5 = "/static/images/index/back.png"; const _imports_2 = "/static/images/index/vip-add.png"; const _imports_0$9 = "/static/images/index/card11.png"; const _imports_4 = "/static/images/index/code1.png"; const _imports_5 = "/static/images/index/home21.png"; -const _imports_1$3 = "/static/images/index/icon22.png"; +const _imports_1$4 = "/static/images/index/icon22.png"; const _imports_7 = "/static/images/index/icon23.png"; const _imports_8 = "/static/images/index/bg4.png"; const _imports_9 = "/static/images/index/icon51.png"; const _imports_10 = "/static/images/index/more-info5.png"; const _imports_11 = "/static/images/index/notice5.png"; const _imports_0$8 = "/static/images/addCard/code.png"; -const _imports_1$2 = "/static/images/other/more.png"; +const _imports_1$3 = "/static/images/other/more.png"; const _imports_0$7 = "/static/images/other/expand.png"; +const _imports_1$2 = "/static/images/other/nodata.png"; const _imports_0$6 = "/static/images/other/code-none.png"; const _imports_0$5 = "/static/images/other/success.png"; const _imports_0$4 = "/static/images/address/edit.png"; @@ -34,11 +35,12 @@ exports._imports_0$7 = _imports_0$4; exports._imports_0$8 = _imports_0$3; exports._imports_0$9 = _imports_0$2; -exports._imports_1 = _imports_1$3; -exports._imports_1$1 = _imports_1$4; -exports._imports_1$2 = _imports_1$2; -exports._imports_1$3 = _imports_1$1; -exports._imports_1$4 = _imports_1; +exports._imports_1 = _imports_1$4; +exports._imports_1$1 = _imports_1$5; +exports._imports_1$2 = _imports_1$3; +exports._imports_1$3 = _imports_1$2; +exports._imports_1$4 = _imports_1$1; +exports._imports_1$5 = _imports_1; exports._imports_10 = _imports_10; exports._imports_11 = _imports_11; exports._imports_2 = _imports_2; diff --git a/unpackage/dist/dev/mp-weixin/pages/addCard/index.js b/unpackage/dist/dev/mp-weixin/pages/addCard/index.js index 909e8f9..917925e 100644 --- a/unpackage/dist/dev/mp-weixin/pages/addCard/index.js +++ b/unpackage/dist/dev/mp-weixin/pages/addCard/index.js @@ -4,11 +4,15 @@ const api_index = require("../../api/index.js"); if (!Array) { const _easycom_navbar2 = common_vendor.resolveComponent("navbar"); - _easycom_navbar2(); + const _easycom_uni_forms_item2 = common_vendor.resolveComponent("uni-forms-item"); + const _easycom_uni_forms2 = common_vendor.resolveComponent("uni-forms"); + (_easycom_navbar2 + _easycom_uni_forms_item2 + _easycom_uni_forms2)(); } const _easycom_navbar = () => "../../components/navbar/navbar.js"; +const _easycom_uni_forms_item = () => "../../uni_modules/uni-forms/components/uni-forms-item/uni-forms-item.js"; +const _easycom_uni_forms = () => "../../uni_modules/uni-forms/components/uni-forms/uni-forms.js"; if (!Math) { - _easycom_navbar(); + (_easycom_navbar + _easycom_uni_forms_item + _easycom_uni_forms)(); } const _sfc_main = { __name: "index", @@ -31,29 +35,51 @@ } }); } + const formRef = common_vendor.ref(); + const rules = common_vendor.ref({ + waterCardNumber: { + rules: [ + { required: true, errorMessage: "请输入卡号" } + ] + }, + userName: { + rules: [ + { required: true, errorMessage: "请输入姓名" }, + { pattern: /^[\u4e00-\u9fa5\\.]+$/, errorMessage: '请输入中文或" . "符号' } + ] + }, + userPhone: { + rules: [ + { required: true, errorMessage: "请输入您的手机号" }, + { pattern: /^1[3-9]\d{9}$/, errorMessage: "手机号格式不正确" } + ] + } + }); async function submit() { - await api_index.creatUserArchive(form.value).then((res) => { - if (res.code == 200) { - common_vendor.index.showToast({ - title: "添加成功!", - image: "../../static/images/other/success.svg", - duration: 2e3 - }).then(() => { - common_vendor.index.navigateBack(); - }); - } else if (res.code == 300) { - common_vendor.index.showToast({ - title: res.msg, - duration: 2e3, - icon: "none" - }); - } else { - common_vendor.index.showToast({ - title: "绑卡失败", - duration: 2e3, - icon: "none" - }); - } + formRef.value.validate().then(async () => { + await api_index.creatUserArchive(form.value).then((res) => { + if (res.code == 200) { + common_vendor.index.showToast({ + title: "添加成功!", + image: "../../static/images/other/success.svg", + duration: 2e3 + }).then(() => { + common_vendor.index.navigateBack(); + }); + } else if (res.code == 300) { + common_vendor.index.showToast({ + title: res.msg, + duration: 2e3, + icon: "none" + }); + } else { + common_vendor.index.showToast({ + title: "绑卡失败", + duration: 2e3, + icon: "none" + }); + } + }); }); } common_vendor.onMounted(() => { @@ -67,13 +93,37 @@ c: common_vendor.o(($event) => form.value.waterCardNumber = $event.detail.value), d: common_vendor.o(($event) => toScan()), e: common_assets._imports_0$3, - f: form.value.userName, - g: common_vendor.o(($event) => form.value.userName = $event.detail.value), - h: form.value.userPhone, - i: common_vendor.o(($event) => form.value.userPhone = $event.detail.value), - j: form.value.remark, - k: common_vendor.o(($event) => form.value.remark = $event.detail.value), - l: common_vendor.o(($event) => submit()) + f: common_vendor.p({ + label: "卡号:", + name: "waterCardNumber" + }), + g: form.value.userName, + h: common_vendor.o(($event) => form.value.userName = $event.detail.value), + i: common_vendor.p({ + label: "姓名:", + name: "userName" + }), + j: form.value.userPhone, + k: common_vendor.o(($event) => form.value.userPhone = $event.detail.value), + l: common_vendor.p({ + label: "联系方式:", + name: "userPhone" + }), + m: form.value.remark, + n: common_vendor.o(($event) => form.value.remark = $event.detail.value), + o: common_vendor.p({ + label: "备注:", + name: "remark" + }), + p: common_vendor.sr(formRef, "4c5e7c86-1", { + "k": "formRef" + }), + q: common_vendor.p({ + model: form.value, + rules: rules.value, + ["label-width"]: "100" + }), + r: common_vendor.o(($event) => submit()) }; }; } diff --git a/unpackage/dist/dev/mp-weixin/pages/addCard/index.json b/unpackage/dist/dev/mp-weixin/pages/addCard/index.json index ff63ccc..a7ecc1a 100644 --- a/unpackage/dist/dev/mp-weixin/pages/addCard/index.json +++ b/unpackage/dist/dev/mp-weixin/pages/addCard/index.json @@ -1,6 +1,8 @@ { "navigationStyle": "custom", "usingComponents": { - "navbar": "../../components/navbar/navbar" + "navbar": "../../components/navbar/navbar", + "uni-forms-item": "../../uni_modules/uni-forms/components/uni-forms-item/uni-forms-item", + "uni-forms": "../../uni_modules/uni-forms/components/uni-forms/uni-forms" } } \ No newline at end of file diff --git a/unpackage/dist/dev/mp-weixin/pages/addCard/index.wxml b/unpackage/dist/dev/mp-weixin/pages/addCard/index.wxml index 61e7de0..94277e9 100644 --- a/unpackage/dist/dev/mp-weixin/pages/addCard/index.wxml +++ b/unpackage/dist/dev/mp-weixin/pages/addCard/index.wxml @@ -1 +1 @@ -<view class="container data-v-4c5e7c86"><view class="content data-v-4c5e7c86"><navbar wx:if="{{a}}" class="data-v-4c5e7c86" u-i="4c5e7c86-0" bind:__l="__l" u-p="{{a}}"></navbar><view class="main data-v-4c5e7c86"><view class="title data-v-4c5e7c86">请填写卡及个人信息</view><view class="form data-v-4c5e7c86"><view class="form-item card-item data-v-4c5e7c86"><text class="data-v-4c5e7c86">卡号:</text><input class="data-v-4c5e7c86" placeholder="请输入卡号" value="{{b}}" bindinput="{{c}}"/><image class="data-v-4c5e7c86" bindtap="{{d}}" src="{{e}}" alt=""></image></view><view class="form-item data-v-4c5e7c86"><text class="data-v-4c5e7c86">姓名:</text><input class="data-v-4c5e7c86" placeholder="请输入姓名" value="{{f}}" bindinput="{{g}}"/></view><view class="form-item data-v-4c5e7c86"><text class="data-v-4c5e7c86">联系方式:</text><input class="data-v-4c5e7c86" placeholder="请输入手机号" value="{{h}}" bindinput="{{i}}"/></view><view class="form-item data-v-4c5e7c86"><text class="data-v-4c5e7c86">备注:</text><input class="data-v-4c5e7c86" placeholder="请输入内容" value="{{j}}" bindinput="{{k}}"/></view></view><view class="tips data-v-4c5e7c86"><text class="data-v-4c5e7c86">1、完成实名认证,方便遗失挂失及补卡等。</text><text class="data-v-4c5e7c86">2、绑卡后,运营商可以看到您实名时填写的 姓名和电话。</text></view><view class="subBtn data-v-4c5e7c86" bindtap="{{l}}">提交信息</view></view></view></view> \ No newline at end of file +<view class="container data-v-4c5e7c86"><view class="content data-v-4c5e7c86"><navbar wx:if="{{a}}" class="data-v-4c5e7c86" u-i="4c5e7c86-0" bind:__l="__l" u-p="{{a}}"></navbar><view class="main data-v-4c5e7c86"><view class="title data-v-4c5e7c86">请填写卡及个人信息</view><view class="form data-v-4c5e7c86"><uni-forms wx:if="{{q}}" class="r data-v-4c5e7c86" u-s="{{['d']}}" u-r="formRef" u-i="4c5e7c86-1" bind:__l="__l" u-p="{{q}}"><uni-forms-item wx:if="{{f}}" u-s="{{['d']}}" class="form-item data-v-4c5e7c86" u-i="4c5e7c86-2,4c5e7c86-1" bind:__l="__l" u-p="{{f}}"><view class="card-item data-v-4c5e7c86"><input class="data-v-4c5e7c86" placeholder="请输入卡号或扫描二维码" value="{{b}}" bindinput="{{c}}"/><image class="data-v-4c5e7c86" bindtap="{{d}}" src="{{e}}" alt=""></image></view></uni-forms-item><uni-forms-item wx:if="{{i}}" class="data-v-4c5e7c86" u-s="{{['d']}}" u-i="4c5e7c86-3,4c5e7c86-1" bind:__l="__l" u-p="{{i}}"><input class="data-v-4c5e7c86" placeholder="请输入姓名" value="{{g}}" bindinput="{{h}}"/></uni-forms-item><uni-forms-item wx:if="{{l}}" class="data-v-4c5e7c86" u-s="{{['d']}}" u-i="4c5e7c86-4,4c5e7c86-1" bind:__l="__l" u-p="{{l}}"><input class="data-v-4c5e7c86" type="textarea" placeholder="请输入手机号" value="{{j}}" bindinput="{{k}}"/></uni-forms-item><uni-forms-item wx:if="{{o}}" class="data-v-4c5e7c86" u-s="{{['d']}}" u-i="4c5e7c86-5,4c5e7c86-1" bind:__l="__l" u-p="{{o}}"><input class="data-v-4c5e7c86" type="textarea" placeholder="请输入内容" value="{{m}}" bindinput="{{n}}"/></uni-forms-item></uni-forms></view><view class="tips data-v-4c5e7c86"><text class="data-v-4c5e7c86">1、完成实名认证,方便遗失挂失及补卡等。</text><text class="data-v-4c5e7c86">2、绑卡后,运营商可以看到您实名时填写的姓名和电话。</text></view><view class="subBtn data-v-4c5e7c86" bindtap="{{r}}">提交信息</view></view></view></view> \ No newline at end of file diff --git a/unpackage/dist/dev/mp-weixin/pages/addCard/index.wxss b/unpackage/dist/dev/mp-weixin/pages/addCard/index.wxss index d4b3e1b..331c799 100644 --- a/unpackage/dist/dev/mp-weixin/pages/addCard/index.wxss +++ b/unpackage/dist/dev/mp-weixin/pages/addCard/index.wxss @@ -35,7 +35,7 @@ width: 100%; height: calc(100vh - 176rpx); background: linear-gradient(to top, #FFFFFF, #E8EFFF); - padding: 0 32rpx 38rpx; + padding: 0 50rpx 38rpx; box-sizing: border-box; } .container .content .main .title.data-v-4c5e7c86 { @@ -45,37 +45,28 @@ line-height: 130rpx; } .container .content .main .form.data-v-4c5e7c86 { - height: 700rpx; + height: 600rpx; width: 100%; background: #FFFFFF; border-radius: 24rpx; + padding: 30rpx 50rpx 0; + box-sizing: border-box; } -.container .content .main .form .form-item.data-v-4c5e7c86 { - height: 100rpx; - width: 96%; - border-bottom: 1px solid rgba(226, 226, 226, 0.6); +.container .content .main .form input.data-v-4c5e7c86 { + line-height: 100%; + height: 100%; +} +.container .content .main .form .card-item.data-v-4c5e7c86 { display: flex; - justify-content: space-between; + justify-content: space-around; + height: 100%; align-items: center; - margin: 0 auto; -} -.container .content .main .form .form-item text.data-v-4c5e7c86 { - width: 160rpx; - font-weight: 400; - font-size: 32rpx; - color: #000000; - margin-left: 24rpx; -} -.container .content .main .form .form-item input.data-v-4c5e7c86 { - width: 450rpx; -} -.container .content .main .form .form-item input.data-v-4c5e7c86 .uni-input-placeholder { - font-weight: 300; - font-size: 32rpx; - color: #ccc; } .container .content .main .form .card-item input.data-v-4c5e7c86 { width: 375rpx; + margin-right: 20rpx; + line-height: 100%; + height: 100%; } .container .content .main .form .card-item image.data-v-4c5e7c86 { width: 44rpx; @@ -91,7 +82,7 @@ flex-direction: column; margin-top: 56rpx; font-weight: 300; - font-size: 32rpx; + font-size: 28rpx; color: #484848; } .container .content .main .tips text.data-v-4c5e7c86:first-child { diff --git a/unpackage/dist/dev/mp-weixin/pages/address/index.js b/unpackage/dist/dev/mp-weixin/pages/address/index.js index b976bea..4d09635 100644 --- a/unpackage/dist/dev/mp-weixin/pages/address/index.js +++ b/unpackage/dist/dev/mp-weixin/pages/address/index.js @@ -89,7 +89,7 @@ }; }), c: common_assets._imports_0$7, - d: common_assets._imports_1$3, + d: common_assets._imports_1$4, e: common_vendor.o(($event) => navToAdd()) }; }; diff --git a/unpackage/dist/dev/mp-weixin/pages/index/index.js b/unpackage/dist/dev/mp-weixin/pages/index/index.js index 104ed16..10e4230 100644 --- a/unpackage/dist/dev/mp-weixin/pages/index/index.js +++ b/unpackage/dist/dev/mp-weixin/pages/index/index.js @@ -1,6 +1,7 @@ "use strict"; const common_vendor = require("../../common/vendor.js"); const common_assets = require("../../common/assets.js"); +const config_baseUrl = require("../../config/baseUrl.js"); const api_index = require("../../api/index.js"); const _sfc_main = { __name: "index", @@ -223,7 +224,7 @@ return common_vendor.e({ a: cardInfo.value.headImg }, cardInfo.value.headImg ? { - b: cardInfo.value.headImg + b: common_vendor.unref(config_baseUrl.BASE_URL) + "/upload" + cardInfo.value.headImg } : { c: common_assets._imports_0$2 }, { -- Gitblit v1.9.3