1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586 |
- <template>
- <div class="main">
- <router-view />
- <div class="footer"></div>
- </div>
- <van-tabbar v-model="tabType">
- <van-tabbar-item icon="home-o" to="/main/message">消息</van-tabbar-item>
- <van-tabbar-item icon="search" to="/main/working"
- >工作台</van-tabbar-item
- >
- <van-tabbar-item
- icon="friends-o"
- :to="tenantId == 'xmhjc' ? '/main/xiamenList' : '/main/equipment'"
- >物联网</van-tabbar-item
- >
- <van-tabbar-item icon="setting-o" to="/main/home">我的</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')
- //监听路由变化
- const router = useRouter()
- watch(router.currentRoute, (to, from) => {
- //滚动条回到顶部
- 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>
|