提交 59767188 编写于 作者: DCloud_JSON's avatar DCloud_JSON

点击一键登录添加loading动画,问题反馈页面添加到路由拦截

上级 5351e8b6
......@@ -9,7 +9,7 @@
地址:[https://codechina.csdn.net/dcloud/uni-starter.git](https://codechina.csdn.net/dcloud/uni-starter.git)
#### 项目背景
我们一直想出一个结合uni-app、uniCloud和openDB以及uni-id和uniCloud admin等,uni全家桶的项目模板;
在过去我们会收集到开发者,咨询的各种问题,其中我们总结了高频。我们一直想出一个结合uni-app、uniCloud和openDB以及uni-id和uniCloud admin等,uni全家桶的项目模板;
为了照顾各类应用的开发者,我们取交集最终罗列了如下功能,发现这些就是除业务逻辑外的项目基本功能并把它命名为`uni-starter`
uni-starter将节省开发者大量的时间,让开发者集中精力在自己的特色业务上。
有了uni-starter,再加上schema2code生成前端页面,一个简单应用就可以快速完成。
......
......@@ -34,9 +34,9 @@ export default function() {
const url = e.url.split('?')[0]
//拦截强制登陆页面
if (needLogin.includes(url) && token == '') {
console.log('该页面需要登陆,即将跳转到login页面');
console.log('该页面需要登陆才能访问,请先登陆');
uni.showToast({
title: '该页面需要登陆,即将跳转到login页面',
title: '该页面需要登陆才能访问,请先登陆',
icon: 'none'
})
uni.navigateTo({
......
......@@ -170,17 +170,17 @@
})
}
},
login_before(type, navigateBack = true) {
login_before(type, navigateBack = true) {
if(!this.agree){
return uni.showToast({
title: '你未同意隐私政策协议',
icon: 'none'
});
}
console.log(arguments);
uni.showLoading()
// console.log(arguments);
let oauthService = this.oauthServices.find((service) => service.id == type)
console.log(type);
// console.log(type);
// #ifdef APP-PLUS
//请勿直接使用前端获取的unionid或openid直接用于登陆,前端的数据都是不可靠的
......@@ -211,11 +211,12 @@
if (type == 'apple') {
let res = await this.getUserInfo({
provider: "apple"
})
})
uni.hideLoading()
Object.assign(e.authResult, res.userInfo)
}
// #ifdef MP-WEIXIN
if (type == 'weixin') {
if (type == 'weixin') {
return this.login({
code: e.code
}, type)
......@@ -275,8 +276,6 @@
delete result.userInfo.token
this.setUserInfo(result.userInfo)
}
}, {
showLoading: true
})
},
async getUserInfo(e) {
......
......@@ -6,9 +6,9 @@
<text class="uer-name">{{userInfo.nickname||userInfo.username||userInfo.mobile||'未登录'}}</text>
</view>
</view>
<uni-grid class="grid" :column="5" :showBorder="false" :square="true">
<uni-grid class="grid" :column="4" :showBorder="false" :square="true">
<uni-grid-item class="item" v-for="(item,index) in gridList" @click.native="tapGrid(index)" :key="index">
<uni-icons class="icon" color="#ffd44f" :type="item.icon" size="26"></uni-icons>
<uni-icons class="icon" color="#007AFF" :type="item.icon" size="26"></uni-icons>
<text class="text">{{item.text}}</text>
</uni-grid-item>
</uni-grid>
......@@ -57,10 +57,6 @@
{
"text": "文字4",
"icon": "download"
},
{
"text": "文字5",
"icon": "paperplane"
}
],
ucenterList: [
......
......@@ -23,7 +23,8 @@ module.exports = {
"needLogin": [
"/pages/ucenter/userinfo/userinfo",
"/uni_modules/uni-news-favorite/pages/uni-news-favorite/list",
"/pages/ucenter/userinfo/uploadCutImageToUnicloud"
"/pages/ucenter/userinfo/uploadCutImageToUnicloud",
"/uni_modules/opendb-feedback/pages/opendb-feedback/add"
],
"login": ["smsCode","univerify", "username", "weixin", "apple"],
/*
......
{
"passwordSecret": "passwordSecret-demo",
"tokenSecret": "tokenSecret-demo",
"tokenExpiresIn": 7200,
"tokenExpiresThreshold": 600,
"passwordErrorLimit": 6,
"bindTokenToDevice": true,
"passwordErrorRetryTime": 3600,
"autoSetInviteCode": false,
"forceInviteCode": false,
"app-plus": {
"tokenExpiresIn": 2592000,
"oauth": {
"weixin": {
"appid": "",
"appsecret": ""
},
"apple": {
"bundleId": ""
}
}
},
"mp-weixin": {
"oauth": {
"weixin": {
"appid": "",
"appsecret": ""
}
}
},
"mp-alipay": {
"oauth": {
"alipay": {
"appid": "alipay appid",
"privateKey": "alipay privateKey"
}
}
},
"service": {
"sms": {
"name": "DCloud",
"codeExpiresIn": 300,
"smsKey": "",
"smsSecret": ""
},
"univerify": {
"appid": "",
"apiKey": "",
"apiSecret": ""
}
}
}
{
"passwordSecret": "passwordSecret-demo",
"tokenSecret": "tokenSecret-demo",
"tokenExpiresIn": 7200,
"tokenExpiresThreshold": 600,
"passwordErrorLimit": 6,
"bindTokenToDevice": true,
"passwordErrorRetryTime": 3600,
"autoSetInviteCode": false,
"forceInviteCode": false,
"app-plus": {
"tokenExpiresIn": 2592000,
"oauth": {
"weixin": {
"appid": "wxffdd8fa6ec4ef2a0",
"appsecret": "6c9119430d7be0a147bcbbb73ef33acf"
},
"apple": {
"bundleId": "io.dcloud.hellouniapp"
}
}
},
"mp-weixin": {
"oauth": {
"weixin": {
"appid": "wx81dbb061d2258234",
"appsecret": "73be6e8b8b31b7b0783fe448cc1fe820"
}
}
},
"mp-alipay": {
"oauth": {
"alipay": {
"appid": "alipay appid",
"privateKey": "alipay privateKey"
}
}
},
"service": {
"sms": {
"name": "DCloud",
"codeExpiresIn": 300,
"smsKey": "71a19f38c954f7d768d68a050486bf15",
"smsSecret": "d6c424b702d73baa3b6e1a1452469213"
},
"univerify": {
"appid": "__UNI__03B096E",
"apiKey": "3fc28519d90d74173bcecf2daf4ffcc4",
"apiSecret": "dd793e5bc4b372ce932f35bbb4c5d61b"
}
}
}
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册