|
@@ -41,6 +41,7 @@
|
|
|
</div>
|
|
|
</el-main>
|
|
|
</el-container>
|
|
|
+ <hc-reminder v-model="isReminderShow" :text="isReminderText" />
|
|
|
</el-container>
|
|
|
</template>
|
|
|
|
|
@@ -196,7 +197,6 @@ const cascaderSend = async ({ projectId, contractId }) => {
|
|
|
//长链接消息
|
|
|
let annUpdateRef
|
|
|
const annRefs = ref([])
|
|
|
-
|
|
|
const socketData = async (res) => {
|
|
|
console.log('socket:', res)
|
|
|
const { type, data } = getObjValue(res)
|
|
@@ -217,6 +217,44 @@ const socketData = async (res) => {
|
|
|
//普通公告,追加公告
|
|
|
const ref = await HcAnnouncement({ type: 'system', data: data })
|
|
|
annRefs.value.push(ref)
|
|
|
+ } else if (type === 'msgLink') {
|
|
|
+ if (store.isLogin) {
|
|
|
+ socket.send('getMsg')
|
|
|
+ store.setIsLogin(false)
|
|
|
+ }
|
|
|
+ } else if (type === 'msgCountDown') {
|
|
|
+ //倒计时更新
|
|
|
+ if (isNullES(data) || data <= 0) {
|
|
|
+ closeReminder()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ isReminderText.value = `系统将在${data}秒后,进行更新`
|
|
|
+ setReminderText(data - 1)
|
|
|
+ isReminderShow.value = true
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+//倒计时
|
|
|
+let timeRef
|
|
|
+const isReminderShow = ref(false)
|
|
|
+const isReminderText = ref('')
|
|
|
+const setReminderText = (time) => {
|
|
|
+ if (time < 0) {
|
|
|
+ closeReminder()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ timeRef = setTimeout(() => {
|
|
|
+ isReminderText.value = `系统将在${time}秒后,进行更新`
|
|
|
+ setReminderText(time - 1)
|
|
|
+ }, 1000)
|
|
|
+}
|
|
|
+
|
|
|
+//关闭倒计时
|
|
|
+const closeReminder = () => {
|
|
|
+ isReminderShow.value = false
|
|
|
+ if (!isNullES(timeRef)) {
|
|
|
+ clearTimeout(timeRef)
|
|
|
+ timeRef = null
|
|
|
}
|
|
|
}
|
|
|
|