Merge remote-tracking branch 'origin/master'
This commit is contained in:
@@ -5,7 +5,7 @@
|
||||
<d-row :gutter="16">
|
||||
<d-col :span="8">
|
||||
<d-form-item field="name" label="软件名称">
|
||||
<d-input placeholder="请输入软件名称" v-model="formData.searchWord"/>
|
||||
<d-input placeholder="请输入软件名称" v-model="formData.softwareName"/>
|
||||
</d-form-item>
|
||||
</d-col>
|
||||
<d-col :span="8">
|
||||
@@ -37,6 +37,18 @@
|
||||
</d-form-item>
|
||||
</d-col>
|
||||
</d-row>
|
||||
<d-row :gutter="16">
|
||||
<d-col :span="8">
|
||||
<d-form-item field="interestTag" label="兴趣标签">
|
||||
<d-input v-model="formData.interestTag"/>
|
||||
</d-form-item>
|
||||
</d-col>
|
||||
<d-col :span="8">
|
||||
<d-form-item field="industry" label="行业">
|
||||
<d-input v-model="formData.industry"/>
|
||||
</d-form-item>
|
||||
</d-col>
|
||||
</d-row>
|
||||
<slot name="operation">
|
||||
<gc-form-operation style="display: flex; justify-content: center; gap: 8px;">
|
||||
<d-button style="width: 96px; height: 32px;" variant="solid" @click="submitForm">搜索</d-button>
|
||||
@@ -59,10 +71,12 @@ const props = defineProps({
|
||||
type: Object,
|
||||
default: () => ({
|
||||
licenseName: '',
|
||||
searchWord: '',
|
||||
softwareName: '',
|
||||
softwareVersion: '',
|
||||
dependentSoftware: '',
|
||||
programmingLanguage: '',
|
||||
interestTag: '',
|
||||
industry: '',
|
||||
dateRange: ['', '']
|
||||
})
|
||||
}
|
||||
@@ -91,10 +105,12 @@ const submitForm = () => {
|
||||
const cancel = () => {
|
||||
formData.value = {
|
||||
licenseName: '',
|
||||
searchWord: '',
|
||||
softwareName: '',
|
||||
softwareVersion: '',
|
||||
dependentSoftware: '',
|
||||
programmingLanguage: '',
|
||||
interestTag: '',
|
||||
industry: '',
|
||||
dateRange: ['', '']
|
||||
}
|
||||
emit('cancel');
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
<template>
|
||||
<d-input
|
||||
: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="softwareName" placeholder="请输入软件名称搜索" @clear="handleClear" clearable >
|
||||
<template #prepend>
|
||||
<d-dropdown @toggle="onCateToggle($event)">
|
||||
<d-dropdown>
|
||||
<div class="flex items-center gap-1 cursor-pointer">
|
||||
{{ searchType }}
|
||||
<d-icon :rotate="cateRotate" name="icon-chevron-down-2"></d-icon>
|
||||
@@ -37,12 +37,18 @@
|
||||
<script setup>
|
||||
import { ref, onMounted, watch, onUnmounted, reactive } from 'vue';
|
||||
import { useRoute, useRouter } from 'vue-router';
|
||||
import { useGlobalInfoStore } from '@/stores/Global';
|
||||
import microApp from '@micro-zoe/micro-app';
|
||||
|
||||
const emit = defineEmits('updateSearch');
|
||||
const globalInfo = useGlobalInfoStore();
|
||||
|
||||
const route = useRoute();
|
||||
const router = useRouter();
|
||||
const searchStr = ref(route?.query?.val || '');
|
||||
const searchType = ref('软件');
|
||||
|
||||
const softwareName = ref(globalInfo.headerSearch.softwareName);
|
||||
const searchType = ref(globalInfo.headerSearch.searchType);
|
||||
|
||||
const position = ref(['right-start', 'right-end']);
|
||||
const industryOptions = ref(['通信', '军工', '金融', '能源']);
|
||||
|
||||
@@ -50,17 +56,15 @@ const placeholder = ref('「开搜」:一搜即达,开发者的AI搜索');
|
||||
|
||||
const onCategoryChange = (event) => {
|
||||
searchType.value = event;
|
||||
globalInfo.updateHeaderSearch({ softwareName: softwareName.value, searchType: searchType.value });
|
||||
}
|
||||
|
||||
const search = () => {
|
||||
if (!searchStr.value) {
|
||||
document.querySelector('#golbalSearch').blur();
|
||||
return;
|
||||
}
|
||||
router.push({ name: 'Search', query: { searchWord: searchStr.value || '', type: route?.query?.type || 'software' }});
|
||||
window.open(`/repoList?softwareName=${softwareName.value ? softwareName.value : ''}&searchType=${searchType.value}`, '_blank')
|
||||
};
|
||||
|
||||
const handleClear = () => {
|
||||
router.push({ name: 'home' });
|
||||
globalInfo.updateHeaderSearch({ softwareName: ''.value, searchType: searchType.value });
|
||||
};
|
||||
|
||||
watch(() => route.query?.val, (newVal) => {
|
||||
@@ -70,7 +74,7 @@ watch(() => route.query?.val, (newVal) => {
|
||||
const handleDataChange = ({ name, type, data }) => {
|
||||
if (name === 'micoro-app-homeweb-app') {
|
||||
if (type === 'keyword-change') {
|
||||
searchStr.value = data;
|
||||
softwareName.value = data;
|
||||
}
|
||||
if (type === 'route-change') {
|
||||
//
|
||||
@@ -79,7 +83,9 @@ const handleDataChange = ({ name, type, data }) => {
|
||||
};
|
||||
|
||||
onMounted(() => {
|
||||
|
||||
globalInfo.updateHeaderSearch({ softwareName: route.query.softwareName ? route.query.softwareName : '', searchType: route.query.searchType || '软件' });
|
||||
softwareName.value = route.query.softwareName;
|
||||
searchType.value = route.query.searchType || '软件';
|
||||
});
|
||||
onUnmounted(() => {
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
</div>
|
||||
<div class="g-user-drawer-info-list">
|
||||
<div class="g-user-drawer-info-list-name">
|
||||
<span class="break-all">{{ accountInfo.username?accountInfo.username[0]:'' }}</span>
|
||||
<span class="break-all">{{ accountInfo.username ? accountInfo.username[0] : '' }}</span>
|
||||
<GIcon class="close-icon" name="gt-close" size="12" @click="handleClose" />
|
||||
</div>
|
||||
<div class="g-user-drawer-info-list-id break-all">@{{ accountInfo.username }}</div>
|
||||
@@ -69,6 +69,10 @@ const logout = async () => {
|
||||
router.go(0);
|
||||
}
|
||||
}
|
||||
// 退出系统刷新页面
|
||||
setTimeout(() => {
|
||||
location.reload();
|
||||
}, 100);
|
||||
};
|
||||
|
||||
const handleClick = (item) => {
|
||||
@@ -107,9 +111,7 @@ const getRouterLink = (params) => {
|
||||
};
|
||||
|
||||
const blockList = ref([
|
||||
[
|
||||
{ id: 'myPage', label: '个人中心', to: getRouterLink('PersonalCenter') }
|
||||
],
|
||||
[{ id: 'myPage', label: '个人中心', to: getRouterLink('PersonalCenter') }],
|
||||
// [
|
||||
// // { id: 'dashboard', label: '工作台', icon: 'gt-member-c', to: getRouterLink('dashboard') },
|
||||
// // { id: 'myIssues', label: '我的 Issue', icon: 'gt-issue-c', to: getRouterLink('issues') },
|
||||
@@ -126,9 +128,7 @@ const blockList = ref([
|
||||
// { id: 'personalSetting', label: '个人设置', icon: 'gt-setting-c', to: getRouterLink('setting') },
|
||||
// { id: 'help', label: '帮助文档', icon: 'gt-file-c', href: 'https://gitcode.com/Gitcode-offical-team/GitCode-Docs/wiki' }
|
||||
// ],
|
||||
[
|
||||
{ id: 'logout', label: '退出登录', icon: 'gt-exit', action: logout }
|
||||
]
|
||||
[{ id: 'logout', label: '退出登录', icon: 'gt-exit', action: logout }]
|
||||
]);
|
||||
</script>
|
||||
|
||||
|
||||
@@ -14,6 +14,10 @@ export const useGlobalInfoStore = defineStore('globalInfo', () => {
|
||||
const showTools = ref(true); // 是否展示工具栏
|
||||
const namespaceType = ref(-1); // 0 - 用户 1 - 组织
|
||||
const globalTheme = ref('light'); // 网站主题
|
||||
const headerSearch = ref({
|
||||
searchType: '软件',
|
||||
softwareName: ''
|
||||
})
|
||||
|
||||
const menuInfo = computed(() => {
|
||||
// 当前菜单
|
||||
@@ -63,6 +67,11 @@ export const useGlobalInfoStore = defineStore('globalInfo', () => {
|
||||
}
|
||||
};
|
||||
|
||||
const updateHeaderSearch = (data: any) => {
|
||||
headerSearch.value = { ...data };
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 设置菜单标题旁的数字(如:mr数量,成员数量)
|
||||
* @param id 菜单id
|
||||
@@ -107,6 +116,7 @@ export const useGlobalInfoStore = defineStore('globalInfo', () => {
|
||||
showTools,
|
||||
namespaceType,
|
||||
globalTheme,
|
||||
headerSearch,
|
||||
setMenuType,
|
||||
updateMenuNum,
|
||||
setMenuInfo,
|
||||
@@ -114,6 +124,7 @@ export const useGlobalInfoStore = defineStore('globalInfo', () => {
|
||||
setIsNotFound,
|
||||
setShowTools,
|
||||
setNamespaceType,
|
||||
setGlobalTheme
|
||||
setGlobalTheme,
|
||||
updateHeaderSearch
|
||||
};
|
||||
});
|
||||
|
||||
@@ -59,14 +59,18 @@
|
||||
</d-dropdown-menu>
|
||||
<d-button color="primary" variant="solid" @click="search">搜索</d-button>
|
||||
</div>
|
||||
<d-button v-if="isLogin" @click="check" ref="origin" icon="share" class="batch-btn">批量校验</d-button>
|
||||
<d-button @click="check" ref="origin" icon="share" class="batch-btn">批量校验</d-button>
|
||||
<div class="home-information">
|
||||
<div class="info-title">
|
||||
<div class="sub-title">
|
||||
<img src="@/assets/imgs/home/informIcon@2x.png" />
|
||||
<span>预警公告</span>
|
||||
</div>
|
||||
<a v-if="isLogin" class="devui-link" @click="checkMore">更多 ></a>
|
||||
|
||||
<!-- <a v-if="accountInfo.access_token" class="devui-link" @click="checkMore"
|
||||
>更多 <i class="icon icon-chevron-right-2"></i>
|
||||
</a>
|
||||
<span v-else class="text-blue-500">查看更多,请先登录</span> -->
|
||||
</div>
|
||||
<div class="info-content">
|
||||
<d-timeline :direction="'vertical'" :time-position="'right'" :position="'right'">
|
||||
@@ -109,13 +113,14 @@
|
||||
<script setup lang="ts">
|
||||
import { ref, onMounted, onBeforeUnmount } from 'vue';
|
||||
import { useRoute, useRouter } from 'vue-router';
|
||||
import { useAccount } from '@/utils/hooks/useAccount';
|
||||
import AdvanceSearch from '@/components/AdvanceSearch/index.vue';
|
||||
import { getHomeNoticeList } from '@/api/jyh';
|
||||
import EarlyWarningDetail from '@/views/Jyh/PersonalCenter/Detail/EarlyWarningDetail.vue';
|
||||
import { useDiscussGetUserInfo } from '@/api/discussion/hook';
|
||||
import { useGlobalInfoStore } from '@/stores/Global';
|
||||
const { updateHeaderSearch } = useGlobalInfoStore();
|
||||
const { accountInfo } = useAccount();
|
||||
|
||||
// 获取当前用户信息 & 是否登录
|
||||
const { isLogin = false, userInfo = {}} = useDiscussGetUserInfo();
|
||||
const route = useRoute();
|
||||
const router = useRouter();
|
||||
const inputGlow = ref(false);
|
||||
@@ -193,7 +198,8 @@ const updateDropdownWidth = () => {
|
||||
};
|
||||
|
||||
const search = () => {
|
||||
router.push({ name: 'Search', query: { searchWord: searchStr.value, searchType: selectedCate.value } });
|
||||
updateHeaderSearch({ searchWord: searchStr.value, searchType: selectedCate.value })
|
||||
router.push({ name: 'Search' });
|
||||
};
|
||||
|
||||
const onCategoryChange = (cate) => {
|
||||
@@ -241,7 +247,7 @@ onBeforeUnmount(() => {
|
||||
const getNoticeList = async () => {
|
||||
const res: any = await getHomeNoticeList();
|
||||
if (!res.error) {
|
||||
infoList.value = res.data.data;
|
||||
infoList.value = res.data.data || [];
|
||||
}
|
||||
};
|
||||
|
||||
@@ -262,6 +268,7 @@ getNoticeList();
|
||||
|
||||
.home-content {
|
||||
font-size: 14px;
|
||||
height: 80%;
|
||||
width: 50%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
@@ -439,11 +446,8 @@ getNoticeList();
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
width: 150px;
|
||||
width: 140px;
|
||||
flex-shrink: 0;
|
||||
overflow: hidden;
|
||||
white-space: nowrap;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
|
||||
:deep(.devui-timeline-item-data-right) {
|
||||
@@ -457,4 +461,4 @@ getNoticeList();
|
||||
padding: 0px !important;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
</style>
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<div class="sub-title mt-3">
|
||||
<div>
|
||||
<span>重要性</span>
|
||||
<d-tag type="danger" size="sm">{{warningData.importance}}</d-tag>
|
||||
<d-tag size="sm" :color="tagMap[warningData.importance].color">{{tagMap[warningData.importance].text}}</d-tag>
|
||||
</div>
|
||||
<div v-if="propsData.type === 'system'">
|
||||
<d-button v-show="mode === 'readonly'" class="edit-btn" icon="icon-edit" variant="text" title="编辑" @click="handleModeChange"/>
|
||||
@@ -39,6 +39,24 @@ const toolbarConfig = [
|
||||
['h1', 'h2', 'bold', 'italic', 'strike', 'underline', 'color', 'font'],
|
||||
['ul', 'ol', 'checklist', 'code', 'link', 'image', 'table'],
|
||||
];
|
||||
const tagMap = {
|
||||
'Critical': {
|
||||
text: '致命',
|
||||
color: '#c7000b'
|
||||
},
|
||||
'High': {
|
||||
text: '高',
|
||||
color: '#f66f6a'
|
||||
},
|
||||
'Medium': {
|
||||
text: '中',
|
||||
color: '#fac20a'
|
||||
},
|
||||
'Low': {
|
||||
text: '低',
|
||||
color: '#5e7ce0'
|
||||
}
|
||||
}
|
||||
const mode = ref('readonly');
|
||||
console.log(propsData.warningData)
|
||||
warningData.value = propsData.warningData ?? {
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
</AdvanceSearch>
|
||||
<div class="jyh-form-operation">
|
||||
<d-button @click="getReleaseList" class="mr-2" variant="solid">搜索</d-button>
|
||||
<d-button variant="solid" color="secondary">清空</d-button>
|
||||
<d-button variant="solid" color="secondary" @click="clear">清空</d-button>
|
||||
</div>
|
||||
<div class="left-btn">
|
||||
<d-button v-if="isLogin" class="output-btn" icon="icon-share" variant="text">导出</d-button>
|
||||
@@ -124,6 +124,7 @@ import { useAccountStore } from '@/stores/user';
|
||||
const { formatTime } = useTimeFormat();
|
||||
import { releasePage } from '@/api/jyh';
|
||||
import { useTimeFormat } from '@/utils/hooks/useTimeFormat';
|
||||
import { useGlobalInfoStore } from '@/stores/Global';
|
||||
const { namespace } = getOrgInfo();
|
||||
const userInfo = useAccountStore();
|
||||
const { isLogin } = storeToRefs(userInfo);
|
||||
@@ -138,16 +139,28 @@ const typeOptions = reactive(['主软件', '依赖软件']);
|
||||
const riskOptions = reactive(['低', '中', '高']);
|
||||
const useTypeOptions = reactive(['软件', '文档', '文档+软件']);
|
||||
const isUseOptions = reactive(['是', '否']);
|
||||
const globalInfo = useGlobalInfoStore();
|
||||
const headerSearch = ref(globalInfo.headerSearch)
|
||||
const newFormData = ref({
|
||||
licenseName: '',
|
||||
searchType: 'software',
|
||||
searchWord: '',
|
||||
searchType: headerSearch.value.searchType ? headerSearch.value.searchType : 'software',
|
||||
softwareName: '',
|
||||
softwareVersion: '',
|
||||
dependentSoftware: '',
|
||||
programmingLanguage: '',
|
||||
interestTag: '',
|
||||
industry: '',
|
||||
dateRange: ['', '']
|
||||
})
|
||||
|
||||
watch(() => globalInfo.headerSearch, (newVal: any) => {
|
||||
headerSearch.value = newVal;
|
||||
console.log(newVal)
|
||||
newFormData.value.searchType = newVal.searchType;
|
||||
newFormData.value.softwareName = newVal.softwareName;
|
||||
getReleaseList();
|
||||
}, { deep: true })
|
||||
|
||||
const pager = ref({
|
||||
total: 10,
|
||||
pageIndex: 1,
|
||||
@@ -195,6 +208,22 @@ const showColumnList = ref(false);
|
||||
const countryModalRef = ref(null);
|
||||
const orgModalRef = ref(null);
|
||||
|
||||
// 清空高级搜索
|
||||
const clear = () => {
|
||||
newFormData.value = {
|
||||
licenseName: '',
|
||||
searchType: headerSearch.value.searchType ? headerSearch.value.searchType : 'software',
|
||||
softwareName: '',
|
||||
softwareVersion: '',
|
||||
dependentSoftware: '',
|
||||
programmingLanguage: '',
|
||||
interestTag: '',
|
||||
industry: '',
|
||||
dateRange: ['', '']
|
||||
}
|
||||
getReleaseList();
|
||||
}
|
||||
|
||||
// 打开模态框的方法
|
||||
const openCountryModal = () => {
|
||||
if (countryModalRef.value) {
|
||||
@@ -304,11 +333,13 @@ const getReleaseList = async() => {
|
||||
if (!error && data) {
|
||||
tableData.value = data.data.records;
|
||||
pager.value.total = data.data.total;
|
||||
|
||||
console.log(tableData.value)
|
||||
}
|
||||
};
|
||||
|
||||
onMounted(async() => {
|
||||
getReleaseList();
|
||||
// getReleaseList();
|
||||
});
|
||||
|
||||
onMounted(() => {
|
||||
@@ -317,18 +348,6 @@ onMounted(() => {
|
||||
...query
|
||||
};
|
||||
});
|
||||
|
||||
// 监听路由变化,更新 searchWord
|
||||
watch(
|
||||
() => route.query.searchWord, // 监听路由的 searchWord 参数
|
||||
(newSearchWord) => {
|
||||
if (newSearchWord) {
|
||||
newFormData.value.searchWord = newSearchWord; // 更新组件的 searchWord
|
||||
getReleaseList(); // 重新调用接口
|
||||
}
|
||||
},
|
||||
{ immediate: true } // 立即执行一次
|
||||
);
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
|
||||
Reference in New Issue
Block a user