From 57405b69bbbf6485c52ba5214a1bb42f62a12b92 Mon Sep 17 00:00:00 2001
From: linju <8432241+linjuDcloud@user.noreply.gitee.com>
Date: Fri, 16 Apr 2021 17:08:24 +0800
Subject: [PATCH] 123
---
App.vue | 6 +++
baseapp.config.json | 6 ++-
common/appInit.js | 37 ++++++++++++++++---
manifest.json | 6 ++-
pages.json | 29 +++++++++------
pages/ucenter/ucenter.vue | 2 +-
.../uni-login-page/common/loginPage.css | 9 +----
.../pages/index/{index.vue => index.nvue} | 29 ++++++++-------
.../pages/upgrade-popup.vue | 7 ++--
9 files changed, 85 insertions(+), 46 deletions(-)
rename uni_modules/uni-login-page/pages/index/{index.vue => index.nvue} (84%)
diff --git a/App.vue b/App.vue
index ee9513aa..7f8aa297 100644
--- a/App.vue
+++ b/App.vue
@@ -15,6 +15,12 @@
console.log(e);
}
});
+ uni.preloadPage({
+ url: "uni_modules/uni-login-page/pages/index/index",
+ complete:e=>{
+ console.log(e);
+ }
+ });
// #ifdef APP-PLUS
//预加载一键登录
plus.oauth.getServices(oauthServices=>{
diff --git a/baseapp.config.json b/baseapp.config.json
index 980a5983..3f9d764d 100644
--- a/baseapp.config.json
+++ b/baseapp.config.json
@@ -3,7 +3,8 @@
"needLogin":[
"/pages/ucenter/edit/edit",
"/uni_modules/uni-login-page/pages/index/pwd-retrieve"
- ]
+ ],
+ "login":["univerify","password","weixin","apple","code"]
},
"about":{
"appName":"base-app",
@@ -18,6 +19,7 @@
"title":"隐私政策",
"url":"https://uniapp.dcloud.io/"
}
- ]
+ ],
+ "下载地址":""
}
}
\ No newline at end of file
diff --git a/common/appInit.js b/common/appInit.js
index 6d3b1270..fdcfeb54 100644
--- a/common/appInit.js
+++ b/common/appInit.js
@@ -9,7 +9,7 @@ export default function() {
initAppVersion();
//自定义路由拦截
- const {"router":{needLogin}} = baseappConfig //需要登陆的页面
+ const {"router":{needLogin,login}} = baseappConfig //需要登陆的页面
// changeAction(["navigateTo", "redirectTo", "reLaunch", "switchTab"], {
// before_action: e => {
@@ -33,9 +33,11 @@ export default function() {
list.forEach(item=>{
uni.addInterceptor(item,{
invoke(e){// 调用前拦截
- //console.log(e);
- let token = uni.getStorageSync('uni-id-token')
- let url = e.url.split('?')[0]
+ console.log(e);
+ const token = uni.getStorageSync('uni_id_token')
+ console.log(token);
+ const url = e.url.split('?')[0]
+ //拦截强制登陆页面
if (needLogin.includes(url) && token == '') {
console.log('该页面需要登陆,即将跳转到login页面');
uni.showToast({title:'该页面需要登陆,即将跳转到login页面',icon:'none'})
@@ -44,9 +46,34 @@ export default function() {
})
return false
}
+ //控制登陆优先级
+ if(url=='/uni_modules/uni-login-page/pages/index/index'){
+ //一键登录(univerify)、密码登陆(password)、快捷登录&验证码登陆(!univerify&password)
+ if(login[0]=='univerify'){
+ console.log(e.url,url);
+ if(e.url==url){ e.url+= '?' }
+ e.url += "univerify_first=true"
+ }else if(login[0]=='password'){
+ e.url = "/uni_modules/uni-login-page/pages/index/pwd-login"
+ }else{
+ //默认即是
+ }
+ }
return true
+ },
+ success(){ // 成功回调拦截
+
+ },
+ fail(){ // 失败回调拦截
+
+ },
+ complete(e){ // 完成回调拦截
+ console.log(e);
+ },
+ returnValue(){// 返回结果拦截
+
}
- })
+ })// 移除拦截器API removeInterceptor('request')
})
diff --git a/manifest.json b/manifest.json
index c8870f20..9ff5fc4c 100644
--- a/manifest.json
+++ b/manifest.json
@@ -57,7 +57,8 @@
"appid" : "wxffdd8fa6ec4ef2a0",
"appsecret" : "",
"UniversalLinks" : ""
- }
+ },
+ "apple" : {}
},
"ad" : {},
"share" : {
@@ -71,7 +72,8 @@
"unipush" : {}
}
}
- }
+ },
+ "nvueLaunchMode" : ""
},
/* 快应用特有相关 */
"quickapp" : {},
diff --git a/pages.json b/pages.json
index 4a3f1c6e..ddcc79b4 100644
--- a/pages.json
+++ b/pages.json
@@ -23,7 +23,9 @@
"navigationBarTitleText": "",
"app-plus": {
"animationType": "none",
- "popGesture": "none"
+ "popGesture": "none",
+ "navigationStyle": "custom",
+ "backgroundColor": "transparent"
// "titleNView": {
// "buttons": [{
// "text": "帮助",
@@ -213,17 +215,20 @@
"navigationBarBackgroundColor": "#FFFFFF",
"backgroundColor": "#F8F8F8"
},
- // "condition": {
- // "list": [
- // {
- // "path": "uni_modules/uni-login-page/pages/index/index"
- // },
- // {
- // "path": "pages/test/test"
- // }
- // ],
- // "current":0
- // },
+ "condition": {
+ "list": [
+ {
+ "path": "uni_modules/uni-login-page/pages/index/index"
+ },
+ {
+ "path": "pages/test/test"
+ },
+ {
+ "path":"pages/ucenter/settings/settings"
+ }
+ ],
+ "current":2
+ },
"tabBar": {
"color": "#7A7E83",
"selectedColor": "#007AFF",
diff --git a/pages/ucenter/ucenter.vue b/pages/ucenter/ucenter.vue
index ff579b65..7376e763 100644
--- a/pages/ucenter/ucenter.vue
+++ b/pages/ucenter/ucenter.vue
@@ -128,7 +128,7 @@
},
tapGrid(index) {
uni.showToast({
- title: '你点击了,第' + index + '个',
+ title: '你点击了,第' + (index+1) + '个',
icon: 'none'
});
}
diff --git a/uni_modules/uni-login-page/common/loginPage.css b/uni_modules/uni-login-page/common/loginPage.css
index 4ca73e86..1c11710e 100644
--- a/uni_modules/uni-login-page/common/loginPage.css
+++ b/uni_modules/uni-login-page/common/loginPage.css
@@ -33,20 +33,13 @@ page {
/* #endif */
width: 630rpx;
flex-direction: column;
-}
+}
.content-top-title {
font-size: 32rpx;
font-weight: 600;
padding-top: 50rpx;
-}
-
-/* #ifndef APP-NVUE */
-.hidden,
-page {
- background-color: transparent;
}
-/* #endif */
.login-iknow {
padding-top: 24rpx;
diff --git a/uni_modules/uni-login-page/pages/index/index.vue b/uni_modules/uni-login-page/pages/index/index.nvue
similarity index 84%
rename from uni_modules/uni-login-page/pages/index/index.vue
rename to uni_modules/uni-login-page/pages/index/index.nvue
index fa40d7d7..727e7285 100644
--- a/uni_modules/uni-login-page/pages/index/index.vue
+++ b/uni_modules/uni-login-page/pages/index/index.nvue
@@ -1,5 +1,6 @@
-
+
+
@@ -38,8 +39,8 @@
-