Kaynağa Gözat

feat:推广专员二维码是否显示修改

zhanghui 4 ay önce
ebeveyn
işleme
ba7914b9e2

+ 6 - 6
App.vue

@@ -62,18 +62,18 @@
                         console.log("+++++++++++++++++自动登录结束时间+++++++++++++++++++++",endDate)
                         console.log("+++++++++++++++++自动登录耗时+++++++++++++++++++++",endDate-startDate,'毫秒')
 
-                        uni.switchTab({
-                            url: "/pages/index/index"
-                        })
+                        // uni.switchTab({
+                        //     url: "/pages/index/index"
+                        // })
                     }).catch(err=>{
                         uni.navigateTo({
                             url: "/pages/login/login"
                         })
                     })
                 }else {
-                    uni.navigateTo({
-                        url: "/pages/login/login"
-                    })
+                    // uni.navigateTo({
+                    //     url: "/pages/login/login"
+                    // })
                 }
 
             }else {

+ 1 - 1
common/js/env.js

@@ -1,7 +1,7 @@
 "use strict";
 
 // let baseUrl = `https://jje.admin.xinyuekj.com.cn`
-let baseUrl = `https://jje.admin.xinyuekj.com.cn/test-api`
+let baseUrl = `https://jje.xinyuekj.com.cn/test-api`
 // let baseUrl = `http://test.admin.xinyuekj.com.cn`
 // let baseUrl = `https://jje.xinyuekj.com.cn/prod-api`
 

+ 21 - 0
common/js/service.js

@@ -2,6 +2,27 @@ import request from '../js/request.js';
 
 
 export default {
+
+
+    //get请求,获取手机验证码 新模板
+    getSmsCodeByType(data) {
+        return request({
+            url: '/resource/sms/codeByType',
+            method: 'GET',
+            data: data
+        })
+    },
+
+
+    // post请求,验证手机号码是否被注册
+    phoneIsExist(data) {
+        return request({
+            url: '/member/wechat/phoneIsExist',
+            method: 'POST',
+            data: data
+        })
+    },
+
     //添加备注
     bind(data) {
         return request({

+ 6 - 0
pages.json

@@ -240,6 +240,12 @@
 			{
 				"navigationBarTitleText" : "文件预览"
 			}
+		},
+		{
+			"path": "pages/setPhone/setPhone",
+			"style": {
+				"navigationBarTitleText": "获取手机号"
+			}
 		}
 	],
 	"tabBar": {

+ 16 - 3
pages/index/attach/attach.vue

@@ -37,9 +37,16 @@
 			</view>
 		</view>
 
-		<view class="flex-row justify-center" v-if="showQrCode">
-			<view class="qrView" @click="qrCodePopup">
-				<uv-qrcode ref="qrcode" size="600rpx" :value="qrcodeUrl" :options="options"></uv-qrcode>
+		<view class="flex-row justify-center">
+			<view  class="qrView" @click="qrCodePopup">
+				<uv-qrcode v-if="showQrCode" ref="qrcode" size="600rpx" :value="qrcodeUrl" :options="options"></uv-qrcode>
+        <view class="flex-col justify-center" v-else style="width: 600rpx;height: 600rpx">
+
+          <view  class="flex-row justify-center">该规则推广次数已达上限</view>
+          <view  class="flex-row justify-center">推广次数:{{roleBindRuleList[value].presentCount}}</view>
+          <view  class="flex-row justify-center">已推次数:{{roleBindRuleList[value].nowCount}}</view>
+
+        </view>
 			</view>
 		</view>
     <view class="flex-row">
@@ -153,6 +160,12 @@
 					});
 					return
 				}
+
+        if (this.roleBindRuleList[this.value].isLimit == 1 && this.roleBindRuleList[this.value].nowCount == this.roleBindRuleList[this.value].presentCount){
+          this.showQrCode = false
+          return
+        }
+
 				this.showQrCode = true
 				let data = {
 					expandUserId:this.userInfo.id,

+ 4 - 4
pages/login/login.vue

@@ -45,10 +45,10 @@
       </u-form>
 
     </view>
-    <!--		<view class="flex-row justify-center  register">-->
-    <!--			<text>无账号?</text>-->
-    <!--			<text @click="goRegister" :style="{color:'#FFE05C'}">切换注册</text>-->
-    <!--		</view>-->
+<!--    		<view class="flex-row justify-center  register">-->
+<!--    			<text>无账号?</text>-->
+<!--    			<text @click="goRegister" :style="{color:'#FFE05C'}">切换注册</text>-->
+<!--    		</view>-->
   </view>
 </template>
 

+ 402 - 408
pages/register/register.vue

@@ -1,446 +1,440 @@
 <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>-->
-                <button class="customStyle" @click="debounce(expandRegister,500)">提交</button>
-            </view>
+      <view :style="{'marginTop':'100rpx'}">
+        <!--                <button class="customStyle" @click="expandRegister">提交</button>-->
+        <button class="customStyle" @click="debounce(expandRegister,500)">提交</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>
+    <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 {
-                timer: null, //定时任务
-                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,
-                            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']
-                    }
-                },
-            }
+export default {
+  data() {
+    return {
+      timer: null, //定时任务
+      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,
+        //         pattern: '^([\u4e00-\u9fa5]{2,20})$',
+        //         message: '请输入正确的姓名',
+        //         trigger: ['blur', 'change']
+        //     }
+        // ],
+        // 'idCard': [
+        //     {
+        //         type: 'string',
+        //         required: false,
+        //         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']
         },
-        onLoad(e) {
-            if (e.roleId) {
-                console.log('++++++++++++扫码进注册页面+++++++++++++++++++')
-                uni.setStorageSync('isRegister', true)
-                this.form.roleId = e.roleId
-                console.log('获取到的id', e.roleId)
-            }
-            if (e.type) {
-                this.form.type = e.type
-                console.log('获取到的type', e.type)
-            }
-            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('用户点击取消');
-                            }
-                        }
-                    });
+        '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.type) {
+      this.form.type = e.type
+      console.log('获取到的type', e.type)
+    }
+    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('用户点击取消');
             }
