feat: 志愿表的学校,专业显示,添加逻辑

master
xjs 2025-03-15 17:37:59 +08:00
parent 207c569505
commit 840dd36f7e
13 changed files with 523 additions and 185 deletions

View File

@ -10,6 +10,7 @@
<view class="action-sheet-header" v-if="title"> <view class="action-sheet-header" v-if="title">
<text class="action-sheet-title">{{ title }}</text> <text class="action-sheet-title">{{ title }}</text>
</view> </view>
<slot name="title"></slot>
<scroll-view class="action-sheet-content" :scroll-y="true"> <scroll-view class="action-sheet-content" :scroll-y="true">
<slot></slot> <slot></slot>
</scroll-view> </scroll-view>

View File

@ -30,7 +30,7 @@
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { computed, ref, watch } from 'vue' import { computed } from 'vue'
const props = defineProps({ const props = defineProps({
modelValue: { modelValue: {
@ -93,7 +93,6 @@ const currentIndex = computed(() => {
} }
return item === targetValue return item === targetValue
}) })
return [index > -1 ? index : 0] return [index > -1 ? index : 0]
}) })

View File

@ -12,7 +12,7 @@
</view> </view>
</view> </view>
<scroll-view class="flex-1 pb-[24rpx] h-[50vh] mt-[32rpx] mx-[32rpx]" :scroll-y="true"> <scroll-view class="flex-1 pb-[24rpx] h-[50vh] mt-[32rpx] mx-[32rpx]" :scroll-y="true">
<Phase v-show="currentMenu === 1" /> <Phase v-show="currentMenu === 1" @change="handlePhaseChange" />
<CollegeFeature <CollegeFeature
v-show="currentMenu === 5" v-show="currentMenu === 5"
width="240rpx" width="240rpx"
@ -35,6 +35,7 @@
class="justify-center!" class="justify-center!"
v-show="currentMenu === 3" v-show="currentMenu === 3"
:defaultValue="defaultUniType" :defaultValue="defaultUniType"
@change-name="handleUniTypeChange"
/> />
<Nature <Nature
width="240rpx" width="240rpx"
@ -42,6 +43,7 @@
class="justify-center!" class="justify-center!"
v-show="currentMenu === 4" v-show="currentMenu === 4"
:defaultValue="defaultNature" :defaultValue="defaultNature"
@change-name="handleNatureChange"
/> />
</scroll-view> </scroll-view>
</view> </view>
@ -100,11 +102,13 @@ const defaultRegion = ref([])
const defaultNature = ref([]) const defaultNature = ref([])
const defaultUniType = ref([]) const defaultUniType = ref([])
const defaultCollegeFeature = ref([]) const defaultCollegeFeature = ref([])
const defaultPhase = ref('')
const chooseRegion = ref([]) const chooseRegion = ref([])
const chooseNature = ref([]) const chooseNature = ref([])
const chooseUniType = ref([]) const chooseUniType = ref([])
const chooseCollegeFeature = ref([]) const chooseCollegeFeature = ref([])
const choosePhase = ref('')
const handleRegionChange = (val: string[]) => { const handleRegionChange = (val: string[]) => {
chooseRegion.value = val chooseRegion.value = val
@ -122,13 +126,18 @@ const handleCollegeFeatureChange = (val: string[]) => {
chooseCollegeFeature.value = val chooseCollegeFeature.value = val
} }
const handlePhaseChange = (val: string) => {
choosePhase.value = val
}
const handleConfirm = () => { const handleConfirm = () => {
console.log( return {
chooseRegion.value, chooseRegion: chooseRegion.value,
chooseNature.value, chooseNature: chooseNature.value,
chooseUniType.value, chooseUniType: chooseUniType.value,
chooseCollegeFeature.value, chooseCollegeFeature: chooseCollegeFeature.value,
) choosePhase: choosePhase.value,
}
} }
defineExpose({ defineExpose({

View File

@ -0,0 +1,106 @@
<template>
<view
v-for="major in item.items"
class="pt-[32rpx] pl-[58rpx] pr-[32rpx] pb-[30rpx] custom-background flex gap-[58rpx]"
:style="`--background-color:${calcTypeName(major.type).style.backgroundColor}`"
>
<view class="flex flex-col gap-[16rpx]">
<view
class="w-[52rpx] h-[52rpx] rounded-[8rpx] font-semibold text-[28rpx] flex items-center justify-center"
:style="calcTypeName(major.type).style"
>
{{ calcTypeName(major.type).text }}
</view>
<text class="text-[32rpx] font-semibold text-[#000]">{{ major.percentAge }}%</text>
</view>
<view class="flex flex-col gap-[16rpx]">
<view class="flex justify-between flex-auto">
<view class="flex flex-col">
<text class="text-[32rpx] text-[#000] font-semibold truncate max-w-[400rpx]">
{{ major.major.replace(/(\r\n|\n|\r)/g, '') }}
</text>
<view class="flex justify-between text-[22rpx] text-[#1F2329] mt-[14rpx]">
<view class="flex flex-col gap-[6rpx]">
<text>代码{{ major.majorCode }}</text>
<text>{{ item.year }}计划{{ major.planCount }}</text>
</view>
<view class="flex flex-col gap-[6rpx]">
<text>选科:{{ major.subjectClam }}</text>
<text>学费/学制:{{ major.fee }}/{{ major.academic }}</text>
</view>
</view>
</view>
<view
class="w-[104rpx] h-[52rpx] rounded-[8rpx] custom-btn"
@click.stop="handleClick(major)"
>
填报
</view>
</view>
<DataTable :data="major.items" :score="score" />
</view>
</view>
</template>
<script lang="ts" setup>
import { calcTypeName } from './useWisheList'
import DataTable from './DataTable.vue'
import { useUserStore } from '@/store/user'
const userStore = useUserStore()
const props = defineProps<{
item: any
score?: number
}>()
const handleClick = (major: any) => {
let exitMajorUnList = userStore.userInfo.wishList.find((item) => item.unId === props.item.uId)
if (exitMajorUnList) {
userStore.setWishListMajor({
val: {
_pId: major.planId,
major: major.major,
majorCode: major.majorCode,
majorGroup: major.majorGroup,
percentAge: major.percentAge,
},
unId: props.item.uId,
})
} else {
let _major = {
unId: props.item.uId,
unName: props.item.name,
unCode: props.item.collegeCode,
type: props.item.type,
vItems: [
{
_pId: major.planId,
major: major.major,
majorCode: major.majorCode,
majorGroup: major.majorGroup,
percentAge: major.percentAge,
sort: 1,
type: major.type,
},
],
}
userStore.setWishListMajorWithUn(_major)
}
}
</script>
<style lang="scss" scoped>
.custom-background {
background: linear-gradient(180deg, var(--background-color) 0%, #fff 60%, #fff 100%);
}
.custom-btn {
border: 2rpx solid #1580ff;
color: #1580ff;
display: flex;
align-items: center;
justify-content: center;
}
</style>

View File

@ -1,27 +1,91 @@
<template> <template>
<!-- 表格 -->
<view class="w-full"> <view class="w-full">
<!-- 头部 --> <!-- 头部 -->
<view class="flex gap-[22rpx]"> <view class="flex items-center gap-[16rpx]">
<view v-for="item in columns" :key="item.prop" class="text-[#505050] text-[22rpx]"> <view
{{ item.label }} v-for="headItem in columns"
class="text-[22rpx] text-[#505050]"
:style="{ width: headItem.width }"
>
{{ headItem.label }}
<view
class="i-carbon-help text-[#86909C]"
v-if="headItem.key === 'lineDiff' || headItem.key === 'rankDiff'"
></view>
</view> </view>
</view> </view>
<!-- 表格内容 -->
<view> <view>
<view v-for="dataItem in data" :key="dataItem._id" class="flex gap-[22rpx]"> <view v-for="(item, index) in recompileData" class="flex items-center gap-[16rpx]">
<view v-for="item in columns" :key="item.prop" class="text-[#505050] text-[22rpx]"> <view
{{ dataItem[item.prop] }} v-for="col in columns"
class="text-[22rpx] text-[#505050]"
:style="{ width: col.width }"
>
<view v-if="col.key === 'lineDiff'">
{{ item['lineDiff'] }}
</view>
<view class="flex items-center gap-[8rpx]" v-else-if="col.key === 'rankDiff'">
{{ item['rankDiff'] }}
<image
src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABoAAAATCAYAAACORR0GAAAAAXNSR0IArs4c6QAAATlJREFUSEu11eFNwzAQBeB3gQEyAIV2g67QDewJgBGYgHYCRmhH8AbABHSDRhSJvxmA5sEFtTKuk7jIza9EivP57l0SQcZjY8z0ApgSGAtwI0ApInpdSkYH78bcicjy6JnkOiukQAwj8Jod+rD29qd1K78qkqusUAxRsCEX2aAQIXmviGam58mQTtTEuXVseGLItXNt+zSzAkgbhq0xjxCZg5yPnFv4WB/i3zdY0QHZr/KwAKlB2pFzL7Gqe6EjxMNEpPKmqxZydtXR2jarrhc2QGoNtBB50rc+WDOIdEIhst/tpzHjncizhyUhUagL2VfhYeVQuzqHYQj5gwFlXyZhJIeMUpH/foRb6NxIm5GPEKgK0p7SktQKZWvtG35/VtWOnE2cq1IXn3KfbIwpL4ti+dU0D+dCdEPf+I3M1u2H9e8AAAAASUVORK5CYII="
mode="scaleToFill"
class="w-[16rpx] h-[16rpx]"
v-if="item['rankDiff'] > 0"
/>
<image
v-else
src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABoAAAATCAYAAACORR0GAAAAAXNSR0IArs4c6QAAARRJREFUSEu91EFOhDAYhuH370TXHGGOwMaEuNJM4jnKCYwnEE4yeAoTE0LcsZwb6BE8wFC1OBBGO6UmZboikPTJ9/Uvkj3rtbqkMUqK9nb7xEJLrmv9Bqzt/kaJXgqTrNZawXYIshQmFjgH1kPnwEboP9jVi05XkLZ3VRU6O0dQCGaRixUNkBgo2k1VhmB/IB82RcbhCcSckBMzlEpxb5MckI/hOSTZSciFTVLkXcduqLC/gzPJvJAzGeTt5mcIflfpw2ah6YYGHgZkSBeKBUFzU+XDslo/YniNAp2q0b5XUNCRR4Nc2NiEoYwKebAqOmTPpK/reMU7o8NVcCH203vURDeNTvZ7UhGS7pMUIUFI5ftv8gVvqo+bwdfwaAAAAABJRU5ErkJggg=="
mode="scaleToFill"
class="w-[16rpx] h-[16rpx]"
/>
</view>
<view v-else>
{{ item[col.key] }}
</view>
</view> </view>
</view> </view>
</view> </view>
</view> </view>
</template> </template>
<script setup lang="ts"> <script lang="ts" setup>
const props = defineProps<{ const props = defineProps({
columns: any[] data: {
data: any[] type: Array,
}>() default: () => [],
</script> },
score: {
type: Number,
default: 0,
},
})
<style scoped lang="scss"></style> const columns = ref([
{ label: '年份', key: 'year', width: '62rpx' },
{ label: '录取', key: 'planCount', width: '54rpx' },
{ label: '线差', key: 'lineDiff', width: '86rpx' },
{ label: '最低分', key: 'score', width: '76rpx' },
{ label: '最低位次', key: 'rankLine', width: '98rpx' },
{ label: '位次差', key: 'rankDiff', width: 'max-content' },
])
const rankDiff = (index: number, item) => {
return index === props.data.length - 1
? item['rankLine']
: item['rankLine'] - props.data[index + 1]['rankLine']
}
const recompileData = computed(() => {
const _data = Object.create(props.data)
_data.forEach((item, index) => {
item['rankDiff'] = rankDiff(index, item)
item['lineDiff'] = item['score'] - props.score
})
return _data
})
</script>

View File

@ -0,0 +1,23 @@
<template>
<view
class="bg-[#E2EDF9] text-[#1580FF] text-[22rpx] flex justify-between items-center px-[32rpx] py-[10rpx]"
>
<view class="flex gap-[16rpx]">
<text>{{ userInfo.estimatedAchievement.expectedScore }}</text>
<text>
{{ userInfo.estimatedAchievement.subjectGroup.split(',').join('/') }}
</text>
<text>{{ userInfo.batchName }}</text>
</view>
<view>
<text>重要提示</text>
<text class="i-carbon-help"></text>
</view>
</view>
</template>
<script lang="ts" setup>
defineProps<{
userInfo: any
}>()
</script>

View File

@ -0,0 +1,111 @@
<template>
<view class="h-[16rpx] bg-[#F5F5F5]"></view>
<view class="flex items-start p-[32rpx]">
<view class="flex flex-col items-center gap-[16rpx]">
<image :src="item.logo" mode="scaleToFill" class="w-[112rpx] h-[112rpx]" />
<view
class="w-[52rpx] h-[52rpx] rounded-[8rpx] font-semibold text-[28rpx] flex items-center justify-center"
:style="calcTypeName(item.type).style"
>
{{ calcTypeName(item.type).text }}
</view>
<text class="text-[32rpx] font-semibold">
{{
Math.round(
item.items.reduce((a, b) => a + Number(b.percentAge.replace('%', '')), 0) /
item.items.length,
)
}}
%
</text>
</view>
<view class="flex flex-col ml-[24rpx] justify-between flex-1">
<view class="flex justify-between mb-[14rpx]">
<view class="flex justify-between flex-col gap-[6rpx]">
<text class="text-[32rpx] font-semibold">{{ item.name }}</text>
<text class="text-[22rpx] text-[#505050]">
{{ item.city }}·{{ item.educationCategory }}
</text>
<view class="text-[22rpx] text-[#8F959E] flex items-center">
<text class="truncate max-w-[300rpx]" v-show="item.features.length > 0">
{{ item.features.slice(0, 3).join('/') }}/
</text>
<text>排名{{ item.rank }}</text>
</view>
<view class="text-[22rpx] text-[#1F2329] mt-[8rpx] flex gap-[10rpx]">
<text class="">代码{{ item.collegeCode }}</text>
<text>{{ item.year }}计划{{ item.items.reduce((a, b) => a + b.planCount, 0) }}</text>
</view>
</view>
<view class="flex flex-col gap-[8rpx] items-center">
<view
class="text-[24rpx] px-[16rpx] py-[12rpx] rounded-[8rpx] border-[2rpx] border-[#1580FF] border-solid"
@click.stop="handleShow"
>
专业{{ item.items.length }}
</view>
<text class="text-[20rpx] text-[#8F959E]">已填 1</text>
</view>
</view>
<DataTable :data="item.childItems" v-bind="$attrs" />
</view>
</view>
<ActionSheet v-model:show="show">
<template #title>
<view class="flex items-center justify-between px-[32rpx] pt-[32rpx] pb-[24rpx]">
<view class="flex flex-col gap-[14rpx]">
<text class="text-[36rpx] text-[#303030] font-bold">{{ item.name }}</text>
<text class="text-[22rpx] text-[#505050]">
{{ item.city }}·{{ item.educationCategory }}
</text>
</view>
<view class="flex flex-col items-end gap-[40rpx]">
<view class="i-carbon-close-large w-[40rpx] h-[40rpx]" @click.stop="show = false"></view>
<view class="text-[22rpx]">
<text>已填</text>
<text class="text-[#1580FF]">2</text>
<text></text>
</view>
</view>
</view>
</template>
<CollegeMajor :item="item" v-bind="$attrs" />
<template #footer>
<view class="flex items-center justify-between gap-[30rpx]">
<view class="cancel-btn" @click.stop="show = false">取消</view>
<view class="submit-btn" @click.stop="handleConfirm">确认</view>
</view>
</template>
</ActionSheet>
</template>
<script lang="ts" setup>
import DataTable from './DataTable.vue'
import { useUserStore } from '@/store/user'
import ActionSheet from '@/pages-sub/components/ActionSheet.vue'
import CollegeMajor from './CollegeMajor.vue'
import { calcTypeName } from './useWisheList'
const userStore = useUserStore()
const props = defineProps({
item: Object,
})
const show = ref(false)
const handleConfirm = () => {
show.value = false
}
const handleShow = () => {
show.value = true
}
</script>
<style lang="scss" scoped>
@import '@/pages-sub/home/styles/picker-view-btn.scss';
</style>

View File

@ -17,21 +17,7 @@
:auto-show-system-loading="true" :auto-show-system-loading="true"
> >
<template #top> <template #top>
<view <HeaderTip :user-info="userStore.userInfo" />
class="bg-[#E2EDF9] text-[#1580FF] text-[22rpx] flex justify-between items-center px-[32rpx] py-[10rpx]"
>
<view class="flex gap-[16rpx]">
<text>{{ userStore.userInfo.estimatedAchievement.expectedScore }}</text>
<text>
{{ userStore.userInfo.estimatedAchievement.subjectGroup.split(',').join('/') }}
</text>
<text>{{ userStore.userInfo.batchName }}</text>
</view>
<view>
<text>重要提示</text>
<text class="i-carbon-help"></text>
</view>
</view>
<view class="flex justify-between items-center px-[32rpx] py-[16rpx]"> <view class="flex justify-between items-center px-[32rpx] py-[16rpx]">
<view class="flex items-center gap-[24rpx] text-[#303030]"> <view class="flex items-center gap-[24rpx] text-[#303030]">
<view <view
@ -51,16 +37,15 @@
</view> </view>
</view> </view>
<SearchInput <SearchInput @confirm="handleChange" placeholder="请输入意向院校" />
v-model:value="searchValue"
@confirm="handleChange"
placeholder="请输入意向院校"
/>
</view> </view>
<view class="flex gap-[10rpx] px-[32rpx] border-top"> <view class="flex gap-[10rpx] px-[32rpx] border-top">
<view class="flex justify-between items-center text-[28rpx] line-height-none"> <view
全部({{ total }}) class="flex justify-between items-center text-[28rpx] line-height-none"
@click="handleShow(3)"
>
{{ collegeSearch.tModelValue === '-1' ? `全部${total}` : collegeSearch.tModel }}
<view class="i-carbon-caret-down"></view> <view class="i-carbon-caret-down"></view>
</view> </view>
@ -74,8 +59,6 @@
class="custom-slider" class="custom-slider"
/> />
</view> </view>
<view class="h-[16rpx] bg-[#F5F5F5]"></view>
</template> </template>
<!-- 滚动主体 --> <!-- 滚动主体 -->
@ -84,86 +67,28 @@
:id="`zp-id-${item.zp_index}`" :id="`zp-id-${item.zp_index}`"
:key="item.zp_index" :key="item.zp_index"
v-for="(item, index) in schoolList" v-for="(item, index) in schoolList"
@click="itemClick(item, item.zp_index)"
> >
<view class="flex items-start p-[32rpx]"> <ScrollListItem :item="item" :score="score" />
<view class="flex flex-col items-center gap-[16rpx]">
<image :src="item.logo" mode="scaleToFill" class="w-[112rpx] h-[112rpx]" />
<view
class="w-[52rpx] h-[52rpx] rounded-[8rpx] font-semibold text-[28rpx] flex items-center justify-center"
:style="calcTypeName(item.type).style"
>
{{ calcTypeName(item.type).text }}
</view>
<text class="text-[32rpx] font-semibold">
{{
Math.round(
item.items.reduce((a, b) => a + Number(b.percentAge.replace('%', '')), 0) /
item.items.length,
)
}}
%
</text>
</view>
<view class="flex flex-col ml-[24rpx] justify-between flex-1">
<view class="flex justify-between mb-[14rpx]">
<view class="flex justify-between flex-col gap-[6rpx]">
<text class="text-[32rpx] font-semibold">{{ item.name }}</text>
<text class="text-[22rpx] text-[#505050]">
{{ item.city }}·{{ item.educationCategory }}
</text>
<view class="text-[22rpx] text-[#8F959E] flex items-center">
<text class="truncate max-w-[300rpx]" v-show="item.features.length > 0">
{{ item.features.slice(0, 3).join('/') }}/
</text>
<text>排名{{ item.rank }}</text>
</view>
<view class="text-[22rpx] text-[#1F2329] mt-[8rpx]">
<text class="">代码{{ item.collegeCode }}</text>
<text>
{{ item.year }}计划{{ item.items.reduce((a, b) => a + b.planCount, 0) }}
</text>
</view>
</view>
<view class="flex flex-col gap-[8rpx] items-center">
<view
class="text-[24rpx] px-[16rpx] py-[12rpx] rounded-[8rpx] border-[2rpx] border-[#1580FF] border-solid"
>
专业{{ item.items.length }}
</view>
<text class="text-[20rpx] text-[#8F959E]">已填 1</text>
</view>
</view>
<WXXTable :data="item.childItems">
<WXXTableCol label="年份" prop="year" />
<WXXTableCol label="录取" prop="planCount" />
<WXXTableCol label="线差" prop="lineDiff" />
<WXXTableCol label="最低分" prop="score" />
<WXXTableCol label="最低位次" prop="rankLine" />
<WXXTableCol label="位次差" prop="rankLine">
<template>hello</template>
</WXXTableCol>
</WXXTable>
</view>
</view>
</view> </view>
<ActionSheet v-model:show="show" :title="actionTitle"> <ActionSheet v-model:show="show" :title="actionTitle">
<view class="px-[36rpx]"> <view class="px-[36rpx]">
<Region <Region
v-if="actionTitle === '地域'" v-if="actionType === 2"
width="210rpx" width="210rpx"
height="60rpx" height="60rpx"
class="px-[32rpx]" class="px-[32rpx]"
@change-name="handleRegionName" @change-name="handleRegionName"
/> />
</view> </view>
<FilterMenu <FilterMenu v-if="actionType === 1" :show-phase="false" ref="filterMenuRef" :menuBit="28" />
v-if="actionTitle === '院校'" <CustomPickerView
:show-phase="false" v-if="actionType === 3"
ref="filterMenuRef" :list="typeModelList"
:menuBit="28" v-model:modelValue="collegeSearch.tModelValue"
value-key="value"
label-key="name"
@change="handleTypeModelChange"
/> />
<template #footer> <template #footer>
<view class="flex items-center justify-between gap-[30rpx]"> <view class="flex items-center justify-between gap-[30rpx]">
@ -172,6 +97,16 @@
</view> </view>
</template> </template>
</ActionSheet> </ActionSheet>
<template #bottom>
<view class="pb-safe px-[32rpx] pt-[32rpx] bg-[#fff]">
<view
class="h-[80rpx] rounded-[8rpx] bg-[#1580FF] flex items-center justify-center text-[#fff]"
>
预览志愿表(2)
</view>
</view>
</template>
</z-paging> </z-paging>
</template> </template>
@ -181,44 +116,19 @@ import ActionSheet from '@/pages-sub/components/ActionSheet.vue'
import Region from '@/pages-sub/home/components/Region.vue' import Region from '@/pages-sub/home/components/Region.vue'
import FilterMenu from '@/pages-sub/home/components/FilterMenu.vue' import FilterMenu from '@/pages-sub/home/components/FilterMenu.vue'
import Slider from '@/pages-sub/components/Slider.vue' import Slider from '@/pages-sub/components/Slider.vue'
import CustomPickerView from '@/pages-sub/components/CustomPickerView.vue'
import { getBatchData } from '@/service/index/api'
import ScrollListItem from './ScrollListItem.vue'
import HeaderTip from './HeaderTip.vue'
import { getPlanProListByFilter } from '@/service/index/api' import { getPlanProListByFilter } from '@/service/index/api'
import WXXTable from '@/pages-sub/components/table/Table.vue'
import WXXTableCol from '@/pages-sub/components/table/TableCol.vue'
// import DataTable from './DataTable.vue'
import { useUserStore } from '@/store/user' import { useUserStore } from '@/store/user'
import { coverTypeModel } from './useWisheList'
const columns = ref([
{
label: '年份',
prop: 'year',
},
{
label: '录取',
prop: 'planCount',
},
{
label: '线差',
prop: 'lineDiff',
},
{
label: '最低分',
prop: 'score',
},
{
label: '最低位次',
prop: 'rankLine',
},
{
label: '位次差',
prop: 'rankLine',
},
])
const userStore = useUserStore() const userStore = useUserStore()
const sliderValue = ref([550, 590])
const schoolList = ref([]) const schoolList = ref([])
const paging = ref(null) const paging = ref(null)
const filterMenuRef = ref(null) const filterMenuRef = ref(null)
@ -226,91 +136,108 @@ const filterMenuRef = ref(null)
const location = ref(userStore.userInfo.estimatedAchievement.provinceCode) const location = ref(userStore.userInfo.estimatedAchievement.provinceCode)
const total = ref(0) const total = ref(0)
const typeModelList = ref([])
const handleTypeModelChange = ({ item }) => {
collegeSearch.value.tModelValue = item.value
collegeSearch.value.tModel = item.name
}
const queryList = (page: number, pageSize: number) => { const queryList = (page: number, pageSize: number) => {
getPlanProListByFilter({ getPlanProListByFilter({
pageIndex: page, pageIndex: page,
pageSize: pageSize, pageSize: pageSize,
location: userStore.userInfo.estimatedAchievement.provinceCode, location: location.value,
p: userStore.userInfo.estimatedAchievement.sp, p: userStore.userInfo.estimatedAchievement.sp,
subjects: userStore.userInfo.estimatedAchievement.subjectGroup.split(','), subjects: userStore.userInfo.estimatedAchievement.subjectGroup.split(','),
score: +userStore.userInfo.estimatedAchievement.expectedScore, score: +userStore.userInfo.estimatedAchievement.expectedScore,
batchName: userStore.userInfo.batchName, batchName: userStore.userInfo.batchName,
startscore: sliderValue.value[0],
endscore: sliderValue.value[1],
province: province.value,
nature: collegeSearch.value.nature,
feature: collegeSearch.value.feature,
majors: collegeSearch.value.majors,
keyword: searchValue.value,
}).then((resp) => { }).then((resp) => {
if (resp.code === 200) { if (resp.code === 200) {
paging.value.complete((resp.result as { rows: any[] }).rows) paging.value.complete((resp.result as { rows: any[] }).rows)
total.value = (resp.result as { totalRows: number }).totalRows total.value = (resp.result as { totalRows: number }).totalRows
typeModelList.value = coverTypeModel((resp.result as { tModel: any }).tModel, total.value)
} }
}) })
} }
const virtualListChange = (_vList) => { const virtualListChange = (_vList) => {
schoolList.value = _vList schoolList.value = _vList
} }
const itemClick = (item, index) => { const itemClick = (item, index) => {
uni.navigateTo({ url: `/pages-sub/home/college/info?collegeId=${item._id}` }) uni.navigateTo({ url: `/pages-sub/home/college/info?collegeId=${item.uId}` })
} }
const collegeSearch = ref({ const collegeSearch = ref({
nature: '', nature: [],
feature: '', feature: [],
majors: '', majors: [],
tModel: '',
tModelValue: '-1',
}) })
const show = ref(false) const show = ref(false)
const actionTitle = ref('') const actionTitle = ref('')
const actionType = ref(1)
const handleConfirm = () => { const handleConfirm = () => {
show.value = false show.value = false
if (actionTitle.value === '院校') { if (actionType.value === 1) {
filterMenuRef.value.handleConfirm() let _cur = filterMenuRef.value.handleConfirm()
collegeSearch.value.feature = _cur.chooseCollegeFeature
collegeSearch.value.nature = _cur.chooseNature
collegeSearch.value.majors = _cur.chooseMajors
} }
paging.value.reload()
} }
const handleShow = (type: number) => { const handleShow = (type: number) => {
actionTitle.value = type === 1 ? '院校' : '地域' if (type === 1) {
actionTitle.value = '院校'
} else if (type === 2) {
actionTitle.value = '地域'
}
actionType.value = type
show.value = true show.value = true
} }
const searchValue = ref('') const searchValue = ref('')
const handleChange = () => { const handleChange = (value: string) => {
console.log(searchValue.value) searchValue.value = value
paging.value.reload()
} }
const province = ref([])
const handleRegionName = (val: string[]) => { const handleRegionName = (val: string[]) => {
console.log(val) province.value = val
} }
const sliderValue = ref([550, 590])
const handleSliderChange = (val) => { const handleSliderChange = (val) => {
console.log('滑块值变化:', val) paging.value.reload()
} }
const calcTypeName = (type: number) => { const score = ref(0)
const style = { onLoad(() => {
0: { getBatchData(userStore.userInfo.batchDataUrl).then((resp) => {
text: '冲', if (resp.code === 200) {
color: '#EB5241', const _batchData = resp.result as any[]
bgColor: 'rgba(235,82,65,0.15)', if (_batchData.length > 0) {
}, const _score =
1: { _batchData[0].batches.find((item) => item.batch === userStore.userInfo.batchName)
text: '稳', ?.score || 0
color: '#FA8E23', score.value = _score
bgColor: 'rgba(250,142,35,0.15)',
},
2: {
text: '保',
color: '#15C496',
bgColor: 'rgba(21,196,150,0.15)',
},
}[type] || { text: '保', color: '#15C496', bgColor: 'rgba(21,196,150,0.15)' }
return {
text: style.text,
style: {
color: style.color,
backgroundColor: style.bgColor,
},
} }
} }
})
})
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>

View File

@ -0,0 +1,44 @@
export const calcTypeName = (type: number) => {
const style = {
0: {
text: '冲',
color: '#EB5241',
bgColor: 'rgba(235,82,65,0.15)',
},
1: {
text: '稳',
color: '#FA8E23',
bgColor: 'rgba(250,142,35,0.15)',
},
2: {
text: '保',
color: '#15C496',
bgColor: 'rgba(21,196,150,0.15)',
},
}[type] || { text: '保', color: '#15C496', bgColor: 'rgba(21,196,150,0.15)' }
return {
text: style.text,
style: {
color: style.color,
backgroundColor: style.bgColor,
},
}
}
export const coverTypeModel = (tModel: Record<keyof typeof TYPE_LABELS, number>, total: number) => {
const TYPE_LABELS = {
c: '冲',
w: '稳',
b: '保',
} as const
let _result = Object.entries(TYPE_LABELS).map(([key, label]) => ({
name: `${label}(${tModel[key]})`,
value: key === 'b' ? '0' : key === 'w' ? '1' : '2',
}))
_result.unshift({
name: `全部${total}`,
value: '-1',
})
return _result
}

View File

@ -239,16 +239,28 @@
"navigationStyle": "custom" "navigationStyle": "custom"
} }
}, },
{
"path": "home/wishesList/CollegeMajor",
"type": "page"
},
{ {
"path": "home/wishesList/DataTable", "path": "home/wishesList/DataTable",
"type": "page" "type": "page"
}, },
{
"path": "home/wishesList/HeaderTip",
"type": "page"
},
{ {
"path": "home/wishesList/index", "path": "home/wishesList/index",
"type": "page", "type": "page",
"style": { "style": {
"navigationBarTitleText": "我的志愿表" "navigationBarTitleText": "我的志愿表"
} }
},
{
"path": "home/wishesList/ScrollListItem",
"type": "page"
} }
] ]
}, },

