Merge remote-tracking branch 'origin/master'

This commit is contained in:
付民康
2025-03-18 20:41:01 +08:00
8 changed files with 206 additions and 37 deletions

BIN
public/static/template.xlsx Normal file

Binary file not shown.

View File

@@ -19,7 +19,7 @@ export function releasePage(data): Promise<any> {
}); });
} }
// 获取用户信息 // 获取邀请列表
export function getInviteListData(): catchRt<any> { export function getInviteListData(): catchRt<any> {
return reqCatchV2(() => request({ return reqCatchV2(() => request({
url: '/api/v1/group/member/invite/list', url: '/api/v1/group/member/invite/list',
@@ -29,7 +29,7 @@ export function getInviteListData(): catchRt<any> {
})); }));
} }
// 获取用户信息 // 处理邀请
export function acceptInvite(params): catchRt<any> { export function acceptInvite(params): catchRt<any> {
return reqCatchV2(() => request({ return reqCatchV2(() => request({
url: '/api/v1/group/member/invite/accept', url: '/api/v1/group/member/invite/accept',
@@ -39,3 +39,50 @@ export function acceptInvite(params): catchRt<any> {
customError: true customError: true
})); }));
} }
// 发送订阅
export function subscribeSoftware(params): catchRt<any> {
return reqCatchV2(() => request({
url: '/api/v1/alert/subscribe',
method: 'post',
data: params,
}, {
customError: true
}));
}
// 获取高级筛选语言列表
export function searchLanguageList() {
return request({
url: `/api/v1/repo/lan/list`,
method: 'get'
});
}
// 获取首页公告列表
export function getHomeNoticeList() {
return request({
url: '/api/v1/home/notice/list',
method: 'get',
params: {}
});
}
// 获取依赖关系列表
export function getDepencyList(softwareId: string) {
return request({
url: '/api/v1/repo/release/info',
method: 'get',
params: { softwareId: 2 }
});
}
// 获取AI修复建议
export function getRepairInfo() {
return request({
url: '/api/v1/repo/repair/info',
method: 'get',
params: {}
});
}

View File

@@ -3,7 +3,30 @@
:key="$route.path + $route.query?.val" id="golbalSearch" class="g-header-search" :key="$route.path + $route.query?.val" id="golbalSearch" class="g-header-search"
v-model.trim="searchStr" placeholder="输入搜索内容..." @keyup.enter="search" @clear="handleClear" clearable > v-model.trim="searchStr" placeholder="输入搜索内容..." @keyup.enter="search" @clear="handleClear" clearable >
<template #prepend> <template #prepend>
<d-select v-model="searchType" :options="options"></d-select> <d-dropdown @toggle="onCateToggle($event)">
<div class="flex items-center gap-1 cursor-pointer">
{{ searchType }}
<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>
</template> </template>
<template #append> <template #append>
<d-icon @click="search" name="search" style="font-size: inherit;" /> <d-icon @click="search" name="search" style="font-size: inherit;" />
@@ -19,11 +42,16 @@ import microApp from '@micro-zoe/micro-app';
const route = useRoute(); const route = useRoute();
const router = useRouter(); const router = useRouter();
const searchStr = ref(route?.query?.val || ''); const searchStr = ref(route?.query?.val || '');
const searchType = ref('License'); const searchType = ref('软件');
const options = reactive(['License']); const position = ref(['right-start', 'right-end']);
const industryOptions = ref(['通信', '军工', '金融', '能源']);
const placeholder = ref('「开搜」一搜即达开发者的AI搜索'); const placeholder = ref('「开搜」一搜即达开发者的AI搜索');
const onCategoryChange = (event) => {
searchType.value = event;
}
const search = () => { const search = () => {
if (!searchStr.value) { if (!searchStr.value) {
document.querySelector('#golbalSearch').blur(); document.querySelector('#golbalSearch').blur();
@@ -81,4 +109,23 @@ onUnmounted(() => {
width: 40px; width: 40px;
} }
} }
.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;
}
</style> </style>

View File

@@ -37,7 +37,7 @@
<template #append> <template #append>
<div class="advanced-search" @click="openAdvancedSearch"> <div class="advanced-search" @click="openAdvancedSearch">
<span>高级筛选</span> <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> <d-icon :rotate="rotate" name="icon-chevron-down-2"></d-icon>
</div> </div>
</template> </template>
@@ -68,11 +68,14 @@
<d-timeline-item v-for="(item, index) in infoList" :key="index" <d-timeline-item v-for="(item, index) in infoList" :key="index"
:dot-color="item.dotColor" :line-color="'var(--devui-form-control-line-hover)'"> :dot-color="item.dotColor" :line-color="'var(--devui-form-control-line-hover)'">
<template #default> <template #default>
<div style="display: flex; justify-content: space-between;"> <div class="flex items-center justify-between w-full">
<div class="cursor-pointer" @click="openWarningDetail(item.text, index)">{{ item.text }}</div> <div class="cursor-pointer notice-content flex gap-2 items-center" @click="openWarningDetail(item, index)">
<div style="display: flex; align-items: center; gap: 8px;"> <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> <d-icon name="icon-time"></d-icon>
{{ item.time }} {{ item.pulishTime }}
</div> </div>
</div> </div>
</template> </template>
@@ -85,12 +88,18 @@
</div> </div>
</div> </div>
</div> </div>
<d-modal class="warning-modal" v-model="warningModalVisable" title="主题:" style="width: 600px;">
<EarlyWarningDetail :warningData="currentWarning" :type="'user'"></EarlyWarningDetail>
</d-modal>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { ref, onMounted, onBeforeUnmount } from 'vue'; import { ref, onMounted, onBeforeUnmount } from 'vue';
import { useRoute, useRouter } from 'vue-router'; import { useRoute, useRouter } from 'vue-router';
import AdvanceSearch from '@/components/AdvanceSearch/index.vue'; 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 route = useRoute();
const router = useRouter(); const router = useRouter();
@@ -104,30 +113,18 @@ const offset = ref({ mainAxis: 7 , crossAxis: -10 });
const isOpen = ref(false); const isOpen = ref(false);
const rotate = ref(0); const rotate = ref(0);
const cateRotate = ref(0); const cateRotate = ref(0);
const infoList = ref([ const infoList = ref([])
{ const warningModalVisable = ref(false);
text: '公告1', const currentWarning = ref();
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 homeSearch = ref(null); const homeSearch = ref(null);
const dropdownWidth = ref(0); const dropdownWidth = ref(0);
const selectedCate = ref('软件'); const selectedCate = ref('软件');
const tagMap = {
'高': '#f66f6a',
'中': '#fac20a',
'低': '#5e7ce0'
}
const searchInput = ref(null); const searchInput = ref(null);
const openAdvancedSearch = () => { const openAdvancedSearch = () => {
@@ -149,7 +146,7 @@ const closeOutside = () => {
const submit = (formData) => { const submit = (formData) => {
isOpen.value = false; 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 = () => { const inputFocus = () => {
@@ -167,7 +164,7 @@ const updateDropdownWidth = () => {
}; };
const search = () => { 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) => { const onCategoryChange = (cate) => {
@@ -190,6 +187,9 @@ const openWarningDetail = (event, index) => {
item.dotColor = ''; item.dotColor = '';
} }
}) })
warningModalVisable.value = true;
currentWarning.value = event;
} }
let resizeObserver: ResizeObserver | null = null; let resizeObserver: ResizeObserver | null = null;
@@ -209,6 +209,15 @@ onBeforeUnmount(() => {
} }
}); });
const getNoticeList = async() => {
const res:any = await getHomeNoticeList();
if (!res.error) {
infoList.value = res.data.data;
}
}
getNoticeList();
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
@@ -381,4 +390,37 @@ onBeforeUnmount(() => {
font-size: 14px; font-size: 14px;
font-weight: 500; 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> </style>

View File

@@ -9,7 +9,7 @@
<d-input <d-input
style="width: 400px" style="width: 400px"
v-model="formData.title" v-model="formData.title"
placeholder="请输入搜索内容" placeholder="请输入软件名称"
maxLength="50" maxLength="50"
minLength="2" minLength="2"
> >
@@ -29,6 +29,8 @@
<span class="yellow">3</span> <span class="yellow">3</span>
</div> </div>
<div class="left-btn"> <div class="left-btn">
<a v-if="isLogin" class="cursor-pointer" href="/static/template.xlsx" download><i class="icon icon-download-2"></i>下载excel模板</a>
<span v-if="isLogin" style="height: 14px" class="split"></span>
<d-button v-if="isLogin" class="output-btn" icon="icon-share" variant="text">导出</d-button> <d-button v-if="isLogin" class="output-btn" icon="icon-share" variant="text">导出</d-button>
<span v-if="isLogin" style="height: 14px" class="split"></span> <span v-if="isLogin" style="height: 14px" class="split"></span>
<TableSetting :columns="columns" :show-column-list="showColumnList" @update:show-column-list="updateShowColumnList"/> <TableSetting :columns="columns" :show-column-list="showColumnList" @update:show-column-list="updateShowColumnList"/>

View File

@@ -67,6 +67,7 @@
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { ref, reactive } from 'vue'; import { ref, reactive } from 'vue';
import { getDepencyList } from '@/api/jyh'
const checked = ref(false); const checked = ref(false);
const showDetail = ref(false); const showDetail = ref(false);
const table = ref(null) const table = ref(null)
@@ -216,6 +217,11 @@ const openAll = (tree) => {
const sortNumberMethod = (a, b) => { const sortNumberMethod = (a, b) => {
return a.number > b.number return a.number > b.number
} }
const getList = async() => {
const res = await getDepencyList('APACHE-001');
}
getList();
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">

View File

@@ -20,24 +20,49 @@
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { subscribeSoftware } from '@/api/jyh';
import { computed, ref } from 'vue'; import { computed, ref } from 'vue';
import { Message } from 'vue-devui';
const props = defineProps(['softwareData']); const props = defineProps(['softwareData']);
const emit = defineEmits(['close']); const emit = defineEmits(['close']);
const formRef = ref(null); const formRef = ref(null);
const formData = ref({ const formData = ref({
subscribeType: '', subscribeType: '',
subscribeText: '',
}); });
const rules = { const rules = {
subscribeType: [{ required: true, message: '请选择', trigger: 'change' }], subscribeType: [{ required: true, message: '请选择', trigger: 'change' }],
}; };
const sendSubscribe = async () => {
const data = await subscribeSoftware({
softwareId: props.softwareData.id,
status: '1',
alertType: {
mobileSwitch: formData.value.subscribeType === '0',
emailSwitch: formData.value.subscribeType === '1',
webSwitch: formData.value.subscribeType === '2',
}
}).catch(err => {
Message({
message: err.error,
type: 'error'
})
});
if (!data?.data?.data?.data) {
Message({
message: data?.data?.data?.msg,
type: 'error'
})
} else {
emit('close');
}
}
const confirm = () => { const confirm = () => {
(formRef?.value as any)?.validate((isValid: boolean, invalidFields: any) => { (formRef?.value as any)?.validate((isValid: boolean, invalidFields: any) => {
if (!isValid) { if (!isValid) {
return; return;
} }
emit('close'); sendSubscribe();
}); });
}; };
</script> </script>

View File

@@ -37,11 +37,11 @@
<d-tabs class="jyh-tabs jyh-tabs-2" type="wrapped" v-model="selectTab"> <d-tabs class="jyh-tabs jyh-tabs-2" type="wrapped" v-model="selectTab">
<d-tab id="bbxx" title="版本信息"></d-tab> <d-tab id="bbxx" title="版本信息"></d-tab>
<d-tab id="ylgx" title="依赖关系"></d-tab> <d-tab id="ylgx" title="依赖关系"></d-tab>
<d-tab id="ldxx" title="漏洞信息"></d-tab>
<d-tab id="SBOM" title="SBOM"></d-tab> <d-tab id="SBOM" title="SBOM"></d-tab>
<d-tab id="communityInfo" title="开发者社区信息"></d-tab> <d-tab id="ldxx" title="漏洞信息"></d-tab>
<d-tab id="ai" title="AI修复建议"></d-tab> <d-tab id="ai" title="AI修复建议"></d-tab>
<d-tab id="licenseInfo" title="许可证信息"></d-tab> <d-tab id="licenseInfo" title="许可证信息"></d-tab>
<d-tab id="communityInfo" title="开发者社区信息"></d-tab>
</d-tabs> </d-tabs>
</div> </div>
<div class="version-detail-content"> <div class="version-detail-content">