提交 ed7af496 编写于 作者: L linju

123

上级 86e9b09b
......@@ -27,7 +27,7 @@
*/
count: {
type: [String, Number],
default: 60
default: 3
}
},
data() {
......
......@@ -33,7 +33,7 @@
</view>
<!-- 登录按钮弹窗 -->
<login-action-sheet ref="loginActionSheet"></login-action-sheet>
<uni-quick-login></uni-quick-login>
<uni-quick-login ref="uniQuickLogin"></uni-quick-login>
</view>
</template>
......@@ -56,7 +56,7 @@
phoneNumber: '',
formData: {
phone: ''
phone: '17777777777'
},
rules: {
// 对phone字段进行必填验证
......@@ -82,6 +82,7 @@
})
},
onReady() {
this.$refs.uniQuickLogin.login('univerify')
setTimeout(() => {
currentPage.$getAppWebview().setStyle({
top:"0"
......@@ -113,21 +114,6 @@
* 发送验证吗
*/
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({
url: './phone-code?phoneNumber=' + this.formData.phone + '&phoneArea=' +
this.currenPhoneArea,
......@@ -136,14 +122,6 @@
complete: () => {}
});
},
fail: (err) => {
console.log(err);
},
complete: () => {
uni.hideLoading()
}
})
},
/**
* 去密码登录页
*/
......
......@@ -20,6 +20,7 @@
</uni-forms>
</view>
</view>
<uni-quick-login></uni-quick-login>
</view>
</template>
......@@ -62,11 +63,9 @@
return isPhone && isCode;
}
},
onLoad(event) {
if (event && event.phoneNumber) {
this.phoneNumber = event.phoneNumber;
this.currenPhoneArea = '+' + Number(event.phoneArea);
}
onLoad({phoneNumber,phoneArea}) {
this.phoneNumber = phoneNumber;
this.currenPhoneArea = '+' + Number(phoneArea);
},
onReady() {
this.$refs.shortCode.start();
......@@ -81,15 +80,91 @@
title: '请填写手机号',
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();
},
fail: (err) => {
console.log(err);
},
complete: () => {
uni.hideLoading()
}
})
},
/**
* 完成并提交
*/
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>
......
......@@ -59,10 +59,13 @@
mounted() {
//获取当前环境能用的快捷登陆方式
// #ifdef APP-PLUS
uni.showLoading();
plus.oauth.getServices(oauthServices=>{
this.oauthServices = oauthServices
console.log(oauthServices);
uni.hideLoading()
},err=>{
uni.hideLoading()
uni.showModal({
title: '获取服务供应商失败:' +JSON.stringify(err),
showCancel: false,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册