diff --git a/baseapp.config.json b/baseapp.config.json index 45313a9da3238d3ee90bfb9b9deaef74431edab0..afac6d82dcd76a349817ac45bd1f42bbe17a81e3 100644 --- a/baseapp.config.json +++ b/baseapp.config.json @@ -1,7 +1,17 @@ { "router":{ "needLogin":[ - "/pages/grid/grid" + "/pages/ucenter/edit/edit", + "/uni_modules/uni-login-page/pages/index/pwd-retrieve" ] + }, + "aboutus":{ + "appName":"base-app", + "company":"数字天堂(北京)网络技术有限公司", + "slogan":"为开发而生", + "agreement":{ + "privacy":"https://uniapp.dcloud.io/", + "business":"https://uniapp.dcloud.io/" + } } } \ No newline at end of file diff --git a/common/appInit.js b/common/appInit.js index 01b7a426f194b31b89ac6a706c4b168154f7ebef..af310b359a509700b8d122e3ec9cfe7fb1eae82d 100644 --- a/common/appInit.js +++ b/common/appInit.js @@ -1,3 +1,4 @@ +import baseappConfig from '@/baseapp.config.json'; // #ifdef APP-PLUS import checkUpdate from '@/uni_modules/uni-upgrade-center-app/utils/check-update'; import callCheckVersion from '@/uni_modules/uni-upgrade-center-app/utils/call-check-version'; @@ -8,11 +9,50 @@ export default function() { initAppVersion(); //自定义路由拦截 - setRouter() + 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 + } + return true + } + }) //提示网络变化 eventListenerNetwork() - + + + /* + 当某个权限调用失败 + 1.先检测手机的该模块是否打开 + 2.检测当前应用是否被授权了该模块对应的权限 + 提示,并点击跳转到设置 + */ + // #ifndef H5 + // changeAction('chooseImage', { + // after_action: e => { + // console.log('changeAction', e); + // if(e.errCode === 11){ + // uni.showModal({ + // content: '无权限', + // confirmText:"前往设置", + // success(e) { + // if(e.confirm){ + // permision.gotoAppPermissionSetting() + // } + // } + // }); + // } + // } + // }) + // #endif } /** * // 初始化appVersion @@ -46,41 +86,6 @@ function initAppVersion() { checkUpdate(); // #endif } - -//用于拦截路由 -import baseappConfig from '@/baseapp.config.json'; -console.log('baseappConfig',baseappConfig); -const {"router":{needLogin}} = baseappConfig //需要登陆的页面 -function setRouter() { - let before_action = e => { - let res = true - let token = uni.getStorageSync('uni-id-token') - if (needLogin.includes(e.url) && token == '') { - res = false - console.log('该页面需要登陆,即将跳转到login页面'); - } - return res - } - - let before_after = e => { - console.log('跳转之后'); - } - - let actions = ["navigateTo", "redirectTo", "reLaunch", "switchTab"] - actions.forEach(action => { - let old_action = uni[action] - uni[action] = e => { - //console.log(e); - if (before_action(e)) { - old_action(e) - before_after(e) - } - } - }) - uni.reLaunch({ - url: '/pages/grid/grid' - }) -} // 设备网络状态变化事件 function eventListenerNetwork () { @@ -109,4 +114,31 @@ function eventListenerNetwork () { }); } }); +} + + +function changeAction(actions, {before_action,after_action}) { + if(typeof actions == 'string'){ + actions = [actions] + } + if (!before_action) { + before_action = () => true + } + actions.forEach(action=>{ + let old_action = uni[action] + uni[action] = e => { + if (before_action(e)) { + console.log(after_action); + if (after_action) { + var compose = function(f, g) { + return function(x) { + return f(x,g(x)); + }; + }; + e.complete = compose(e.complete,after_action) + } + old_action(e) + } + } + }) } \ No newline at end of file diff --git a/js_sdk/request.js b/js_sdk/request.js index 76f234f333be4940f58e75e9b6897bcbcdc92c98..0f71c30cb8958072feeaf051c6bd52462c939892 100644 --- a/js_sdk/request.js +++ b/js_sdk/request.js @@ -7,7 +7,7 @@ */ const debug = true;//开启后,会alert错误信息 export default function request(name,params,callback=false,{showLoading=false,loadText='',fail=()=>{}}={}){ - console.log('request'); + // console.log('request'); showLoading||loadText? uni.showLoading({title:loadText}):''; let routers = name.split('/'); @@ -16,7 +16,7 @@ export default function request(name,params,callback=false,{showLoading=false,lo name = routers[0] action = routers[1] } - // console.log({name,data: {action,params}}) + console.log({name,data: {action,params}}) return new Promise((resolve,reject)=>{ uniCloud.callFunction({name,data: {action,params}, success(e){ diff --git a/manifest.json b/manifest.json index 1945b7e43b88a9be16fb993f7d916efbb03ffd98..c8870f2086a6c22fac85d05e0bfb7739da83b761 100644 --- a/manifest.json +++ b/manifest.json @@ -18,27 +18,32 @@ }, /* 模块配置 */ "modules" : { - "OAuth" : {} + "OAuth" : {}, + "Fingerprint" : {}, + "Share" : {}, + "Push" : {} }, /* 应用发布信息 */ "distribute" : { /* android打包配置 */ "android" : { "permissions" : [ - "", - "", - "", - "", - "", + "", "", "", + "", "", + "", + "", + "", "", + "", + "", + "", "", - "", + "", + "", "", - "", - "", "" ] }, @@ -54,7 +59,17 @@ "UniversalLinks" : "" } }, - "ad" : {} + "ad" : {}, + "share" : { + "weixin" : { + "appid" : "wxffdd8fa6ec4ef2a0", + "UniversalLinks" : "" + } + }, + "geolocation" : {}, + "push" : { + "unipush" : {} + } } } }, diff --git a/pages.json b/pages.json index 95c7b599576d910c9c9f0339fb7f8faba66177c8..cb3914c5e1e700fe936b0d4c2311d4681e12c7c8 100644 --- a/pages.json +++ b/pages.json @@ -188,15 +188,24 @@ } } - ,{ - "path" : "pages/test/test", - "style" : - { - "navigationBarTitleText": "", - "enablePullDownRefresh": false - } - - } + ,{ + "path" : "pages/test/test", + "style" : + { + "navigationBarTitleText": "", + "enablePullDownRefresh": false + } + + } + ,{ + "path" : "pages/common/webview/webview", + "style" : + { + "navigationBarTitleText": "", + "enablePullDownRefresh": false + } + + } ], "globalStyle": { "navigationBarTextStyle": "black", diff --git a/pages/common/webview/webview.vue b/pages/common/webview/webview.vue new file mode 100644 index 0000000000000000000000000000000000000000..d0bf9fa4a90717fee4c71dab870b6807c0fdd856 --- /dev/null +++ b/pages/common/webview/webview.vue @@ -0,0 +1,26 @@ + + + + + diff --git a/pages/ucenter/about/about.vue b/pages/ucenter/about/about.vue index 76e95d33bca2aaeb5b79dcd75e7375170a809021..eea75a8349a532fa441e58115b6f66e720254053 100644 --- a/pages/ucenter/about/about.vue +++ b/pages/ucenter/about/about.vue @@ -1,221 +1,92 @@ - - - + \ No newline at end of file diff --git a/pages/ucenter/edit/edit.nvue b/pages/ucenter/edit/edit.vue similarity index 97% rename from pages/ucenter/edit/edit.nvue rename to pages/ucenter/edit/edit.vue index 90d557ff135a22604bb13170ec9df33b3221e9e3..e54d416f66ae31f06b2191f362a332b6e842884a 100644 --- a/pages/ucenter/edit/edit.nvue +++ b/pages/ucenter/edit/edit.vue @@ -104,8 +104,6 @@ width: 150rpx; height: 150rpx; border-radius: 75rpx; - - border-width: 1rpx; - border-color: #999999; + border: #F8F8F8 solid 1px; } diff --git a/pages/ucenter/settings/settings.vue b/pages/ucenter/settings/settings.vue index b223296810ae53bdec4fc7ec65768bdb52aa7e68..393248a8d79363666ac9eef5f3415c181257b77b 100644 --- a/pages/ucenter/settings/settings.vue +++ b/pages/ucenter/settings/settings.vue @@ -2,12 +2,15 @@ - + :link="!item.showSwitch"> - - + + @@ -68,22 +71,24 @@ logout: 'user/logout' }), toEdit(){ - uni.navigateTo({ - url: '../edit/edit' + url: '/pages/ucenter/edit/edit' }); }, changePwd(){ - if(this.userInfo){ - uni.navigateTo({ - url:'/uni_modules/uni-login-page/pages/index/pwd-retrieve?phoneNumber='+ (this.userInfo.phone||'') +'&phoneArea=+86' - }); - } else { - uni.showToast({ - title: '请先登录', - icon: 'none' - }); - } + uni.navigateTo({ + url:'/uni_modules/uni-login-page/pages/index/pwd-retrieve?phoneNumber='+ (this.userInfo.phone||'') +'&phoneArea=+86' + }); + // if(this.userInfo){ + // uni.navigateTo({ + // url:'/uni_modules/uni-login-page/pages/index/pwd-retrieve?phoneNumber='+ (this.userInfo.phone||'') +'&phoneArea=+86' + // }); + // } else { + // uni.showToast({ + // title: '请先登录', + // icon: 'none' + // }); + // } }, checkPush(){ // 手机端获取推送是否开启 @@ -186,21 +191,26 @@ }) }, clickLogout() { - - uni.showModal({ - title: '提示', - content: '是否退出登录', - cancelText: '取消', - confirmText: '确定', - success: res => { - if(res.confirm){ - this.logout(); - uni.navigateBack(); - } - }, - fail: () => {}, - complete: () => {} - }); + if(this.userInfo){ + uni.showModal({ + title: '提示', + content: '是否退出登录', + cancelText: '取消', + confirmText: '确定', + success: res => { + if(res.confirm){ + this.logout(); + uni.navigateBack(); + } + }, + fail: () => {}, + complete: () => {} + }); + }else{ + uni.navigateTo({ + url: '/uni_modules/uni-login-page/pages/index/index' + }); + } }, itemClick(item) { if (!item.to && item.event) { @@ -252,11 +262,12 @@ border: none; /* #endif */ border-width: 0; - border-radius: 0; + border-radius: 0; + background-color: #007AFF; } .bottom-back-text { font-size: 40rpx; - color: #DD524D; + color: #FFFFFF; } diff --git a/pages/ucenter/ucenter.vue b/pages/ucenter/ucenter.vue index 9c048cc18a1db94fa88d6d1c72822b12e441ecb7..7885ee7d6aa37279c5e52487609b0a8da3aca465 100644 --- a/pages/ucenter/ucenter.vue +++ b/pages/ucenter/ucenter.vue @@ -1,12 +1,12 @@