| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556 |
- /*
- * 全局注入器
- */
- let page = {
- data() {
- return {
- }
- },
- computed: {
- //ios底部安全区域
- safeAreaBottom() {
- let info = uni.getSystemInfoSync()
- let safe = 20
- if (
- info && ['devtools', 'ios'].includes(info.platform) &&
- info.statusBarHeight > safe
- ) {
- return info.statusBarHeight - safe + 'px'
- }
- return 0
- }
- },
- methods: {
- },
- onLoad(options) {
- let currentPage = this.$util.getCurrentRoute()
- //全局登录拦截
- let WHiTE_LIST = ['pages/login/login',
- 'pages/login/forget',
- 'pages/login/account-login',
- 'pages/test/test',
- ]
- if (!WHiTE_LIST.includes(currentPage)) {
- if (!this.$cache.get('phone')) {
- uni.reLaunch({
- url: "/pages/login/login"
- })
- return
- }
- }
- //判断商场id是否为空
- WHiTE_LIST.push('pages/index/index')
- if (!WHiTE_LIST.includes(currentPage)) {
- if (!this.vuex_mallId) {
- uni.reLaunch({
- url:"/pages/index/index"
- })
- return
- }
- }
- }
- }
- export default page
|