From 4ac3c2382e0733685f7612f8e9ca4e85d15c1411 Mon Sep 17 00:00:00 2001 From: zhaojs <349234519@qq.com> Date: 星期日, 25 六月 2023 08:55:00 +0800 Subject: [PATCH] Merge branch 'hotfix/苹果审核修改' --- uniapp/pages/login/bindingPhone.vue | 141 +++++++++++++++++++++++++++++++++++++++------- 1 files changed, 119 insertions(+), 22 deletions(-) diff --git a/uniapp/pages/login/bindingPhone.vue b/uniapp/pages/login/bindingPhone.vue index 606ec64..a4d1ba6 100644 --- a/uniapp/pages/login/bindingPhone.vue +++ b/uniapp/pages/login/bindingPhone.vue @@ -5,28 +5,36 @@ <view class="titleText"> 缁戝畾鎵嬫満鍙� </view> - - <view class="input-container colCen"> - <view class="outSidebox rowCen" :class="selectedInput=='phone'?'outSidebox-active':''"> - <input type="number" data-type='phone' @focus="changeType" @blur="cleanActive" v-model="phone" - placeholder="璇疯緭鍏ユ墜鏈哄彿" placeholder-class="input-placeHolder" /> - </view> + <view v-if="iscanbind" class="goaccount rowCenCen" @tap="mobShow()"> + <view>鏈満鎵嬫満鍙蜂竴閿粦瀹�</view> </view> - - <view class="input-container colCen"> - <view class="outSidebox rowCenBet" data-type='pass' - :class="selectedInput=='code'?'outSidebox-active':''"> - <input @focus="changeType" @blur="cleanActive" data-type='code' type="number" v-model="code" - placeholder="璇疯緭鍏ラ獙璇佺爜" placeholder-class="input-placeHolder" /> - <view class="getcodebox" :class="canGetCode?'colorTxt':''" @click="getCode()"> - {{canGetCode?'鑾峰彇楠岃瘉鐮�':second+'s鍚庨噸鏂拌幏鍙�'}} + <view v-else> + <view class="input-container colCen"> + <view class="outSidebox rowCen" :class="selectedInput=='phone'?'outSidebox-active':''"> + <input type="number" data-type='phone' @focus="changeType" @blur="cleanActive" v-model="phone" + placeholder="璇疯緭鍏ユ墜鏈哄彿" placeholder-class="input-placeHolder" /> + </view> </view> - </view> - <view class="login-btn rowCenCen" :class="code&&phone?'colorfulbtn':''" @click="bindMobile()"> - <view class="btn-font"> - 缁戝畾 + <view class="input-container colCen"> + <view class="outSidebox rowCenBet" data-type='pass' + :class="selectedInput=='code'?'outSidebox-active':''"> + <input @focus="changeType" @blur="cleanActive" data-type='code' type="number" v-model="code" + placeholder="璇疯緭鍏ラ獙璇佺爜" placeholder-class="input-placeHolder" /> + <view class="getcodebox" :class="canGetCode?'colorTxt':''" @click="getCode()"> + {{canGetCode?'鑾峰彇楠岃瘉鐮�':second+'s鍚庨噸鏂拌幏鍙�'}} + </view> + </view> + </view> + + <view class="login-btn rowCenCen" :class="code&&phone?'colorfulbtn':''" @click="bindMobile()"> + <view class="btn-font"> + 缁戝畾 + </view> + </view> + <view style="text-align: center; width: 100%;margin-top: 30rpx;" @click="mobShow()"> + 鏈満鎵嬫満鍙蜂竴閿粦瀹� </view> </view> </view> @@ -51,6 +59,7 @@ import MD5 from '../../utils/md5.js' import config from '../../utils/config.js' import utils from '../../utils/utils.js' + const univerifyManager = uni.getUniverifyManager(); export default { components: { inviteCodeModel, @@ -72,7 +81,9 @@ prevent: true, inviteCodeShow:false, inviterShow:false, - wxUser:"" + wxUser:"", + iscanbind:true, + isyj:false }; }, onLoad(options) { @@ -90,6 +101,77 @@ }, methods: { ...mapMutations(['login']), + doMobileLogin(mobRes) + { + var that=this; + uniCloud.callFunction({ + name: 'getPhoneNumber', // 浣犵殑浜戝嚱鏁板悕绉� + data: { + 'access_token': mobRes.access_token, // 瀹㈡埛绔竴閿櫥褰曟帴鍙h繑鍥炵殑access_token + 'openid': mobRes.openid, // 瀹㈡埛绔竴閿櫥褰曟帴鍙h繑鍥炵殑openid + 'op_type':'getmob' + } + }).then(res => { + console.log(res); + that.phone=res.result.mobile; + univerifyManager.close(); + that.isyj=true; + that.bindMobile(); + }).catch(err=>{ + // 澶勭悊閿欒 + console.log(err) + that.iscanbind=false; + that.$alert('鑾峰彇鎵嬫満鍙风爜澶辫触锛岃浣跨敤鍏朵粬鏂瑰紡缁戝畾') + setTimeout(function(){ + univerifyManager.close(); + },2000); + that.isyj=false; + }) + }, + mobShow() + { + var that=this; + univerifyManager.login({ + provider: 'univerify', + univerifyStyle: { // 鑷畾涔夌櫥褰曟鏍峰紡 + "fullScreen":false, + "authButton": + { + "normalColor":"#F73314", + "highlightColor":"#F73314", + "title":"鏈満鍙风爜涓�閿粦瀹�" + }, + "otherLoginButton":{ + "title":"鍏朵粬缁戝畾鏂瑰紡" + }, + "privacyTerms":{ + "defaultCheckBoxState":false + } + + }, + success(res){ // 鑾峰彇鎴愬姛 + console.log(res.authResult); + that.doMobileLogin(res.authResult); + }, + fail(res){ // 鐧诲綍澶辫触 + console.log(res) + if(res.errCode==30002) + {//鍒囨崲鐧诲綍鏂瑰紡 + that.iscanbind=false; + univerifyManager.close(); + } + else + { + that.$alert('鑾峰彇鎵嬫満鍙风爜澶辫触锛岃浣跨敤鍏朵粬鏂瑰紡缁戝畾') + setTimeout(function(){ + univerifyManager.close(); + },2000); + } + + that.iscanbind=false; + } + }) + }, backHome() { var pages = getCurrentPages(); console.log(pages.length); @@ -132,11 +214,14 @@ }, bindMobile(){ var that = this; - if(!this.hasLogin && this.wxUser != ""){ + console.log(this.hasLogin) + console.log(this.wxUser) + if(this.wxUser != ""){ this.$u.api.bindMobileLogin({ wxUser : encodeURIComponent(JSON.stringify(that.wxUser)), mobile:this.phone, - captcha:this.code + captcha:this.code, + isyj:this.isyj }).then(e => { console.log(e) if (e.code != 0) return that.$alert(e.msg) @@ -161,7 +246,8 @@ }else{ this.$u.api.changeMobile({ mobile:this.phone, - captcha:this.code + captcha:this.code, + isyj:this.isyj }).then(e => { if(e.code != 0) return that.$alert(e.msg) that.$alert('缁戝畾鎴愬姛'); @@ -284,6 +370,17 @@ </script> <style lang="scss"> + .goaccount { + width: 100%; + height: 100rpx; + background: #FFFFFF; + border: 1rpx solid #999999; + border-radius: 50rpx; + font-size: 30rpx; + font-weight: 500; + color: #333333; + margin-top: 30rpx; + } .login-wrapper { width: 100%; min-height: 100vh; -- Gitblit v1.9.3