fix: 修复issue

This commit is contained in:
@user8949
2025-03-18 20:20:37 +08:00
parent 166a5bcdfd
commit af1ce0d1bf
6 changed files with 174 additions and 64 deletions

View File

@@ -37,7 +37,7 @@
<template #append>
<div class="advanced-search" @click="openAdvancedSearch">
<span>高级筛选</span>
<d-badge :count="5" :bg-color="'#f0f0f0'"></d-badge>
<d-badge :count="6" :bg-color="'#f0f0f0'"></d-badge>
<d-icon :rotate="rotate" name="icon-chevron-down-2"></d-icon>
</div>
</template>
@@ -68,11 +68,14 @@
<d-timeline-item v-for="(item, index) in infoList" :key="index"
:dot-color="item.dotColor" :line-color="'var(--devui-form-control-line-hover)'">
<template #default>
<div style="display: flex; justify-content: space-between;">
<div class="cursor-pointer" @click="openWarningDetail(item.text, index)">{{ item.text }}</div>
<div style="display: flex; align-items: center; gap: 8px;">
<div class="flex items-center justify-between w-full">
<div class="cursor-pointer notice-content flex gap-2 items-center" @click="openWarningDetail(item, index)">
<span>{{ item.subject }}</span>
<d-tag :color="tagMap[item.importance]" size="sm">{{ item.importance }}</d-tag>
</div>
<div class="time-container">
<d-icon name="icon-time"></d-icon>
{{ item.time }}
{{ item.pulishTime }}
</div>
</div>
</template>
@@ -85,12 +88,18 @@
</div>
</div>
</div>
<d-modal class="warning-modal" v-model="warningModalVisable" title="主题:" style="width: 600px;">
<EarlyWarningDetail :warningData="currentWarning" :type="'user'"></EarlyWarningDetail>
</d-modal>
</template>
<script setup lang="ts">
import { ref, onMounted, onBeforeUnmount } from 'vue';
import { useRoute, useRouter } from 'vue-router';
import AdvanceSearch from '@/components/AdvanceSearch/index.vue';
import { getHomeNoticeList } from '@/api/jyh'
import EarlyWarningDetail from '@/views/Jyh/PersonalCenter/Detail/EarlyWarningDetail.vue';
const route = useRoute();
const router = useRouter();
@@ -98,36 +107,22 @@ const inputGlow = ref(false);
const searchStr = ref('');
const position = ref(['right-start', 'right-end']);
const industryOptions = ref(['通信', '军工', '金融', '能源'])
const searchType = ref('组件/软件');
const searchOptions = ref(['组件/软件']);
const offset = ref({ mainAxis: 7 , crossAxis: -10 });
const isOpen = ref(false);
const rotate = ref(0);
const cateRotate = ref(0);
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',
},
])
const infoList = ref([])
const warningModalVisable = ref(false);
const currentWarning = ref();
const homeSearch = ref(null);
const dropdownWidth = ref(0);
const selectedCate = ref('组件/软件');
const tagMap = {
'高': '#f66f6a',
'中': '#fac20a',
'低': '#5e7ce0'
}
const searchInput = ref(null);
const openAdvancedSearch = () => {
@@ -149,7 +144,7 @@ const closeOutside = () => {
const submit = (formData) => {
isOpen.value = false;
router.push({ name: 'Search', query: { ...formData, searchType: selectedCate.value }});
router.push({ name: 'Search', query: { searchWord: searchStr, ...formData, searchType: selectedCate.value}});
};
const inputFocus = () => {
@@ -167,7 +162,7 @@ const updateDropdownWidth = () => {
};
const search = () => {
router.push({ name: 'Search', query: { val: searchStr.value || '', type: route?.query?.type || 'License' }});
router.push({ name: 'Search', query: { searchWord: searchStr.value, searchType: selectedCate.value}});
};
const onCategoryChange = (cate) => {
@@ -190,6 +185,9 @@ const openWarningDetail = (event, index) => {
item.dotColor = '';
}
})
warningModalVisable.value = true;
currentWarning.value = event;
}
let resizeObserver: ResizeObserver | null = null;
@@ -209,6 +207,15 @@ onBeforeUnmount(() => {
}
});
const getNoticeList = async() => {
const res:any = await getHomeNoticeList();
if (!res.error) {
infoList.value = res.data.data;
}
}
getNoticeList();
</script>
<style scoped lang="scss">
@@ -381,4 +388,37 @@ onBeforeUnmount(() => {
font-size: 14px;
font-weight: 500;
}
.notice-content {
flex: 1;
overflow: hidden;
margin-right: 8px;
span {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
display: block;
}
}
.time-container {
display: flex;
align-items: center;
gap: 8px;
width: 120px;
flex-shrink: 0;
}
:deep(.devui-timeline-item-data-right) {
width: 80%;
}
</style>
<style>
.warning-modal {
.devui-modal__body {
padding: 0px !important;
}
}
</style>