From e6b4c02e34b7ce1701af4f45166fb5d3ef207bb2 Mon Sep 17 00:00:00 2001 From: sudoooooo Date: Sun, 22 Sep 2024 12:38:42 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BC=98=E5=8C=96=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E5=86=85=E5=AE=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/.env | 4 +-- .../survey/__test/surveyMeta.service.spec.ts | 4 +-- .../__test/surveyResponse.controller.spec.ts | 4 +-- server/src/securityPlugin/interface.ts | 2 +- .../securityPlugin/pluginManager.provider.ts | 6 ++-- server/src/securityPlugin/pluginManager.ts | 6 ++-- .../responseSecurityPlugin/index.ts | 11 ++---- .../securityPlugin/surveyUtilPlugin/index.ts | 4 +-- web/src/management/App.vue | 4 +-- web/src/management/api/auth.js | 4 +-- .../api/{downloadTask.js => download.js} | 0 web/src/management/components/TopNav.vue | 6 ++-- web/src/management/config/listConfig.js | 9 +++-- .../pages/analysis/pages/DataTablePage.vue | 36 ++++++++++--------- .../pages/download/DownloadPage.vue | 7 ++-- .../{DownloadTaskList.vue => TaskList.vue} | 16 +++++---- web/src/management/pages/list/index.vue | 4 --- web/src/management/stores/edit.ts | 2 +- .../VerifyDialog/FillDataDialog.vue | 2 +- 19 files changed, 62 insertions(+), 69 deletions(-) rename web/src/management/api/{downloadTask.js => download.js} (100%) rename web/src/management/pages/download/components/{DownloadTaskList.vue => TaskList.vue} (93%) diff --git a/server/.env b/server/.env index 22187306..f534d4ca 100644 --- a/server/.env +++ b/server/.env @@ -1,5 +1,5 @@ XIAOJU_SURVEY_MONGO_DB_NAME=xiaojuSurvey -XIAOJU_SURVEY_MONGO_URL=#mongodb://127.0.0.1:27017 # 建议设置强密码,放开注释不能有空格 +XIAOJU_SURVEY_MONGO_URL=mongodb://127.0.0.1:27017 XIAOJU_SURVEY_MONGO_AUTH_SOURCE=admin XIAOJU_SURVEY_REDIS_HOST= @@ -9,7 +9,7 @@ XIAOJU_SURVEY_REDIS_PASSWORD= XIAOJU_SURVEY_REDIS_DB= -XIAOJU_SURVEY_RESPONSE_AES_ENCRYPT_SECRET_KEY= # dataAesEncryptSecretKey +XIAOJU_SURVEY_RESPONSE_AES_ENCRYPT_SECRET_KEY=dataAesEncryptSecretKey XIAOJU_SURVEY_HTTP_DATA_ENCRYPT_TYPE=rsa XIAOJU_SURVEY_JWT_SECRET=xiaojuSurveyJwtSecret diff --git a/server/src/modules/survey/__test/surveyMeta.service.spec.ts b/server/src/modules/survey/__test/surveyMeta.service.spec.ts index b48e6818..74b9e9e2 100644 --- a/server/src/modules/survey/__test/surveyMeta.service.spec.ts +++ b/server/src/modules/survey/__test/surveyMeta.service.spec.ts @@ -37,9 +37,7 @@ describe('SurveyMetaService', () => { surveyRepository = module.get>( getRepositoryToken(SurveyMeta), ); - pluginManager = module.get( - PluginManager, - ); + pluginManager = module.get(PluginManager); pluginManager.registerPlugin(new SurveyUtilPlugin()); }); diff --git a/server/src/modules/surveyResponse/__test/surveyResponse.controller.spec.ts b/server/src/modules/surveyResponse/__test/surveyResponse.controller.spec.ts index eca1cfea..82632bbe 100644 --- a/server/src/modules/surveyResponse/__test/surveyResponse.controller.spec.ts +++ b/server/src/modules/surveyResponse/__test/surveyResponse.controller.spec.ts @@ -153,9 +153,7 @@ describe('SurveyResponseController', () => { clientEncryptService = module.get(ClientEncryptService); - const pluginManager = module.get( - PluginManager, - ); + const pluginManager = module.get(PluginManager); pluginManager.registerPlugin( new ResponseSecurityPlugin('dataAesEncryptSecretKey'), ); diff --git a/server/src/securityPlugin/interface.ts b/server/src/securityPlugin/interface.ts index 4a693b3e..a5e3b55f 100644 --- a/server/src/securityPlugin/interface.ts +++ b/server/src/securityPlugin/interface.ts @@ -1,4 +1,4 @@ -export interface XiaojuSurveyPlugin { +export interface SecurityPlugin { encryptResponseData?(responseData); afterResponseFind?(responseData); maskData?(data: Record); diff --git a/server/src/securityPlugin/pluginManager.provider.ts b/server/src/securityPlugin/pluginManager.provider.ts index 05f1ef8b..032517a8 100644 --- a/server/src/securityPlugin/pluginManager.provider.ts +++ b/server/src/securityPlugin/pluginManager.provider.ts @@ -1,9 +1,7 @@ -import xiaojuSurveyPluginManager, { - PluginManager, -} from './pluginManager'; +import securityPluginManager, { PluginManager } from './pluginManager'; import { Provider } from '@nestjs/common'; export const PluginManagerProvider: Provider = { provide: PluginManager, - useValue: xiaojuSurveyPluginManager, + useValue: securityPluginManager, }; diff --git a/server/src/securityPlugin/pluginManager.ts b/server/src/securityPlugin/pluginManager.ts index 2b05f133..dbd7c0c5 100644 --- a/server/src/securityPlugin/pluginManager.ts +++ b/server/src/securityPlugin/pluginManager.ts @@ -1,4 +1,4 @@ -import { XiaojuSurveyPlugin } from './interface'; +import { SecurityPlugin } from './interface'; type AllowHooks = | 'encryptResponseData' @@ -7,9 +7,9 @@ type AllowHooks = | 'genSurveyPath'; export class PluginManager { - private plugins: Array = []; + private plugins: Array = []; // 注册插件 - registerPlugin(...plugins: Array) { + registerPlugin(...plugins: Array) { this.plugins.push(...plugins); } diff --git a/server/src/securityPlugin/responseSecurityPlugin/index.ts b/server/src/securityPlugin/responseSecurityPlugin/index.ts index e218b208..07e6a20a 100644 --- a/server/src/securityPlugin/responseSecurityPlugin/index.ts +++ b/server/src/securityPlugin/responseSecurityPlugin/index.ts @@ -1,13 +1,8 @@ -import { XiaojuSurveyPlugin } from '../interface'; +import { SecurityPlugin } from '../interface'; import { SurveyResponse } from 'src/models/surveyResponse.entity'; -import { - decryptData, - encryptData, - isDataSensitive, - maskData, -} from './utils'; +import { decryptData, encryptData, isDataSensitive, maskData } from './utils'; -export class ResponseSecurityPlugin implements XiaojuSurveyPlugin { +export class ResponseSecurityPlugin implements SecurityPlugin { constructor(private readonly secretKey: string) {} encryptResponseData(responseData: SurveyResponse) { const secretKeys = []; diff --git a/server/src/securityPlugin/surveyUtilPlugin/index.ts b/server/src/securityPlugin/surveyUtilPlugin/index.ts index 9fb93354..a4b30948 100644 --- a/server/src/securityPlugin/surveyUtilPlugin/index.ts +++ b/server/src/securityPlugin/surveyUtilPlugin/index.ts @@ -1,10 +1,10 @@ -import { XiaojuSurveyPlugin } from '../interface'; +import { SecurityPlugin } from '../interface'; import { customAlphabet } from 'nanoid'; const surveyPathAlphabet = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'; -export class SurveyUtilPlugin implements XiaojuSurveyPlugin { +export class SurveyUtilPlugin implements SecurityPlugin { genSurveyPath() { const id = customAlphabet(surveyPathAlphabet, 8); return id(); diff --git a/web/src/management/App.vue b/web/src/management/App.vue index eb5beb6f..4f2044f7 100644 --- a/web/src/management/App.vue +++ b/web/src/management/App.vue @@ -7,7 +7,7 @@ import { watch, onBeforeUnmount } from 'vue' import { useUserStore } from '@/management/stores/user' import { useRouter } from 'vue-router' import { ElMessageBox, ElMessage, type Action } from 'element-plus' -import { checkIsTokenValid } from '@/management/api/auth'; +import { checkIsTokenValid } from '@/management/api/auth' const userStore = useUserStore() const router = useRouter() @@ -31,7 +31,7 @@ const checkAuth = async () => { try { const res: Record = await checkIsTokenValid() if (res.code !== 200 || !res.data) { - showConfirmBox(); + showConfirmBox() } else { timer = setTimeout( () => { diff --git a/web/src/management/api/auth.js b/web/src/management/api/auth.js index 038a644f..37d758f8 100644 --- a/web/src/management/api/auth.js +++ b/web/src/management/api/auth.js @@ -21,5 +21,5 @@ export const getPasswordStrength = (password) => { } export const checkIsTokenValid = () => { - return axios.get('/auth/verifyToken'); -} \ No newline at end of file + return axios.get('/auth/verifyToken') +} diff --git a/web/src/management/api/downloadTask.js b/web/src/management/api/download.js similarity index 100% rename from web/src/management/api/downloadTask.js rename to web/src/management/api/download.js diff --git a/web/src/management/components/TopNav.vue b/web/src/management/components/TopNav.vue index 6aae1816..c9b9bc88 100644 --- a/web/src/management/components/TopNav.vue +++ b/web/src/management/components/TopNav.vue @@ -3,7 +3,7 @@
logo - + 问卷列表 @@ -34,8 +34,6 @@ const handleLogout = () => { userStore.logout() router.replace({ name: 'login' }) } - - \ No newline at end of file + diff --git a/web/src/management/config/listConfig.js b/web/src/management/config/listConfig.js index 3a856fc5..ca9578c1 100644 --- a/web/src/management/config/listConfig.js +++ b/web/src/management/config/listConfig.js @@ -88,15 +88,20 @@ export const noSpaceDataConfig = { img: '/imgs/icons/list-empty.webp' } export const noSpaceSearchDataConfig = { - title: '没有满足该查询条件的团队空间哦', + title: '没有满足该查询条件的团队空间', desc: '可以更换条件查询试试', img: '/imgs/icons/list-empty.webp' } export const noSearchDataConfig = { - title: '没有满足该查询条件的问卷哦', + title: '没有满足该查询条件的问卷', desc: '可以更换条件查询试试', img: '/imgs/icons/list-empty.webp' } +export const noDownloadTaskConfig = { + title: '没有下载任务', + desc: '可以在数据分析进行下载', + img: '/imgs/icons/list-empty.webp' +} export const statusMaps = { new: '未发布', diff --git a/web/src/management/pages/analysis/pages/DataTablePage.vue b/web/src/management/pages/analysis/pages/DataTablePage.vue index b298457a..4d438988 100644 --- a/web/src/management/pages/analysis/pages/DataTablePage.vue +++ b/web/src/management/pages/analysis/pages/DataTablePage.vue @@ -2,7 +2,9 @@