|
@@ -52,7 +52,7 @@
|
|
|
</template>
|
|
|
|
|
|
<script setup>
|
|
|
-import { nextTick, onMounted, ref, watch } from 'vue'
|
|
|
+import { nextTick, onMounted, onUnmounted, ref, watch } from 'vue'
|
|
|
import { useAppStore } from '~src/store'
|
|
|
import { useRoute, useRouter } from 'vue-router'
|
|
|
import { initButtons } from '~sto/app'
|
|
@@ -166,7 +166,7 @@ const cascaderSend = async ({ projectId, contractId }) => {
|
|
|
await useClick()
|
|
|
//链接webSocket
|
|
|
if (!isNullES(socket)) socket.close()
|
|
|
- socket = new HcSocket({ projectId, contractId, userId: userId.value }, (data) => {
|
|
|
+ socket = new HcSocket({ projectId, contractId, userId: userId.value }, ({ data }) => {
|
|
|
console.log('socket:', data)
|
|
|
})
|
|
|
}
|
|
@@ -187,6 +187,11 @@ const logoClick = () => {
|
|
|
const userProjectClick = () => {
|
|
|
router.push({ path: '/user/project' })
|
|
|
}
|
|
|
+
|
|
|
+//页面卸载
|
|
|
+onUnmounted(() => {
|
|
|
+ if (!isNullES(socket)) socket.close()
|
|
|
+})
|
|
|
</script>
|
|
|
|
|
|
<style lang="scss">
|