-        },
-        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,
-                    type: this.form.type
-                }).then(res => {
-                    console.log("获取到的记录id", res.data.data)
-                    this.recordId = res.data.data
-                })
-            },
+      }
+    }
+  },
+  methods: {
 
-            updateScanRecordById() {
-                this.$api.service.updateScanRecordById({
-                    recordId: this.recordId
-                }).then(res => {
-                    console.log("+++++++++++++创建被扫码记录为成功++++++++++++++", res)
-                })
-            },
+    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,
+        type: this.form.type
+      }).then(res => {
+        console.log("获取到的记录id", res.data.data)
+        this.recordId = res.data.data
+      })
+    },
 
-            idCardAndName() {
-                return this.$api.service.idCardAndName({
-                    name: this.form.name,
-                    idCard: this.form.idCard,
-                }).then(res => {
-                    return res
-                })
-            },
+    updateScanRecordById() {
+      this.$api.service.updateScanRecordById({
+        recordId: this.recordId
+      }).then(res => {
+        console.log("+++++++++++++创建被扫码记录为成功++++++++++++++", res)
+      })
+    },
 
-            gologin() {
-                uni.redirectTo({
-                    url: '/pages/login/login'
-                })
+     idCardAndName() {
+       this.$api.service.idCardAndName({
+        name: this.form.name,
+        idCard: this.form.idCard,
+      }).then(res => {
+        if (res.data.data != null && res.data.data.respCode !== '0000') {
+          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.register()
+        }
+      })
+    },
 
-            updateAvatar() {
-                let that = this
-                uni.chooseImage({
-                    count: 1, //默认9
-                    sizeType: ['compressed'], //可以指定是原图还是压缩图,默认二者都有
-                    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
-                            },
-                          fail: (err) => {
-                              console.log(err)
-                            uni.showToast({
-                              icon: 'error',
-                              duration: 2000,
-                              title: err.errMsg
-                            });
-                          }
-                        });
-
-                    },
-                  fail: function(err) {
-                    console.log(err)
-                    uni.showToast({
-                      icon: 'error',
-                      duration: 2000,
-                      title: err.errMsg
-                    });
-                  }
-                })
+    gologin() {
+      uni.redirectTo({
+        url: '/pages/login/login'
+      })
+    },
 
+    updateAvatar() {
+      let that = this
+      uni.chooseImage({
+        count: 1, //默认9
+        sizeType: ['compressed'], //可以指定是原图还是压缩图,默认二者都有
+        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'),
             },
-
-            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')
+            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
             },
+            fail: (err) => {
+              console.log(err)
+              uni.showToast({
+                icon: 'error',
+                duration: 2000,
+                title: err.errMsg
+              });
+            }
+          });
 
