首页高级搜索跳转到搜索列表逻辑修改
This commit is contained in:
@@ -17,7 +17,7 @@
|
|||||||
<template #prepend>
|
<template #prepend>
|
||||||
<d-dropdown @toggle="onCateToggle($event)">
|
<d-dropdown @toggle="onCateToggle($event)">
|
||||||
<div class="flex items-center gap-1 cursor-pointer">
|
<div class="flex items-center gap-1 cursor-pointer">
|
||||||
{{ selectedCate }}
|
{{ searchType }}
|
||||||
<d-icon :rotate="cateRotate" name="icon-chevron-down-2"></d-icon>
|
<d-icon :rotate="cateRotate" name="icon-chevron-down-2"></d-icon>
|
||||||
</div>
|
</div>
|
||||||
<template #menu>
|
<template #menu>
|
||||||
@@ -30,8 +30,8 @@
|
|||||||
</li>
|
</li>
|
||||||
<template #menu>
|
<template #menu>
|
||||||
<ul class="list-menu">
|
<ul class="list-menu">
|
||||||
<li class="menu-item" v-for="option in industryOptions" @click="onCategoryChange(option)">
|
<li class="menu-item" v-for="option in industryList" @click="onCategoryChange(option)">
|
||||||
{{ option }}
|
{{ option.name }}
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</template>
|
</template>
|
||||||
@@ -143,7 +143,6 @@ const currentWarning = ref();
|
|||||||
const { isLogin } = useDiscussGetUserInfo();
|
const { isLogin } = useDiscussGetUserInfo();
|
||||||
const homeSearch = ref(null);
|
const homeSearch = ref(null);
|
||||||
const dropdownWidth = ref(0);
|
const dropdownWidth = ref(0);
|
||||||
const selectedCate = ref('软件');
|
|
||||||
const tagMap = {
|
const tagMap = {
|
||||||
Critical: {
|
Critical: {
|
||||||
text: '致命',
|
text: '致命',
|
||||||
@@ -185,8 +184,20 @@ const closeOutside = () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const submit = (formData) => {
|
const submit = (formData) => {
|
||||||
|
debugger
|
||||||
isOpen.value = false;
|
isOpen.value = false;
|
||||||
router.push({ name: 'Search', query: { searchWord: searchStr, ...formData, searchType: selectedCate.value } });
|
router.push({ name: 'Search', query: {
|
||||||
|
softwareName: searchStr.value ? searchStr.value : '',
|
||||||
|
searchType: getIndustryValue(searchType.value),
|
||||||
|
softwareVersion: formData.softwareVersion || '',
|
||||||
|
programmingLanguage: formData.programmingLanguage || '',
|
||||||
|
interestTag: formData.interestTag || '',
|
||||||
|
industry: formData.industry || '',
|
||||||
|
licenseName: formData.licenseName || '',
|
||||||
|
dependentSoftware: formData.dependentSoftware || '',
|
||||||
|
releaseDateStart: formData.dateRange&&formData.dateRange.length>0?formData.dateRange[0]:'',
|
||||||
|
releaseDateEnd: formData.dateRange&&formData.dateRange.length>0?formData.dateRange[1]:'',
|
||||||
|
} });
|
||||||
};
|
};
|
||||||
|
|
||||||
const inputFocus = () => {
|
const inputFocus = () => {
|
||||||
@@ -202,14 +213,24 @@ const updateDropdownWidth = () => {
|
|||||||
dropdownWidth.value = homeSearch.value.offsetWidth * 0.85;
|
dropdownWidth.value = homeSearch.value.offsetWidth * 0.85;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
const globalInfo = useGlobalInfoStore();
|
||||||
const search = () => {
|
const industryList = globalInfo.industryList;
|
||||||
updateHeaderSearch({ searchWord: searchStr.value, searchType: selectedCate.value });
|
const getIndustryValue = (name) => {
|
||||||
router.push({ name: 'Search' });
|
const industry = industryList.find(item => item.name === name);
|
||||||
|
return industry ? industry.value : ''; // 如果找不到,返回默认值
|
||||||
};
|
};
|
||||||
|
|
||||||
const onCategoryChange = (cate) => {
|
const search = () => {
|
||||||
selectedCate.value = cate;
|
// updateHeaderSearch({ searchWord: searchStr.value, searchType: selectedCate.value });
|
||||||
|
router.push({ name: 'Search', query: {
|
||||||
|
softwareName: searchStr.value ? searchStr.value : '',
|
||||||
|
searchType: getIndustryValue(searchType.value)} });
|
||||||
|
// window.open(`${import.meta.env.VITE_BASE_URL}repoList?softwareName=${searchStr.value ? searchStr.value : ''}&searchType=${getIndustryValue(searchType.value)}`, '_blank')
|
||||||
|
};
|
||||||
|
|
||||||
|
const onCategoryChange = (event) => {
|
||||||
|
searchType.value = event?.name || '软件';
|
||||||
|
globalInfo.updateHeaderSearch({ softwareName: softwareName.value, searchType: event.value });
|
||||||
};
|
};
|
||||||
|
|
||||||
const onCateToggle = (event) => {
|
const onCateToggle = (event) => {
|
||||||
|
|||||||
@@ -448,13 +448,20 @@ const getLanguageList = async () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
onMounted(async() => {
|
onMounted(async() => {
|
||||||
newFormData.value.industry = route.query.searchType || '';
|
await getLanguageList();
|
||||||
newFormData.value.softwareName = route.query.softwareName || '';
|
newFormData.value.softwareName = route.query.softwareName || '';
|
||||||
|
newFormData.value.searchType = route.query.searchType || '';
|
||||||
|
newFormData.value.softwareVersion = route.query.softwareVersion || '';
|
||||||
|
newFormData.value.programmingLanguage = route.query.programmingLanguage || '';
|
||||||
|
newFormData.value.interestTag = route.query.interestTag || '';
|
||||||
|
newFormData.value.industry = route.query.searchType || '';
|
||||||
|
newFormData.value.licenseName = route.query.licenseName || '';
|
||||||
|
newFormData.value.dependentSoftware = route.query.dependentSoftware || '';
|
||||||
|
newFormData.value.dateRange = [route.query.releaseDateStart || '',route.query.releaseDateEnd || '']
|
||||||
nextTick(() => {
|
nextTick(() => {
|
||||||
getReleaseList();
|
getReleaseList();
|
||||||
})
|
})
|
||||||
// getReleaseList();
|
// getReleaseList();
|
||||||
getLanguageList();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// onMounted(() => {
|
// onMounted(() => {
|
||||||
|
|||||||
Reference in New Issue
Block a user