ZaiZai 6 months ago
parent
commit
bc2c5986dd
2 changed files with 31 additions and 7 deletions
  1. 1 1
      public/version.json
  2. 30 6
      src/layout/index.vue

+ 1 - 1
public/version.json

@@ -1,3 +1,3 @@
 {
-  "value": "20240821143956"
+  "value": "20240822110617"
 }

+ 30 - 6
src/layout/index.vue

@@ -1,5 +1,5 @@
 <template>
-    <el-container class="hc-layout-box" :class="[!isNullES(isLayout) && isLayout === 'no' ? 'is-no-layout' : '']">
+    <el-container v-loading="isLoading" class="hc-layout-box" :class="[!isNullES(isLayout) && isLayout === 'no' ? 'is-no-layout' : '']">
         <div v-if="appTheme === 'dark'" class="hc-app-bg-box">
             <img :src="appViewBg" alt="">
         </div>
@@ -52,7 +52,7 @@
 </template>
 
 <script setup>
-import { nextTick, onMounted, onUnmounted, ref, watch } from 'vue'
+import { computed, nextTick, onMounted, onUnmounted, ref, watch } from 'vue'
 import { useAppStore } from '~src/store'
 import { useRoute, useRouter } from 'vue-router'
 import { initButtons } from '~sto/app'
@@ -65,7 +65,7 @@ const router = useRouter()
 const useRoutes = useRoute()
 const store = useAppStore()
 
-const reloadRouter = ref(true)
+const reloadRouter = ref(!website.localModel)
 const userRoleId = ref(store.getRoleId)
 const projectInfoData = ref(store.getProjectInfo)
 
@@ -88,6 +88,14 @@ const menuBarKey = ref('')
 const menuBarData = ref([])
 const isLayout = ref('')
 
+const isLoading = computed(() => {
+    if (website.localModel) {
+        return !reloadRouter.value
+    } else {
+        return false
+    }
+})
+
 //渲染完成
 onMounted(() => {
     const layout = useRoutes?.query?.layout, layout2 = store.isLayout
@@ -164,11 +172,27 @@ const userInfoLoad = ({ user_id }) => {
 let socket
 const cascaderSend = async ({ projectId, contractId }) => {
     await useClick()
+    if (isNullES(contractId)) {
+        //本地模式
+        if (website.localModel) {
+            window.$message?.error('项目信息不存在,请联系管理员')
+            reloadRouter.value = false
+        }
+        return
+    }
     //链接webSocket
     if (!isNullES(socket)) socket.close()
-    socket = new HcSocket({ projectId, contractId, userId: userId.value }, ({ data }) => {
-        console.log('socket:', data)
-    })
+    if (!website.localModel) {
+        socket = new HcSocket({ projectId, contractId, userId: userId.value }, ({ data }) => {
+            console.log('socket:', data)
+        })
+    }
+    //本地模式
+    if (website.localModel) {
+        setTimeout(() => {
+            reloadRouter.value = true
+        }, 500)
+    }
 }
 
 // 项目切换