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

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

上级 5351e8b6
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
地址:[https://codechina.csdn.net/dcloud/uni-starter.git](https://codechina.csdn.net/dcloud/uni-starter.git) 地址:[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将节省开发者大量的时间,让开发者集中精力在自己的特色业务上。 uni-starter将节省开发者大量的时间,让开发者集中精力在自己的特色业务上。
有了uni-starter,再加上schema2code生成前端页面,一个简单应用就可以快速完成。 有了uni-starter,再加上schema2code生成前端页面,一个简单应用就可以快速完成。
......
...@@ -34,9 +34,9 @@ export default function() { ...@@ -34,9 +34,9 @@ export default function() {
const url = e.url.split('?')[0] const url = e.url.split('?')[0]
//拦截强制登陆页面 //拦截强制登陆页面
if (needLogin.includes(url) && token == '') { if (needLogin.includes(url) && token == '') {
console.log('该页面需要登陆,即将跳转到login页面'); console.log('该页面需要登陆才能访问,请先登陆');
uni.showToast({ uni.showToast({
title: '该页面需要登陆,即将跳转到login页面', title: '该页面需要登陆才能访问,请先登陆',
icon: 'none' icon: 'none'
}) })
uni.navigateTo({ uni.navigateTo({
......
...@@ -170,17 +170,17 @@ ...@@ -170,17 +170,17 @@
}) })
} }
}, },
login_before(type, navigateBack = true) { login_before(type, navigateBack = true) {
if(!this.agree){ if(!this.agree){
return uni.showToast({ return uni.showToast({
title: '你未同意隐私政策协议', title: '你未同意隐私政策协议',
icon: 'none' icon: 'none'
}); });
} }
uni.showLoading()
console.log(arguments); // console.log(arguments);
let oauthService = this.oauthServices.find((service) => service.id == type) let oauthService = this.oauthServices.find((service) => service.id == type)
console.log(type); // console.log(type);
// #ifdef APP-PLUS // #ifdef APP-PLUS
//请勿直接使用前端获取的unionid或openid直接用于登陆,前端的数据都是不可靠的 //请勿直接使用前端获取的unionid或openid直接用于登陆,前端的数据都是不可靠的
...@@ -211,11 +211,12 @@ ...@@ -211,11 +211,12 @@
if (type == 'apple') { if (type == 'apple') {
let res = await this.getUserInfo({ let res = await this.getUserInfo({
provider: "apple" provider: "apple"
}) })
uni.hideLoading()
Object.assign(e.authResult, res.userInfo) Object.assign(e.authResult, res.userInfo)
} }
// #ifdef MP-WEIXIN // #ifdef MP-WEIXIN
if (type == 'weixin') { if (type == 'weixin') {
return this.login({ return this.login({
code: e.code code: e.code
}, type) }, type)
...@@ -275,8 +276,6 @@ ...@@ -275,8 +276,6 @@
delete result.userInfo.token delete result.userInfo.token
this.setUserInfo(result.userInfo) this.setUserInfo(result.userInfo)
} }
}, {
showLoading: true
}) })
}, },
async getUserInfo(e) { async getUserInfo(e) {
......
...@@ -6,9 +6,9 @@ ...@@ -6,9 +6,9 @@
<text class="uer-name">{{userInfo.nickname||userInfo.username||userInfo.mobile||'未登录'}}</text> <text class="uer-name">{{userInfo.nickname||userInfo.username||userInfo.mobile||'未登录'}}</text>
</view> </view>
</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-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> <text class="text">{{item.text}}</text>
</uni-grid-item> </uni-grid-item>
</uni-grid> </uni-grid>
...@@ -57,10 +57,6 @@ ...@@ -57,10 +57,6 @@
{ {
"text": "文字4", "text": "文字4",
"icon": "download" "icon": "download"
},
{
"text": "文字5",
"icon": "paperplane"
} }
], ],
ucenterList: [ ucenterList: [
......
...@@ -23,7 +23,8 @@ module.exports = { ...@@ -23,7 +23,8 @@ module.exports = {
"needLogin": [ "needLogin": [
"/pages/ucenter/userinfo/userinfo", "/pages/ucenter/userinfo/userinfo",
"/uni_modules/uni-news-favorite/pages/uni-news-favorite/list", "/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"], "login": ["smsCode","univerify", "username", "weixin", "apple"],
/* /*
......
{ {
"passwordSecret": "passwordSecret-demo", "passwordSecret": "passwordSecret-demo",
"tokenSecret": "tokenSecret-demo", "tokenSecret": "tokenSecret-demo",
"tokenExpiresIn": 7200, "tokenExpiresIn": 7200,
"tokenExpiresThreshold": 600, "tokenExpiresThreshold": 600,
"passwordErrorLimit": 6, "passwordErrorLimit": 6,
"bindTokenToDevice": true, "bindTokenToDevice": true,
"passwordErrorRetryTime": 3600, "passwordErrorRetryTime": 3600,
"autoSetInviteCode": false, "autoSetInviteCode": false,
"forceInviteCode": false, "forceInviteCode": false,
"app-plus": { "app-plus": {
"tokenExpiresIn": 2592000, "tokenExpiresIn": 2592000,
"oauth": { "oauth": {
"weixin": { "weixin": {
"appid": "", "appid": "wxffdd8fa6ec4ef2a0",
"appsecret": "" "appsecret": "6c9119430d7be0a147bcbbb73ef33acf"
}, },
"apple": { "apple": {
"bundleId": "" "bundleId": "io.dcloud.hellouniapp"
} }
} }
}, },
"mp-weixin": { "mp-weixin": {
"oauth": { "oauth": {
"weixin": { "weixin": {
"appid": "", "appid": "wx81dbb061d2258234",
"appsecret": "" "appsecret": "73be6e8b8b31b7b0783fe448cc1fe820"
} }
} }
}, },
"mp-alipay": { "mp-alipay": {
"oauth": { "oauth": {
"alipay": { "alipay": {
"appid": "alipay appid", "appid": "alipay appid",
"privateKey": "alipay privateKey" "privateKey": "alipay privateKey"
} }
} }
}, },
"service": { "service": {
"sms": { "sms": {
"name": "DCloud", "name": "DCloud",
"codeExpiresIn": 300, "codeExpiresIn": 300,
"smsKey": "", "smsKey": "71a19f38c954f7d768d68a050486bf15",
"smsSecret": "" "smsSecret": "d6c424b702d73baa3b6e1a1452469213"
}, },
"univerify": { "univerify": {
"appid": "", "appid": "__UNI__03B096E",
"apiKey": "", "apiKey": "3fc28519d90d74173bcecf2daf4ffcc4",
"apiSecret": "" "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.
先完成此消息的编辑!
想要评论请 注册