emits('click', el)" />
-
+
diff --git a/app/.vitepress/src/i18n/feedback/feedback-en.ts b/app/.vitepress/src/i18n/feedback/feedback-en.ts
index 6d541eba460d02a81238011b4596986d2c4084d9..f42505987dcd2add341b6a1a15a6759ba5de8e66 100644
--- a/app/.vitepress/src/i18n/feedback/feedback-en.ts
+++ b/app/.vitepress/src/i18n/feedback/feedback-en.ts
@@ -28,6 +28,7 @@ export default {
bugDescriptionPlaceholder: 'Describe the bug so that we can quickly locate the problem.',
bugPostPrivacyPolicy: 'By submitting your content, you fully understand and agree to the openEuler',
privacyPolicy: 'Privacy Policy',
+ input: 'Enter here.',
wantSubmitMark: 'Rate Now',
confirmTitle: 'Confirm',
diff --git a/app/.vitepress/src/i18n/feedback/feedback-zh.ts b/app/.vitepress/src/i18n/feedback/feedback-zh.ts
index 504f1f2a8c4cebd29bb85219d5ecc2ed680271d0..840a99c8c39940fe6cd4ebef3006a1f83f2731cc 100644
--- a/app/.vitepress/src/i18n/feedback/feedback-zh.ts
+++ b/app/.vitepress/src/i18n/feedback/feedback-zh.ts
@@ -28,6 +28,7 @@ export default {
bugDescriptionPlaceholder: '点击输入详细问题描述,以帮助我们快速定位问题',
bugPostPrivacyPolicy: '您理解并同意,您填写并提交的内容,即视为您已充分阅读并同意openEuler的',
privacyPolicy: '《隐私政策》',
+ input: '请输入',
wantSubmitMark: '我要评分',
confirmTitle: '确定',
diff --git a/app/.vitepress/src/views/home/TheHome.vue b/app/.vitepress/src/views/home/TheHome.vue
index 44f56c87cf922cbd8a5a58120ddce6206cbc9d57..17aab9749bca0fdcac29ab0ec10efb96a9566d5b 100644
--- a/app/.vitepress/src/views/home/TheHome.vue
+++ b/app/.vitepress/src/views/home/TheHome.vue
@@ -37,7 +37,13 @@ const gap = computed(() => {
// -------------------- 搜索 --------------------
const searchValue = ref('');
+
+const getSearchUrl = (val: string) => {
+ return `${import.meta.env.VITE_MAIN_DOMAIN_URL}/${locale.value}/other/search/?search=${val.trim()}&type=docs&version=${searchStore.version}`;
+}
+
const enterSearchDoc = (val: string) => {
+ clearTimeout(timer);
if (!val.trim()) {
return;
}
@@ -46,13 +52,15 @@ const enterSearchDoc = (val: string) => {
lastRecommendCanceler('cancel');
}
- const url = `${import.meta.env.VITE_MAIN_DOMAIN_URL}/${locale.value}/other/search/?search=${val.trim()}&type=docs&version=${searchStore.version}`;
- window.open(url, '_blank');
+ window.open(getSearchUrl(val), '_blank');
showSearchWord.value = false;
};
-const hotSearch = (val: string) => {
- enterSearchDoc(val);
+const onClikHotWord = () => {
+ if (lastRecommendCanceler) {
+ lastRecommendCanceler('cancel');
+ }
+ showSearchWord.value = false;
};
// -------------------- 联想关键词 --------------------
@@ -171,7 +179,7 @@ const cardListComputed = computed(() => (locale.value === 'en' ? cardList.slice(
{{ t('home.topSearch') }}
- {{ item }}
+ {{ item }}
diff --git a/app/.vitepress/src/views/search/TheSearchResult.vue b/app/.vitepress/src/views/search/TheSearchResult.vue
index 41c08c83c621d63142ab843381d7cb979e5c9d94..c8badd748bd92a26b36ff027e87935eb948af1cf 100644
--- a/app/.vitepress/src/views/search/TheSearchResult.vue
+++ b/app/.vitepress/src/views/search/TheSearchResult.vue
@@ -17,6 +17,7 @@ import { useLocale } from '@/composables/useLocale';
import { useSearchingStore } from '@/stores/common';
import { scrollToTop } from '@/utils/common';
import { useNodeStore } from '@/stores/node';
+import { useViewStore } from '@/stores/view';
const props = defineProps({
// 菜单数据
@@ -32,6 +33,7 @@ const { t, locale } = useLocale();
const searchStore = useSearchingStore();
const { isPhone } = useScreen();
const nodeStore = useNodeStore();
+const viewStore = useViewStore();
// n叉树
const tree = computed(() => {
@@ -47,30 +49,6 @@ const pageSizes = ref([10, 20, 50]);
// 是否加载loading
const isLoading = ref(false);
-const searchPath = computed(() => {
- const arr = route.path.split('/');
- let url = '';
- // 根节点
- if (arr.length === 3) {
- url = arr[arr.length - 1].replace('.html', '');
- } else {
- url = arr.slice(2, arr.length - 1).join('/');
- }
- return `${url}`;
-});
-
-//搜索参数
-const searchParams = computed(() => {
- const version = route.path.split('/')?.[3] || searchStore.version;
- return {
- keyword: searchStore.keyword,
- lang: locale.value,
- page: currentPage.value,
- version: version,
- path: searchPath.value,
- };
-});
-
// ----------------------- 监听是否加载loading -----------------------
watch(
() => searchStore.isLoading,
@@ -84,30 +62,37 @@ watch(
const searchResult = async () => {
try {
searchStore.setIsLoading(true);
- const res = await getSearchDocs(searchParams.value);
+ const url = (viewStore.isOverview ? nodeStore.moduleNode?.href : nodeStore.manualNode?.href) || route.path;
+ const res = await getSearchDocs({
+ keyword: searchStore.keyword,
+ lang: locale.value,
+ page: currentPage.value,
+ version: route.path.split('/')?.[3] || searchStore.version,
+ path: url.replace(`/${locale.value}/`, ''),
+ });
let records: SearchDocItemT[] = [];
if (res.status == 200) {
records = res.obj.records;
- }
- records.map((item) => {
- if (item.path) {
- item.path = `/${item.path}.html`;
+ records.map((item) => {
+ if (item.path) {
+ item.path = `/${item.path}.html`;
- let pathTempData = [];
+ let pathTempData = [];
- let node = tree.value.getNode(tree.value.root, 'href', item.path);
+ let node = tree.value.getNode(tree.value.root, 'href', item.path);
- if (node) {
- while (node && node.depth !== 0 && node.parent) {
- pathTempData.unshift(node);
- node = node?.parent;
+ if (node) {
+ while (node && node.depth !== 0 && node.parent) {
+ pathTempData.unshift(node);
+ node = node?.parent;
+ }
}
- }
- item.sourceData = pathTempData.slice(pathTempData.length - 1);
- }
- });
+ item.sourceData = pathTempData.slice(pathTempData.length - 1);
+ }
+ });
+ }
result.value = records;
total.value = res?.obj?.count || 0;
@@ -170,9 +155,11 @@ const goToPage = (href: string) => {
- {{ t('common.docCenter') }}
+ {{ t('common.docCenter') }}
- {{ nodeStore.moduleNode!!.label }}
+ {{
+ nodeStore.moduleNode!!.label
+ }}
{{ node.label }}