blob: 1f1a6bb11d970b38bc98e378918e8c0f8345cf27 [file] [log] [blame]
import Vue from 'vue'
import App from './App'
Vue.config.productionTip = false
App.mpType = 'app'
// 引入全局uView
import uView from 'uview-ui'
Vue.use(uView)
// 此处为演示vuex使用,非uView的功能部分
import store from '@/store'
// 引入uView提供的对vuex的简写法文件
let vuexStore = require('@/store/$u.mixin.js')
Vue.mixin(vuexStore)
// #ifndef H5
var value = ""
uni.getScreenBrightness({
success: function(res) {
value = res.value
}
});
Vue.prototype.changeTabbar = function(e) {
// #ifdef APP-PLUS
uni.removeStorageSync("stopShowTwice")
// #endif
if (e == 2) {
uni.setScreenBrightness({
value: 1,
success: function() {}
});
} else {
uni.setScreenBrightness({
value: value,
success: function() {}
});
}
}
// #endif
// #ifdef H5
Vue.prototype.changeTabbar = function(e) {
// console.log(e)
}
// #endif
//全局页面跳转
Vue.prototype.toPath = function(e) {
let token = uni.getStorageSync("token")
if (!token) {
uni.showModal({
title: "提示",
content: "您还未登录,无法使用app功能",
cancelText: "再等等",
confirmText: "去登陆",
success(res) {
if (res.confirm) {
uni.reLaunch({
url: '/pages/sub_basic/login/index'
})
}
}
})
return false
}
if (!e) {
uni.showToast({
icon: "none",
title: "功能暂未开通",
duration: 1500,
})
return false
}
if (e == "/pages/sub_tabbar/active" || e == "/pages/sub_tabbar/index") {
uni.switchTab({
url: e
})
return false
}
uni.navigateTo({
url: e
})
}
Vue.prototype.toUrl = function(e) {
if (e == "/pages/sub_tabbar/active" || e == "/pages/sub_tabbar/index") {
uni.switchTab({
url: e
})
return false
}
uni.navigateTo({
url: e
})
}
const app = new Vue({
store,
...App
})
// http拦截器,此为需要加入的内容,如果不是写在common目录,请自行修改引入路径
import httpInterceptor from '@/static/js/http.interceptor.js'
// 这里需要写在最后,是为了等Vue创建对象完成,引入"app"对象(也即页面的"this"实例)
Vue.use(httpInterceptor, app)
//http接口API集中管理引入部分
// import httpApi from '@/static/js/http.api.js'
// Vue.use(httpApi, app)
app.$mount()