diff --git a/nxTemp/apis/userAPI.js b/nxTemp/apis/userAPI.js index fbf1f10..53d7fcb 100644 --- a/nxTemp/apis/userAPI.js +++ b/nxTemp/apis/userAPI.js @@ -117,7 +117,6 @@ export function rankSave(data) { /** * @description: 消息中心-消息列表 * @param {*} -* brand_id, order_no , rank_data{id,val} */ export function msgList(data) { return http.post(`${config.baseUrl}/matchAssistant/msgCenter/list`,data); @@ -126,7 +125,6 @@ export function msgList(data) { /** * @description: 消息中心-未读消息数量 * @param {*} -* brand_id, order_no , rank_data{id,val} */ export function msgNum(data) { return http.post(`${config.baseUrl}/matchAssistant/msgCenter/notReadNum`,data); @@ -135,7 +133,6 @@ export function msgNum(data) { /** * @description: 消息中心-消息详情 * @param {*} -* brand_id, order_no , rank_data{id,val} */ export function msgGet(data) { return http.post(`${config.baseUrl}/matchAssistant/msgCenter/get`,data); diff --git a/pages/index/index.vue b/pages/index/index.vue index 1adb0a5..30a5896 100644 --- a/pages/index/index.vue +++ b/pages/index/index.vue @@ -45,9 +45,11 @@ computed:{ ...mapState(['userInfo']), ...mapGetters(['hasLogin']), + }, + onShow() { + this.updateMsgNum() }, onLoad(opt) { - this.updateMsgNum() }, onUnload() { @@ -58,11 +60,11 @@ this.$Router.push({name:name}) }, updateMsgNum(){ - console.log(123); + if(!this.hasLogin) return console.log("该用户还未登录"); msgNum(this.postData).then(res => { this.unReadNum = res }).catch(e=>{ - this.$tools.showNone(e.errMsg) + // this.$tools.showNone(e.errMsg) }) }, async clickEvent(){ diff --git a/pages/login/login.vue b/pages/login/login.vue index 0dec59e..4a68c52 100644 --- a/pages/login/login.vue +++ b/pages/login/login.vue @@ -8,7 +8,7 @@ - 手机号码格式错误,请重新填写 + 手机号码格式错误,请重新填写 @@ -21,7 +21,7 @@ {{count}}s - 验证码错误,请重新填写 + 验证码错误,请重新填写 @@ -59,20 +59,32 @@ count:5, code:"", agreed:false,//是否同意协议 - login: {//后台让先写死 - mobile: '13500071371',//手机 - ticket: 'test',//短信验证码返回的 - verify_code:'666666',//验证码 + login: {//后台让先写死 + mobile: '',//手机 + ticket: '',//短信验证码返回的 + verify_code:'',//验证码 + // mobile: '13500071371',//手机 + // ticket: 'test',//短信验证码返回的 + // verify_code:'666666',//验证码 }, WXdetail:{ code:"", appid:"", encryptedData:"", iv:"", - } - + }, + showCodeErr:false, + showPhoneErr:false }; }, + computed:{ + checkMobile(){ + return this.login.mobile + }, + checkCode(){ + return this.login.verify_code + } + }, async onLoad() { // let _login = await this.$tools.promisify(uni.login)() // this.code = _login.code @@ -84,11 +96,23 @@ }, methods: { ...mapActions(["setUserData"]), - bindLogin() { - if (this.login.mobile.length != 11) { - return this.$tools.showNone("请输入正确的手机号");} - if (this.login.verify_code.length < 6) { - return this.$tools.showNone("请输入正确的验证码");} + bindLogin() { + let {mobile} = this.login + let phoneReg = new RegExp(/^1(3|4|5|6|7|8|9)\d{9}$/); + if (!phoneReg.test(mobile)) { + this.showPhoneErr = true + return this.$tools.showNone("请输入正确的手机号"); + } + this.showPhoneErr = false + if (this.login.verify_code.length < 6) { + this.showCodeErr = true + return this.$tools.showNone("请输入正确的验证码"); + } + this.showCodeErr = false + + if(!this.agreed){ + return this.$tools.showNone("请确认已阅读并同意隐私协议"); + } postLogin(this.login).then(res => { this.loginSuccess(res) }).catch((e)=>{ @@ -104,7 +128,15 @@ this.$Router.push('/pages/login/agreement') }, sendSMS(){ + console.log("sendSMS"); let {mobile} = this.login + let phoneReg = new RegExp(/^1(3|4|5|6|7|8|9)\d{9}$/); + if(!mobile||!phoneReg.test(mobile)){ + this.showPhoneErr = true + return + }else if(phoneReg.test(mobile)){ + this.showPhoneErr = false + } postSendSMS({mobile}).then(res => { this.$tools.showNone("发送成功"); this.login.ticket = res.data||"" @@ -125,6 +157,9 @@ }, async decryptPhoneNumber(e){ console.log("decryptPhoneNumber",e); + if(!this.agreed){ + return this.$tools.showNone("请确认已阅读并同意隐私协议"); + } if(e.detail.errMsg!=="getPhoneNumber:ok")return this.$tools.showNone(e.detail.errMsg) this.$tools.showNone("解析数据...") @@ -136,6 +171,7 @@ this.getWXPhoneNumber(this.WXdetail) }, getWXPhoneNumber(WXdetail){ + wechatGetPhoneNumberLogin(WXdetail).then(res => { // this.login.ticket = res.data||"" this.loginSuccess(res) @@ -259,6 +295,7 @@ } .agreement-box{ + margin-top: 20rpx; padding-left: 30rpx; color: #696D6F; .a-icon{