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