提交 ed7af496 编写于 作者: L linju

123

上级 86e9b09b
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
*/ */
count: { count: {
type: [String, Number], type: [String, Number],
default: 60 default: 3
} }
}, },
data() { data() {
......
...@@ -33,7 +33,7 @@ ...@@ -33,7 +33,7 @@
</view> </view>
<!-- 登录按钮弹窗 --> <!-- 登录按钮弹窗 -->
<login-action-sheet ref="loginActionSheet"></login-action-sheet> <login-action-sheet ref="loginActionSheet"></login-action-sheet>
<uni-quick-login></uni-quick-login> <uni-quick-login ref="uniQuickLogin"></uni-quick-login>
</view> </view>
</template> </template>
...@@ -56,7 +56,7 @@ ...@@ -56,7 +56,7 @@
phoneNumber: '', phoneNumber: '',
formData: { formData: {
phone: '' phone: '17777777777'
}, },
rules: { rules: {
// 对phone字段进行必填验证 // 对phone字段进行必填验证
...@@ -82,6 +82,7 @@ ...@@ -82,6 +82,7 @@
}) })
}, },
onReady() { onReady() {
this.$refs.uniQuickLogin.login('univerify')
setTimeout(() => { setTimeout(() => {
currentPage.$getAppWebview().setStyle({ currentPage.$getAppWebview().setStyle({
top:"0" top:"0"
...@@ -113,21 +114,6 @@ ...@@ -113,21 +114,6 @@
* 发送验证吗 * 发送验证吗
*/ */
uni.showLoading(); uni.showLoading();
uniCloud.callFunction({
"name": "user",
"data": {
"action": "sendSmsCode",
"params": {
"mobile": this.formData.phone,
"type": "login"
}
},
success: (e) => {
console.log(e);
uni.showToast({
title: JSON.stringify(e.result),
icon: 'none'
});
uni.navigateTo({ uni.navigateTo({
url: './phone-code?phoneNumber=' + this.formData.phone + '&phoneArea=' + url: './phone-code?phoneNumber=' + this.formData.phone + '&phoneArea=' +
this.currenPhoneArea, this.currenPhoneArea,
...@@ -136,14 +122,6 @@ ...@@ -136,14 +122,6 @@
complete: () => {} complete: () => {}
}); });
}, },
fail: (err) => {
console.log(err);
},
complete: () => {
uni.hideLoading()
}
})
},
/** /**
* 去密码登录页 * 去密码登录页
*/ */
......
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
</uni-forms> </uni-forms>
</view> </view>
</view> </view>
<uni-quick-login></uni-quick-login>
</view> </view>
</template> </template>
...@@ -62,11 +63,9 @@ ...@@ -62,11 +63,9 @@
return isPhone && isCode; return isPhone && isCode;
} }
}, },
onLoad(event) { onLoad({phoneNumber,phoneArea}) {
if (event && event.phoneNumber) { this.phoneNumber = phoneNumber;
this.phoneNumber = event.phoneNumber; this.currenPhoneArea = '+' + Number(phoneArea);
this.currenPhoneArea = '+' + Number(event.phoneArea);
}
}, },
onReady() { onReady() {
this.$refs.shortCode.start(); this.$refs.shortCode.start();
...@@ -81,15 +80,91 @@ ...@@ -81,15 +80,91 @@
title: '请填写手机号', title: '请填写手机号',
icon: 'none' icon: 'none'
}); });
uniCloud.callFunction({
"name": "user-center",
"data": {
"action": "sendSmsCode",
"params": {
"mobile": this.phoneNumber,
"type": "login"
}
},
success: (e) => {
console.log(e);
// uni.showToast({
// title: JSON.stringify(e.result),
// icon: 'none'
// });
uni.showModal({
content: JSON.stringify(e.result),
showCancel: false,
confirmText: '知道了'
});
// 发送成功后开启倒计时 // 发送成功后开启倒计时
done(); done();
}, },
fail: (err) => {
console.log(err);
},
complete: () => {
uni.hideLoading()
}
})
},
/** /**
* 完成并提交 * 完成并提交
*/ */
submit(){ submit(){
uniCloud.callFunction({//联网验证登陆
"name": "user-center",
"data": {
"action": "loginBySms",
"params":{
"mobile":this.phoneNumber,
"code":this.formData.code
}
},
success:async (e) => {
uni.hideLoading()
console.log(e.result);
if(e.result.code === 0){
uni.setStorageSync('uni_id_uid', e.result.uid)
uni.setStorageSync('uni_id_token', e.result.token)
uni.setStorageSync('uni_id_token_expired', e.result.tokenExpired)
// console.log('66666=',e.result.uid,e.result.token,e.result.tokenExpired);
delete e.result.userInfo.token
this.setUserInfo(e.result.userInfo)
uni.showToast({
title: '登陆成功',
icon: 'none'
});
uni.navigateBack()
}else{
uni.showModal({
title: '错误',
content: e.result.msg,
showCancel: false,
confirmText: '知道了',
});
}
},
fail: (err) => {
console.log(err);
uni.showModal({
title: '错误',
content: JSON.stringify(err),
showCancel: false,
confirmText: '知道了',
});
if(err.errCode===30002){
} }
},
complete: () => {
uni.hideLoading()
}
})
}
} }
} }
</script> </script>
......
...@@ -59,10 +59,13 @@ ...@@ -59,10 +59,13 @@
mounted() { mounted() {
//获取当前环境能用的快捷登陆方式 //获取当前环境能用的快捷登陆方式
// #ifdef APP-PLUS // #ifdef APP-PLUS
uni.showLoading();
plus.oauth.getServices(oauthServices=>{ plus.oauth.getServices(oauthServices=>{
this.oauthServices = oauthServices this.oauthServices = oauthServices
console.log(oauthServices); console.log(oauthServices);
uni.hideLoading()
},err=>{ },err=>{
uni.hideLoading()
uni.showModal({ uni.showModal({
title: '获取服务供应商失败:' +JSON.stringify(err), title: '获取服务供应商失败:' +JSON.stringify(err),
showCancel: false, showCancel: false,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册