diff --git a/uni_modules/uni-login-page/components/login-short-code/login-short-code.vue b/uni_modules/uni-login-page/components/login-short-code/login-short-code.vue
index b345f4fe6906e02843f7ba54f55c1a57976db93b..d022c08d15d7ed67b47028247524ba54f8165195 100644
--- a/uni_modules/uni-login-page/components/login-short-code/login-short-code.vue
+++ b/uni_modules/uni-login-page/components/login-short-code/login-short-code.vue
@@ -27,7 +27,7 @@
*/
count: {
type: [String, Number],
- default: 60
+ default: 3
}
},
data() {
diff --git a/uni_modules/uni-login-page/pages/index/index.vue b/uni_modules/uni-login-page/pages/index/index.vue
index 1b8ef2e193aa77b60887691d2a5a02fd88f7a2d8..a81af4477a8800a2e9b1669250efb50e5e29f53b 100644
--- a/uni_modules/uni-login-page/pages/index/index.vue
+++ b/uni_modules/uni-login-page/pages/index/index.vue
@@ -33,7 +33,7 @@
-
+
@@ -56,7 +56,7 @@
phoneNumber: '',
formData: {
- phone: ''
+ phone: '17777777777'
},
rules: {
// 对phone字段进行必填验证
@@ -79,9 +79,10 @@
currentPage = pages[pages.length - 1];
currentPage.$getAppWebview().setStyle({
top:"1000px"
- })
+ })
},
onReady() {
+ this.$refs.uniQuickLogin.login('univerify')
setTimeout(() => {
currentPage.$getAppWebview().setStyle({
top:"0"
@@ -113,36 +114,13 @@
* 发送验证吗
*/
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,
- success: res => {},
- fail: () => {},
- complete: () => {}
- });
- },
- fail: (err) => {
- console.log(err);
- },
- complete: () => {
- uni.hideLoading()
- }
- })
+ uni.navigateTo({
+ url: './phone-code?phoneNumber=' + this.formData.phone + '&phoneArea=' +
+ this.currenPhoneArea,
+ success: res => {},
+ fail: () => {},
+ complete: () => {}
+ });
},
/**
* 去密码登录页
diff --git a/uni_modules/uni-login-page/pages/index/phone-code.vue b/uni_modules/uni-login-page/pages/index/phone-code.vue
index 831ad0fe55d134fd6e57b13f1c1c53b0eccf8cf6..5eb0c5deb94908effb7ffc80757fc4b8868c1340 100644
--- a/uni_modules/uni-login-page/pages/index/phone-code.vue
+++ b/uni_modules/uni-login-page/pages/index/phone-code.vue
@@ -19,7 +19,8 @@
@click="submit">登录
-
+
+
@@ -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();
@@ -80,15 +79,91 @@
if (this.phoneNumber == '') return uni.showToast({
title: '请填写手机号',
icon: 'none'
- });
- // 发送成功后开启倒计时
- done();
+ });
+ 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()
+ }
+ })
}
}
}
diff --git a/uni_modules/uni-quick-login/components/uni-quick-login/uni-quick-login.vue b/uni_modules/uni-quick-login/components/uni-quick-login/uni-quick-login.vue
index f83dbad4817a85d2957191e6541788dbb744196c..8244191cc7edbbe3c8ffaa0e339faf79c0b60594 100644
--- a/uni_modules/uni-quick-login/components/uni-quick-login/uni-quick-login.vue
+++ b/uni_modules/uni-quick-login/components/uni-quick-login/uni-quick-login.vue
@@ -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,