diff --git a/src/api/crawl-addresses.ts b/src/api/crawl-addresses.ts new file mode 100644 index 0000000..b7bb6f5 --- /dev/null +++ b/src/api/crawl-addresses.ts @@ -0,0 +1,25 @@ +import { request } from '@/utils/request' + +export type CrawlAddressTargetType = 'paper' | 'industry_news' | 'teacher' + +export interface CrawlAddressOption { + id: number + target_type: CrawlAddressTargetType + name: string + request_url: string + keyword?: string | null + category_dict_item_id?: number | null + category_label?: string | null + university_id?: number | null + university_name?: string | null + department?: string | null +} + +export const crawlAddressApi = { + options(target_type?: CrawlAddressTargetType) { + const query = target_type ? `?target_type=${encodeURIComponent(target_type)}` : '' + return request<{ items: CrawlAddressOption[] }>(`/crawl-addresses/options${query}`, { + auth: true, + }).then((res) => res.items) + }, +} diff --git a/src/api/crawler.ts b/src/api/crawler.ts index 22a7f80..76c462b 100644 --- a/src/api/crawler.ts +++ b/src/api/crawler.ts @@ -7,6 +7,7 @@ export interface CrawlResolveResult { source_name: string adapter_code: string target_type: string + entry_url?: string } export interface CrawlJobResult { @@ -16,10 +17,12 @@ export interface CrawlJobResult { platform_url?: string status: string source_name?: string + adapter_code?: string items_fetched?: number items_imported?: number papers_imported?: number teacher_leads_imported?: number + news_imported?: number result_summary?: string preview_teacher_lead_count?: number } @@ -36,6 +39,16 @@ export const crawlerApi = { target_type: CrawlTargetType request_url: string params?: Record + teacher_defaults?: { + university_id?: number + department?: string + city?: string + research_direction_ids?: number[] + } + news_defaults?: { + source?: string + category_dict_item_id?: number + } }) { return request('/crawl-jobs', { method: 'POST', diff --git a/src/components/NewsRichContent.vue b/src/components/NewsRichContent.vue new file mode 100644 index 0000000..5c20a47 --- /dev/null +++ b/src/components/NewsRichContent.vue @@ -0,0 +1,61 @@ + + + + + diff --git a/src/stores/user.ts b/src/stores/user.ts index 7284c9e..b686361 100644 --- a/src/stores/user.ts +++ b/src/stores/user.ts @@ -70,8 +70,9 @@ export const useUserStore = defineStore('user', { company: user.company || this.profile.company, mobile: user.mobile || this.profile.mobile, title: user.job_title || this.profile.title, + research_direction: user.research_direction || this.profile.research_direction, research_direction_ids: user.research_direction_ids || this.profile.research_direction_ids, - custom_research_directions: this.profile.custom_research_directions, + custom_research_directions: [], } uni.setStorageSync(STORAGE_KEYS.profile, JSON.stringify(this.profile)) syncRadarTabPermission(user) @@ -86,8 +87,9 @@ export const useUserStore = defineStore('user', { company: user.company || this.profile.company, mobile: user.mobile || this.profile.mobile, title: user.job_title || this.profile.title, + research_direction: user.research_direction || this.profile.research_direction, research_direction_ids: user.research_direction_ids || this.profile.research_direction_ids, - custom_research_directions: this.profile.custom_research_directions, + custom_research_directions: [], } uni.setStorageSync(STORAGE_KEYS.profile, JSON.stringify(this.profile)) syncRadarTabPermission(user) @@ -115,8 +117,9 @@ export const useUserStore = defineStore('user', { clearToken() }, async saveProfile(profile: UserProfile) { + let user = this.user if (this.isLoggedIn) { - const user = await profileApi.update({ + user = await profileApi.update({ name: profile.name, mobile: profile.mobile, company: profile.company, @@ -128,7 +131,13 @@ export const useUserStore = defineStore('user', { }) this.user = user } - this.profile = { ...this.profile, ...profile } + this.profile = { + ...this.profile, + ...profile, + research_direction: user?.research_direction || this.profile.research_direction, + research_direction_ids: user?.research_direction_ids || profile.research_direction_ids, + custom_research_directions: [], + } uni.setStorageSync(STORAGE_KEYS.profile, JSON.stringify(this.profile)) }, markCourseSigned(id: number) { diff --git a/src/subpkg/crawler/index.vue b/src/subpkg/crawler/index.vue index 89115a8..657b663 100644 --- a/src/subpkg/crawler/index.vue +++ b/src/subpkg/crawler/index.vue @@ -8,6 +8,18 @@ + + 爬虫地址(选填) + + {{ addressLabels[addressIndex] }} + + + 目标地址 * 正在识别采集源… - 已识别:{{ resolvedName }} - - - - 搜索关键词(选填) -