提交 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字段进行必填验证
...@@ -79,9 +79,10 @@ ...@@ -79,9 +79,10 @@
currentPage = pages[pages.length - 1]; currentPage = pages[pages.length - 1];
currentPage.$getAppWebview().setStyle({ currentPage.$getAppWebview().setStyle({
top:"1000px" top:"1000px"
}) })
}, },
onReady() { onReady() {
this.$refs.uniQuickLogin.login('univerify')
setTimeout(() => { setTimeout(() => {
currentPage.$getAppWebview().setStyle({ currentPage.$getAppWebview().setStyle({
top:"0" top:"0"
...@@ -113,36 +114,13 @@ ...@@ -113,36 +114,13 @@
* 发送验证吗 * 发送验证吗
*/ */
uni.showLoading(); uni.showLoading();
uniCloud.callFunction({ uni.navigateTo({
"name": "user", url: './phone-code?phoneNumber=' + this.formData.phone + '&phoneArea=' +
"data": { this.currenPhoneArea,
"action": "sendSmsCode", success: res => {},
"params": { fail: () => {},
"mobile": this.formData.phone, complete: () => {}
"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,
success: res => {},
fail: () => {},
complete: () => {}
});
},
fail: (err) => {
console.log(err);
},
complete: () => {
uni.hideLoading()
}
})
}, },
/** /**
* 去密码登录页 * 去密码登录页
......
...@@ -19,7 +19,8 @@ ...@@ -19,7 +19,8 @@
@click="submit">登录</button> @click="submit">登录</button>
</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();
...@@ -80,15 +79,91 @@ ...@@ -80,15 +79,91 @@
if (this.phoneNumber == '') return uni.showToast({ if (this.phoneNumber == '') return uni.showToast({
title: '请填写手机号', title: '请填写手机号',
icon: 'none' icon: 'none'
}); });
// 发送成功后开启倒计时 uniCloud.callFunction({
done(); "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(){ 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()
}
})
} }
} }
} }
......
...@@ -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.
先完成此消息的编辑!
想要评论请 注册