diff --git a/Dockerfile b/Dockerfile index feb537c752ff969b620766de247f9f896fc7e74c..0ddb6b8c5a0cc4fb82248894aa2af4207e56eb89 100644 --- a/Dockerfile +++ b/Dockerfile @@ -7,7 +7,6 @@ RUN npm install pnpm -g --registry=https://registry.npmmirror.com && \ pnpm install --registry=https://registry.npmmirror.com && \ pnpm run build - FROM hub.oepkgs.net/openeuler/openeuler:22.03-lts-sp4 ENV TZ Asia/Shanghai diff --git a/deploy/prod/nginx.conf.tmpl b/deploy/prod/nginx.conf.tmpl index d91f5f6723b2913275c040e7a67144ddf0b853d6..f0328230093a3c209a4f072efd2101283330b4e6 100644 --- a/deploy/prod/nginx.conf.tmpl +++ b/deploy/prod/nginx.conf.tmpl @@ -67,10 +67,7 @@ http { add_header Referrer-Policy "no-referrer"; add_header X-Content-Type-Options nosniff; add_header Content-Security-Policy "default-src 'self'; script-src 'self' 'unsafe-inline' 'unsafe-eval'; style-src 'self' 'unsafe-inline'; img-src 'self' data: base64;"; - add_header Cache-Control "no-cache,no-store,must-revalidate"; - add_header Pragma no-cache; - add_header Expires 0; - # limit_conn limitperip 10; + add_header Cache-Control "no-cache"; if ($request_method !~ ^(GET|HEAD|POST|PUT|DELETE)$) { return 444; @@ -102,13 +99,8 @@ http { location /witchaind/api/ { proxy_set_header X-Real-IP $remote_addr; - add_header X-XSS-Protection "1; mode=block"; add_header X-Frame-Options DENY; - add_header X-Content-Type-Options nosniff; - add_header Content-Security-Policy "default-src 'self'; script-src 'self' 'unsafe-inline' 'unsafe-eval'; style-src 'self' 'unsafe-inline'; img-src 'self' data: base64;"; add_header Cache-Control "no-cache,no-store,must-revalidate"; - add_header Pragma no-cache; - add_header Expires 0; proxy_buffering off; error_page 404 = @not_found; diff --git a/package.json b/package.json index d6658fa27c41d901ef4f63bf5333b3a48532aa21..7ccb607a916541c7620776da6c9b64b12c9feead 100644 --- a/package.json +++ b/package.json @@ -113,7 +113,6 @@ "stylelint-config-recommended-scss": "^14.1.0", "stylelint-config-recommended-vue": "^1.5.0", "stylelint-config-standard": "^36.0.1", - "terser": "^5.31.6", "typescript": "^5.5.4", "unocss": "^0.58.9", "unplugin-auto-import": "^0.17.8", diff --git a/src/App.vue b/src/App.vue index 830a0fc9c9c16bebe260b41193c1245849b1ae1c..69cf440a1d04c3f6ab845bab56722869ee750259 100644 --- a/src/App.vue +++ b/src/App.vue @@ -1,18 +1,62 @@ - + \ No newline at end of file diff --git a/src/assets/fonts/HarmonyOS/HarmonyOS_font.css b/src/assets/fonts/HarmonyOS/HarmonyOS_font.css index d078d578a946f8ff78ca00f55eb22f12273f266f..b03886c71bf1435dac35e43aa77b6796e83f9ece 100644 --- a/src/assets/fonts/HarmonyOS/HarmonyOS_font.css +++ b/src/assets/fonts/HarmonyOS/HarmonyOS_font.css @@ -11,24 +11,6 @@ */ /* 鸿蒙中文 */ -@font-face { - font-family: 'HarmonyOS Sans SC Thin'; - src: - url(./HarmonyOS_Sans_SC/HarmonyOS_Sans_SC_Thin.woff2) format('woff2'), - url(./HarmonyOS_Sans_SC/HarmonyOS_Sans_SC_Thin.woff) format('woff'); - font-weight: 100; - font-style: normal; -} - -@font-face { - font-family: 'HarmonyOS Sans SC Light'; - src: - url(./HarmonyOS_Sans_SC/HarmonyOS_Sans_SC_Light.woff2) format('woff2'), - url(./HarmonyOS_Sans_SC/HarmonyOS_Sans_SC_Light.woff) format('woff'); - font-weight: 300; - font-style: normal; -} - @font-face { font-family: 'HarmonyOS Sans SC Regular'; src: @@ -37,85 +19,3 @@ font-weight: 400; font-style: normal; } - -@font-face { - font-family: 'HarmonyOS Sans SC Medium'; - src: - url(./HarmonyOS_Sans_SC/HarmonyOS_Sans_SC_Medium.woff2) format('woff2'), - url(./HarmonyOS_Sans_SC/HarmonyOS_Sans_SC_Medium.woff) format('woff'); - font-weight: 500; - font-style: normal; -} - -@font-face { - font-family: 'HarmonyOS Sans SC Bold'; - src: - url(./HarmonyOS_Sans_SC/HarmonyOS_Sans_SC_Bold.woff2) format('woff2'), - url(./HarmonyOS_Sans_SC/HarmonyOS_Sans_SC_Bold.woff) format('woff'); - font-weight: 700; - font-style: normal; -} - -@font-face { - font-family: 'HarmonyOS Sans SC Black'; - src: - url(./HarmonyOS_Sans_SC/HarmonyOS_Sans_SC_Black.woff2) format('woff2'), - url(./HarmonyOS_Sans_SC/HarmonyOS_Sans_SC_Black.woff) format('woff'); - font-weight: 900; - font-style: normal; -} - -/* 鸿蒙西文字体 */ -@font-face { - font-family: 'HarmonyOS Sans En Thin'; - src: - url(./HarmonyOS_Sans/HarmonyOS_Sans_Thin.woff2) format('woff2'), - url(./HarmonyOS_Sans/HarmonyOS_Sans_Thin.woff) format('woff'); - font-weight: 100; - font-style: normal; -} - -@font-face { - font-family: 'HarmonyOS Sans En Light'; - src: - url(./HarmonyOS_Sans/HarmonyOS_Sans_Light.woff2) format('woff2'), - url(./HarmonyOS_Sans/HarmonyOS_Sans_Light.woff) format('woff'); - font-weight: 300; - font-style: normal; -} - -@font-face { - font-family: 'HarmonyOS Sans En Regular'; - src: - url(./HarmonyOS_Sans/HarmonyOS_Sans_Regular.woff2) format('woff2'), - url(./HarmonyOS_Sans/HarmonyOS_Sans_Regular.woff) format('woff'); - font-weight: 400; - font-style: normal; -} - -@font-face { - font-family: 'HarmonyOS Sans En Medium'; - src: - url(./HarmonyOS_Sans/HarmonyOS_Sans_Medium.woff2) format('woff2'), - url(./HarmonyOS_Sans/HarmonyOS_Sans_Medium.woff) format('woff'); - font-weight: 500; - font-style: normal; -} - -@font-face { - font-family: 'HarmonyOS Sans En Bold'; - src: - url(./HarmonyOS_Sans/HarmonyOS_Sans_Bold.woff2) format('woff2'), - url(./HarmonyOS_Sans/HarmonyOS_Sans_Bold.woff) format('woff'); - font-weight: 700; - font-style: normal; -} - -@font-face { - font-family: 'HarmonyOS Sans En Black'; - src: - url(./HarmonyOS_Sans/HarmonyOS_Sans_Black.woff2) format('woff2'), - url(./HarmonyOS_Sans/HarmonyOS_Sans_Black.woff) format('woff'); - font-weight: 900; - font-style: normal; -} diff --git a/src/assets/images/login-background-light.png b/src/assets/images/login-background-light.png deleted file mode 100644 index bbdbc96190782177734971a1c411ef627382cecb..0000000000000000000000000000000000000000 Binary files a/src/assets/images/login-background-light.png and /dev/null differ diff --git a/src/assets/images/login-background-light.webp b/src/assets/images/login-background-light.webp new file mode 100644 index 0000000000000000000000000000000000000000..4a7f7719b05608234e8895d51f1818734a90eb2f Binary files /dev/null and b/src/assets/images/login-background-light.webp differ diff --git a/src/components/Upload/index.vue b/src/components/Upload/index.vue index d076d3b8a2cd19f81509c19091af293d310ebcae..c868239e7784b94176cdcc8ec09618d799e4dc65 100644 --- a/src/components/Upload/index.vue +++ b/src/components/Upload/index.vue @@ -295,7 +295,7 @@ const handleChange = (file: UploadFile) => { }; // 超出文件数量限制时的处理 -const handleExceed = (files: File[], uploadFiles: any[]) => { +const handleExceed = () => { ElMessage.warning(`超出文件数量限制,最多只能上传 ${props.maxFileNum} 个文件!`); }; @@ -427,20 +427,24 @@ const uploadFiles = () => { } }, onError: (e: any) => { + uploadFileNumber += 1; uploadingList.value = uploadingList.value.map((up) => { if (up.id === e.id) { - return e; + return { ...e, uploadStatus: 'error'}; } return up; }); + props?.handleImportLoading(false); + handleToggleUploadNotify(); }, onSuccess: () => { uploadFileNumber += 1; if (uploadFileNumber === fileTableList.data.length) { props.handleQueryTaskList(); + fileTableList.data = []; } }, - fileInfo: item, + fileInfo: item }); }); uploadingList.value = [ @@ -462,11 +466,10 @@ const uploadFiles = () => { }; }), ]; - uploadingList.value.length && handleToggleUploadNotify(); props.handleCancelVisible(); - fileTableList.data = []; uploadRef.value?.clearFiles(); allFileSizes.value = 0; + uploadingList.value.length && handleToggleUploadNotify(); }); }; @@ -511,6 +514,8 @@ const uploadKnowledgeFile = () => { } return up; }); + props?.handleImportLoading(false); + handleToggleUploadNotify(); // 立即显示错误状态 reject(e); // 传递错误 }, onSuccess: () => { diff --git a/src/components/Upload/uploadProgress.vue b/src/components/Upload/uploadProgress.vue index b660e5130b8df628da1e745a99f9d85062ced9e7..32c89d5400a183a6101873596b2915d4c9abf88c 100644 --- a/src/components/Upload/uploadProgress.vue +++ b/src/components/Upload/uploadProgress.vue @@ -46,7 +46,7 @@ :content="`,${$t('dialogTipText.fileSize')} ${bytesToSize(item?.file?.size || item?.size || 0)}`" />
{{ `,${$t('assetLibrary.uploadIng')}...` }}
@@ -72,7 +72,7 @@ {{ $t('uploadText.uploadSuccess') }}
diff --git a/src/components/UserHeaderBar/headerCom.vue b/src/components/UserHeaderBar/headerCom.vue index e5ea0fcd5b58e3b9dd779df7f68bb236ac9bccd8..567de347dee5faf084d060b2261d1b11ddf7da29 100644 --- a/src/components/UserHeaderBar/headerCom.vue +++ b/src/components/UserHeaderBar/headerCom.vue @@ -309,23 +309,7 @@ const handleClose = () => { }; }; -/** - * 处理接postmessage收到的数据,根据消息中的语言设置应用语言。 - * 该函数会根据接收到的语言代码更新应用的语言设置,并将其存储在本地存储中。 - */ -const handleMessage = (e: MessageEvent) => { - const langObj = { - CN: 'zh', - EN: 'en', - }; - let lang = langObj[e.data.lang as keyof typeof langObj]; - locale.value = lang; - appStore.changeLanguage(lang); - localStorage.setItem('language', lang); -}; - onMounted(() => { - window.addEventListener('message', handleMessage); userInfo.value = JSON.parse(localStorage.getItem('userInfo') || '{}'); userLanguage.value = userInfo.value?.language; if (openai_api_type.value === 'local') { @@ -335,7 +319,6 @@ onMounted(() => { } getModelInfo(); }); -onUnmounted(() => window.removeEventListener('message', handleMessage)); const getModelInfo = () => { KbAppAPI.getdUserModel().then((res: any) => { @@ -602,7 +585,7 @@ const handleModelVisible = (visible: boolean) => { } .el-dialog__title { - font-family: 'HarmonyOS Sans SC Bold', sans-serif !important; + font-family: 'HarmonyOS Sans SC Regular', sans-serif !important; font-weight: 800; } diff --git a/src/store/modules/app.ts b/src/store/modules/app.ts index 0d9548d8f3b23d7b683edf3debf1ff9ee6965f88..1150e16c2116cfa227e4f0eacae561d91b655325 100644 --- a/src/store/modules/app.ts +++ b/src/store/modules/app.ts @@ -6,6 +6,12 @@ import en from 'element-plus/es/locale/lang/en'; import { store } from '@/store'; export const useAppStore = defineStore('app', () => { + const parentToken = ref(''); + + function changeParentToken(value: string) { + parentToken.value = value; + } + // 语言 const language = useStorage('language', defaultSettings.language); /** @@ -31,6 +37,8 @@ export const useAppStore = defineStore('app', () => { language, locale, changeLanguage, + parentToken, + changeParentToken, }; }); diff --git a/src/styles/HarmonyOS_Sans/HarmonyOS_Sans_Black.woff b/src/styles/HarmonyOS_Sans/HarmonyOS_Sans_Black.woff deleted file mode 100644 index d3a7a9a2f445580353177f71592f722a9f8264b7..0000000000000000000000000000000000000000 Binary files a/src/styles/HarmonyOS_Sans/HarmonyOS_Sans_Black.woff and /dev/null differ diff --git a/src/styles/HarmonyOS_Sans/HarmonyOS_Sans_Black.woff2 b/src/styles/HarmonyOS_Sans/HarmonyOS_Sans_Black.woff2 deleted file mode 100644 index 5b1b8fbe5c2b665c378f29a78c8bf9b245bafbe5..0000000000000000000000000000000000000000 Binary files a/src/styles/HarmonyOS_Sans/HarmonyOS_Sans_Black.woff2 and /dev/null differ diff --git a/src/styles/HarmonyOS_Sans/HarmonyOS_Sans_Bold.woff b/src/styles/HarmonyOS_Sans/HarmonyOS_Sans_Bold.woff deleted file mode 100644 index 90e19c2273855080af70ae1d57f4c650584947b9..0000000000000000000000000000000000000000 Binary files a/src/styles/HarmonyOS_Sans/HarmonyOS_Sans_Bold.woff and /dev/null differ diff --git a/src/styles/HarmonyOS_Sans/HarmonyOS_Sans_Bold.woff2 b/src/styles/HarmonyOS_Sans/HarmonyOS_Sans_Bold.woff2 deleted file mode 100644 index 69d0baa5db0c1fd1a6581c8fec2833e0d681c4ef..0000000000000000000000000000000000000000 Binary files a/src/styles/HarmonyOS_Sans/HarmonyOS_Sans_Bold.woff2 and /dev/null differ diff --git a/src/styles/HarmonyOS_Sans/HarmonyOS_Sans_Light.woff b/src/styles/HarmonyOS_Sans/HarmonyOS_Sans_Light.woff deleted file mode 100644 index e06f7add695edd7ee5c39c1a67527a7df51dfae2..0000000000000000000000000000000000000000 Binary files a/src/styles/HarmonyOS_Sans/HarmonyOS_Sans_Light.woff and /dev/null differ diff --git a/src/styles/HarmonyOS_Sans/HarmonyOS_Sans_Light.woff2 b/src/styles/HarmonyOS_Sans/HarmonyOS_Sans_Light.woff2 deleted file mode 100644 index f3731ae01c816eb7d461837b423d4a2b563e113f..0000000000000000000000000000000000000000 Binary files a/src/styles/HarmonyOS_Sans/HarmonyOS_Sans_Light.woff2 and /dev/null differ diff --git a/src/styles/HarmonyOS_Sans/HarmonyOS_Sans_Medium.woff b/src/styles/HarmonyOS_Sans/HarmonyOS_Sans_Medium.woff deleted file mode 100644 index 0568219cd88f5d376a7f083cf23cdce705cb70c9..0000000000000000000000000000000000000000 Binary files a/src/styles/HarmonyOS_Sans/HarmonyOS_Sans_Medium.woff and /dev/null differ diff --git a/src/styles/HarmonyOS_Sans/HarmonyOS_Sans_Medium.woff2 b/src/styles/HarmonyOS_Sans/HarmonyOS_Sans_Medium.woff2 deleted file mode 100644 index 63f418cb53701cd899c031cb189857d08cb1264b..0000000000000000000000000000000000000000 Binary files a/src/styles/HarmonyOS_Sans/HarmonyOS_Sans_Medium.woff2 and /dev/null differ diff --git a/src/styles/HarmonyOS_Sans/HarmonyOS_Sans_Regular.woff b/src/styles/HarmonyOS_Sans/HarmonyOS_Sans_Regular.woff deleted file mode 100644 index dbe11e9c8547a59da3eae6174b5f2201c321d02f..0000000000000000000000000000000000000000 Binary files a/src/styles/HarmonyOS_Sans/HarmonyOS_Sans_Regular.woff and /dev/null differ diff --git a/src/styles/HarmonyOS_Sans/HarmonyOS_Sans_Regular.woff2 b/src/styles/HarmonyOS_Sans/HarmonyOS_Sans_Regular.woff2 deleted file mode 100644 index 633a70c07aee063d0f301b78cd2bf9d06d42d696..0000000000000000000000000000000000000000 Binary files a/src/styles/HarmonyOS_Sans/HarmonyOS_Sans_Regular.woff2 and /dev/null differ diff --git a/src/styles/HarmonyOS_Sans/HarmonyOS_Sans_Thin.woff b/src/styles/HarmonyOS_Sans/HarmonyOS_Sans_Thin.woff deleted file mode 100644 index eb04aef0fa66e71063b346d79cbc2ae21fc67c71..0000000000000000000000000000000000000000 Binary files a/src/styles/HarmonyOS_Sans/HarmonyOS_Sans_Thin.woff and /dev/null differ diff --git a/src/styles/HarmonyOS_Sans/HarmonyOS_Sans_Thin.woff2 b/src/styles/HarmonyOS_Sans/HarmonyOS_Sans_Thin.woff2 deleted file mode 100644 index bfe90d34d1a0823f78574f486ff6c2608007a747..0000000000000000000000000000000000000000 Binary files a/src/styles/HarmonyOS_Sans/HarmonyOS_Sans_Thin.woff2 and /dev/null differ diff --git a/src/styles/HarmonyOS_Sans_SC/HarmonyOS_Sans_SC_Black.woff b/src/styles/HarmonyOS_Sans_SC/HarmonyOS_Sans_SC_Black.woff deleted file mode 100644 index 4824510dae9974c2f1eb2d64ad96b62d3c133bde..0000000000000000000000000000000000000000 Binary files a/src/styles/HarmonyOS_Sans_SC/HarmonyOS_Sans_SC_Black.woff and /dev/null differ diff --git a/src/styles/HarmonyOS_Sans_SC/HarmonyOS_Sans_SC_Black.woff2 b/src/styles/HarmonyOS_Sans_SC/HarmonyOS_Sans_SC_Black.woff2 deleted file mode 100644 index 749b12841bf135f3414e8baf4e18afc80e70587b..0000000000000000000000000000000000000000 Binary files a/src/styles/HarmonyOS_Sans_SC/HarmonyOS_Sans_SC_Black.woff2 and /dev/null differ diff --git a/src/styles/HarmonyOS_Sans_SC/HarmonyOS_Sans_SC_Bold.woff b/src/styles/HarmonyOS_Sans_SC/HarmonyOS_Sans_SC_Bold.woff deleted file mode 100644 index ec892a1c1c6e9feda6d3ce5abe13c14bda6173c7..0000000000000000000000000000000000000000 Binary files a/src/styles/HarmonyOS_Sans_SC/HarmonyOS_Sans_SC_Bold.woff and /dev/null differ diff --git a/src/styles/HarmonyOS_Sans_SC/HarmonyOS_Sans_SC_Bold.woff2 b/src/styles/HarmonyOS_Sans_SC/HarmonyOS_Sans_SC_Bold.woff2 deleted file mode 100644 index 6cb17baa452ae6ee4f688adfa72be2d6c03938e7..0000000000000000000000000000000000000000 Binary files a/src/styles/HarmonyOS_Sans_SC/HarmonyOS_Sans_SC_Bold.woff2 and /dev/null differ diff --git a/src/styles/HarmonyOS_Sans_SC/HarmonyOS_Sans_SC_Light.woff b/src/styles/HarmonyOS_Sans_SC/HarmonyOS_Sans_SC_Light.woff deleted file mode 100644 index ed26373b729bcb24a77741f950286bdd314b5730..0000000000000000000000000000000000000000 Binary files a/src/styles/HarmonyOS_Sans_SC/HarmonyOS_Sans_SC_Light.woff and /dev/null differ diff --git a/src/styles/HarmonyOS_Sans_SC/HarmonyOS_Sans_SC_Light.woff2 b/src/styles/HarmonyOS_Sans_SC/HarmonyOS_Sans_SC_Light.woff2 deleted file mode 100644 index 6a59240cbf4e699739dbe85d4e6d0ce3a21c60d7..0000000000000000000000000000000000000000 Binary files a/src/styles/HarmonyOS_Sans_SC/HarmonyOS_Sans_SC_Light.woff2 and /dev/null differ diff --git a/src/styles/HarmonyOS_Sans_SC/HarmonyOS_Sans_SC_Medium.woff b/src/styles/HarmonyOS_Sans_SC/HarmonyOS_Sans_SC_Medium.woff deleted file mode 100644 index 0ba379afc9b8c643898894a6a7a23076d286aaa5..0000000000000000000000000000000000000000 Binary files a/src/styles/HarmonyOS_Sans_SC/HarmonyOS_Sans_SC_Medium.woff and /dev/null differ diff --git a/src/styles/HarmonyOS_Sans_SC/HarmonyOS_Sans_SC_Medium.woff2 b/src/styles/HarmonyOS_Sans_SC/HarmonyOS_Sans_SC_Medium.woff2 deleted file mode 100644 index d44a28aa609934818b770341d831f566b8b86eb6..0000000000000000000000000000000000000000 Binary files a/src/styles/HarmonyOS_Sans_SC/HarmonyOS_Sans_SC_Medium.woff2 and /dev/null differ diff --git a/src/styles/HarmonyOS_Sans_SC/HarmonyOS_Sans_SC_Thin.woff b/src/styles/HarmonyOS_Sans_SC/HarmonyOS_Sans_SC_Thin.woff deleted file mode 100644 index 650c30466f3378e4e324577b1e4712eeb0ccb1a5..0000000000000000000000000000000000000000 Binary files a/src/styles/HarmonyOS_Sans_SC/HarmonyOS_Sans_SC_Thin.woff and /dev/null differ diff --git a/src/styles/HarmonyOS_Sans_SC/HarmonyOS_Sans_SC_Thin.woff2 b/src/styles/HarmonyOS_Sans_SC/HarmonyOS_Sans_SC_Thin.woff2 deleted file mode 100644 index 37cf9b3340aa41594bc305868a47e54085771a6e..0000000000000000000000000000000000000000 Binary files a/src/styles/HarmonyOS_Sans_SC/HarmonyOS_Sans_SC_Thin.woff2 and /dev/null differ diff --git a/src/styles/app.scss b/src/styles/app.scss index 3079cf0aa52e1287f7007eb09dc27582e5b0aedd..4f3f02b6a5839efafacccd7b0af950097a1a2a3c 100644 --- a/src/styles/app.scss +++ b/src/styles/app.scss @@ -14,7 +14,7 @@ body, width: 100%; min-width: 600px; overflow-y: auto; - background: url('/src/assets/images/login-background-light.png') center/100% 100%; + background: url('/src/assets/images/login-background-light.webp') center/100% 100%; } .main-container { diff --git a/src/styles/knowledgeFile.scss b/src/styles/knowledgeFile.scss index 3b4cc149e7e12d376f90732016c41cddc85bc747..4c3e9c3a8e25faf9b789aec4368fae4bfaaee73c 100644 --- a/src/styles/knowledgeFile.scss +++ b/src/styles/knowledgeFile.scss @@ -282,7 +282,8 @@ .statusAnalysisText { font-size: 12px; - font-family: 'HarmonyOS Sans SC Medium'; + font-family: 'HarmonyOS Sans SC Regular'; + font-weight: 500; margin-left: 2px; color: rgb(0 0 0); } diff --git a/src/styles/knowledgeLibrary.scss b/src/styles/knowledgeLibrary.scss index 8f1ec23cb8386cb34961b20d83829d1651b16c93..2e72c0cd8244857711143c2f0fb977c92cbedf73 100644 --- a/src/styles/knowledgeLibrary.scss +++ b/src/styles/knowledgeLibrary.scss @@ -240,7 +240,9 @@ } .kl-file-num { - font-family: 'HarmonyOS Sans SC Bold'; + font-size: 14px; + font-family: 'HarmonyOS Sans SC Regular'; + font-weight: 700; } } @@ -265,7 +267,8 @@ } .id-label { - font-family: 'HarmonyOS Sans SC Bold'; + font-family: 'HarmonyOS Sans SC Regular'; + font-weight: 700; } } } diff --git a/src/styles/reset.scss b/src/styles/reset.scss index 374396ba7c963bf787f369381c148968ed9c0422..343469a0afca43aa8ffc73ffe3608ec71d5adf6a 100644 --- a/src/styles/reset.scss +++ b/src/styles/reset.scss @@ -1,21 +1,3 @@ -@font-face { - font-family: 'HarmonyOS Sans SC Thin'; - src: - url(./HarmonyOS_Sans_SC/HarmonyOS_Sans_SC_Thin.woff2) format('woff2'), - url(./HarmonyOS_Sans_SC/HarmonyOS_Sans_SC_Thin.woff) format('woff'); - font-weight: 100; - font-style: normal; -} - -@font-face { - font-family: 'HarmonyOS Sans SC Light'; - src: - url(./HarmonyOS_Sans_SC/HarmonyOS_Sans_SC_Light.woff2) format('woff2'), - url(./HarmonyOS_Sans_SC/HarmonyOS_Sans_SC_Light.woff) format('woff'); - font-weight: 300; - font-style: normal; -} - @font-face { font-family: 'HarmonyOS Sans SC Regular'; src: @@ -25,88 +7,6 @@ font-style: normal; } -@font-face { - font-family: 'HarmonyOS Sans SC Medium'; - src: - url(./HarmonyOS_Sans_SC/HarmonyOS_Sans_SC_Medium.woff2) format('woff2'), - url(./HarmonyOS_Sans_SC/HarmonyOS_Sans_SC_Medium.woff) format('woff'); - font-weight: 500; - font-style: normal; -} - -@font-face { - font-family: 'HarmonyOS Sans SC Bold'; - src: - url(./HarmonyOS_Sans_SC/HarmonyOS_Sans_SC_Bold.woff2) format('woff2'), - url(./HarmonyOS_Sans_SC/HarmonyOS_Sans_SC_Bold.woff) format('woff'); - font-weight: 700; - font-style: normal; -} - -@font-face { - font-family: 'HarmonyOS Sans SC Black'; - src: - url(./HarmonyOS_Sans_SC/HarmonyOS_Sans_SC_Black.woff2) format('woff2'), - url(./HarmonyOS_Sans_SC/HarmonyOS_Sans_SC_Black.woff) format('woff'); - font-weight: 900; - font-style: normal; -} - -/* 鸿蒙西文字体 */ -@font-face { - font-family: 'HarmonyOS Sans En Thin'; - src: - url(./HarmonyOS_Sans/HarmonyOS_Sans_Thin.woff2) format('woff2'), - url(./HarmonyOS_Sans/HarmonyOS_Sans_Thin.woff) format('woff'); - font-weight: 100; - font-style: normal; -} - -@font-face { - font-family: 'HarmonyOS Sans En Light'; - src: - url(./HarmonyOS_Sans/HarmonyOS_Sans_Light.woff2) format('woff2'), - url(./HarmonyOS_Sans/HarmonyOS_Sans_Light.woff) format('woff'); - font-weight: 300; - font-style: normal; -} - -@font-face { - font-family: 'HarmonyOS Sans En Regular'; - src: - url(./HarmonyOS_Sans/HarmonyOS_Sans_Regular.woff2) format('woff2'), - url(./HarmonyOS_Sans/HarmonyOS_Sans_Regular.woff) format('woff'); - font-weight: 400; - font-style: normal; -} - -@font-face { - font-family: 'HarmonyOS Sans En Medium'; - src: - url(./HarmonyOS_Sans/HarmonyOS_Sans_Medium.woff2) format('woff2'), - url(./HarmonyOS_Sans/HarmonyOS_Sans_Medium.woff) format('woff'); - font-weight: 500; - font-style: normal; -} - -@font-face { - font-family: 'HarmonyOS Sans En Bold'; - src: - url(./HarmonyOS_Sans/HarmonyOS_Sans_Bold.woff2) format('woff2'), - url(./HarmonyOS_Sans/HarmonyOS_Sans_Bold.woff) format('woff'); - font-weight: 700; - font-style: normal; -} - -@font-face { - font-family: 'HarmonyOS Sans En Black'; - src: - url(./HarmonyOS_Sans/HarmonyOS_Sans_Black.woff2) format('woff2'), - url(./HarmonyOS_Sans/HarmonyOS_Sans_Black.woff) format('woff'); - font-weight: 900; - font-style: normal; -} - ::before, ::after { box-sizing: border-box; @@ -133,9 +33,10 @@ body { :root { --el-font-family: - 'HarmonyOS Sans SC Medium', -apple-system, blinkmacsystemfont, 'Segoe UI', roboto, + 'HarmonyOS Sans SC Regular', -apple-system, blinkmacsystemfont, 'Segoe UI', roboto, 'Helvetica Neue', arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji' !important; + font-weight: 500; } html, @@ -145,7 +46,7 @@ button, .is-selected { margin: 0; font-family: - 'HarmonyOS Sans SC Medium', + 'HarmonyOS Sans SC Regular', -apple-system, BlinkMacSystemFont, 'Segoe UI', @@ -158,6 +59,7 @@ button, 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji' !important; + font-weight: 500; line-height: inherit; -moz-osx-font-smoothing: grayscale; -webkit-font-smoothing: antialiased; @@ -445,7 +347,7 @@ div:focus { } .el-select-dropdown__item { - font-family: 'HarmonyOS Sans SC Medium' !important; + font-family: 'HarmonyOS Sans SC Regular' !important; font-size: 12px; font-weight: unset !important; } diff --git a/src/utils/request.ts b/src/utils/request.ts index ca84c17e9a1eba768f785d82f31fe1dadf4dbbe6..ec9146babd186d031265488577f20d6f1b55a537 100644 --- a/src/utils/request.ts +++ b/src/utils/request.ts @@ -5,6 +5,7 @@ import { TOKEN_KEY } from '@/enums/CacheEnum'; import qs from 'qs'; import i18n from '@/lang/index'; import { IconError } from '@computing/opendesign-icons'; +import { useAppStore } from '@/store/modules/app'; // 创建 axios 实例 const service = axios.create({ @@ -22,10 +23,15 @@ const service = axios.create({ // 请求拦截器 service.interceptors.request.use( (config: InternalAxiosRequestConfig) => { + const appStore = useAppStore(); + const { parentToken } = storeToRefs(appStore); const accessToken = localStorage.getItem(TOKEN_KEY); if (accessToken) { config.headers.Authorization = accessToken; } + if (parentToken.value) { + config.headers['Authorization'] = `Bearer ${parentToken.value}`; + } return config; }, (error: any) => { diff --git a/src/views/knowledgeFile/index.vue b/src/views/knowledgeFile/index.vue index f6ecb394b87569da9a1fde7f60c09c0949650b96..9d265f9c91294e3e80cd97aadbc134c2289aeff9 100644 --- a/src/views/knowledgeFile/index.vue +++ b/src/views/knowledgeFile/index.vue @@ -1108,6 +1108,20 @@ const handleStartPollTimer = () => { pollingKfTimer.value = setInterval(() => handlePollAssetFileData(), 15000); }; +// 添加postMessage监听器 +const handleMessage = (event: MessageEvent) => { + if(event.data?.type!=='changeActive'){ + return; + } + if (event.data && typeof event.data.StopActive !== 'undefined') { + if (event.data.StopActive) { + handleCleartTimer(); + } else { + handleStartPollTimer(); + } + } +}; + onMounted(() => { const kbId = route.query.kb_id; if (kbId?.length) { @@ -1128,6 +1142,9 @@ onMounted(() => { handleQueryKbData(); } document.addEventListener('click', () => handleDateTimerange); + + // 添加postMessage事件监听 + window.addEventListener('message', handleMessage); }); const handleCleartTimer = () => { @@ -1137,6 +1154,8 @@ const handleCleartTimer = () => { onUnmounted(() => { handleCleartTimer(); + // 移除postMessage事件监听 + window.removeEventListener('message', handleMessage); }); const handleVisibleChange = (e: boolean) => { diff --git a/src/views/login/index.vue b/src/views/login/index.vue index fe48f4a756722d3e6a1aae5537e30dab75f19da8..0a7d8d02711baed21470468d72cf0701b977e47f 100644 --- a/src/views/login/index.vue +++ b/src/views/login/index.vue @@ -459,25 +459,6 @@ const handleSigInSubmit = () => { }); }; -/** - * 处理接postmessage收到的数据,根据消息中的语言设置应用语言。 - * 该函数会根据接收到的语言代码更新应用的语言设置,并将其存储在本地存储中。 - */ -const handleMessage = (e: MessageEvent) => { - const langObj = { - CN: 'zh', - EN: 'en', - }; - let lang: string = langObj[e.data.lang as keyof typeof langObj]; - locale.value = lang; - appStore.changeLanguage(lang); - localStorage.setItem('language', lang); -}; - -onMounted(() => { - window.addEventListener('message', handleMessage); -}); -onUnmounted(() => window.removeEventListener('message', handleMessage)); diff --git a/vite.config.ts b/vite.config.ts index 1f250add0392af0f44be60c3378731644a26a77e..3458c6b9b0bb68a5b2cf563137f38884d16fa7ae 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -208,17 +208,7 @@ export default defineConfig(({ mode }: ConfigEnv): UserConfig => { // 构建配置 build: { chunkSizeWarningLimit: 2000, // 消除打包大小超过500kb警告 - minify: 'terser', // Vite 2.6.x 以上需要配置 minify: "terser", terserOptions 才能生效 - terserOptions: { - compress: { - keep_infinity: true, // 防止 Infinity 被压缩成 1/0,这可能会导致 Chrome 上的性能问题 - drop_console: true, // 生产环境去除 console - drop_debugger: true, // 生产环境去除 debugger - }, - format: { - comments: false, // 删除注释 - }, - }, + minify: 'esbuild', rollupOptions: { output: { // 用于从入口点创建的块的打包输出格式[name]表示文件名,[hash]表示该文件内容hash值