init project
This commit is contained in:
50
App.vue
Normal file
50
App.vue
Normal file
@@ -0,0 +1,50 @@
|
||||
<script>
|
||||
import config from './config'
|
||||
import store from '@/store'
|
||||
import {
|
||||
getToken
|
||||
} from '@/utils/auth'
|
||||
|
||||
export default {
|
||||
onLaunch: function() {
|
||||
this.initApp()
|
||||
},
|
||||
methods: {
|
||||
// 初始化应用
|
||||
initApp() {
|
||||
// 初始化应用配置
|
||||
this.initConfig()
|
||||
// 检查用户登录状态
|
||||
//#ifdef H5
|
||||
this.checkLogin()
|
||||
//#endif
|
||||
},
|
||||
initConfig() {
|
||||
this.globalData.config = config;
|
||||
if (!uni.getStorageSync("base_url")) {
|
||||
uni.setStorage({
|
||||
key: 'base_url',
|
||||
data: config.baseUrl
|
||||
})
|
||||
}
|
||||
if (!uni.getStorageSync("wms_url")) {
|
||||
uni.setStorage({
|
||||
key: 'wms_url',
|
||||
data: config.wmsUrl
|
||||
})
|
||||
}
|
||||
},
|
||||
checkLogin() {
|
||||
if (!getToken()) {
|
||||
console.log(4);
|
||||
this.$tab.reLaunch('/pages/login')
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
@import "@/static/scss/index.scss";
|
||||
@import "@/static/iconfont.css";
|
||||
</style>
|
||||
Reference in New Issue
Block a user