12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091 |
- <template>
- <div class="main">
- <router-view />
- <div class="footer"></div>
- </div>
- <van-tabbar v-model="tabType" v-if="routerName != '/main/processDtl'">
- <van-tabbar-item icon="home-o" to="/main/message">{{$t('common.message')}}</van-tabbar-item>
- <van-tabbar-item icon="search" to="/main/working"
- >{{$t('common.workbench')}}</van-tabbar-item
- >
- <van-tabbar-item
- icon="friends-o"
- :to="tenantId == 'smt' ? '/main/xiamenList' : '/main/equipment'"
- >{{$t('common.things')}}</van-tabbar-item
- >
- <van-tabbar-item icon="setting-o" to="/main/home">{{$t('common.mine')}}</van-tabbar-item>
- </van-tabbar>
- </template>
- <script setup>
- import { ref, getCurrentInstance, watch } from 'vue'
- import { getUserInfo } from '@/utils/auth'
- import { useRouter } from 'vue-router'
- import { lang } from '@/lang/cn'
- import * as dd from 'dingtalk-jsapi'
- import '@/assets/icon/iconfont.css'
- import 'vant/lib/index.css'
- import axios from 'axios'
- import { uploadDdRightBtn } from '@/utils/ddAdapter'
- const tenantId = getUserInfo().tenantId
- const proxy = getCurrentInstance().proxy
- const tabType = ref('home')
- //判断是否为开发环境.如果是开发环境,则同步前后台中文配置表
- // const isDev = process.env.NODE_ENV === 'development'
- // if (isDev) {
- // let networkLang = window.localStorage.getItem('lang')
- // if (networkLang || networkLang != JSON.stringify(lang)) {
- // try {
- // networkLang = JSON.parse(networkLang)
- // networkLang.app.cn = lang
- // proxy
- // .post('/open/multilingual/setJson', {
- // configValue: JSON.stringify(networkLang),
- // })
- // .then((res) => {})
- // } catch (error) {}
- // }
- // }
- const corpId = window.localStorage.getItem('corpId')
- let routerName = ref(null)
- //监听路由变化
- const router = useRouter()
- //获取当前path
- routerName.value = router.currentRoute.value.path
- watch(router.currentRoute, (to, from) => {
- routerName.value = to.path
- console.log('routerName', routerName.value)
- //滚动条回到顶部
- document.documentElement.scrollTop = 0
- if (!corpId) return
- dd.biz.navigation.setTitle({
- title: router.currentRoute.value.name,
- onSuccess: function (result) {},
- onFail: function (err) {},
- })
- //设置右侧按钮
- proxy.uploadDdRightBtn(function () {}, ' ')
- //获取元素的绑定事件
- setTimeout(() => {
- if (!corpId) {
- return
- }
- let el = document.getElementsByClassName('van-nav-bar__content')[0]
- if (el) {
- //删除el元素
- el.parentNode.removeChild(el)
- }
- }, 10)
- })
- </script>
- <style lang="scss">
- .main {
- position: fixed;
- top: 0;
- left: 0;
- right: 0;
- bottom: 50px;
- overflow-y: auto;
- }
- </style>
|