From 87ac04d9a737f4c1f9f2215b2ce59d87b64eb300 Mon Sep 17 00:00:00 2001 From: YunaiV Date: Thu, 6 Apr 2023 19:49:58 +0800 Subject: [PATCH] =?UTF-8?q?Redis=20=E8=8F=9C=E5=8D=95=E7=9A=84=E9=87=8D?= =?UTF-8?q?=E6=9E=84=EF=BC=8C=E7=A7=BB=E9=99=A4=E5=AF=B9=20key=20=E7=9A=84?= =?UTF-8?q?=E7=AE=A1=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .env | 3 + src/api/infra/redis/index.ts | 36 ----------- src/api/infra/redis/types.ts | 9 --- src/main.ts | 2 + src/plugins/tongji/index.ts | 23 +++++++ src/utils/dict.ts | 1 - src/views/infra/redis/index.vue | 110 ++------------------------------ 7 files changed, 34 insertions(+), 150 deletions(-) create mode 100644 src/plugins/tongji/index.ts diff --git a/.env b/.env index 5f2334a3..a77d490d 100644 --- a/.env +++ b/.env @@ -15,3 +15,6 @@ VITE_APP_CAPTCHA_ENABLE=true # 验证码的开关 VITE_APP_CAPTCHA_ENABLE=true + +# 百度统计 +VITE_APP_BAIDU_CODE = a1ff8825baa73c3a78eb96aa40325abc diff --git a/src/api/infra/redis/index.ts b/src/api/infra/redis/index.ts index 9856fa64..f27be77f 100644 --- a/src/api/infra/redis/index.ts +++ b/src/api/infra/redis/index.ts @@ -6,39 +6,3 @@ import request from '@/config/axios' export const getCache = () => { return request.get({ url: '/infra/redis/get-monitor-info' }) } - -// 获取模块 -export const getKeyDefineList = () => { - return request.get({ url: '/infra/redis/get-key-define-list' }) -} - -/** - * 获取redis key列表 - */ -export const getKeyList = (keyTemplate: string) => { - return request.get({ - url: '/infra/redis/get-key-list', - params: { - keyTemplate - } - }) -} - -// 获取缓存内容 -export const getKeyValue = (key: string) => { - return request.get({ url: '/infra/redis/get-key-value?key=' + key }) -} - -// 根据键名删除缓存 -export const deleteKey = (key: string) => { - return request.delete({ url: '/infra/redis/delete-key?key=' + key }) -} - -export const deleteKeys = (keyTemplate: string) => { - return request.delete({ - url: '/infra/redis/delete-keys?', - params: { - keyTemplate - } - }) -} diff --git a/src/api/infra/redis/types.ts b/src/api/infra/redis/types.ts index 2342e543..548bfe96 100644 --- a/src/api/infra/redis/types.ts +++ b/src/api/infra/redis/types.ts @@ -174,12 +174,3 @@ export interface RedisCommandStatsVO { calls: number usec: number } - -export interface RedisKeyInfo { - keyTemplate: string - keyType: string - valueType: string - timeoutType: number - timeout: number - memo: string -} diff --git a/src/main.ts b/src/main.ts index b3a9da16..f24560b5 100644 --- a/src/main.ts +++ b/src/main.ts @@ -52,6 +52,8 @@ import 'bpmn-js/dist/assets/bpmn-font/css/bpmn-embedded.css' import hljs from 'highlight.js' //导入代码高亮文件 import 'highlight.js/styles/github.css' //导入代码高亮样式 新版 +import '@/plugins/tongji' // 百度统计 + import Logger from '@/utils/Logger' // 本地开发模式 全局引入 element-plus 样式,加快第一次进入速度 diff --git a/src/plugins/tongji/index.ts b/src/plugins/tongji/index.ts new file mode 100644 index 00000000..ec261a16 --- /dev/null +++ b/src/plugins/tongji/index.ts @@ -0,0 +1,23 @@ +import router from '@/router' + +// 用于 router push +window._hmt = window._hmt || [] +// HM_ID +const HM_ID = import.meta.env.VITE_APP_BAIDU_CODE +;(function () { + // 有值的时候,才开启 + if (!HM_ID) { + return + } + const hm = document.createElement('script') + hm.src = 'https://hm.baidu.com/hm.js?' + HM_ID + const s = document.getElementsByTagName('script')[0] + s.parentNode.insertBefore(hm, s) +})() + +router.afterEach(function (to) { + if (!HM_ID) { + return + } + _hmt.push(['_trackPageview', to.fullPath]) +}) diff --git a/src/utils/dict.ts b/src/utils/dict.ts index 05c70dad..d1d84242 100644 --- a/src/utils/dict.ts +++ b/src/utils/dict.ts @@ -112,7 +112,6 @@ export enum DICT_TYPE { // ========== INFRA 模块 ========== INFRA_BOOLEAN_STRING = 'infra_boolean_string', - INFRA_REDIS_TIMEOUT_TYPE = 'infra_redis_timeout_type', INFRA_JOB_STATUS = 'infra_job_status', INFRA_JOB_LOG_STATUS = 'infra_job_log_status', INFRA_API_ERROR_LOG_PROCESS_STATUS = 'infra_api_error_log_process_status', diff --git a/src/views/infra/redis/index.vue b/src/views/infra/redis/index.vue index 30d3cf65..1fd1a120 100644 --- a/src/views/infra/redis/index.vue +++ b/src/views/infra/redis/index.vue @@ -4,6 +4,7 @@ + @@ -47,106 +48,33 @@ +
+
- - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - {{ cacheForm.key }} - {{ cacheForm.value }} - - - - -