From 88027df120981482ab0032ef8a270fd28df2d6ae Mon Sep 17 00:00:00 2001 From: chenjinsong <523037378@qq.com> Date: Fri, 7 Oct 2022 21:04:08 +0800 Subject: [PATCH] =?UTF-8?q?CN-732=20feat:=20dns=E4=B8=8B=E9=92=BB=E8=A1=A8?= =?UTF-8?q?=E6=A0=BC=E9=83=A8=E5=88=86=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/App.vue | 25 +++ src/components/layout/Header.vue | 71 ++++---- src/mixins/common.js | 14 ++ src/mock/linkMonitor.js | 7 +- src/permission.js | 4 +- src/utils/constants.js | 163 +++++++++++++++++- src/utils/tools.js | 12 ++ .../networkOverview/NetworkOverviewTabs.vue | 20 ++- 8 files changed, 268 insertions(+), 48 deletions(-) diff --git a/src/App.vue b/src/App.vue index 82eb1989..00be36f0 100644 --- a/src/App.vue +++ b/src/App.vue @@ -7,6 +7,31 @@ import { storageKey } from '@/utils/constants' export default { name: 'App', + mounted () { + // 浏览器控制按钮前进后退触发函数 + window.addEventListener('popstate', this.popstate, false) + }, + unmounted () { + window.removeEventListener('popstate', this.popstate, false) + }, + methods: { + popstate () { + const historyJSON = sessionStorage.getItem(storageKey.history) + if (history) { + const history = JSON.parse(historyJSON) + if (history.index > -1) { + history.index-- + } else { + history.index = history.history.length - 3 + } + sessionStorage.setItem(storageKey.history, JSON.stringify(history)) + this.$router.push({ + path: history.history[history.index].path, + query: history.history[history.index].query + }) + } + } + }, setup () { // 处理刷新后 $dayJs的时区变为默认的问题 const timezone = localStorage.getItem(storageKey.sysTimezone) || '' diff --git a/src/components/layout/Header.vue b/src/components/layout/Header.vue index e7dd0b5b..69270238 100644 --- a/src/components/layout/Header.vue +++ b/src/components/layout/Header.vue @@ -73,10 +73,10 @@