This commit is contained in:
汪少伟
2025-03-21 10:30:37 +08:00
parent cc87314dcb
commit 125f781ac5
2 changed files with 62 additions and 46 deletions

View File

@@ -87,9 +87,12 @@
@click="openWarningDetail(item, index)" @click="openWarningDetail(item, index)"
> >
<span>{{ item.subject }}</span> <span>{{ item.subject }}</span>
<d-tag v-if="item.importance" :color="tagMap[item.importance].color" size="sm">{{ <d-tag
tagMap[item.importance].text v-if="item.importance && tagMap[item.importance]"
}}</d-tag> :color="tagMap[item.importance].color"
size="sm"
>{{ tagMap[item.importance].text }}</d-tag
>
</div> </div>
<div class="time-container"> <div class="time-container">
<d-icon name="icon-time"></d-icon> <d-icon name="icon-time"></d-icon>
@@ -144,19 +147,19 @@ const { isLogin } = useDiscussGetUserInfo();
const homeSearch = ref(null); const homeSearch = ref(null);
const dropdownWidth = ref(0); const dropdownWidth = ref(0);
const tagMap = { const tagMap = {
Critical: { critical: {
text: '致命', text: '致命',
color: '#c7000b' color: '#c7000b'
}, },
High: { high: {
text: '高', text: '高',
color: '#f66f6a' color: '#f66f6a'
}, },
Medium: { medium: {
text: '中', text: '中',
color: '#fac20a' color: '#fac20a'
}, },
Low: { low: {
text: '低', text: '低',
color: '#5e7ce0' color: '#5e7ce0'
} }
@@ -184,9 +187,11 @@ const closeOutside = () => {
}; };
const submit = (formData) => { const submit = (formData) => {
debugger debugger;
isOpen.value = false; isOpen.value = false;
router.push({ name: 'Search', query: { router.push({
name: 'Search',
query: {
softwareName: searchStr.value ? searchStr.value : '', softwareName: searchStr.value ? searchStr.value : '',
searchType: getIndustryValue(searchType.value), searchType: getIndustryValue(searchType.value),
softwareVersion: formData.softwareVersion || '', softwareVersion: formData.softwareVersion || '',
@@ -195,9 +200,10 @@ const submit = (formData) => {
industry: formData.industry || '', industry: formData.industry || '',
licenseName: formData.licenseName || '', licenseName: formData.licenseName || '',
dependentSoftware: formData.dependentSoftware || '', dependentSoftware: formData.dependentSoftware || '',
releaseDateStart: formData.dateRange&&formData.dateRange.length>0?formData.dateRange[0]:'', releaseDateStart: formData.dateRange && formData.dateRange.length > 0 ? formData.dateRange[0] : '',
releaseDateEnd: formData.dateRange&&formData.dateRange.length>0?formData.dateRange[1]:'', releaseDateEnd: formData.dateRange && formData.dateRange.length > 0 ? formData.dateRange[1] : ''
} }); }
});
}; };
const inputFocus = () => { const inputFocus = () => {
@@ -216,15 +222,19 @@ const updateDropdownWidth = () => {
const globalInfo = useGlobalInfoStore(); const globalInfo = useGlobalInfoStore();
const industryList = globalInfo.industryList; const industryList = globalInfo.industryList;
const getIndustryValue = (name) => { const getIndustryValue = (name) => {
const industry = industryList.find(item => item.name === name); const industry = industryList.find((item) => item.name === name);
return industry ? industry.value : ''; // 如果找不到,返回默认值 return industry ? industry.value : ''; // 如果找不到,返回默认值
}; };
const search = () => { const search = () => {
// updateHeaderSearch({ searchWord: searchStr.value, searchType: selectedCate.value }); // updateHeaderSearch({ searchWord: searchStr.value, searchType: selectedCate.value });
router.push({ name: 'Search', query: { router.push({
name: 'Search',
query: {
softwareName: searchStr.value ? searchStr.value : '', softwareName: searchStr.value ? searchStr.value : '',
searchType: getIndustryValue(searchType.value)} }); searchType: getIndustryValue(searchType.value)
}
});
// window.open(`${import.meta.env.VITE_BASE_URL}repoList?softwareName=${searchStr.value ? searchStr.value : ''}&searchType=${getIndustryValue(searchType.value)}`, '_blank') // window.open(`${import.meta.env.VITE_BASE_URL}repoList?softwareName=${searchStr.value ? searchStr.value : ''}&searchType=${getIndustryValue(searchType.value)}`, '_blank')
}; };

View File

@@ -1,26 +1,33 @@
<template> <template>
<div class="warning-detail-container"> <div class="warning-detail-container">
<div class="warning-title"> <div class="warning-title">
<div style="padding-right: 20px;">{{ warningData.subject }}</div> <div style="padding-right: 20px">{{ warningData.subject }}</div>
<div class="sub-title mt-3"> <div class="sub-title mt-3">
<div> <div>
<span>重要性</span> <span>重要性</span>
<d-tag size="sm" :color="tagMap[warningData.importance]?.color">{{tagMap[warningData.importance]?.text}}</d-tag> <d-tag v-if="tagMap[warningData.importance]" size="sm" :color="tagMap[warningData.importance]?.color">{{
tagMap[warningData.importance]?.text
}}</d-tag>
</div> </div>
<div v-if="propsData.type === 'system'"> <div v-if="propsData.type === 'system'">
<d-button v-show="mode === 'readonly'" class="edit-btn" icon="icon-edit" variant="text" title="编辑" @click="handleModeChange"/> <d-button
v-show="mode === 'readonly'"
class="edit-btn"
icon="icon-edit"
variant="text"
title="编辑"
@click="handleModeChange"
/>
<d-button v-show="mode === 'editonly'" class="edit-btn" @click="handleModeChange">预览</d-button> <d-button v-show="mode === 'editonly'" class="edit-btn" @click="handleModeChange">预览</d-button>
</div> </div>
</div> </div>
</div> </div>
<div class="warning-text"> <div class="warning-text">
<d-editor-md <d-editor-md v-model="warningData.overview" :mode="mode" :toolbar-config="toolbarConfig"></d-editor-md>
v-model="warningData.overview" </div>
:mode="mode" <div :style="{ 'border-radius': propsData.type === 'user' ? '6px' : 0 }" class="warning-from">
:toolbar-config="toolbarConfig" {{ warningData.group }} {{ warningData.publishTime }}
></d-editor-md>
</div> </div>
<div :style="{'border-radius': propsData.type === 'user' ? '6px' : 0}" class="warning-from">{{warningData.group}} {{ warningData.publishTime }}</div>
<div v-if="propsData.type === 'system'" class="warning-operation"> <div v-if="propsData.type === 'system'" class="warning-operation">
<d-button @click="confirm" variant="solid" class="mr-2">确定</d-button> <d-button @click="confirm" variant="solid" class="mr-2">确定</d-button>
<d-button @click="$emit('close')">取消</d-button> <d-button @click="$emit('close')">取消</d-button>
@@ -33,48 +40,48 @@ import { ref } from 'vue';
const emit = defineEmits(['close']); const emit = defineEmits(['close']);
const propsData = defineProps(['type', 'warningData']); const propsData = defineProps(['type', 'warningData']);
const warningData = ref({}); const warningData: any = ref({});
const toolbarConfig = [ const toolbarConfig = [
['undo', 'redo'], ['undo', 'redo'],
['h1', 'h2', 'bold', 'italic', 'strike', 'underline', 'color', 'font'], ['h1', 'h2', 'bold', 'italic', 'strike', 'underline', 'color', 'font'],
['ul', 'ol', 'checklist', 'code', 'link', 'image', 'table'], ['ul', 'ol', 'checklist', 'code', 'link', 'image', 'table']
]; ];
const tagMap = { const tagMap = {
'致命': { 致命: {
text: '致命', text: '致命',
color: '#c7000b' color: '#c7000b'
}, },
'高': { : {
text: '高', text: '高',
color: '#f66f6a' color: '#f66f6a'
}, },
'中': { : {
text: '中', text: '中',
color: '#fac20a' color: '#fac20a'
}, },
'低': { : {
text: '低', text: '低',
color: '#5e7ce0' color: '#5e7ce0'
}, },
'Critical': { critical: {
text: '致命', text: '致命',
color: '#c7000b' color: '#c7000b'
}, },
'High': { high: {
text: '高', text: '高',
color: '#f66f6a' color: '#f66f6a'
}, },
'Medium': { medium: {
text: '中', text: '中',
color: '#fac20a' color: '#fac20a'
}, },
'Low': { low: {
text: '低', text: '低',
color: '#5e7ce0' color: '#5e7ce0'
} }
} };
const mode = ref('readonly'); const mode = ref('readonly');
console.log(propsData.warningData) console.log(propsData.warningData);
warningData.value = propsData.warningData ?? { warningData.value = propsData.warningData ?? {
subject: '【漏洞排查预警】ApacheIgnite远程代码执行漏洞排查CVE-2024-52577)', subject: '【漏洞排查预警】ApacheIgnite远程代码执行漏洞排查CVE-2024-52577)',
importance: '高', importance: '高',
@@ -112,7 +119,7 @@ const handleModeChange = () => {
.sub-title { .sub-title {
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
>div:first-of-type>span { > div:first-of-type > span {
margin-right: 12px; margin-right: 12px;
color: #808080; color: #808080;
font-family: HarmonyOS Sans SC; font-family: HarmonyOS Sans SC;
@@ -120,10 +127,10 @@ const handleModeChange = () => {
} }
} }
} }
.warning-text { .warning-text {
padding: 20px 20px 0; padding: 20px 20px 0;
background: #F6F6F8; background: #f6f6f8;
color: initial; color: initial;
:deep .dp-md-readonly { :deep .dp-md-readonly {
@@ -133,7 +140,7 @@ const handleModeChange = () => {
} }
:deep .dp-md-view { :deep .dp-md-view {
background-color: #F6F6F8; background-color: #f6f6f8;
h2 { h2 {
font-size: 1.5em; font-size: 1.5em;
@@ -141,7 +148,7 @@ const handleModeChange = () => {
} }
p { p {
color: #252B3A; color: #252b3a;
font-family: 苹方-; font-family: 苹方-;
font-size: 14px; font-size: 14px;
line-height: 24px; line-height: 24px;
@@ -150,10 +157,9 @@ const handleModeChange = () => {
} }
.text-box { .text-box {
div { div {
margin-bottom: 8px; margin-bottom: 8px;
color: #252B3A; color: #252b3a;
font-family: HarmonyOS Sans SC; font-family: HarmonyOS Sans SC;
font-weight: 600; font-weight: 600;
font-size: 16px; font-size: 16px;
@@ -161,7 +167,7 @@ const handleModeChange = () => {
} }
::v-deep .devui-textarea { ::v-deep .devui-textarea {
color: #252B3A; color: #252b3a;
font-family: 苹方-; font-family: 苹方-;
font-size: 14px; font-size: 14px;
line-height: 24px; line-height: 24px;
@@ -171,7 +177,7 @@ const handleModeChange = () => {
} }
.warning-from { .warning-from {
background: #F6F6F8; background: #f6f6f8;
color: #808080; color: #808080;
font-family: HarmonyOS Sans SC; font-family: HarmonyOS Sans SC;
font-size: 14px; font-size: 14px;
@@ -184,4 +190,4 @@ const handleModeChange = () => {
padding: 20px; padding: 20px;
} }
} }
</style> </style>