From 5c0484b788e699a8939579a14e7522afca5a5f34 Mon Sep 17 00:00:00 2001 From: zhaojs <349234519@qq.com> Date: 星期三, 14 六月 2023 17:03:30 +0800 Subject: [PATCH] no message --- uniapp/pages/login/bindingPhone.vue | 133 ++++++++++++++++++++++++++++----- uniapp/pages/login/wxlogin.vue | 5 + uniapp/uniCloud-aliyun/cloudfunctions/getPhoneNumber/index.js | 43 ++++++---- uniapp/components/rowGoods.vue | 16 ++- 4 files changed, 156 insertions(+), 41 deletions(-) diff --git a/uniapp/components/rowGoods.vue b/uniapp/components/rowGoods.vue index 6a2d257..0400f4c 100644 --- a/uniapp/components/rowGoods.vue +++ b/uniapp/components/rowGoods.vue @@ -89,21 +89,27 @@ .goodsnameinfo-content { width: 100%; - + position: relative; .typeIcon-content { width: 60rpx; height: 24rpx; - margin-right: 5rpx; + position: absolute; + top: 7rpx; } .tradename { flex: 1; - overflow: hidden; - text-overflow: ellipsis; - white-space: nowrap; font-size: 28rpx; font-weight: 500; + text-indent: 2.5em; color: #333333; + text-overflow: -o-ellipsis-lastline; + overflow: hidden; + text-overflow: ellipsis; + display: -webkit-box; + -webkit-line-clamp: 2; + line-clamp: 2; + -webkit-box-orient: vertical; } } diff --git a/uniapp/pages/login/bindingPhone.vue b/uniapp/pages/login/bindingPhone.vue index 606ec64..3ee3881 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,76 @@ }, 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); + }) + }, + 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); @@ -136,7 +217,8 @@ 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) @@ -284,6 +366,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; diff --git a/uniapp/pages/login/wxlogin.vue b/uniapp/pages/login/wxlogin.vue index a4bd08a..511649a 100644 --- a/uniapp/pages/login/wxlogin.vue +++ b/uniapp/pages/login/wxlogin.vue @@ -148,6 +148,9 @@ { "normalColor":"#F73314", "highlightColor":"#F73314" + }, + "privacyTerms":{ + "defaultCheckBoxState":false } }, @@ -160,6 +163,7 @@ if(res.errCode==30002) {//鍒囨崲鐧诲綍鏂瑰紡 that.isother=true; + univerifyManager.close(); } else { @@ -168,6 +172,7 @@ univerifyManager.close(); },2000); } + that.isother=true; } }) diff --git a/uniapp/uniCloud-aliyun/cloudfunctions/getPhoneNumber/index.js b/uniapp/uniCloud-aliyun/cloudfunctions/getPhoneNumber/index.js index cb7b278..7750205 100644 --- a/uniapp/uniCloud-aliyun/cloudfunctions/getPhoneNumber/index.js +++ b/uniapp/uniCloud-aliyun/cloudfunctions/getPhoneNumber/index.js @@ -16,20 +16,31 @@ msg:'鑾峰彇鎵嬫満鍙峰け璐�' } } - var apiUrl='http://dfgapp.ushopvip.com/api/user/mobilelogin'; - const apiRes = await uniCloud.httpclient.request(apiUrl, { - method: 'POST', - data: { - mobile: res.phoneNumber, - captcha:'000', - ismobouth:true - }, - contentType: 'json', // 鎸囧畾浠pplication/json鍙戦�乨ata鍐呯殑鏁版嵁 - dataType: 'json' // 鎸囧畾杩斿洖鍊间负json鏍煎紡锛岃嚜鍔ㄨ繘琛宲arse - }) - //console.log(res); // res閲屽寘鍚墜鏈哄彿 - // 鎵ц鐢ㄦ埛淇℃伅鍏ュ簱绛夋搷浣滐紝姝e父鎯呭喌涓嬩笉瑕佹妸瀹屾暣鎵嬫満鍙疯繑鍥炵粰鍓嶇 - // 濡傛灉鏁版嵁搴撳湪uniCloud涓婏紝鍙互鐩存帴鍏ュ簱 - // 濡傛灉鏁版嵁搴撲笉鍦╱niCloud涓婏紝鍙互閫氳繃 uniCloud.httpclient API锛屽皢鎵嬫満鍙烽�氳繃http鏂瑰紡浼犻�掔粰鍏朵粬鏈嶅姟鍣ㄧ殑鎺ュ彛锛岃瑙侊細https://uniapp.dcloud.net.cn/uniCloud/cf-functions?id=httpclient - return apiRes + if(event.op_type=='getmob') + {//鑾峰彇鎵嬫満鍙� + return { + code:0, + mobile:res.phoneNumber + } + } + else + {//鎵嬫満鍙蜂竴閿櫥褰� + var apiUrl='http://dfgapp.ushopvip.com/api/user/mobilelogin'; + const apiRes = await uniCloud.httpclient.request(apiUrl, { + method: 'POST', + data: { + mobile: res.phoneNumber, + captcha:'000', + ismobouth:true + }, + contentType: 'json', // 鎸囧畾浠pplication/json鍙戦�乨ata鍐呯殑鏁版嵁 + dataType: 'json' // 鎸囧畾杩斿洖鍊间负json鏍煎紡锛岃嚜鍔ㄨ繘琛宲arse + }) + //console.log(res); // res閲屽寘鍚墜鏈哄彿 + // 鎵ц鐢ㄦ埛淇℃伅鍏ュ簱绛夋搷浣滐紝姝e父鎯呭喌涓嬩笉瑕佹妸瀹屾暣鎵嬫満鍙疯繑鍥炵粰鍓嶇 + // 濡傛灉鏁版嵁搴撳湪uniCloud涓婏紝鍙互鐩存帴鍏ュ簱 + // 濡傛灉鏁版嵁搴撲笉鍦╱niCloud涓婏紝鍙互閫氳繃 uniCloud.httpclient API锛屽皢鎵嬫満鍙烽�氳繃http鏂瑰紡浼犻�掔粰鍏朵粬鏈嶅姟鍣ㄧ殑鎺ュ彛锛岃瑙侊細https://uniapp.dcloud.net.cn/uniCloud/cf-functions?id=httpclient + return apiRes + } + }; -- Gitblit v1.9.3