feat(@vben/web-antd): 优化爬虫功能
This commit is contained in:
parent
90e9b3aaf2
commit
71cd4b7363
@ -45,6 +45,7 @@
|
|||||||
"@vueuse/integrations": "catalog:",
|
"@vueuse/integrations": "catalog:",
|
||||||
"ant-design-vue": "catalog:",
|
"ant-design-vue": "catalog:",
|
||||||
"ant-design-x-vue": "^1.1.2",
|
"ant-design-x-vue": "^1.1.2",
|
||||||
|
"dayjs": "^1.11.13",
|
||||||
"markdown-it": "^14.1.0",
|
"markdown-it": "^14.1.0",
|
||||||
"qrcode": "catalog:",
|
"qrcode": "catalog:",
|
||||||
"tippy.js": "catalog:",
|
"tippy.js": "catalog:",
|
||||||
|
@ -12,7 +12,8 @@ import {
|
|||||||
CardTitle,
|
CardTitle,
|
||||||
} from '@vben-core/shadcn-ui';
|
} from '@vben-core/shadcn-ui';
|
||||||
|
|
||||||
import { RangePicker } from 'ant-design-vue';
|
import { message, RangePicker } from 'ant-design-vue';
|
||||||
|
import dayjs from 'dayjs';
|
||||||
|
|
||||||
interface SpiderParams {
|
interface SpiderParams {
|
||||||
appid: string;
|
appid: string;
|
||||||
@ -66,12 +67,14 @@ const startFetching = async () => {
|
|||||||
isFetching.value = true;
|
isFetching.value = true;
|
||||||
fetchStatus.value = 'fetching';
|
fetchStatus.value = 'fetching';
|
||||||
|
|
||||||
let publishStartTime = ''; // 默认值
|
let publish_start_time = ''; // 默认值
|
||||||
let publishEndTime = ''; // 默认值
|
let publish_end_time = ''; // 默认值
|
||||||
|
|
||||||
if (selectedDateRange.value && selectedDateRange.value.length === 2) {
|
if (selectedDateRange.value && selectedDateRange.value.length === 2) {
|
||||||
publishStartTime = selectedDateRange.value[0] || '';
|
publish_start_time =
|
||||||
publishEndTime = selectedDateRange.value[1] || '';
|
dayjs(selectedDateRange.value[0]).format('YYYYMMDDhhmmss') || '';
|
||||||
|
publish_end_time =
|
||||||
|
dayjs(selectedDateRange.value[1]).format('YYYYMMDDhhmmss') || '';
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@ -84,13 +87,19 @@ const startFetching = async () => {
|
|||||||
conversationId: '',
|
conversationId: '',
|
||||||
files: [],
|
files: [],
|
||||||
inputs: {
|
inputs: {
|
||||||
publishStartTime,
|
publish_start_time,
|
||||||
publishEndTime,
|
publish_end_time,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
if (res.data.outputs.result) {
|
||||||
// 保存抓取结果
|
// 保存抓取结果
|
||||||
fetchResult.value = res.data.outputs.result;
|
fetchResult.value = res.data.outputs.result;
|
||||||
|
message.success('抓取成功');
|
||||||
|
} else {
|
||||||
|
fetchResult.value = '';
|
||||||
|
message.error('抓取无结果');
|
||||||
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
}
|
}
|
||||||
@ -141,7 +150,7 @@ const fetchStatus = ref('');
|
|||||||
<RangePicker
|
<RangePicker
|
||||||
class="mx-2"
|
class="mx-2"
|
||||||
v-model:value="selectedDateRange"
|
v-model:value="selectedDateRange"
|
||||||
format="YYYY-MM-DD"
|
format="YYYY/MM/DD"
|
||||||
/>
|
/>
|
||||||
<Button :disabled="!item" @click="startFetching">
|
<Button :disabled="!item" @click="startFetching">
|
||||||
{{ isFetching ? '抓取中...' : '开始抓取' }}
|
{{ isFetching ? '抓取中...' : '开始抓取' }}
|
||||||
|
@ -1344,6 +1344,9 @@ importers:
|
|||||||
ant-design-x-vue:
|
ant-design-x-vue:
|
||||||
specifier: ^1.1.2
|
specifier: ^1.1.2
|
||||||
version: 1.1.2(ant-design-vue@4.2.6(vue@3.5.13(typescript@5.8.3)))(vue@3.5.13(typescript@5.8.3))
|
version: 1.1.2(ant-design-vue@4.2.6(vue@3.5.13(typescript@5.8.3)))(vue@3.5.13(typescript@5.8.3))
|
||||||
|
dayjs:
|
||||||
|
specifier: ^1.11.13
|
||||||
|
version: 1.11.13
|
||||||
markdown-it:
|
markdown-it:
|
||||||
specifier: ^14.1.0
|
specifier: ^14.1.0
|
||||||
version: 14.1.0
|
version: 14.1.0
|
||||||
|
Loading…
Reference in New Issue
Block a user