feat(@vben/web-antd): 实现模板动态加载调整 API 地址并优化爬虫功能

- 修改生产环境 API 地址为本地地址- 更新爬虫功能相关代码,增加 markdown-it 依赖
-调整 Vite 配置中的代理目标地址
- 优化工作流视图中的爬虫运行逻辑
This commit is contained in:
vertoryao 2025-06-12 16:16:40 +08:00
parent 7d762aada2
commit 8d17c6eb9f
10 changed files with 20 additions and 29 deletions

View File

@ -1,7 +1,8 @@
VITE_BASE=/ VITE_BASE=/
# 接口地址 # 接口地址
VITE_GLOB_API_URL=http://dify.vertoryao.xyz/api # VITE_GLOB_API_URL=http://dify.vertoryao.xyz/api
VITE_GLOB_API_URL=http://172.16.35.190:9090/api
# 是否开启压缩,可以设置为 none, brotli, gzip # 是否开启压缩,可以设置为 none, brotli, gzip
VITE_COMPRESS=none VITE_COMPRESS=none

View File

@ -48,6 +48,7 @@
"ant-design-vue": "catalog:", "ant-design-vue": "catalog:",
"ant-design-x-vue": "^1.1.2", "ant-design-x-vue": "^1.1.2",
"dayjs": "catalog:", "dayjs": "catalog:",
"markdown-it": "^14.1.0",
"pinia": "catalog:", "pinia": "catalog:",
"vue": "catalog:", "vue": "catalog:",
"vue-router": "catalog:" "vue-router": "catalog:"

View File

