فهرست منبع

修复项目名称

ZaiZai 1 سال پیش
والد
کامیت
f75ac940f7
5فایلهای تغییر یافته به همراه38 افزوده شده و 5 حذف شده
  1. 1 1
      public/version.json
  2. 1 1
      src/config/index.json
  3. 6 0
      src/store/index.js
  4. 3 1
      src/views/home/auth.vue
  5. 27 2
      src/views/home/datav.vue

+ 1 - 1
public/version.json

@@ -1,3 +1,3 @@
 {
-  "value": "20240228102016"
+  "value": "20240228102536"
 }

+ 1 - 1
src/config/index.json

@@ -1,6 +1,6 @@
 {
     "version": "202304141558",
-    "target": "http://39.108.216.210:8090",
+    "target": "http://192.168.0.109:8090",
     "smsPhone": "",
     "vite": {
         "port": 5175,

+ 6 - 0
src/store/index.js

@@ -37,6 +37,7 @@ export const useAppStore = defineStore('main', {
         orderServiceTipModal: getStoreValue('orderServiceTipModal') ?? 1, //0不弹出,1弹出
         isCollapse: getStoreValue('isCollapse') || false, //菜单折叠
         isDatavTour: getStoreValue('isDatavTour') || 0, //datav引导,0开启,1关闭
+        isDatavBg: getStoreValue('isDatavBg') || true, //datav背景
         isScreenShort: false,
         barMenuName: '',
     }),
@@ -179,6 +180,10 @@ export const useAppStore = defineStore('main', {
             this.isDatavTour = value
             setStoreValue('isDatavTour', value)
         },
+        setIsDatavBg(value) {
+            this.isDatavBg = value
+            setStoreValue('isDatavBg', value)
+        },
         //清除缓存和token
         clearStoreData() {
             //清除状态
@@ -200,6 +205,7 @@ export const useAppStore = defineStore('main', {
             this.orderServiceTipModal = null
             this.isCollapse = false
             this.isDatavTour = 0
+            this.isDatavBg = false
             //清除缓存
             clearStoreAll()
             removeToken()

+ 3 - 1
src/views/home/auth.vue

@@ -38,13 +38,14 @@ const isErrorShow = ref(false)
 //渲染完成
 onMounted(() => {
     // http://档案的域名/#/auth-token?token=xxx&tid=xxx&pid=xxx&cid=xxx
-    const { token, tid, pid, cid } = getObjValue(useRoutes.query)
+    const { token, tid, pid, cid, bg } = getObjValue(useRoutes.query)
     if (!isNullES(token)) {
         isErrorShow.value = false
         //缓存数据
         store.setTokenVal(token)
         store.setProjectId(pid)
         store.setContractId(cid)
+        store.setIsDatavBg(bg !== 'no')
         //处理授权登录
         setLoginByTokenData(token, tid)
     } else {
@@ -86,6 +87,7 @@ const loginByTokenApi = async (form) => {
         window.$message?.error('授权登录失败')
         isErrorShow.value = true
         loading.value = false
+        store.setIsDatavBg(true)
     }
 }
 

+ 27 - 2
src/views/home/datav.vue

@@ -1,6 +1,6 @@
 <template>
     <el-container v-loading="isLoading" class="hc-home-datav-box relative h-full w-full">
-        <div class="datav-bg">
+        <div class="datav-bg" v-if="isBgImg">
             <img :src="bgImg" alt="背景图片">
         </div>
         <el-header id="datav-header" class="relative p-0">
@@ -83,7 +83,7 @@
 
 <script setup>
 import { onMounted, onUnmounted, ref } from 'vue'
-import { useRouter } from 'vue-router'
+import {useRouter} from 'vue-router'
 import { useAppStore } from '~src/store'
 import { initProjectContract } from '~sto/app'
 import { userConfigSave } from '~api/other'
@@ -113,12 +113,28 @@ defineOptions({
     name: 'HcDataV',
 })
 
+const isBgImg = ref(store.isDatavBg)
+
 //渲染完成
 onMounted(() => {
     windowResize()
     setInitData()
+    isBgImg.value = store.isDatavBg
+    if (!isBgImg.value) {
+        setTimeout(() => {
+            setAppStyle()
+        }, 1000)
+    }
 })
 
+//设置样式
+const htmlClass = ref('')
+const setAppStyle = () => {
+    const appClass = document.documentElement.getAttribute('class')
+    htmlClass.value = appClass
+    document.documentElement.setAttribute('class', `${appClass} is-no-bg`)
+}
+
 //加载
 const isLoading = ref(false)
 const fullScreenRef = ref()
@@ -273,9 +289,18 @@ const fullScreenClick = () => {
 //被卸载
 onUnmounted(() => {
     window.removeEventListener('resize', resizeEvent)
+    if (htmlClass.value) {
+        document.documentElement.setAttribute('class', htmlClass.value)
+    }
 })
 </script>
 
 <style lang="scss">
 @import "~src/styles/view/datav.scss";
+html.is-no-bg {
+    background-color: transparent;
+    body, #app, .hc-home-datav-box {
+        background-color: transparent;
+    }
+}
 </style>