From a197d63278b379d58ff76e68d4a1cf078a28e522 Mon Sep 17 00:00:00 2001 From: wuming230 <1819845645@qq.com> Date: Wed, 5 Mar 2025 17:47:49 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E6=94=B9=E6=96=87=E6=A1=A3?= =?UTF-8?q?=E6=8D=89=E8=99=AB=E5=92=8C=E8=AF=84=E5=88=86=E5=8F=8D=E9=A6=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- deploy/nginx/nginx-pro.conf | 15 + deploy/nginx/nginx-test.conf | 17 + docs/.vitepress/src/App.vue | 4 +- docs/.vitepress/src/api/api-feedback.ts | 21 + .../category/feedback/svg-icons/icon-faq.svg | 4 + .../feedback/svg-icons/icon-headset.svg | 4 + .../src/components/FloatingButton.vue | 527 +--------------- .../src/components/FloatingButtonDocs.vue | 588 ++++++++++++++++++ .../components/feedback/FeedbackSlider.vue | 36 +- .../feedback/FloatingButtonHome.vue | 249 ++++++++ docs/vite.config.ts | 3 +- 11 files changed, 929 insertions(+), 539 deletions(-) create mode 100644 docs/.vitepress/src/api/api-feedback.ts create mode 100644 docs/.vitepress/src/assets/category/feedback/svg-icons/icon-faq.svg create mode 100644 docs/.vitepress/src/assets/category/feedback/svg-icons/icon-headset.svg create mode 100644 docs/.vitepress/src/components/FloatingButtonDocs.vue create mode 100644 docs/.vitepress/src/components/feedback/FloatingButtonHome.vue diff --git a/deploy/nginx/nginx-pro.conf b/deploy/nginx/nginx-pro.conf index b5c7536..1f6451b 100644 --- a/deploy/nginx/nginx-pro.conf +++ b/deploy/nginx/nginx-pro.conf @@ -1,3 +1,4 @@ +# 登录 location ^~ /api-id/ { proxy_set_header X-Forwarded-For $http_x_real_ip; add_header X-XSS-Protection "1; mode=block"; @@ -11,3 +12,17 @@ location ^~ /api-id/ { proxy_pass https://omapi.osinfra.cn/; } + +# datastat数据 +location /api-dsapi/ { + proxy_set_header X-Forwarded-For $http_x_real_ip; + 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 "script-src 'self'; object-src 'none'; frame-src 'none'"; + add_header Cache-Control "no-cache,no-store,must-revalidate"; + add_header Pragma no-cache; + add_header Expires 0; + + proxy_pass https://dsapi.osinfra.cn/; +} diff --git a/deploy/nginx/nginx-test.conf b/deploy/nginx/nginx-test.conf index 8a06423..a445a73 100644 --- a/deploy/nginx/nginx-test.conf +++ b/deploy/nginx/nginx-test.conf @@ -1,3 +1,4 @@ +# 搜索 location ^~ /api-search/ { add_header X-XSS-Protection "1; mode=block"; add_header X-Frame-Options DENY; @@ -15,6 +16,7 @@ location ^~ /api-search/ { proxy_pass https://doc-search.test.osinfra.cn/; } +# 登录 location ^~ /api-id/ { proxy_set_header X-Forwarded-For $http_x_real_ip; add_header X-XSS-Protection "1; mode=block"; @@ -28,3 +30,18 @@ location ^~ /api-id/ { proxy_pass https://omapi.test.osinfra.cn/; } + +# datastat数据 +location /api-dsapi/ { + proxy_set_header X-Forwarded-For $http_x_real_ip; + 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 "script-src 'self'; object-src 'none'; frame-src 'none'"; + add_header Cache-Control "no-cache,no-store,must-revalidate"; + add_header Pragma no-cache; + add_header Expires 0; + + # proxy_pass https://dsapi.test.osinfra.cn/; + proxy_pass https://dsapi.osinfra.cn/; +} diff --git a/docs/.vitepress/src/App.vue b/docs/.vitepress/src/App.vue index b8c6b6a..0025a43 100644 --- a/docs/.vitepress/src/App.vue +++ b/docs/.vitepress/src/App.vue @@ -10,6 +10,7 @@ import TheHome from '@/views/home/TheHome.vue'; import AppHeader from '@/components/header/AppHeader.vue'; import AppFooter from '@/components/AppFooter.vue'; import FloatingButton from '@/components/FloatingButton.vue'; +import FloatingButtonDocs from '@/components/FloatingButtonDocs.vue'; import CookieNotice from '@/components/CookieNotice.vue'; import LayoutDoc from '@/layouts/LayoutDoc.vue'; @@ -72,7 +73,8 @@ watch( - + + diff --git a/docs/.vitepress/src/api/api-feedback.ts b/docs/.vitepress/src/api/api-feedback.ts new file mode 100644 index 0000000..840309a --- /dev/null +++ b/docs/.vitepress/src/api/api-feedback.ts @@ -0,0 +1,21 @@ +import { request } from '@/shared/axios'; +import type { AxiosResponse } from '@/shared/axios'; +interface FeedBackQueryT { + feedbackPageUrl: string; + feedbackText: string; + feedbackValue: number; +} +/** + * 满意度评分 + * @param {FeedBackQueryT} params + * @return {Object} + */ +export function postFeedback(params: FeedBackQueryT): Promise<{ + code: number; + data: string; + msg: string; + update_at: string; +}> { + const url = '/api-dsapi/query/nps?community=openeuler'; + return request.post(url, params).then((res: AxiosResponse) => res.data); +} diff --git a/docs/.vitepress/src/assets/category/feedback/svg-icons/icon-faq.svg b/docs/.vitepress/src/assets/category/feedback/svg-icons/icon-faq.svg new file mode 100644 index 0000000..bf7bfb5 --- /dev/null +++ b/docs/.vitepress/src/assets/category/feedback/svg-icons/icon-faq.svg @@ -0,0 +1,4 @@ + + + + diff --git a/docs/.vitepress/src/assets/category/feedback/svg-icons/icon-headset.svg b/docs/.vitepress/src/assets/category/feedback/svg-icons/icon-headset.svg new file mode 100644 index 0000000..aee2698 --- /dev/null +++ b/docs/.vitepress/src/assets/category/feedback/svg-icons/icon-headset.svg @@ -0,0 +1,4 @@ + + + + diff --git a/docs/.vitepress/src/components/FloatingButton.vue b/docs/.vitepress/src/components/FloatingButton.vue index b63a5c4..d6f5ccb 100644 --- a/docs/.vitepress/src/components/FloatingButton.vue +++ b/docs/.vitepress/src/components/FloatingButton.vue @@ -1,172 +1,24 @@ - + diff --git a/docs/.vitepress/src/components/feedback/FeedbackSlider.vue b/docs/.vitepress/src/components/feedback/FeedbackSlider.vue index def8fd9..352db70 100644 --- a/docs/.vitepress/src/components/feedback/FeedbackSlider.vue +++ b/docs/.vitepress/src/components/feedback/FeedbackSlider.vue @@ -5,7 +5,7 @@ import { ElSlider } from 'element-plus'; import IconClose from '~icons/app/icon-close.svg'; -// import { postFeedback } from '@/api/api-feedback'; +import { postFeedback } from '@/api/api-feedback'; import { useLocale } from '@/composables/useLocale'; const props = defineProps({ @@ -89,23 +89,23 @@ const submitFeedback = () => { feedbackValue: score.value / 10, }; - // postFeedback(params) - // .then((res) => { - // if (res.code === 200) { - // message.success({ - // content: t('space.submitSuccess'), - // }); - // } else { - // message.warning({ - // content: t('feedback.submitBusy'), - // }); - // } - // }) - // .catch(() => { - // message.warning({ - // content: t('feedback.feedbackFailed'), - // }); - // }); + postFeedback(params) + .then((res) => { + if (res.code === 200) { + message.success({ + content: t('space.submitSuccess'), + }); + } else { + message.warning({ + content: t('feedback.submitBusy'), + }); + } + }) + .catch(() => { + message.warning({ + content: t('feedback.feedbackFailed'), + }); + }); closeFeedbackPopup(); }; diff --git a/docs/.vitepress/src/components/feedback/FloatingButtonHome.vue b/docs/.vitepress/src/components/feedback/FloatingButtonHome.vue new file mode 100644 index 0000000..0faf3e6 --- /dev/null +++ b/docs/.vitepress/src/components/feedback/FloatingButtonHome.vue @@ -0,0 +1,249 @@ + + + + + diff --git a/docs/vite.config.ts b/docs/vite.config.ts index 555f425..4e5368e 100644 --- a/docs/vite.config.ts +++ b/docs/vite.config.ts @@ -13,6 +13,7 @@ export default defineConfig({ app: FileSystemIconLoader(fileURLToPath(new URL('./.vitepress/src/assets/svg-icons', import.meta.url))), home: FileSystemIconLoader(fileURLToPath(new URL('./.vitepress/src/assets/category/home/svg-icons', import.meta.url))), footer: FileSystemIconLoader(fileURLToPath(new URL('./.vitepress/src/assets/category/footer/svg-icons', import.meta.url))), + feedback: FileSystemIconLoader(fileURLToPath(new URL('./.vitepress/src/assets/category/feedback/svg-icons', import.meta.url))), }, }), basicSsl(), @@ -47,7 +48,7 @@ export default defineConfig({ server: { proxy: { '/api-dsapi/': { - target: 'https://dsapi.osinfra.cn/', + target: 'https://dsapi.test.osinfra.cn/', changeOrigin: true, rewrite: (path: string) => path.replace(/^\/api-dsapi/, ''), }, -- Gitee