-            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.requestStatus = true
+        },
+        fail: function (err) {
+          console.log(err)
+          uni.showToast({
+            icon: 'error',
+            duration: 2000,
+            title: err.errMsg
+          });
+        }
+      })
+
+    },
 
-                this.rules.idCard = [
-                    {
-                        type: 'string',
-                        required: true,
-                        min: 18,
-                        max: 18,
-                        pattern: this.$idCardPattern,
-                        message: '请输入身份证号',
-                        trigger: ['blur', 'change']
-                    }
-                ]
+    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')
+    },
 
-                this.$refs.uForm.validate().then(res => {
+    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;
+      }
+      // this.rules.idCard = [
+      //     {
+      //         type: 'string',
+      //         required: false,
+      //         min: 18,
+      //         max: 18,
+      //         pattern: this.$idCardPattern,
+      //         message: '请输入身份证号',
+      //         trigger: ['blur', 'change']
+      //     }
+      // ]
 
-                    console.log('验证不通过!!!!')
+      this.$refs.uForm.validate().then(validate => {
+        this.register()
+      })
+    },
 
-                    this.idCardAndName().then(res => {
-                        if (res.data.data != null && res.data.data.respCode !== '0000') {
 
-                            this.rules.idCard.push({
-                                validator: (a, b, callback) => {
-                                    callback(new Error(res.data.data.respMessage));
-                                },
-                                // 触发器可以同时用blur和change
-                                trigger: []
-                            })
+    register () {
+      if (this.requestStatus) {
+        return
+      }
+      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.requestStatus = false
+          this.gologin()
+        }, 2000)
+        this.updateScanRecordById()
 
-                            this.$refs.uForm.validateField('idCard')
+      }).catch(err => {
+        uni.hideLoading();
+        this.requestStatus = false
+      })
 
-                        } else {
-                            // 如果校验通过执行注册
-                            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.requestStatus = false
-                                    this.gologin()
-                                }, 2000)
-                                this.updateScanRecordById()
+    },
 
-                            }).catch(err => {
-                                uni.hideLoading();
-                                this.requestStatus = false
-                            })
-                        }
-                    }).finally((res)=>{
-                        console.log('改为false')
-                        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('倒计时结束后再发送');
-                }
-            },
-            debounce(fn, delay) {
-                console.log(delay)
-                clearTimeout(this.timer);
-                this.timer = setTimeout(() => {
-                    fn.apply();
-                }, delay);
-            }
 
-        }
+    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('倒计时结束后再发送');
+      }
+    },
+    debounce(fn, delay) {
+      console.log(delay)
+      clearTimeout(this.timer);
+      this.timer = setTimeout(() => {
+        fn.apply();
+      }, delay);
     }
+
+  }
+}
 </script>
 
 <style lang="scss" scoped>
-    @import './index.rpx.css';
+@import './index.rpx.css';
 </style>

+ 41 - 0
pages/setPhone/index.rpx.css

@@ -0,0 +1,41 @@
+.page {
+	height: 100vh;
+	padding: 0 32rpx;
+}
+.updatePasswordButton{
+	text-align: center;
+	background: #4cd964;
+	line-height: 80rpx;
+	border-radius: 10rpx;
+	color: #FFFFFF;
+	margin-top: 100rpx;
+}
+.customStyle{
+	background: #fff05c;
+	border: #fff05c;
+	border-radius: 10rpx;
+}
+.customStyle::after{
+	border: none;
+}
+.inputCode{
+	width: 350rpx;
+}
+.register {
+	margin-top: 24rpx;
+	padding-bottom: 50rpx;
+	font-size: 30rpx;
+	color: #AAAAAA;
+}
+
+.photoView{
+	width: 100rpx;
+	height: 100rpx;
+	border-radius: 50rpx;
+	overflow: hidden;
+	background: #FFE50C;
+}
+.photoImage{
+	width: 100rpx;
+	height: 100rpx;
+}

+ 383 - 0
pages/setPhone/setPhone.vue

