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