2025-03-13 19:18:53 +08:00
|
|
|
<template>
|
|
|
|
|
<div class="home-container">
|
|
|
|
|
<div class="home-content">
|
|
|
|
|
<div class="home-title">
|
|
|
|
|
<img src="@/assets/imgs/home/home-title-logo-2x.webp" alt="logo" />
|
|
|
|
|
<h1>可信开源代码库</h1>
|
|
|
|
|
</div>
|
2025-03-14 20:03:14 +08:00
|
|
|
<div class="home-search" ref="homeSearch" :class="{ 'glow-border': inputGlow }">
|
2025-03-15 17:02:06 +08:00
|
|
|
<d-input ref="searchInput" placeholder="请输入搜索关键字" @focus="inputFocus" @blur="inputBlur" :autocomplete="'off'"
|
2025-03-14 20:03:14 +08:00
|
|
|
v-model="searchStr">
|
2025-03-13 19:18:53 +08:00
|
|
|
<template #prepend>
|
2025-03-15 17:02:06 +08:00
|
|
|
<d-dropdown @toggle="onCateToggle($event)">
|
|
|
|
|
<div class="flex items-center gap-1 cursor-pointer">
|
|
|
|
|
{{ selectedCate }}
|
|
|
|
|
<d-icon :rotate="cateRotate" name="icon-chevron-down-2"></d-icon>
|
|
|
|
|
</div>
|
|
|
|
|
<template #menu>
|
|
|
|
|
<ul class="list-menu">
|
|
|
|
|
<li class="menu-item" @click="onCategoryChange('组件/软件')">组件/软件</li>
|
|
|
|
|
<d-dropdown :position="position" :offset="0">
|
|
|
|
|
<li class="menu-item">
|
|
|
|
|
行业
|
|
|
|
|
<i class="icon icon-chevron-right"></i>
|
|
|
|
|
</li>
|
|
|
|
|
<template #menu>
|
|
|
|
|
<ul class="list-menu">
|
|
|
|
|
<li class="menu-item" v-for="option in industryOptions" @click="onCategoryChange(option)">
|
|
|
|
|
{{ option }}
|
|
|
|
|
</li>
|
|
|
|
|
</ul>
|
|
|
|
|
</template>
|
|
|
|
|
</d-dropdown>
|
|
|
|
|
</ul>
|
|
|
|
|
</template>
|
|
|
|
|
</d-dropdown>
|
2025-03-13 19:18:53 +08:00
|
|
|
</template>
|
|
|
|
|
<template #append>
|
2025-03-14 20:03:14 +08:00
|
|
|
<div class="advanced-search" @click="openAdvancedSearch">
|
2025-03-13 19:18:53 +08:00
|
|
|
<span>高级筛选</span>
|
|
|
|
|
<d-badge :count="5" :bg-color="'#f0f0f0'"></d-badge>
|
2025-03-14 20:03:14 +08:00
|
|
|
<d-icon :rotate="rotate" name="icon-chevron-down-2"></d-icon>
|
2025-03-13 19:18:53 +08:00
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
</d-input>
|
2025-03-14 20:03:14 +08:00
|
|
|
<d-dropdown-menu v-model="isOpen" :origin="searchInput?.$el" close-scope="'blank'"
|
2025-03-15 17:02:06 +08:00
|
|
|
:offset="offset" :clickOutside="closeOutside">
|
2025-03-14 20:03:14 +08:00
|
|
|
<div class="advanced-search-menu" :style="{ width: dropdownWidth + 'px'}">
|
2025-03-15 17:15:39 +08:00
|
|
|
<AdvanceSearch @submit="submit($event)" @cancel="isOpen = false" class="p-20" :layout="'vertical'">
|
2025-03-15 17:02:06 +08:00
|
|
|
<template #title>
|
|
|
|
|
<span class="title">高级筛选</span>
|
|
|
|
|
</template>
|
|
|
|
|
</AdvanceSearch>
|
2025-03-14 20:03:14 +08:00
|
|
|
</div>
|
|
|
|
|
</d-dropdown-menu>
|
|
|
|
|
<d-button color="primary" variant="solid" @click="search">搜索</d-button>
|
2025-03-13 19:18:53 +08:00
|
|
|
</div>
|
2025-03-14 20:03:14 +08:00
|
|
|
<d-button ref="origin" icon="share" class="batch-btn">批量校验</d-button>
|
2025-03-13 19:18:53 +08:00
|
|
|
<div class="home-information">
|
|
|
|
|
<div class="info-title">
|
|
|
|
|
<div class="sub-title">
|
|
|
|
|
<img src="@/assets/imgs/home/informIcon@2x.png">
|
|
|
|
|
<span>信息公示</span>
|
|
|
|
|
</div>
|
2025-03-15 17:02:06 +08:00
|
|
|
<a class="devui-link" @click="checkMore">更多 ></a>
|
2025-03-13 19:18:53 +08:00
|
|
|
</div>
|
|
|
|
|
<div class="info-content">
|
|
|
|
|
<d-timeline :direction="'vertical'" :time-position="'right'" :position="'right'">
|
2025-03-15 17:02:06 +08:00
|
|
|
<d-timeline-item v-for="(item, index) in infoList" :key="index"
|
2025-03-13 19:18:53 +08:00
|
|
|
:dot-color="item.dotColor" :line-color="'var(--devui-form-control-line-hover)'">
|
|
|
|
|
<template #default>
|
|
|
|
|
<div style="display: flex; justify-content: space-between;">
|
2025-03-15 17:27:47 +08:00
|
|
|
<div class="cursor-pointer" @click="openWarningDetail(item.text, index)">{{ item.text }}</div>
|
2025-03-13 19:18:53 +08:00
|
|
|
<div style="display: flex; align-items: center; gap: 8px;">
|
|
|
|
|
<d-icon name="icon-time"></d-icon>
|
|
|
|
|
{{ item.time }}
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
<template #time>
|
|
|
|
|
<span></span>
|
|
|
|
|
</template>
|
|
|
|
|
</d-timeline-item>
|
|
|
|
|
</d-timeline>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script setup lang="ts">
|
|
|
|
|
import { ref, onMounted, onBeforeUnmount } from 'vue';
|
2025-03-14 20:03:14 +08:00
|
|
|
import { useRoute, useRouter } from 'vue-router';
|
2025-03-14 20:35:13 +08:00
|
|
|
import AdvanceSearch from '@/components/AdvanceSearch/index.vue';
|
2025-03-13 19:18:53 +08:00
|
|
|
|
2025-03-14 20:03:14 +08:00
|
|
|
const route = useRoute();
|
|
|
|
|
const router = useRouter();
|
|
|
|
|
const inputGlow = ref(false);
|
|
|
|
|
const searchStr = ref('');
|
2025-03-15 17:02:06 +08:00
|
|
|
const position = ref(['right-start', 'right-end']);
|
|
|
|
|
const industryOptions = ref(['通信', '军工', '金融', '能源'])
|
2025-03-13 19:18:53 +08:00
|
|
|
const searchType = ref('组件/软件');
|
|
|
|
|
const searchOptions = ref(['组件/软件']);
|
2025-03-14 20:03:14 +08:00
|
|
|
const offset = ref({ mainAxis: 7 , crossAxis: -10 });
|
|
|
|
|
const isOpen = ref(false);
|
|
|
|
|
const rotate = ref(0);
|
2025-03-15 17:02:06 +08:00
|
|
|
const cateRotate = ref(0);
|
2025-03-13 19:18:53 +08:00
|
|
|
const infoList = ref([
|
|
|
|
|
{
|
|
|
|
|
text: '公告1',
|
|
|
|
|
time: '2021-10-1',
|
|
|
|
|
dotColor: 'var(--devui-info)',
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
text: '公告2',
|
|
|
|
|
time: '2021-10-2',
|
|
|
|
|
dotColor: 'var(--devui-info)',
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
text: '公告3',
|
|
|
|
|
time: '2021-10-3',
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
text: '公告4',
|
|
|
|
|
time: '2021-10-3',
|
|
|
|
|
},
|
|
|
|
|
])
|
|
|
|
|
|
2025-03-14 20:03:14 +08:00
|
|
|
const homeSearch = ref(null);
|
2025-03-13 19:18:53 +08:00
|
|
|
const dropdownWidth = ref(0);
|
2025-03-15 17:02:06 +08:00
|
|
|
const selectedCate = ref('组件/软件');
|
2025-03-14 20:03:14 +08:00
|
|
|
|
|
|
|
|
const searchInput = ref(null);
|
|
|
|
|
const openAdvancedSearch = () => {
|
|
|
|
|
isOpen.value = !isOpen.value;
|
|
|
|
|
rotate.value = isOpen.value ? 180 : 0;
|
|
|
|
|
inputGlow.value = isOpen.value;
|
|
|
|
|
};
|
|
|
|
|
|
2025-03-15 17:02:06 +08:00
|
|
|
const closeOutside = () => {
|
|
|
|
|
return false
|
|
|
|
|
}
|
|
|
|
|
|
2025-03-14 20:35:13 +08:00
|
|
|
const submit = (formData) => {
|
|
|
|
|
isOpen.value = false;
|
2025-03-15 17:02:06 +08:00
|
|
|
router.push({ name: 'Search', query: { ...formData, searchType: selectedCate.value }});
|
2025-03-14 20:35:13 +08:00
|
|
|
};
|
|
|
|
|
|
2025-03-14 20:03:14 +08:00
|
|
|
const inputFocus = () => {
|
|
|
|
|
inputGlow.value = true;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const inputBlur = () => {
|
|
|
|
|
inputGlow.value = false;
|
|
|
|
|
}
|
2025-03-13 19:18:53 +08:00
|
|
|
|
|
|
|
|
const updateDropdownWidth = () => {
|
|
|
|
|
if (homeSearch.value) {
|
2025-03-14 20:03:14 +08:00
|
|
|
dropdownWidth.value = homeSearch.value.offsetWidth * 0.85;
|
2025-03-13 19:18:53 +08:00
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
2025-03-14 20:03:14 +08:00
|
|
|
const search = () => {
|
|
|
|
|
router.push({ name: 'Search', query: { val: searchStr.value || '', type: route?.query?.type || 'License' }});
|
|
|
|
|
};
|
|
|
|
|
|
2025-03-15 17:02:06 +08:00
|
|
|
const onCategoryChange = (cate) => {
|
|
|
|
|
selectedCate.value = cate;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const onCateToggle = (event) => {
|
|
|
|
|
cateRotate.value = event ? 180 : 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const checkMore = () => {
|
|
|
|
|
router.push({ name: 'PersonalCenter' });
|
|
|
|
|
}
|
|
|
|
|
|
2025-03-15 17:27:47 +08:00
|
|
|
const openWarningDetail = (event, index) => {
|
|
|
|
|
infoList.value.forEach((item, i) => {
|
|
|
|
|
if (i <= index) {
|
|
|
|
|
item.dotColor = 'var(--devui-info)';
|
|
|
|
|
} else {
|
|
|
|
|
item.dotColor = '';
|
|
|
|
|
}
|
|
|
|
|
})
|
2025-03-15 17:02:06 +08:00
|
|
|
}
|
|
|
|
|
|
2025-03-13 19:18:53 +08:00
|
|
|
let resizeObserver: ResizeObserver | null = null;
|
|
|
|
|
|
|
|
|
|
onMounted(() => {
|
|
|
|
|
resizeObserver = new ResizeObserver(updateDropdownWidth);
|
|
|
|
|
if (homeSearch.value) {
|
|
|
|
|
resizeObserver.observe(homeSearch.value);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
updateDropdownWidth();
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
onBeforeUnmount(() => {
|
|
|
|
|
if (resizeObserver && homeSearch.value) {
|
|
|
|
|
resizeObserver.unobserve(homeSearch.value);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<style scoped lang="scss">
|
|
|
|
|
@import 'devui-theme/styles-var/devui-var.scss';
|
|
|
|
|
|
|
|
|
|
.home-container {
|
|
|
|
|
width: 100%;
|
|
|
|
|
height: 100%;
|
|
|
|
|
display: flex;
|
|
|
|
|
justify-content: center;
|
|
|
|
|
align-items: center;
|
|
|
|
|
position: relative;
|
|
|
|
|
overflow: hidden;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
.home-content {
|
|
|
|
|
font-size: 14px;
|
|
|
|
|
height: 50%;
|
|
|
|
|
width: 50%;
|
|
|
|
|
display: flex;
|
|
|
|
|
flex-direction: column;
|
|
|
|
|
justify-self: center;
|
|
|
|
|
align-items: center;
|
|
|
|
|
gap: 20px;
|
|
|
|
|
|
|
|
|
|
.home-title {
|
|
|
|
|
display: flex;
|
|
|
|
|
justify-content: center;
|
|
|
|
|
align-items: center;
|
|
|
|
|
gap: 20px;
|
|
|
|
|
h1 {
|
|
|
|
|
font-size: xx-large;
|
|
|
|
|
font-weight: bold;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
img {
|
|
|
|
|
width: 50px;
|
|
|
|
|
filter: brightness(0);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.home-search {
|
|
|
|
|
width: 100%;
|
|
|
|
|
height: 40px;
|
|
|
|
|
background-color: white;
|
|
|
|
|
border-radius: 10px;
|
|
|
|
|
display: flex;
|
|
|
|
|
justify-content: space-between;
|
|
|
|
|
align-items: center;
|
|
|
|
|
padding: 12px;
|
2025-03-14 20:03:14 +08:00
|
|
|
box-shadow: var(--devui-shadow, 0 2px 12px 0);
|
2025-03-13 19:18:53 +08:00
|
|
|
input {
|
|
|
|
|
border: none;
|
|
|
|
|
outline: none;
|
|
|
|
|
padding: 5px;
|
|
|
|
|
font-size: 14px;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.advanced-search {
|
|
|
|
|
cursor: pointer;
|
|
|
|
|
display: flex;
|
|
|
|
|
justify-content: center;
|
|
|
|
|
align-items: center;
|
|
|
|
|
gap: 8px;
|
2025-03-14 20:03:14 +08:00
|
|
|
|
|
|
|
|
&::before {
|
|
|
|
|
content: '';
|
|
|
|
|
position: absolute;
|
|
|
|
|
left: -10px;
|
|
|
|
|
top: 50%;
|
|
|
|
|
transform: translateY(-50%);
|
|
|
|
|
width: 1px;
|
|
|
|
|
height: 20px;
|
|
|
|
|
background-color: var(--devui-form-control-line, #d7d8da);
|
|
|
|
|
}
|
2025-03-13 19:18:53 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.advanced-search-menu {
|
|
|
|
|
height: 300px;
|
|
|
|
|
padding: 12px;
|
|
|
|
|
background-color: white;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.form-operation {
|
|
|
|
|
display: flex;
|
|
|
|
|
justify-content: center;
|
|
|
|
|
align-items: center;
|
|
|
|
|
gap: 8px;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.batch-btn {
|
|
|
|
|
color: $devui-aide-text;
|
|
|
|
|
width: 150px;
|
|
|
|
|
background-color: #f0f0f0;
|
|
|
|
|
border-color: $devui-aide-text;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.home-information {
|
|
|
|
|
width: 100%;
|
|
|
|
|
background-color: #f0f0f0;
|
|
|
|
|
border-radius: 10px;
|
|
|
|
|
padding: 12px;
|
|
|
|
|
|
|
|
|
|
.info-title {
|
|
|
|
|
img {
|
|
|
|
|
width: 20px;
|
|
|
|
|
}
|
|
|
|
|
display: flex;
|
|
|
|
|
justify-content: space-between;
|
|
|
|
|
.sub-title {
|
|
|
|
|
display: flex;
|
|
|
|
|
gap: 8px;
|
|
|
|
|
}
|
|
|
|
|
margin-bottom: 20px;
|
|
|
|
|
margin-left: 10px;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
:deep(.devui-timeline-item-data-left) {
|
|
|
|
|
display: none;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
:deep(.devui-timeline-item-dot) {
|
|
|
|
|
scale: 0.7;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.home-search {
|
|
|
|
|
:deep(.devui-input-slot__prepend),
|
|
|
|
|
:deep(.devui-input-slot__append),
|
|
|
|
|
:deep(.devui-input__wrapper) {
|
|
|
|
|
border: none;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
:deep(.devui-select__selection--glow-style),
|
|
|
|
|
:deep(.devui-input--glow-style) {
|
|
|
|
|
box-shadow: none !important;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2025-03-14 20:03:14 +08:00
|
|
|
.glow-border {
|
|
|
|
|
border: 1px solid var(--devui-form-control-line, #d7d8da);
|
|
|
|
|
border-color: var(--devui-form-control-line-active, #5e7ce0) !important;
|
|
|
|
|
box-shadow: 0 0 0 4px var(--devui-form-control-interactive-outline, rgba(94, 124, 224, .08));
|
|
|
|
|
transition: border-color 0.3s ease, box-shadow 0.3s ease;
|
|
|
|
|
}
|
|
|
|
|
|
2025-03-15 17:02:06 +08:00
|
|
|
.menu-item {
|
|
|
|
|
display: flex;
|
|
|
|
|
justify-content: space-between;
|
|
|
|
|
align-items: center;
|
|
|
|
|
width: 100%;
|
|
|
|
|
padding: 4px;
|
|
|
|
|
cursor: pointer;
|
|
|
|
|
&:hover {
|
|
|
|
|
background-color: var(--devui-list-item-hover-bg, #f2f5fc);
|
|
|
|
|
color: var(--devui-list-item-hover-text, #526ecc);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.list-menu {
|
|
|
|
|
padding: 8px;
|
|
|
|
|
margin: 0;
|
|
|
|
|
width: 100px;
|
|
|
|
|
}
|
2025-03-13 19:18:53 +08:00
|
|
|
|
2025-03-15 17:02:06 +08:00
|
|
|
.title {
|
|
|
|
|
font-size: 14px;
|
|
|
|
|
font-weight: 500;
|
|
|
|
|
}
|
2025-03-13 19:18:53 +08:00
|
|
|
</style>
|