View File

@ -56,6 +56,7 @@ const initState = {
}, },
batchDataUrl: '', batchDataUrl: '',
batchName: '', batchName: '',
wishList: [],
} }
export const useUserStore = defineStore( export const useUserStore = defineStore(
@ -117,6 +118,40 @@ export const useUserStore = defineStore(
userInfo.value.batchName = val userInfo.value.batchName = val
} }
const setWishListMajor = ({ val, unId }: { val: any; unId: string }) => {
try {
const targetItem = userInfo.value.wishList.find((item) => item.unId === unId)
if (!targetItem) {
console.error('未找到对应的志愿清单项')
return
}
userInfo.value = {
...userInfo.value,
wishList: userInfo.value.wishList.map((item) => {
if (item.unId === unId) {
return {
...item,
vItems: [...item.vItems, { ...val, sort: item.vItems.length + 1 }],
}
}
return item
}),
}
} catch (error) {
console.error('更新志愿清单失败:', error)
}
}
const setWishListMajorWithUn = (val) => {
userInfo.value.wishList.push({ ...val, sort: userInfo.value.wishList.length + 1 })
}
// 清除志愿表
const clearWishList = () => {
userInfo.value.wishList = []
}
// 清除用户信息 // 清除用户信息
const clearUserInfo = () => { const clearUserInfo = () => {
userInfo.value = { ...initState } userInfo.value = { ...initState }
@ -143,6 +178,9 @@ export const useUserStore = defineStore(
setZyBatches, setZyBatches,
setBatchDataUrl, setBatchDataUrl,
setBatchName, setBatchName,
clearWishList,
setWishListMajor,
setWishListMajorWithUn,
} }
}, },
{ {

View File

@ -62,6 +62,7 @@ export type ExtraUserInfo = {
} }
batchDataUrl: string batchDataUrl: string
batchName: string batchName: string
wishList: any[]
} & IUserInfo } & IUserInfo
export type News = { export type News = {

View File

@ -27,8 +27,11 @@ interface NavigateToOptions {
"/pages-sub/home/news/index" | "/pages-sub/home/news/index" |
"/pages-sub/home/news/newsList" | "/pages-sub/home/news/newsList" |
"/pages-sub/home/schoolRank/index" | "/pages-sub/home/schoolRank/index" |
"/pages-sub/home/wishesList/CollegeMajor" |
"/pages-sub/home/wishesList/DataTable" | "/pages-sub/home/wishesList/DataTable" |
"/pages-sub/home/wishesList/HeaderTip" |
"/pages-sub/home/wishesList/index" | "/pages-sub/home/wishesList/index" |
"/pages-sub/home/wishesList/ScrollListItem" |
"/login-sub/index" | "/login-sub/index" |
"/pages-evaluation-sub/index" | "/pages-evaluation-sub/index" |
"/pages-evaluation-sub/aiAutoFill/index" | "/pages-evaluation-sub/aiAutoFill/index" |