diff --git a/App.vue b/App.vue
index 4c4f50c12783b0b7ece4038847ee4cf8c4a80a67..ee9513aacc4073e2760b7d184230c99b56afb0c2 100644
--- a/App.vue
+++ b/App.vue
@@ -8,24 +8,31 @@
onLaunch: function() {
console.log('App Launch')
initApp();
+ //预加载设置页面
+ uni.preloadPage({
+ url: "/pages/ucenter/settings/settings",
+ complete:e=>{
+ console.log(e);
+ }
+ });
// #ifdef APP-PLUS
//预加载一键登录
- // plus.oauth.getServices(oauthServices=>{
- // oauthServices.forEach(({_id},item)=>{
- // if(_id=='provider'){
- // uni.preLogin({
- // provider:item,
- // complete:e=>{
- // console.log(e);
- // }
- // })
- // }
- // })
-
- // uni.preloadPage({url: "/uni_modules/uni-login-page/pages/index/index"});
- // },err=>{
- // console.error('获取服务供应商失败:' + JSON.stringify(err));
- // })
+ plus.oauth.getServices(oauthServices=>{
+ console.log(oauthServices);
+ oauthServices.forEach(({_id},item)=>{
+ if(_id=='provider'){
+ uni.preLogin({
+ provider:item,
+ complete:e=>{
+ console.log(e);
+ }
+ })
+ }
+ })
+ uni.preloadPage({url: "/uni_modules/uni-login-page/pages/index/index"});
+ },err=>{
+ console.error('获取服务供应商失败:' + JSON.stringify(err));
+ })
// #endif
},
onShow: function() {
diff --git a/baseapp.config.json b/baseapp.config.json
index afac6d82dcd76a349817ac45bd1f42bbe17a81e3..980a5983c0d91bc6e82718bc06d288db403ad24d 100644
--- a/baseapp.config.json
+++ b/baseapp.config.json
@@ -5,13 +5,19 @@
"/uni_modules/uni-login-page/pages/index/pwd-retrieve"
]
},
- "aboutus":{
+ "about":{
"appName":"base-app",
"company":"数字天堂(北京)网络技术有限公司",
"slogan":"为开发而生",
- "agreement":{
- "privacy":"https://uniapp.dcloud.io/",
- "business":"https://uniapp.dcloud.io/"
- }
+ "agreements":[
+ {
+ "title":"用户服务协议",
+ "url":"https://uniapp.dcloud.io/"
+ },
+ {
+ "title":"隐私政策",
+ "url":"https://uniapp.dcloud.io/"
+ }
+ ]
}
}
\ No newline at end of file
diff --git a/common/appInit.js b/common/appInit.js
index af310b359a509700b8d122e3ec9cfe7fb1eae82d..6d3b1270982ce0835a53429656f43296bf6234b7 100644
--- a/common/appInit.js
+++ b/common/appInit.js
@@ -10,21 +10,46 @@ export default function() {
//自定义路由拦截
const {"router":{needLogin}} = baseappConfig //需要登陆的页面
- changeAction(["navigateTo", "redirectTo", "reLaunch", "switchTab"], {
- before_action: e => {
- let token = uni.getStorageSync('uni-id-token')
- if (needLogin.includes(e.url) && token == '') {
- console.log('该页面需要登陆,即将跳转到login页面');
- uni.showToast({title:'该页面需要登陆,即将跳转到login页面',icon:'none'})
- uni.redirectTo({
- url:"/uni_modules/uni-login-page/pages/index/index"
- })
- return false
+
+ // changeAction(["navigateTo", "redirectTo", "reLaunch", "switchTab"], {
+ // before_action: e => {
+ // let token = uni.getStorageSync('uni-id-token')
+ // let url = e.url.split('?')[0]
+ // if (needLogin.includes(url) && token == '') {
+ // console.log('该页面需要登陆,即将跳转到login页面');
+ // uni.showToast({title:'该页面需要登陆,即将跳转到login页面',icon:'none'})
+ // uni.navigateTo({
+ // url:"/uni_modules/uni-login-page/pages/index/index"
+ // })
+ // return false
+ // }
+ // return true
+ // }
+ // })
+
+ //uni.addInterceptor的写法
+
+ let list = ["navigateTo", "redirectTo", "reLaunch", "switchTab"];
+ list.forEach(item=>{
+ uni.addInterceptor(item,{
+ invoke(e){// 调用前拦截
+ //console.log(e);
+ let token = uni.getStorageSync('uni-id-token')
+ let url = e.url.split('?')[0]
+ if (needLogin.includes(url) && token == '') {
+ console.log('该页面需要登陆,即将跳转到login页面');
+ uni.showToast({title:'该页面需要登陆,即将跳转到login页面',icon:'none'})
+ uni.navigateTo({
+ url:"/uni_modules/uni-login-page/pages/index/index"
+ })
+ return false
+ }
+ return true
}
- return true
- }
+ })
})
+
//提示网络变化
eventListenerNetwork()
@@ -128,7 +153,7 @@ function changeAction(actions, {before_action,after_action}) {
let old_action = uni[action]
uni[action] = e => {
if (before_action(e)) {
- console.log(after_action);
+ // console.log(after_action);
if (after_action) {
var compose = function(f, g) {
return function(x) {
diff --git a/js_sdk/request.js b/js_sdk/request.js
index 0f71c30cb8958072feeaf051c6bd52462c939892..244d9b2fcd63f2b64bbd48a9ce89496b155ed6ee 100644
--- a/js_sdk/request.js
+++ b/js_sdk/request.js
@@ -28,12 +28,24 @@ export default function request(name,params,callback=false,{showLoading=false,lo
resolve(e)
return callback(data,e.result,e)
}
- debug? uni.showModal({content: JSON.stringify(e)}) :'';
+ if(debug){
+ uni.showModal({
+ content: JSON.stringify(e),
+ showCancel: false,
+ confirmText: '知道了'
+ })
+ }
},
fail(err){
reject(err)
console.log(err);
- debug? uni.showModal({content: JSON.stringify(err)}) :'';
+ if(debug){
+ uni.showModal({
+ content: JSON.stringify(err),
+ showCancel: false,
+ confirmText: '知道了'
+ })
+ }
fail(err)
}
})
diff --git a/pages.json b/pages.json
index cb3914c5e1e700fe936b0d4c2311d4681e12c7c8..4a3f1c6e2e4ce76d3dfd0d51e6cac375690cc5e0 100644
--- a/pages.json
+++ b/pages.json
@@ -19,19 +19,19 @@
}
}, {
"path": "uni_modules/uni-login-page/pages/index/index",
- "style": {
+ "style": {
"navigationBarTitleText": "",
"app-plus": {
"animationType": "none",
- "popGesture": "none",
- "titleNView": {
- "buttons": [{
- "text": "帮助",
- "type": "none",
- "fontSize": "16px",
- "width": "60px"
- }]
- }
+ "popGesture": "none"
+ // "titleNView": {
+ // "buttons": [{
+ // "text": "帮助",
+ // "type": "none",
+ // "fontSize": "16px",
+ // "width": "60px"
+ // }]
+ // }
}
}
}, {
@@ -139,14 +139,14 @@
"style": {
"navigationBarTitleText": "",
"app-plus": {
- "titleNView": {
- "buttons": [{
- "text": "帮助",
- "type": "none",
- "fontSize": "16px",
- "width": "60px"
- }]
- }
+ // "titleNView": {
+ // "buttons": [{
+ // "text": "帮助",
+ // "type": "none",
+ // "fontSize": "16px",
+ // "width": "60px"
+ // }]
+ // }
}
}
}, {
@@ -154,14 +154,14 @@
"style": {
"navigationBarTitleText": "",
"app-plus": {
- "titleNView": {
- "buttons": [{
- "text": "帮助",
- "type": "none",
- "fontSize": "16px",
- "width": "60px"
- }]
- }
+ // "titleNView": {
+ // "buttons": [{
+ // "text": "帮助",
+ // "type": "none",
+ // "fontSize": "16px",
+ // "width": "60px"
+ // }]
+ // }
}
}
}, {
@@ -169,14 +169,14 @@
"style": {
"navigationBarTitleText": "",
"app-plus": {
- "titleNView": {
- "buttons": [{
- "text": "帮助",
- "type": "none",
- "fontSize": "16px",
- "width": "60px"
- }]
- }
+ // "titleNView": {
+ // "buttons": [{
+ // "text": "帮助",
+ // "type": "none",
+ // "fontSize": "16px",
+ // "width": "60px"
+ // }]
+ // }
}
}
diff --git a/pages/test/test.vue b/pages/test/test.vue
index f84fe7e0531ef973660747a62280c8986d3421d9..1c253787341baf798e264f4b6db904b16ccf88df 100644
--- a/pages/test/test.vue
+++ b/pages/test/test.vue
@@ -21,7 +21,27 @@
}
},
- onLoad() {
+ onLoad() {
+ uni.addInterceptor('showToast',{
+ invoke(e){// 调用前拦截
+ console.log(e)
+ e.title = "645"
+ },
+ success(e){// 成功回调拦截
+ console.log(e)
+ },
+ fail(e){// 失败回调拦截
+ console.log(e)
+ },
+ complete(e){
+ console.log(e)
+ },
+ returnValue(e){// 返回结果拦截
+ console.log(e)
+ }
+ })
+
+ return
/*
当某个权限调用失败
1.先检测手机的该模块是否打开
diff --git a/pages/ucenter/about/about.vue b/pages/ucenter/about/about.vue
index eea75a8349a532fa441e58115b6f66e720254053..878761b5c188b856a9d0fc31ecfbbb638e8ed3bf 100644
--- a/pages/ucenter/about/about.vue
+++ b/pages/ucenter/about/about.vue
@@ -1,16 +1,17 @@
-
+
- {{aboutus.appName}}
+ {{about.appName}}
Version {{version}}
- 《用户服务协议》
- 和
- 《隐私政策》
+
+ 《{{agreement.title}}》
+ 和
+
Copyright © {{year}}
- {{aboutus.company}}
+ {{about.company}}
@@ -26,15 +27,15 @@ import baseappConfig from '@/baseapp.config.json';
return {
version:"V1.0.0",
year:"2020",
- aboutus:{}
+ about:{}
};
},
created() {
- this.aboutus = baseappConfig.aboutus
+ this.about = baseappConfig.about
this.year = (new Date).getFullYear()
},
methods:{
- navigateTo(url,title){
+ navigateTo({url,title}){
uni.navigateTo({
url: '/pages/common/webview/webview?url='+url+'&title='+title,
success: res => {},
@@ -46,7 +47,7 @@ import baseappConfig from '@/baseapp.config.json';
}
diff --git a/pages/ucenter/settings/settings.vue b/pages/ucenter/settings/settings.vue
index 393248a8d79363666ac9eef5f3415c181257b77b..0e42d0448e0c753981daf4f02fb4204b05072e0e 100644
--- a/pages/ucenter/settings/settings.vue
+++ b/pages/ucenter/settings/settings.vue
@@ -15,14 +15,8 @@