@ -6,8 +6,8 @@ export function runSpider(data: any) {
} }
// 广州公共资源爬虫 // 广州公共资源爬虫
export function runSpiderGz(data: any) { export function runSpiderGz(appId: string, data: any) {
return requestClient.post(`/spider2/run`, data); return requestClient.post(`/spider2/run/${appId}`, data);
} }
export function getSpiderStatus() { export function getSpiderStatus() {

View File

@ -8,7 +8,7 @@ import { useVbenVxeGrid } from '@vben/plugins/vxe-table';
import { getAllDeptTree } from '#/api'; import { getAllDeptTree } from '#/api';
import { useAuthColumns } from '../data'; // import { useAuthColumns } from '../data';
const emits = defineEmits(['success']); const emits = defineEmits(['success']);
const formData = ref(); const formData = ref();
@ -31,7 +31,7 @@ const [Modal, modalApi] = useVbenModal({
const [Grid, gridApi] = useVbenVxeGrid({ const [Grid, gridApi] = useVbenVxeGrid({
gridEvents: {}, gridEvents: {},
gridOptions: { gridOptions: {
columns: useAuthColumns(), // columns: useAuthColumns(),
height: 'auto', height: 'auto',
keepSource: true, keepSource: true,
pagerConfig: { pagerConfig: {

View File

@ -34,18 +34,6 @@ const props = withDefaults(defineProps<Props>(), {
name: '', name: '',
url: '', url: '',
}), }),
runSpider: () => async () => ({
msg: '',
code: '',
}),
getSpiderStatus: () => async () => ({
msg: '',
code: '',
}),
stopSpider: () => async () => ({
msg: '',
code: '',
}),
runSpiderGz: () => async () => ({ runSpiderGz: () => async () => ({
outputs: { outputs: {
result: '', result: '',
@ -80,7 +68,7 @@ const startFetching = async () => {
message: '正在获取中...', message: '正在获取中...',
duration: 3, duration: 3,
}); });
const res = await props.runSpiderGz({ const res = await props.runSpiderGz(props.item.id, {
userId: userStore.userInfo?.userId || '', userId: userStore.userInfo?.userId || '',
conversationId: '', conversationId: '',
files: [], files: [],

View File

@ -90,22 +90,18 @@ onMounted(() => {
/> />
</div> </div>
<SelfWorkView <SelfWorkView
v-if="currentTemp.id === '387e1ff7-3385-404d-ba29-80c5c62fbcf7'" v-if="currentTemp.id === '77c068fd-d5b6-4c33-97d8-db5511a09b26'"
title="目标网址:" title="目标网址:"
:item="currentTemp" :item="currentTemp"
:run-spider="runSpider" :run-spider="runSpider"
:stop-spider="stopSpider" :stop-spider="stopSpider"
:get-spider-status="getSpiderStatus" :get-spider-status="getSpiderStatus"
:run-spider-gz="runSpiderGz"
:item-message="itemMessage" :item-message="itemMessage"
/> />
<WorkflowWorkView <WorkflowWorkView
v-else v-else
title="目标网址:" title="目标网址:"
:item="currentTemp" :item="currentTemp"
:run-spider="runSpider"
:stop-spider="stopSpider"
:get-spider-status="getSpiderStatus"
:run-spider-gz="runSpiderGz" :run-spider-gz="runSpiderGz"
:item-message="itemMessage" :item-message="itemMessage"
/> />

View File

@ -57,7 +57,7 @@ interface Props {
stopSpider?: () => Promise<{ stopSpider?: () => Promise<{
status: string; status: string;
}>; }>;
runSpiderGz?: (data: SpiderContext) => Promise<any>; runSpiderGz?: (appId: string, data: SpiderContext) => Promise<any>;
} }
export type { export type {

View File

@ -43,6 +43,7 @@ const getLogs = async (appid: string) => {
// page: 1, // page: 1,
// }); // });
hitsory.value = res.data; hitsory.value = res.data;
loading.value = false; loading.value = false;
}; };

View File

@ -10,8 +10,9 @@ export default defineConfig(async () => {
changeOrigin: true, changeOrigin: true,
rewrite: (path) => path.replace(/^\/api/, ''), rewrite: (path) => path.replace(/^\/api/, ''),
// mock代理目标地址 // mock代理目标地址
// target: 'http://localhost:8081/api', // target: 'http://172.16.35.190:9090/api',
target: 'http://43.139.10.64:8082/api', // target: 'http://43.139.10.64:8082/api',
target: 'http://localhost:8081/api',
// target: 'http://192.168.3.238:8081/api', // target: 'http://192.168.3.238:8081/api',
ws: true, ws: true,
}, },
@ -28,7 +29,7 @@ export default defineConfig(async () => {
'/pptx': { '/pptx': {
changeOrigin: true, changeOrigin: true,
rewrite: (path) => path.replace(/^\/pptx/, ''), rewrite: (path) => path.replace(/^\/pptx/, ''),
target: 'http://47.112.173.8:6802/static', target: 'http://47.112.173.8:6800/',
}, },
'/spider': { '/spider': {
changeOrigin: true, changeOrigin: true,
@ -38,8 +39,8 @@ export default defineConfig(async () => {
'/v1': { '/v1': {
changeOrigin: true, changeOrigin: true,
rewrite: (path) => path.replace(/^\/v1/, ''), rewrite: (path) => path.replace(/^\/v1/, ''),
// target: 'http://localhost:8081/v1', target: 'http://localhost:8081/v1',
target: 'http://43.139.10.64:8082/v1', // target: 'http://43.139.10.64:8082/v1',
// target: 'http://192.168.3.238:8081/v1', // target: 'http://192.168.3.238:8081/v1',
}, },
}, },

View File

@ -661,6 +661,9 @@ importers:
dayjs: dayjs:
specifier: 'catalog:' specifier: 'catalog:'
version: 1.11.13 version: 1.11.13
markdown-it:
specifier: ^14.1.0
version: 14.1.0
pinia: pinia:
specifier: ^3.0.2 specifier: ^3.0.2
version: 3.0.2(typescript@5.8.3)(vue@3.5.13(typescript@5.8.3)) version: 3.0.2(typescript@5.8.3)(vue@3.5.13(typescript@5.8.3))