From 05ba76f7af9454a968855c04dbd9e6aa5a0cb9c7 Mon Sep 17 00:00:00 2001 From: zhouwentao Date: Sun, 1 Feb 2026 14:51:06 +0800 Subject: [PATCH 1/4] updates --- src/pages/school/[schoolCode].vue | 49 ++++++++++++++++++++++++++----- 1 file changed, 41 insertions(+), 8 deletions(-) diff --git a/src/pages/school/[schoolCode].vue b/src/pages/school/[schoolCode].vue index c546b6b..1e97964 100644 --- a/src/pages/school/[schoolCode].vue +++ b/src/pages/school/[schoolCode].vue @@ -112,6 +112,18 @@ const stopCarousel = () => { } } +// 关注按钮点击事件 +const handleFollow = () => { + console.log('关注学校:', schoolCode.value) + // TODO: 实现关注逻辑 +} + +// 加入对比按钮点击事件 +const handleCompare = () => { + console.log('加入对比:', schoolCode.value) + // TODO: 实现对比逻辑 +} + onMounted(() => { startCarousel() }) @@ -133,29 +145,50 @@ useHead({
-
-
-
+
+
+
Logo
-

+

中国石油大学(华东)

-
+
公办|理工类|教育部直属
+ +
+ + +
-
diff --git a/src/components/ScoreForm.vue b/src/components/ScoreForm.vue index 03ccb1e..e633d20 100644 --- a/src/components/ScoreForm.vue +++ b/src/components/ScoreForm.vue @@ -42,6 +42,9 @@ const scores = ref({ english: '', // 英语 }) +// Dynamic sub-major scores +const subMajorScores = ref>({}) + // Errors state const errors = ref({ examType: '', @@ -54,6 +57,7 @@ const errors = ref({ chinese: '', english: '', }, + subMajorScores: {} as Record, }) // --- Computed Properties using Dict System --- @@ -85,15 +89,15 @@ function getSubMajorOptions() { switch (majorCategory.value) { case '表演类': return [ - { label: '服装表演', value: '服装表演' }, - { label: '戏剧影视导演', value: '戏剧影视导演' }, - { label: '戏剧影视表演', value: '戏剧影视表演' }, + { label: '服装表演', value: '服装表演', formKey: '服装表演' }, + { label: '戏剧影视导演', value: '戏剧影视导演', formKey: '戏剧影视导演' }, + { label: '戏剧影视表演', value: '戏剧影视表演', formKey: '戏剧影视表演' }, ] case '音乐类': return [ - { label: '音乐表演声乐', value: '音乐表演声乐', disabled: selectedSubMajors.value.includes('音乐表演器乐') }, - { label: '音乐表演器乐', value: '音乐表演器乐', disabled: selectedSubMajors.value.includes('音乐表演声乐') }, - { label: '音乐教育', value: '音乐教育' }, + { label: '音乐表演声乐', value: '音乐表演声乐', formKey: '音乐表演声乐', disabled: selectedSubMajors.value.includes('音乐表演器乐') }, + { label: '音乐表演器乐', value: '音乐表演器乐', formKey: '音乐表演器乐', disabled: selectedSubMajors.value.includes('音乐表演声乐') }, + { label: '音乐教育', value: '音乐教育', formKey: '音乐教育' }, ] default: return [] @@ -122,10 +126,35 @@ function handleMajorCategoryChange(val: any) { errors.value.majorCategory = '' } +function getSubMajorFormKey(subMajorValue: string): string { + const options = getSubMajorOptions() + const option = options.find(opt => opt.value === subMajorValue) + return option?.formKey || '' +} + function handleSubMajorChange(val: any) { // 可以在这里处理额外的逻辑 console.warn(val) errors.value.subMajors = '' + + // 获取当前选中的子专业选项 + const options = getSubMajorOptions() + const selectedOptions = options.filter(opt => val.includes(opt.value)) + + // 初始化新选中的子专业成绩输入框 + selectedOptions.forEach(opt => { + if (!subMajorScores.value[opt.formKey]) { + subMajorScores.value[opt.formKey] = '' + } + }) + + // 移除未选中的子专业成绩 + const currentFormKeys = selectedOptions.map(opt => opt.formKey) + Object.keys(subMajorScores.value).forEach(key => { + if (!currentFormKeys.includes(key)) { + delete subMajorScores.value[key] + } + }) } // --- Validation Logic --- @@ -209,6 +238,11 @@ function validateForm() { // --- Submit --- async function handleSubmit() { if (validateForm()) { + if (getSubMajorOptions().length == 0){ + selectedSubMajors.value = [] + subMajorScores.value = {} + } + // 组装数据 const formData: ScoreFormData = { examType: examType.value, @@ -224,7 +258,7 @@ async function handleSubmit() { subjectList: selectedElectives.value, professionalCategory: majorCategory.value, professionalCategoryChildren: selectedSubMajors.value, - professionalCategoryChildrenScore: {}, + professionalCategoryChildrenScore: subMajorScores.value, professionalScore: Number(scores.value.unified) || 0, culturalScore: Number(scores.value.culture) || 0, englishScore: Number(scores.value.english) || 0, @@ -262,6 +296,11 @@ function initForm() { scores.value.culture = info.culturalScore?.toString() || '' scores.value.chinese = info.chineseScore?.toString() || '' scores.value.english = info.englishScore?.toString() || '' + + // 回显子专业成绩 + if (info.professionalCategoryChildrenScore) { + subMajorScores.value = { ...info.professionalCategoryChildrenScore } + } } } @@ -297,6 +336,7 @@ defineExpose({ majorCategory.value = '' selectedSubMajors.value = [] scores.value = { unified: '', culture: '', chinese: '', english: '' } + subMajorScores.value = {} }, }) @@ -386,6 +426,30 @@ defineExpose({ 成绩输入 + +
+
+
+ + +
+ {{ errors.subMajorScores[getSubMajorFormKey(subMajor)] }} +
+
+
+
+
diff --git a/src/pages/major/[majorCode].vue b/src/pages/major/[majorCode].vue new file mode 100644 index 0000000..84d0976 --- /dev/null +++ b/src/pages/major/[majorCode].vue @@ -0,0 +1,74 @@ + + + + + diff --git a/src/pages/simulate.vue b/src/pages/simulate.vue index 4a83b16..b25f759 100644 --- a/src/pages/simulate.vue +++ b/src/pages/simulate.vue @@ -153,6 +153,7 @@ async function loadMore(reset = false) { const res = await getUserMajorList({ page: page.value, size: size.value, + keyword: currentKeyword.value, probability, batch: currentBatchTab.value, batch2: currentBatch2Tab.value, @@ -455,6 +456,7 @@ function handleDataChange(data: { keyword: string, filters: FilterState }) { console.warn('发起请求:', data.keyword, data.filters) currentKeyword.value = data.keyword currentFilters.value = data.filters + loadMore(true) } // 用于记录当前鼠标是否悬停在手柄上,悬停时该行的索引存入这里 diff --git a/src/typed-router.d.ts b/src/typed-router.d.ts index eaaeb70..a6b888e 100644 --- a/src/typed-router.d.ts +++ b/src/typed-router.d.ts @@ -26,6 +26,7 @@ declare module 'vue-router/auto-routes' { '/demo/pop-confirm': RouteRecordInfo<'/demo/pop-confirm', '/demo/pop-confirm', Record, Record>, '/dict-demo': RouteRecordInfo<'/dict-demo', '/dict-demo', Record, Record>, '/hi/[name]': RouteRecordInfo<'/hi/[name]', '/hi/:name', { name: ParamValue }, { name: ParamValue }>, + '/major/[majorCode]': RouteRecordInfo<'/major/[majorCode]', '/major/:majorCode', { majorCode: ParamValue }, { majorCode: ParamValue }>, '/majors': RouteRecordInfo<'/majors', '/majors', Record, Record>, '/privacy-policy': RouteRecordInfo<'/privacy-policy', '/privacy-policy', Record, Record>, '/README': RouteRecordInfo<'/README', '/README', Record, Record>, From 6a39f754bf168106ee3bdce87302a41cb67ae9c8 Mon Sep 17 00:00:00 2001 From: zhouwentao Date: Sat, 7 Feb 2026 14:00:10 +0800 Subject: [PATCH 4/4] fix: majorPage --- src/pages/major/[majorCode].vue | 291 +++++++++++++++++++++++++------- 1 file changed, 231 insertions(+), 60 deletions(-) diff --git a/src/pages/major/[majorCode].vue b/src/pages/major/[majorCode].vue index 84d0976..a695e70 100644 --- a/src/pages/major/[majorCode].vue +++ b/src/pages/major/[majorCode].vue @@ -1,74 +1,245 @@ - + +
+
+
+ logo +
+

{{ school.name }}

+
+ {{ tag }} +
+
{{ school.location }}
+
+
+
+
排名: {{ school.rank }}
+
专业学科评级 {{ school.grade }}
+
+
+ + +
+ + + + + ... + + +
+
- - +// --- Tab Logic --- +const currentTab = ref('intro'); +const tabs = [ + { id: 'intro', name: '基本介绍' }, + { id: 'job', name: '就业分析' }, + { id: 'school', name: '开设院校' } +]; + +// --- Data for School List --- +const schools = [ + { + name: '北京工业大学', + logo: 'https://ui-avatars.com/api/?name=BJ&background=0D8ABC&color=fff', // Placeholder + tags: ['211', '双一流', '省属重点'], + location: '北京 朝阳区 工科 公办', + rank: 63, + grade: 'C' + }, + { + name: '北京理工大学', + logo: 'https://ui-avatars.com/api/?name=BIT&background=166534&color=fff', // Placeholder + tags: ['985', '211', '双一流', '省部共建'], + location: '北京 海淀区 工科 公办', + rank: 18, + grade: 'B' + } +]; + +// --- Data for Cities (Mock) --- +const cities = [ + { name: '深圳', percent: 20 }, + { name: '上海', percent: 20 }, + { name: '北京', percent: 17 }, + { name: '广州', percent: 13 }, + { name: '杭州', percent: 8 }, + { name: '成都', percent: 4 }, + { name: '东莞', percent: 4 }, +]; + + \ No newline at end of file