Преглед на файлове

feat:身份证校验优化

zhanghui преди 2 години
родител
ревизия
61d4347eb9
променени са 10 файла, в които са добавени 496 реда и са изтрити 374 реда
  1. 2 2
      common/js/env.js
  2. 15 5
      common/js/service.js
  3. 3 3
      main.js
  4. 1 0
      pages/index/index.rpx.css
  5. 1 1
      pages/index/index.vue
  6. 1 1
      pages/login/login.vue
  7. 24 0
      pages/my/index.rpx.css
  8. 72 0
      pages/my/my.vue
  9. 377 362
      pages/register/register.vue
  10. BIN
      static/my/qr.png

+ 2 - 2
common/js/env.js

@@ -1,8 +1,8 @@
 "use strict";
 
 // let baseUrl = `https://jje.admin.xinyuekj.com.cn`
-let baseUrl = `https://jje.admin.xinyuekj.com.cn/test-api`
-// let baseUrl = `http://65i1sxopd9qp.ngrok.xiaomiqiu123.top`
+// let baseUrl = `https://jje.admin.xinyuekj.com.cn/test-api`
+let baseUrl = `http://65i1sxopd9qp.ngrok.xiaomiqiu123.top`
 // let baseUrl = `https://jje.xinyuekj.com.cn/prod-api`
 
 

+ 15 - 5
common/js/service.js