@@ -0,0 +1,383 @@
+<template>
+  <view class="container">
+
+    <!-- #ifdef H5-->
+    <uni-nav-bar v-if="!$isWxBrowser()" :fixed="true" background-color="#FFE05C" :border="false" :statusBar="false"
+                 title="注册手机号"/>
+    <!-- #endif -->
+
+    <view class="login-wrap">
+      <view class="login-form">
+        <u--form
+            labelPosition="left"
+            :model="userInfo"
+            :rules="rules"
+            ref="form1"
+        >
+          <u-form-item
+              label="手机号"
+              prop="phonenumber"
+              labelWidth="auto"
+              labelAlign="right"
+          >
+            <u--input
+                v-model="userInfo.phonenumber"
+                placeholder="请输入手机号"
+                border="bottom"
+                type="number"
+                maxlength="11"
+            ></u--input>
+          </u-form-item>
+          <u-form-item
+              labelWidth="auto"
+              labelAlign="right"
+              label="验证码"
+              prop="smsCode"
+              width="120"
+          >
+            <u--input
+                v-model="userInfo.smsCode"
+                disabledColor="#ffffff"
+                placeholder="请输入验证码"
+                border="bottom"
+                maxlength="4"
+            ></u--input>
+            <template #right>
+              <view class="identifying-code">
+                <u-code
+                    ref="uCode3"
+                    @change="codeChange2"
+                    keep-running
+                    start-text="获取验证码"
+                ></u-code>
+                <text
+                    @tap="getCode2"
+                    :text="tips2"
+                    class="u-page__code-text"
+                >{{ tips2 }}
+                </text>
+              </view>
+            </template>
+
+          </u-form-item>
+
+        </u--form>
+      </view>
+    </view>
+
+    <view v-if="errTipShow" class="h-err">
+      <text>你输入的手机号码已存在,请换一个</text>
+    </view>
+
+    <view @click="setPhone()" class="op-btn-wrap">
+      <view class="h-btn">
+        <text>跳转到小程序</text>
+      </view>
+    </view>
+
+
+  </view>
+</template>
+<script>
+
+export default {
+  data() {
+    return {
+      errTipShow: false,
+      userInfo: {
+        phonenumber: '',
+        smsCode: '',
+      },
+      tips2: '',
+      storageUserInfo:{},
+      rules: {
+        phonenumber: [
+          {
+            required: true,
+            min: 11,
+            max: 11,
+            message: '请输入11位电话号码',
+            trigger: ['blur', 'change'],
+          },
+          {
+            // 此为同步验证,可以直接返回true或者false,如果是异步验证,稍微不同,见下方说明
+            validator: (rule, value, callback) => {
+              // 调用uView自带的js验证规则,详见:https://www.uviewui.com/js/test.html
+              return !this.$isDataEmpty(value);
+            },
+            message: "请认真填写电话号码",
+            trigger: ['blur', 'change'],
+          }
+        ],
+        smsCode: {
+          required: true,
+          min: 4,
+          max: 6,
+          message: '请输入4位验证码',
+          trigger: ['blur', 'change'],
+        },
+      },
+    }
+  },
+  onLoad(option) {
+    this.storageUserInfo = uni.getStorageSync('userInfo')
+  },
+  onReady() {
+    this.$refs.form1.setRules(this.rules)
+  },
+  methods: {
+
+    getUserInfo() {
+      this.$api.getUserInfo().then(res => {
+        uni.setStorageSync('userInfo', res.data.data)
+      })
+
+    },
+    // 验证电话号码是否存在
+    saveSetPhoneData() {
+      let that = this;
+      // 验证电话号码是否存在
+      this.$api.setPhone(this.userInfo).then((res) => {
+        uni.showToast({
+          title: '绑定成功'
+        })
+        this.getUserInfo()
+        setTimeout(function () {
+          // 绑定成功,返回上一页
+          uni.navigateBack({
+            delta: 1,
+          });
+        }, 2000); // 延迟2秒执行
+      })
+    },
+    // 去绑定账号密码页面
+    setPhone() {
+      let that = this;
+      this.$refs.form1.validate().then(res => {
+        that.saveSetPhoneData();
+      }).catch(errors => {
+        uni.$u.toast('校验失败,请认真填写')
+      })
+    },
+    codeChange2(text) {
+      this.tips2 = text;
+    },
+    getCode2() {
+      let that = this;
+      if (this.$refs.uCode3.canGetCode) {
+        that.getSmsCode();
+      } else {
+        uni.$u.toast('倒计时结束后再发送');
+      }
+    },
+    // 获取手机验证码
+    getSmsCode() {
+      let that = this;
+      if (!this.userInfo.phonenumber) {
+        uni.$u.toast('请认真填写手机号');
+        return;
+      }
+
+
+      // 验证电话号码是否存在
+      this.$api.service.phoneIsExist(this.userInfo).then((res) => {
+        console.log(res.data.data.phoneIsExist)
+        if (res.data.data.phoneIsExist) { // 存在
+          that.errTipShow = true;
+          setTimeout(() => {
+            that.errTipShow = false;
+            // 在这里编写延迟执行的代码
+            that.userInfo.phonenumber = null;
+          }, 3000);
+        } else {
+
+          that.getPhoneCode();
+        }
+      })
+    },
+
+
+    // 获取验证码
+    getPhoneCode() {
+      let that = this;
+
+      // 模拟向后端请求验证码
+      uni.showLoading({
+        title: '正在获取验证码'
+      })
+      this.$api.service.getSmsCodeByType({phonenumber: this.userInfo.phonenumber, auth: true, type: 0}).then((res) => {
+        uni.hideLoading();
+        // 这里此提示会被this.start()方法中的提示覆盖
+        uni.$u.toast('验证码已发送');
+        // 通知验证码组件内部开始倒计时
+        that.$refs.uCode3.start();
+      })
+    },
+  }
+}
+</script>
+<style lang="scss">
+
+page, body {
+  background: #fff;
+}
+
+.h-err {
+  color: red;
+  text-align: center;
+  font-size: 14px;
+}
+
+.h-popo-content {
+  height: 170px;
+  padding: 12px;
+  width: 300px;
+  text-align: center;
+  font-size: 14px;
+  font-family: PingFangSC-Semibold, PingFang SC;
+
+  .h-img {
+    display: flex;
+    justify-content: center;
+  }
+
+  .h-text {
+    margin-top: 12px;
+    font-weight: 400;
+    color: #666666;
+  }
+
+  .text {
+    margin-top: 6px;
+    font-weight: 400;
+    color: #666666;
+  }
+
+  .h-btn-wrap {
+    display: flex;
+    justify-content: space-between;
+    color: #333333;
+    text-align: center;
+    margin-top: 14px;
+
+    .h-left-btn {
+      height: 32px;
+      line-height: 30px;
+      background: #EEEEEE;
+      width: 100px;
+      text-align: center;
+      border-radius: 16px;
+      margin: 0 auto;
+    }
+
+    .h-right-btn {
+      height: 32px;
+      line-height: 30px;
+      background: #FFE05C;
+      width: 100px;
+      border-radius: 16px;
+      margin: 0 auto;
+
+    }
+  }
+}
+
+.container {
+  background: #fff;
+  height: 300px;
+
+  .login-wrap {
+    display: flex;
+    justify-content: center;
+
+    .login-form {
+      width: 90%;
+    }
+
+    .account {
+      display: flex;
+    }
+
+    .identifying-code {
+    }
+  }
+
+  .op-btn-wrap {
+    margin-top: 30px;
+    display: flex;
+    justify-content: center;
+    align-items: center;
+
+    .h-btn {
+      text-align: center;
+      width: 343px;
+      height: 42px;
+      background: #FFE05C;
+      border-radius: 27px;
+      line-height: 42px;
+    }
+  }
+}
+
+.popup-content {
+  width: 622rpx;
+  background-color: #FFFFFF;
+  border-radius: 20rpx;
+  padding: 24rpx;
+
+  .popupItem {
+    width: 558rpx;
+    height: 100rpx;
+    background-color: #FAFAFA;
+    border-radius: 16rpx;
+    margin:24rpx ;
+    display: flex;
+    align-items: center;
+    justify-content: space-around;
+  }
+  .popupItemSelect {
+    width: 558rpx;
+    height: 100rpx;
+    background-color: #FAFAFA;
+    border-radius: 16rpx;
+    border: 4rpx solid #FFE05C;
+    margin:24rpx ;
+    display: flex;
+    align-items: center;
+    justify-content: space-around;
+    box-sizing: border-box;
+  }
+  .popupItemSelect::after {
+    content: '√';
+    color: #fff;
+    z-index: 1000;
+    display: inline-block;
+    width: 32rpx;
+    height: 32rpx;
+    transform: rotate(20deg);
+    position: absolute;
+    top: 0;
+    right: 0;
+  }
+
+}
+
+.button-popup {
+  height: 60px;
+  display: flex;
+  justify-content: space-between;
+  background: #fff;
+
+  .h-btn {
+    margin: 0 auto;
+    margin-top: 8px;
+    width: 240rpx;
+    height: 84rpx;
+    border-radius: 27px;
+    display: flex;
+    justify-content: center;
+    align-items: center;
+    font-size: 14px;
+  }
+}
+</style>