|
@@ -1,5 +1,8 @@
|
|
|
<template>
|
|
|
- <div id='app'>
|
|
|
+ <!-- ios头部padding适配 -->
|
|
|
+ <div id='app' :class='isIOS?"ios-padding":""'>
|
|
|
+ <!-- 顶部navbar -->
|
|
|
+ <NarBar class='nav-bar' />
|
|
|
<keep-alive>
|
|
|
<router-view v-if='$route.meta.keepAlive' />
|
|
|
</keep-alive>
|
|
@@ -18,9 +21,12 @@ import Vue from 'vue'
|
|
|
import { Tabbar, TabbarItem } from 'vant'
|
|
|
Vue.use(Tabbar).use(TabbarItem)
|
|
|
import store from './store/index'
|
|
|
+import NarBar from './components/Navbar'
|
|
|
+import { osInfo } from './utils/util'
|
|
|
export default {
|
|
|
name: 'App',
|
|
|
props: {},
|
|
|
+ components: { NarBar },
|
|
|
data() {
|
|
|
return {
|
|
|
active: 0,
|
|
@@ -31,24 +37,49 @@ export default {
|
|
|
2: 'EquipmentFacilities',
|
|
|
3: 'OtherMatter',
|
|
|
},
|
|
|
+ // appTitle字典
|
|
|
+ titleDict: {
|
|
|
+ 0: '管理说明书',
|
|
|
+ 1: '楼层功能',
|
|
|
+ 2: '设备设施',
|
|
|
+ 3: '其他事项',
|
|
|
+ },
|
|
|
+ isIOS: false, //是否是IOS
|
|
|
}
|
|
|
},
|
|
|
- components: {},
|
|
|
beforeMount() {},
|
|
|
created() {
|
|
|
- store.commit('SETSSOTOKEN','admin:1231')
|
|
|
+ store.commit('SETSSOTOKEN', 'admin:liujiandong')
|
|
|
+ console.log(window.location.href)
|
|
|
+ const { os } = osInfo()
|
|
|
+ if (os === 'iOS') {
|
|
|
+ this.isIOS = true
|
|
|
+ } else {
|
|
|
+ this.isIOS = false
|
|
|
+ }
|
|
|
},
|
|
|
mounted() {
|
|
|
- console.log(process.env)
|
|
|
+ console.log('环境变量', process.env.VUE_APP_RealEnv)
|
|
|
},
|
|
|
methods: {
|
|
|
+ // 路由更改
|
|
|
changeTabbar(active) {
|
|
|
console.log(active)
|
|
|
this.$router.push({ name: this.routeDict[active] })
|
|
|
+ store.commit('SETAPPTITLE', this.titleDict[active])
|
|
|
},
|
|
|
},
|
|
|
}
|
|
|
</script>
|
|
|
<style lang="less">
|
|
|
@import './style/common.less';
|
|
|
+.ios-padding {
|
|
|
+ padding-top: 15px;
|
|
|
+ box-sizing: border-box;
|
|
|
+}
|
|
|
+// navbar高度
|
|
|
+.nav-bar {
|
|
|
+ width: 100%;
|
|
|
+ height: 50px;
|
|
|
+}
|
|
|
</style>
|