12345678910111213141516171819202122232425262728293031323334353637 |
- import Vue from 'vue'
- import App from './App'
- import { config } from './config/config'
- import store from './store'
- import Request from '@/js_sdk/luch-request/luch-request/index.js';
- const http = new Request();
- import './utils/filter'
- Vue.config.productionTip = false
- //栏目标题设置
- const setNavbarTitle = (title,defaultTitle) => {
- uni.setNavigationBarTitle({
- title:title || defaultTitle
- })
- }
- //封装全局登录检查函数:backpage为登录后返回的页面;backtype为打开页面的类型[1 : redirectTo 2 : switchTab]
- //3种页面跳转方式:NavigationTo(直接打开新页面),RedirectTo(覆盖原页面后打开新页面),SwitchTo(切换顶部导航的方式来切换页面)
- Vue.prototype.checkLogin = function(backpage, backtype){
- var TOKEN = uni.getStorageSync('token');//本地持久化存储
- if(TOKEN == ''){
- uni.redirectTo({url:'/page/login/login?backpage='+backpage+'&backtype='+backtype});
- return false;
- }
- return [TOKEN];//已经登录返回数组TOKEN等用户信息
- }
- Vue.prototype.$api = {http,setNavbarTitle}
- Vue.prototype.$store = store
- Vue.prototype.config = config
- App.mpType = 'app'
- const app = new Vue({
- ...App
- })
- app.$mount()
|