@@ -3,6 +3,16 @@ import request from '../js/request.js';
 
 export default {
 
+
+    //获取推广人员跳转小程序的链接
+    getExtensionId(data) {
+        return request({
+            url: '/expand/wechat/getExtensionId',
+            method: 'GET',
+        })
+    },
+
+
     //添加拓客经理二维码被扫记录
     addRecordForManager(data) {
         return request({
@@ -31,10 +41,10 @@ export default {
 
     // 提现记录
     records(data) {
-    return request({
-        url: '/expand/wechat/withdraw/records',
-        method: 'POST',
-        data:data
+        return request({
+            url: '/expand/wechat/withdraw/records',
+            method: 'POST',
+            data: data
         })
     },
 
@@ -43,7 +53,7 @@ export default {
         return request({
             url: '/expand/wechat/withdraw/apply',
             method: 'POST',
-            data:data
+            data: data
         })
     },
 

+ 3 - 3
main.js

@@ -20,14 +20,14 @@ Vue.prototype.$baseUrl = env.baseUrl;
 Vue.prototype.$xcxUrl = 'https://jje.xinyuekj.com.cn/spread/spread';
 
 // #ifdef H5
-//拓客端H5页面拓客专员注册跳转地址 --- 测试地址
+//生活圈H5页面拓客专员注册跳转地址 --- 测试地址
 Vue.prototype.$tkUrl = 'http://tk.gzzzyd.com/#/pages/register/register';
-//拓客端H5页面拓客专员注册跳转地址 --- 正式地址
+//生活圈H5页面拓客专员注册跳转地址 --- 正式地址
 // Vue.prototype.$tkUrl = 'https://jje.xinyuekj.com.cn/tk/#/pages/register/register';
 // #endif
 
 // #ifdef MP-WEIXIN
-//拓客端小程序拓客专员注册跳转地址
+//生活圈小程序拓客专员注册跳转地址
 Vue.prototype.$tkUrl = 'https://jje.xinyuekj.com.cn/tk/register';
 // #endif
 

+ 1 - 0
pages/index/index.rpx.css

@@ -1,3 +1,4 @@
 .page{
     background: #F7F7F7;
+    min-height: 100vh;
 }

+ 1 - 1
pages/index/index.vue

@@ -1,5 +1,5 @@
 <template>
-	<view class="page" :style="{height:height}">
+	<view class="page">
 
 		<!-- #ifdef H5-->
 		<uni-nav-bar v-if="!$isWxBrowser()"  :fixed="true" background-color="#FFE05C" :border="false" :statusBar="false"   title="首页"/>

+ 1 - 1
pages/login/login.vue

@@ -2,7 +2,7 @@
 	<view class="page" :style="{height:height}">
 		<view class="logTitle">
 			<view class="welcome flex-row justify-center">
-				<text>欢迎登录娇骄儿拓客端</text>
+				<text>欢迎登录娇骄儿生活圈</text>
 			</view>
 			<view class="flex-row justify-center">
 				<image src="../../static/logo.png" class="log"></image>

+ 24 - 0
pages/my/index.rpx.css

@@ -114,3 +114,27 @@
 	font-size: 26rpx;
 	color: #999999;
 }
+.qrCodePopupView{
+	width: 550rpx;
+	height: 620rpx;
+	background: white;
+	border-radius: 15rpx;
+	position:relative;
+}
+.qrCreateTime{
+	margin-top: 24rpx;
+	font-size: 24rpx;
+	color: #999999;
+}
+.popupTitle{
+	line-height: 100rpx;
+	font-size: 32rpx;
+	font-weight: bold;
+	color: #111111;
+}
+.xoIcon{
+	position: absolute;
+	top: 20rpx;
+	right: 32rpx;
+
+}

+ 72 - 0
pages/my/my.vue

@@ -75,16 +75,48 @@
 		<view class="flex-col justify-start list">
 			<uni-list :border="false">
 				<uni-list-item v-if="userInfo.isManager == 1" :clickable="true" title="我的分组" to="/pages/myGroup/myGroup" showArrow thumb="/static/my/fenzu.png" thumb-size="sm"/>
+				<uni-list-item v-if="userInfo.isExtensionWorker == 1" :clickable="true" title="推广码"  showArrow thumb="/static/my/qr.png" thumb-size="sm" @click="openQrCord"/>
 				<uni-list-item v-if="userInfo.roleTag == 1" :clickable="true" title="购买优惠券" to="/pages/purchaseCoupon/purchaseCoupon" showArrow thumb="/static/my/coupon.png" thumb-size="sm"/>
 			</uni-list>
 		</view>
+
+		<button @click="anniu">按钮</button>
+
+		<uni-popup ref="qrCodePopup" type="center" @change="qrCodePopupChange">
+			<view class="flex-col qrCodePopupView">
+				<view class="flex-row justify-center">
+					<text class="popupTitle">推广码</text>
+				</view>
+				<view class="xoIcon" @click="closePopup">
+					<u-icon name="close-circle" color="#666" size="24"></u-icon>
+				</view>
+				<view class="flex-row justify-center">
+					<uv-qrcode ref="qrcode" size="440rpx" :value="qrcodeUrl" :options="options"></uv-qrcode>
+				</view>
+				<view class="flex-row justify-center qrCreateTime">
+					<text>生成时间:{{qrCreateTime}}</text>
+				</view>
+			</view>
+		</uni-popup>
+
 	</view>
 </template>
 
 <script>
+	import UniPopup from "../../uni_modules/uni-popup/components/uni-popup/uni-popup";
+	import commonUtils from "../../common/js/utils/commonUtils";
 	export default {
+		components: {UniPopup},
 		data() {
 			return {
+				qrcodeUrl:this.$xcxUrl+'?expandUserId={expandUserId}&ruleId={ruleId}&timestamp={timestamp}',
+				options: {
+					// 指定二维码前景,一般可在中间放logo
+					foregroundImagePadding:2,
+					foregroundImageBorderRadius:5,
+					foregroundImageSrc: '/static/logo.png'
+				},
+				qrCreateTime:'',
 				isWxBrowser:false,
 				isCanWithdraw:true,
 				staticsData: {},
@@ -107,6 +139,46 @@
 		},
 
 		methods: {
+			anniu(){
+				uni.navigateTo({
+					url:'/pages/register/register?roleId=1772472312711086081&parentId=1772471873559068674&timestamp=2032242661103'
+				})
+			},
+
+			closePopup(){
+				this.$refs.qrCodePopup.close()
+			},
+
+			formatDate(){
+				this.qrCreateTime = commonUtils.formatDate(new Date())
+			},
+
+			openQrCord(){
+				console.log(11111111111111111)
+				this.$api.service.getExtensionId().then(res=>{
+					let data = {
+						ruleId: res.data.data,
+						expandUserId: this.userInfo.id,
+						timestamp: new Date().getTime() + (60 * 1000 * 60 * 24 * 365 * 10)
+					};
+					for (let key in data) {
+						let regexp = new RegExp("{" + key + "}"); // 构造正则表达式
+						this.qrcodeUrl = this.qrcodeUrl.replace(regexp, data[key]); // 执行替换操作
+					}
+					this.formatDate()
+					console.log('生成的链接',this.qrcodeUrl)
+					this.$refs.qrCodePopup.open()
+
+				})
+			},
+
+			qrCodePopupChange(e){
+				console.log(e)
+				if (!e.show){
+					this.qrcodeUrl=this.$xcxUrl+'?expandUserId={expandUserId}&ruleId={ruleId}&timestamp={timestamp}'
+				}
+			},
+
 			canWithdraw(){
 				this.$api.service.canWithdraw().then(res=>{
 					console.log(res)

+ 377 - 362
pages/register/register.vue

@@ -1,390 +1,405 @@
 <template>
-	<view class="page">
-		<!-- #ifdef H5-->
-		<uni-nav-bar  v-if="!$isWxBrowser()" :fixed="true" background-color="#FFE05C" :border="false" :statusBar="false"   title="注册"  />
-		<!-- #endif -->
-		<view :style="{'marginTop':'10rpx'}">
-			<u--form labelPosition="left" :model="form" :rules="rules" ref="uForm">
-				<u-form-item :labelWidth="80" label="头像:" borderBottom prop="img" ref="item1">
-					<view class="photoView" @click="updateAvatar" >
-						<image class="photoImage" :src="form.imgUrl || '/static/ud4.png'"></image>
-					</view>
-				</u-form-item>
-				<u-form-item :labelWidth="80" label="姓名:" borderBottom prop="name" ref="item1">
-					<u--input v-model="form.name"  placeholder="请输入姓名" border="none"></u--input>
-				</u-form-item>
-				<u-form-item :labelWidth="80" label="身份证号:" borderBottom prop="idCard" ref="item1">
-					<u--input v-model="form.idCard"  placeholder="请输入姓名" border="none"></u--input>
-				</u-form-item>
-				<u-form-item :labelWidth="80" label="密码:" borderBottom prop="newPassword" ref="item1">
-					<u--input v-model="form.newPassword" placeholder="请输入密码" type="password" border="none"></u--input>
-				</u-form-item>
+    <view class="page">
+        <!-- #ifdef H5-->
+        <uni-nav-bar v-if="!$isWxBrowser()" :fixed="true" background-color="#FFE05C" :border="false" :statusBar="false"
+                     title="注册"/>
+        <!-- #endif -->
+        <view :style="{'marginTop':'10rpx'}">
+            <u--form labelPosition="left" :model="form" :rules="rules" ref="uForm">
+                <u-form-item :labelWidth="80" label="头像:" borderBottom prop="img" ref="item1">
+                    <view class="photoView" @click="updateAvatar">
+                        <image class="photoImage" :src="form.imgUrl || '/static/ud4.png'"></image>
+                    </view>
+                </u-form-item>
+                <u-form-item :labelWidth="80" label="姓名:" borderBottom prop="name" ref="item1">
+                    <u--input v-model="form.name" placeholder="请输入姓名" border="none"></u--input>
+                </u-form-item>
+                <u-form-item :labelWidth="80" label="身份证号:" borderBottom prop="idCard" ref="item1">
+                    <u--input v-model="form.idCard" placeholder="请输入姓名" border="none"></u--input>
+                </u-form-item>
+                <u-form-item :labelWidth="80" label="密码:" borderBottom prop="newPassword" ref="item1">
+                    <u--input v-model="form.newPassword" placeholder="请输入密码" type="password" border="none"></u--input>
+                </u-form-item>
 
-				<u-form-item :labelWidth="80" label="确认密码:" borderBottom prop="againPassword" ref="item1">
-					<u--input v-model="form.againPassword" placeholder="再次确认密码" type="password" border="none"></u--input>
-				</u-form-item>
+                <u-form-item :labelWidth="80" label="确认密码:" borderBottom prop="againPassword" ref="item1">
+                    <u--input v-model="form.againPassword" placeholder="再次确认密码" type="password"
+                              border="none"></u--input>
+                </u-form-item>
 
-				<u-form-item :labelWidth="80" label="手机号:" borderBottom prop="phone" ref="item1">
-					<u--input v-model="form.phone"  placeholder="请输入手机号" border="none"></u--input>
-				</u-form-item>
-				<u-form-item :labelWidth="80" label="验证码:" borderBottom prop="code" ref="item1">
-					<view class="inputCode">
-						<u--input v-model="form.code"  placeholder="请输入验证码" border="none"></u--input>
-					</view>
-					<u-button slot="right" @tap="getCode" :text="tips" type="success" size="small" :disabled="disabled1"></u-button>
-				</u-form-item>
+                <u-form-item :labelWidth="80" label="手机号:" borderBottom prop="phone" ref="item1">
+                    <u--input v-model="form.phone" placeholder="请输入手机号" border="none"></u--input>
+                </u-form-item>
+                <u-form-item :labelWidth="80" label="验证码:" borderBottom prop="code" ref="item1">
+                    <view class="inputCode">
+                        <u--input v-model="form.code" placeholder="请输入验证码" border="none"></u--input>
+                    </view>
+                    <u-button slot="right" @tap="getCode" :text="tips" type="success" size="small"
+                              :disabled="disabled1"></u-button>
+                </u-form-item>
 
-			</u--form>
+            </u--form>
 
-			<view :style="{'marginTop':'100rpx'}">
-				<button class="customStyle"  @click="expandRegister">提交</button>
-			</view>
+            <view :style="{'marginTop':'100rpx'}">
+                <button class="customStyle" @click="expandRegister">提交</button>
+            </view>
 
-			<view class="flex-row justify-center  register">
-				<text>已有账号!</text>
-				<text @click="gologin" :style="{color:'#FFE05C'}">切换登录</text>
-			</view>
+            <view class="flex-row justify-center  register">
+                <text>已有账号!</text>
+                <text @click="gologin" :style="{color:'#FFE05C'}">切换登录</text>
+            </view>
 
-		</view>
-		<u-code ref="uCode" @change="codeChange" seconds="60" @start="disabled1 = true" @end="disabled1 = false"></u-code>
-		<u-action-sheet
-				:show="showSex"
-				:actions="actions"
-				title="请选择性别"
-				@close="showSex = false"
-				@select="sexSelect">
-		</u-action-sheet>
-		<u-datetime-picker
-				:show="showBirthday"
-				:value="birthday"
-				mode="date"
-				closeOnClickOverlay
-				@confirm="birthdayConfirm"
-				@cancel="birthdayClose"
-				@close="birthdayClose"
-		></u-datetime-picker>
-	</view>
+        </view>
+        <u-code ref="uCode" @change="codeChange" seconds="60" @start="disabled1 = true"
+                @end="disabled1 = false"></u-code>
+        <u-action-sheet
+                :show="showSex"
+                :actions="actions"
+                title="请选择性别"
+                @close="showSex = false"
+                @select="sexSelect">
+        </u-action-sheet>
+        <u-datetime-picker
+                :show="showBirthday"
+                :value="birthday"
+                mode="date"
+                closeOnClickOverlay
+                @confirm="birthdayConfirm"
+                @cancel="birthdayClose"
+                @close="birthdayClose"
+        ></u-datetime-picker>
+    </view>
 </template>
 <script>
-	export default {
-		data() {
-			return {
+    export default {
+        data() {
+            return {
 
-				recordId:'',//拓客经理二维码被扫记录id
-				qrCodeInvalid:false,//二维码是否无效标识
-				requestStatus:false,
-				disabled1:false,
-				showBirthday:false,
-				showSex:false,
-				birthday: Number(new Date()),
-				actions: [{
-					name: '男',
-					value:'1'
-					},
-					{
-						name: '女',
-						value:'0'
-					},{
-						name: '保密',
-						value:'2'
-					}
-				],
-				tips:'',
-				form:{
-					roleId:'',
-					parentId:'',
-					img:'',
-					imgUrl:'',
-					name:'',
-					idCard:'',
-					newPassword:'',
-					againPassword:'',
-					phone:'',
-					code:'',
-				},
-				rules: {
-					'img': {
-						type: 'string',
-						required: true,
-						message: '请上传头像',
-						trigger: ['blur', 'change']
-					},
-					'name':[
-						{
-							type: 'string',
-							required: true,
-							min:2,
-							message: '请输入姓名',
-							trigger: ['blur']
-						}
-					] ,
-					'idCard': [
-						{
-							type: 'string',
-							required: true,
-							min:18,
-							max: 18,
-							pattern:this.$idCardPattern,
-							message: '请输入身份证号',
-							trigger: ['blur']
-						},
-						{
-							asyncValidator: async (a,b,callback) => {
-								this.$refs.uForm.validateField('name');
-								let res = await this.idCardAndName()
-								if(res.data.data.respCode !== '0000') {
-									callback(new Error(res.data.data.respMessage));
-								} else {
-									// 如果校验通过,也要执行callback()回调
-									callback();
-								}
-							},
-							// 触发器可以同时用blur和change
-							trigger: ['blur']
-						}
-					],
-					'phone': {
-						type: 'string',
-						required: true,
-						min:11,
-						max: 11,
-						pattern:this.$phonePattern,
-						message: '请输入正确的电话号码',
-						trigger: ['blur', 'change']
-					},
-					'code': {
-						type: 'string',
-						required: true,
-						min:4,
-						max: 6,
-						message: '请输入验证码',
-						trigger: ['blur', 'change']
-					},
-					'newPassword': {
-						type: 'string',
-						min:6,
-						max: 16,
-						required: true,
-						message: '请输入6-18位密码',
-						trigger: ['blur', 'change']
-					},
-					'againPassword': {
-						type: 'string',
-						min:6,
-						max: 16,
-						required: true,
-						message: '请输入6-18位密码',
-						trigger: ['blur', 'change']
-					}
-				},
-			}
-		},
-		onLoad(e){
-			if (e.roleId){
-				console.log('++++++++++++扫码进注册页面+++++++++++++++++++')
-				uni.setStorageSync('isRegister', true)
-				this.form.roleId = e.roleId
-				console.log('获取到的id',e.roleId)
-			}
-			if (e.parentId){
-				this.form.parentId = e.parentId
-				console.log('获取到的name',e.parentId)
-				this.addRecordForManager()
-			}
-			if (e.timestamp){
-				console.log('获取到的时间戳',e.timestamp,new Date().getTime() > e.timestamp)
-				if (new Date().getTime() > e.timestamp){
-					this.qrCodeInvalid = true
+                recordId: '',//拓客经理二维码被扫记录id
+                qrCodeInvalid: false,//二维码是否无效标识
+                requestStatus: false,
+                disabled1: false,
+                showBirthday: false,
+                showSex: false,
+                birthday: Number(new Date()),
+                actions: [{
+                    name: '男',
+                    value: '1'
+                },
+                    {
+                        name: '女',
+                        value: '0'
+                    }, {
+                        name: '保密',
+                        value: '2'
+                    }
+                ],
+                tips: '',
+                form: {
+                    roleId: '',
+                    parentId: '',
+                    img: '',
+                    imgUrl: '',
+                    name: '',
+                    idCard: '522422199303150677',
+                    newPassword: '123456',
+                    againPassword: '123456',
+                    phone: '17365000141',
+                    code: '1234',
+                },
+                rules: {
+                    // 'img': {
+                    // 	type: 'string',
+                    // 	required: true,
+                    // 	message: '请上传头像',
+                    // 	trigger: ['blur', 'change']
+                    // },
+                    'name': [
+                        {
+                            type: 'string',
+                            required: true,
+                            min: 2,
+                            pattern: '^([\u4e00-\u9fa5]{2,20})$',
+                            message: '请输入正确的姓名',
+                            trigger: ['blur', 'change']
+                        }
+                    ],
+                    'idCard': [
+                        {
+                            type: 'string',
+                            required: true,
+                            min: 18,
+                            max: 18,
+                            pattern: this.$idCardPattern,
+                            message: '请输入身份证号',
+                            trigger: ['blur', 'change']
+                        }
+                    ],
+                    'phone': {
+                        type: 'string',
+                        required: true,
+                        min: 11,
+                        max: 11,
+                        pattern: this.$phonePattern,
+                        message: '请输入正确的电话号码',
+                        trigger: ['blur', 'change']
+                    },
+                    'code': {
+                        type: 'string',
+                        required: true,
+                        min: 4,
+                        max: 6,
+                        message: '请输入验证码',
+                        trigger: ['blur', 'change']
+                    },
+                    'newPassword': {
+                        type: 'string',
+                        min: 6,
+                        max: 16,
+                        required: true,
+                        message: '请输入6-18位密码',
+                        trigger: ['blur', 'change']
+                    },
+                    'againPassword': {
+                        type: 'string',
+                        min: 6,
+                        max: 16,
+                        required: true,
+                        message: '请输入6-18位密码',
+                        trigger: ['blur', 'change']
+                    }
+                },
+            }
+        },
+        onLoad(e) {
+            if (e.roleId) {
+                console.log('++++++++++++扫码进注册页面+++++++++++++++++++')
+                uni.setStorageSync('isRegister', true)
+                this.form.roleId = e.roleId
+                console.log('获取到的id', e.roleId)
+            }
+            if (e.parentId) {
+                this.form.parentId = e.parentId
+                console.log('获取到的name', e.parentId)
+                this.addRecordForManager()
+            }
+            if (e.timestamp) {
+                console.log('获取到的时间戳', e.timestamp, new Date().getTime() > e.timestamp)
+                if (new Date().getTime() > e.timestamp) {
+                    this.qrCodeInvalid = true
 
-					uni.showModal({
-						title: '温馨提示',
-						content: ' 当前二维码已过期,请重新扫码',
-						showCancel:false,
-						success: function (res) {
-							if (res.confirm) {
-								console.log('用户点击确定');
-							} else if (res.cancel) {
-								console.log('用户点击取消');
-							}
-						}
-					});
+                    uni.showModal({
+                        title: '温馨提示',
+                        content: ' 当前二维码已过期,请重新扫码',
+                        showCancel: false,
+                        success: function (res) {
+                            if (res.confirm) {
+                                console.log('用户点击确定');
+                            } else if (res.cancel) {
+                                console.log('用户点击取消');
+                            }
+                        }
+                    });
 
-				}
-			}
-		},
-		methods: {
+                }
+            }
+        },
+        methods: {
 
-			addRecordForManager(){
-				console.log("+++++++++++++创建被扫码记录++++++++++++++")
-				console.log("+++++++++++++拓客经理id++++++++++++++",this.form.parentId)
-				console.log("+++++++++++++角色id++++++++++++++",this.form.roleId)
-				this.$api.service.addRecordForManager({
-					expandUserId:this.form.parentId,
-					roleId: this.form.roleId
-				}).then(res=>{
-					console.log("获取到的记录id",res.data.data)
-					this.recordId = res.data.data
-				})
-			},
+            addRecordForManager() {
+                console.log("+++++++++++++创建被扫码记录++++++++++++++")
+                console.log("+++++++++++++拓客经理id++++++++++++++", this.form.parentId)
+                console.log("+++++++++++++角色id++++++++++++++", this.form.roleId)
+                this.$api.service.addRecordForManager({
+                    expandUserId: this.form.parentId,
+                    roleId: this.form.roleId
+                }).then(res => {
+                    console.log("获取到的记录id", res.data.data)
+                    this.recordId = res.data.data
+                })
+            },
 
-			updateScanRecordById(){
-				this.$api.service.updateScanRecordById({
-					recordId:this.recordId
-				}).then(res=>{
-					console.log("+++++++++++++创建被扫码记录为成功撞他++++++++++++++",res)
-				})
-			},
+            updateScanRecordById() {
+                this.$api.service.updateScanRecordById({
+                    recordId: this.recordId
+                }).then(res => {
+                    console.log("+++++++++++++创建被扫码记录为成功++++++++++++++", res)
+                })
+            },
 
-			idCardAndName(){
-				return this.$api.service.idCardAndName({
-					name:this.form.name,
-					idCard:this.form.idCard,
-				}).then(res=>{
-					return res
-				})
-			},
+            idCardAndName() {
+                return this.$api.service.idCardAndName({
+                    name: this.form.name,
+                    idCard: this.form.idCard,
+                }).then(res => {
+                    return res
+                })
+            },
 
-			gologin(){
-				uni.redirectTo({
-					url:'/pages/login/login'
-				})
-			},
+            gologin() {
+                uni.redirectTo({
+                    url: '/pages/login/login'
+                })
+            },
 
-			updateAvatar(){
-				let that = this
-				uni.chooseImage({
-					count: 1, //默认9
-					sizeType: ['original'], //可以指定是原图还是压缩图,默认二者都有
-					sourceType: ['album'], //从相册选择
-					success: function (res) {
-						let tempUrl = res.tempFiles[0].path
-						uni.uploadFile({
-							url: that.$baseUrl + '/resource/oss/upload', //仅为示例,非真实的接口地址
-							filePath:tempUrl,
-							name: 'file',
-							header: {
-								// "Content-Type": "multipart/form-data",
-								// 'X-Access-Token': uni.getStorageSync('token'),
-								'Authorization': 'Bearer ' + uni.getStorageSync('accessToken'),
-							},
-							success: (uploadFileRes) => {
-								let res = JSON.parse(uploadFileRes.data)
-								console.log('+++++++++++++++++chooseavatar+++++++++++++++++++++++',uploadFileRes.data)
-								that.form.imgUrl = res.data.url.replace(/^http:/, "https:")
-								that.form.img = res.data.ossId
-							}
-						});
+            updateAvatar() {
+                let that = this
+                uni.chooseImage({
+                    count: 1, //默认9
+                    sizeType: ['original'], //可以指定是原图还是压缩图,默认二者都有
+                    sourceType: ['album'], //从相册选择
+                    success: function (res) {
+                        let tempUrl = res.tempFiles[0].path
+                        uni.uploadFile({
+                            url: that.$baseUrl + '/resource/oss/upload', //仅为示例,非真实的接口地址
+                            filePath: tempUrl,
+                            name: 'file',
+                            header: {
+                                // "Content-Type": "multipart/form-data",
+                                // 'X-Access-Token': uni.getStorageSync('token'),
+                                'Authorization': 'Bearer ' + uni.getStorageSync('accessToken'),
+                            },
+                            success: (uploadFileRes) => {
+                                let res = JSON.parse(uploadFileRes.data)
+                                console.log('+++++++++++++++++chooseavatar+++++++++++++++++++++++', uploadFileRes.data)
+                                that.form.imgUrl = res.data.url.replace(/^http:/, "https:")
+                                that.form.img = res.data.ossId
+                            }
+                        });
 
-					}
-				})
+                    }
+                })
 
-			},
+            },
 
-			birthdayClose() {
-				this.showBirthday = false
-				// this.$refs.form1.validateField('userInfo.birthday')
-			},
-			birthdayConfirm(e) {
-				console.log(e)
-				this.showBirthday = false
-				this.form.birthday = uni.$u.timeFormat(e.value, 'yyyy-mm-dd')
-				// this.$refs.form1.validateField('userInfo.birthday')
-			},
+            birthdayClose() {
+                this.showBirthday = false
+                // this.$refs.form1.validateField('userInfo.birthday')
+            },
+            birthdayConfirm(e) {
+                console.log(e)
+                this.showBirthday = false
+                this.form.birthday = uni.$u.timeFormat(e.value, 'yyyy-mm-dd')
+                // this.$refs.form1.validateField('userInfo.birthday')
+            },
 
-			sexSelect(e) {
-				console.log(e)
-			},
-			expandRegister(){
-				if (this.qrCodeInvalid){
-					uni.showModal({
-						title: '温馨提示',
-						content: ' 当前二维码已过期,请重新扫码',
-						showCancel:false,
-						success: function (res) {
-							if (res.confirm) {
-								console.log('用户点击确定');
-							} else if (res.cancel) {
-								console.log('用户点击取消');
-							}
-						}
-					});
-					return;
-				}
-				console.log(this.form)
-				if (this.requestStatus){
-					return
-				}
-				this.requestStatus=true
-				this.$refs.uForm.validate().then(res => {
-					uni.showLoading({
-						title: '正在注册...'
-					});
+            sexSelect(e) {
+                console.log(e)
+            },
+            expandRegister() {
+                if (this.qrCodeInvalid) {
+                    uni.showModal({
+                        title: '温馨提示',
+                        content: ' 当前二维码已过期,请重新扫码',
+                        showCancel: false,
+                        success: function (res) {
+                            if (res.confirm) {
+                                console.log('用户点击确定');
+                            } else if (res.cancel) {
+                                console.log('用户点击取消');
+                            }
+                        }
+                    });
+                    return;
+                }
+                if (this.requestStatus) {
+                    return
+                }
+                this.rules.idCard = [
+                    {
+                        type: 'string',
+                        required: true,
+                        min: 18,
+                        max: 18,
+                        pattern: this.$idCardPattern,
+                        message: '请输入身份证号',
+                        trigger: ['blur', 'change']
+                    }
+                ]
 
-					this.$api.login.expandRegister(this.form).then(res=>{
-						uni.hideLoading();
-						this.requestStatus=false
-						uni.showToast({
-							icon: 'success',
-							duration: 2000,
-							title: '注册成功,即将跳转登录页'
-						});
-						uni.removeStorageSync('isRegister');
-						setTimeout(()=>{
-							this.gologin()
-						},2000)
+                this.$refs.uForm.validate().then(res => {
 
-						this.updateScanRecordById()
+                    this.idCardAndName().then(res => {
+                        if (res.data.data.respCode !== '0000') {
 
-					}).catch(err=>{
-						this.requestStatus=false
-					})
-				}).catch(err=>{
-					this.requestStatus=false
-				})
-			},
-			logout(){
-				this.$api.login.logout().then(res=>{
-					uni.clearStorageSync();
-					uni.navigateTo({
-						url:'/pages/login/login'
-					})
-				})
-			},
-			back(){
-				uni.navigateBack({
-					delta: 1
-				});
-			},
-			codeChange(text) {
-				this.tips = text;
-			},
-			getCode() {
-				let regExp=new RegExp(this.$phonePattern);
-				let b= regExp.test(this.form.phone)
-				if (!b){
-					uni.$u.toast('请输入正确的手机号')
-					return
-				}
-				if (this.$refs.uCode.canGetCode) {
-					// 模拟向后端请求验证码
-					uni.showLoading({
-						title: '正在获取验证码'
-					})
-					this.$api.service.getSmsCode({phonenumber: this.form.phone}).then(res=>{
-						uni.hideLoading();
-						// 这里此提示会被this.start()方法中的提示覆盖
-						uni.$u.toast('验证码已发送');
-						// 通知验证码组件内部开始倒计时
-						this.$refs.uCode.start();
-					})
-				} else {
-					uni.$u.toast('倒计时结束后再发送');
-				}
-			},
-		}
-	}
+                            this.rules.idCard.push({
+                                validator: (a, b, callback) => {
+                                    callback(new Error(res.data.data.respMessage));
+                                },
+                                // 触发器可以同时用blur和change
+                                trigger: []
+                            })
+
+                            this.$refs.uForm.validateField('idCard')
+
+                        } else {
+                            // 如果校验通过执行注册
+                            this.requestStatus = true
+                            uni.showLoading({
+                                title: '正在注册...'
+                            });
+                            this.$api.login.expandRegister(this.form).then(res => {
+                                uni.hideLoading();
+                                uni.showToast({
+                                    icon: 'success',
+                                    duration: 2000,
+                                    title: '注册成功,即将跳转登录页'
+                                });
+                                uni.removeStorageSync('isRegister');
+                                setTimeout(() => {
+                                    this.gologin()
+                                }, 2000)
+                                this.updateScanRecordById()
+                                this.requestStatus = false
+                            }).catch(err => {
+                                this.requestStatus = false
+                            })
+                        }
+                    })
+                })
+            },
+            logout() {
+                this.$api.login.logout().then(res => {
+                    uni.clearStorageSync();
+                    uni.navigateTo({
+                        url: '/pages/login/login'
+                    })
+                })
+            },
+            back() {
+                uni.navigateBack({
+                    delta: 1
+                });
+            },
+            codeChange(text) {
+                this.tips = text;
+            },
+            getCode() {
+                let regExp = new RegExp(this.$phonePattern);
+                let b = regExp.test(this.form.phone)
+                if (!b) {
+                    uni.$u.toast('请输入正确的手机号')
+                    return
+                }
+                if (this.$refs.uCode.canGetCode) {
+                    // 模拟向后端请求验证码
+                    uni.showLoading({
+                        title: '正在获取验证码'
+                    })
+                    this.$api.service.getSmsCode({phonenumber: this.form.phone}).then(res => {
+                        uni.hideLoading();
+                        // 这里此提示会被this.start()方法中的提示覆盖
+                        uni.$u.toast('验证码已发送');
+                        // 通知验证码组件内部开始倒计时
+                        this.$refs.uCode.start();
+                    })
+                } else {
+                    uni.$u.toast('倒计时结束后再发送');
+                }
+            },
+        }
+    }
 </script>
 
 <style lang="scss" scoped>
-	@import './index.rpx.css';
+    @import './index.rpx.css';
 </style>

BIN
static/my/qr.png