Browse Source

更新依赖

ZaiZai 6 months ago
parent
commit
dfa458896f
3 changed files with 25 additions and 21 deletions
  1. 1 1
      package.json
  2. 20 16
      src/layout/index.vue
  3. 4 4
      yarn.lock

+ 1 - 1
package.json

@@ -25,7 +25,7 @@
         "dayjs": "^1.11.13",
         "echarts": "^5.5.1",
         "element-plus": "^2.8.1",
-        "hc-vue3-ui": "^4.2.6",
+        "hc-vue3-ui": "^4.2.7",
         "js-base64": "^3.7.7",
         "js-fast-way": "^0.5.6",
         "js-md5": "^0.8.3",

+ 20 - 16
src/layout/index.vue

@@ -49,11 +49,11 @@ import { nextTick, onMounted, onUnmounted, ref, watch } from 'vue'
 import { useRoute, useRouter } from 'vue-router'
 import { getObjValue, isNullES, useClick } from 'js-fast-way'
 import { HcSocket } from '~src/plugins/HcSocket'
+import { HcAnnouncement } from 'hc-vue3-ui'
 import { useAppStore } from '~src/store'
 import { initButtons } from '~sto/app'
 import { useProject } from '~sto/useProject'
 import website from '~src/config'
-import { setNotification } from '~uti/tools'
 
 //初始组合式
 const router = useRouter()
@@ -169,10 +169,7 @@ const cascaderSend = async ({ projectId, contractId }) => {
     if (!isNullES(socket)) socket.close()
     if (!website.localModel) {
         socket = new HcSocket({ projectId, contractId, userId: userId.value }, (res) => {
-            const { type, data } = getObjValue(res?.data)
-            console.log(type, data)
-            //msgUpdateMsg 更新公告
-            //msgSystemMsg 普通公告
+            socketData(res?.data)
         })
     }
     //本地模式
@@ -181,19 +178,26 @@ const cascaderSend = async ({ projectId, contractId }) => {
             reloadRouter.value = true
         }, 500)
     }
-    //通知公告
-    setNotification({
-        type: 'update',
-        data: '测试一下,这是系统更新公告, 测试一下,这是系统更新公告, 测试一下,这是系统更新公告',
-        time: 'xxx年xx月xx日 xx:xx:xx',
-    })
-    //普通公告
-    setTimeout(() => {
-        setNotification({
+}
+
+//长链接消息
+const socketData = async (res) => {
+    console.log('socket:', res)
+    const { type, data } = getObjValue(res)
+    if (type === 'msgUpdateMsg') {
+        //更新公告
+        await HcAnnouncement({
+            type: 'update',
+            data: data,
+            //time: 'xxx年xx月xx日 xx:xx:xx',
+        })
+    } else if (type === 'msgSystemMsg') {
+        //普通公告
+        await HcAnnouncement({
             type: 'system',
-            data: '测试一下,这是系统发布的普通公告,测试一下,这是系统发布的普通公告,测试一下,这是系统发布的普通公告',
+            data: data,
         })
-    }, 500)
+    }
 }
 
 // 项目切换

+ 4 - 4
yarn.lock

@@ -1987,10 +1987,10 @@ has-flag@^4.0.0:
   resolved "http://39.108.216.210:9000/has-flag/-/has-flag-4.0.0.tgz#944771fd9c81c81265c4d6941860da06bb59479b"
   integrity sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==
 
-hc-vue3-ui@^4.2.6:
-  version "4.2.6"
-  resolved "http://39.108.216.210:9000/hc-vue3-ui/-/hc-vue3-ui-4.2.6.tgz#4c60c35838f5fa94c362ec1b4d4767bd60ce88e5"
-  integrity sha512-TeXfWRki6PbLeK7LahPPpHDdTWCFm4y8Z3HCirNqS1eweWOHnIfPu0wP0lKbXp9puJzuh8a/G57Yp9T9pevUIw==
+hc-vue3-ui@^4.2.7:
+  version "4.2.7"
+  resolved "http://39.108.216.210:9000/hc-vue3-ui/-/hc-vue3-ui-4.2.7.tgz#27225ef46d638fdf6aba3d5205c489c7ee322647"
+  integrity sha512-AD+w6j37FbLcVmbTHuaPmFFD/HvE67HvBg2v10ogsfdEeusmCcfUWgsuNyx9FBW0diOJOIV7MJBbRkdRgEeAkg==
   dependencies:
     axios "^1.7.5"
     dayjs "^1.11.13"