[全量] 初始化项目代码、配置、文档及Agent协同harness

This commit is contained in:
2026-04-02 11:36:05 +08:00
parent 0553309cdf
commit 87e571d9ec
1133 changed files with 221948 additions and 0 deletions

View File

@@ -0,0 +1,422 @@
<template>
<div class="tools-container">
<div class="top-level" ref="topLevel">
<template v-for="(item, index) in topSpecies">
<div class="species-name" :class="activeTopSpecieIndex === index ? 'active' : ''"
@click="changeTopSpecies(index)">{{ item.name }}
</div>
</template>
</div>
<div class="second-level" ref="secondLevel">
<template v-for="(item, index) in secondSpecies">
<div class="species-name" :class="activeSecondSpecieIndex === index ? 'active' : ''"
@click="changeSecondSpecies(index)">{{ item.name }}
</div>
</template>
</div>
<div class="tools-info" :style="toolsHeight != '' ? 'max-height:'+toolsHeight:''">
<template v-for="tool in tools">
<div class="level-name" v-if="tool.topLevel">{{ tool.topLevel}}</div>
<div class="tools">
<template v-for="item in tool.data">
<div class="tool-item" @click="goToLink(item)">
<img :src="getToolsImg(item.imgUrl)" alt="">
<div class="tool-info">
<div class="top">
<div class="name">{{ item.name }}</div>
<div class="type" v-if="item.tag && activeTopSpecieIndex === 0">{{ item.tag }}</div>
</div>
<div class="bottom">
<div class="desc" :title="item.description"> {{ item.description }}</div>
<img src="@/assets/images/applications/right.png" alt="">
</div>
</div>
</div>
</template>
</div>
</template>
</div>
</div>
<page-footer></page-footer>
</template>
<script setup lang="ts">
import {onMounted, onUnmounted, reactive, ref} from "vue";
import {withLoading} from "@/utils/loading";
import {getConfig, getTagConfig, viewUrl} from "@/api";
import PageFooter from "@/components/pageFooter.vue";
import {ElMessage} from "element-plus";
// 后端接口的上下文
const baseURL = import.meta.env.VITE_GLOB_API_CTX;
// 请求参数类型
type RequestParams = {
type?: string;
sort?: string;
tag?: string;
className?: string;
};
// 一级导航
const topSpecies = reactive<any[]>([]);
const activeTopSpecieIndex = ref<number>(0);
// 二级导航
const secondSpecies = reactive<any[]>([]);
const activeSecondSpecieIndex = ref<number>(-1);
// 工具
type ToolInfo = {
imgUrl: string,
name: string,
description: string,
tag: string
}
type Tool = {
topLevel?: string;
data: ToolInfo[];
}
const tools = reactive<Tool[]>([]);
// 工具模块高度自适应相关
const topLevel = ref<any>(null);
const secondLevel = ref<any>(null);
const toolsHeight = ref('');
/**
* 获取工具广场信息
* 适用于获取一级导航,二级导航,以及实用工具下除项目管理、知识管理、研究实施、运营推广外的内容
* @param params
*/
const getConfigList = async (params: RequestParams) => {
try {
let res = await withLoading(getConfig)(params);
return res.code === 200 && res.data ? res.data : [];
} catch (error: any) {
ElMessage.error(error && error.message ? error.message : '未知错误');
return [];
}
}
/**
* 获取工具广场信息
* 适用于获取实用工具下除项目管理、知识管理、研究实施、运营推广的内容
* @param params
*/
const getTagConfigList = async (params: RequestParams) => {
try {
let res = await withLoading(getTagConfig)(params);
return res.code === 200 && res.data ? res.data : [];
} catch (error: any) {
ElMessage.error(error && error.message ? error.message : '未知错误');
}
}
/**
* 获取一级导航
*/
const getTopSpecies = async () => {
topSpecies.length = 0;
let params: RequestParams = {
type: "广场",
sort: '广场',
tag: ''
}
topSpecies.push(...await getConfigList(params));
}
/**
* 获取二级导航
*/
const getSecondSpecies = async () => {
secondSpecies.length = 0;
if (activeTopSpecieIndex.value === 0) {
let params: RequestParams = {
type: "广场",
sort: topSpecies[activeTopSpecieIndex.value].value,
tag: 'tag'
}
secondSpecies.push(...await getConfigList(params));
}
}
/**
* 获取工具
*/
const getTools = async () => {
tools.length = 0;
if (activeTopSpecieIndex.value === 0 && activeSecondSpecieIndex.value === 0) {
await getTagToolList();
return;
}
await getToolList();
}
const getTagToolList = async () => {
let params: RequestParams = {
className: secondSpecies[activeSecondSpecieIndex.value].value,
}
tools.push(...await getTagConfigList(params));
}
const getToolList = async () => {
let tag = '';
if (activeSecondSpecieIndex.value === 0) {
tag = "NoTag";
} else if (activeSecondSpecieIndex.value != -1) {
tag = secondSpecies[activeSecondSpecieIndex.value].value;
}
let params: RequestParams = {
type: "广场",
sort: topSpecies[activeTopSpecieIndex.value].value,
tag: tag
}
let data = await getConfigList(params);
tools.push({ data: data})
}
/**
* 切换一级导航
*/
const changeTopSpecies = async (index: number) => {
activeTopSpecieIndex.value = index;
if (activeTopSpecieIndex.value === 0) {
activeSecondSpecieIndex.value = 0;
} else {
activeSecondSpecieIndex.value = -1;
}
await getSecondSpecies();
await getTools();
getToolsHeight();
}
/**
* 切换二级导航
* @param index
*/
const changeSecondSpecies = (index: number) => {
if (activeTopSpecieIndex.value !== 0) {
return;
}
activeSecondSpecieIndex.value = index;
getTools();
}
/**
* 拼接工具图片地址
*/
const getToolsImg = (imgUrl: string) => {
return new URL(baseURL + '/file/' + imgUrl, import.meta.url).href
}
/**
* 工具模块高度自适应
*/
const getToolsHeight = () => {
if (activeTopSpecieIndex.value !== 0) {
if (topLevel.value && topLevel.value.offsetHeight !== 0) {
let otherHeight: number = topLevel.value.offsetHeight + 146;
toolsHeight.value = "calc(100vh - " + otherHeight + "px)";
}
} else {
if (topLevel.value && topLevel.value.offsetHeight !== 0 && secondLevel.value && secondLevel.value.offsetHeight !== 0) {
let otherHeight: number = topLevel.value.offsetHeight + secondLevel.value.offsetHeight + 176;
toolsHeight.value = "calc(100vh - " + otherHeight + "px)";
}
}
}
/**
* 链接跳转
* @param item
*/
const goToLink = async (item: any) => {
try {
let res = await withLoading(viewUrl)(Number(item.id));
if (res.code === 200) {
window.open(item.jumpUrl, '_blank');
} else {
ElMessage.error(res.msg);
}
} catch (error) {
ElMessage.error(error && error.message ? error.message : '未知错误');
}
}
onMounted(async () => {
await getTopSpecies();
await changeTopSpecies(0);
getToolsHeight();
window.addEventListener("resize", getToolsHeight);
})
onUnmounted(() => {
window.removeEventListener("resize", getToolsHeight);
})
</script>
<style scoped lang="scss">
.tools-container {
width: 100%;
padding: 60px 160px 20px 236px;
position: relative;
height: 100%;
.top-level {
display: flex;
margin-bottom: 20px;
.species-name {
font-weight: bold;
font-size: 20px;
color: #858A94;
margin-right: 60px;
cursor: pointer;
}
.active {
color: #004EA0;
}
}
.second-level {
display: flex;
flex-wrap: wrap;
margin-bottom: 8px;
.species-name {
width: 89px;
height: 36px;
text-align: center;
line-height: 36px;
background: rgba(133, 138, 150, 0.1);
border-radius: 18px;
border: 1px solid #E6EDFF;
margin-right: 16px;
font-size: 16px;
margin-bottom: 12px;
cursor: pointer;
}
.active {
background: #004EA0;
color: #FAFBFF;
}
}
.tools {
display: flex;
flex-wrap: wrap;
overflow-y: auto;
.tool-item {
display: flex;
width: 325px;
height: 105px;
background: #E6EDFF;
border-radius: 8px;
border: 1px solid #E6EDFF;
margin-right: 17px;
margin-bottom: 20px;
padding: 16px;
cursor: pointer;
img {
width: 73px;
height: 73px;
}
.tool-info {
height: 73px;
margin-left: 12px;
.top {
display: flex;
justify-content: space-between;
margin-bottom: 14px;
.name {
width: 128px;
font-weight: bold;
font-size: 16px;
color: #000000;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.type {
width: 64px;
height: 23px;
line-height: 23px;
text-align: center;
font-size: 12px;
color: #1C73CE;
background: rgba(28, 115, 206, 0.11);
border-radius: 11px
}
}
.bottom {
display: flex;
align-items: center;
.desc {
width: 185px;
height: 37px;
font-size: 12px;
color: #858A94;
display: flex;
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 2;
overflow: hidden;
text-overflow: ellipsis;
line-height: 1.5;
}
img {
width: 7px;
height: 14px;
margin-left: 16px
}
}
}
}
.tools-top-level {
font-weight: bold;
font-size: 16px;
color: #000000;
}
}
.tools-info {
overflow-y: auto;
.level-name {
font-weight: bold;
font-size: 16px;
color: #000000;
margin-bottom: 16px;
}
}
.footer {
font-weight: 400;
font-size: 14px;
color: #B9B9B9;
line-height: 30px;
text-align: right;
font-style: normal;
text-transform: none;
position: absolute;
bottom: 2vh;
right: 160px;
a {
color: inherit; /* 继承父元素的文字颜色 */
text-decoration: none; /* 去除下划线 */
cursor: pointer;
}
}
}
</style>