volunteer-4/src/pages-sub/home/expand/index.vue

166 lines
4.4 KiB
Vue

<route lang="json5" type="page">
{
style: {
navigationStyle: 'custom',
},
}
</route>
<template>
<view class="flex flex-col h-screen">
<view class="relative">
<Navbar
safeAreaInsetTop
bg-color="transparent"
:bordered="false"
left-arrow
title="查扩缩招"
@click-left="navigatorBack"
/>
<view class="custom-background h-[200rpx] w-full absolute top-0 left-0 z-[-1]"></view>
</view>
<drop-menu>
<drop-menu-item
:key="1"
:title="searchParams.locationName || '省份'"
custom-class="flex items-center"
>
<view class="pl-[32rpx] pb-[32rpx]">
<Region
:defaultValue="searchParams.locationCode ? [searchParams.locationCode] : []"
:max="1"
@changeName="handleRegionChange"
@change="handleRegionChangeCode"
/>
</view>
</drop-menu-item>
<drop-menu-item
:key="2"
:title="searchParams.searchNature || '层次'"
custom-class="flex items-center"
>
<view class="pl-[32rpx] pb-[32rpx]">
<Nature @changeName="handleNatureChange" />
</view>
</drop-menu-item>
<drop-menu-item :key="3" title="类别" custom-class="flex items-center">
<view class="pl-[32rpx] pb-[32rpx]">
<UniType
@change="handleUniTypeChange"
:max="1"
:default-value="searchParams.type ? [searchParams.type] : []"
/>
</view>
</drop-menu-item>
</drop-menu>
<view class="px-32rpx">
<view class="flex items-center justify-between input-wrapper-class">
<input
v-model="searchParams.Score"
type="number"
placeholder="请输入你的高考分数"
confirm-type="done"
input-mode="numeric"
class="flex-auto"
/>
<view class="text-[#1580FF] text-[24rpx] search-text" @click="handleConfirm">查询</view>
</view>
<view class="text-[#636363] text-[20rpx] mt-[24rpx]">分数范围:{{ betweenScores }}</view>
</view>
<view class="bg-[#F8F8F8] h-[16rpx] mt-[40rpx]"></view>
</view>
</template>
<script lang="ts" setup>
import Navbar from '@/pages-sub/components/navbar/Navbar.vue'
import { useUserStore } from '@/store'
import DropMenu from '@/pages-sub/components/drop-menu/DropMenu.vue'
import DropMenuItem from '@/pages-sub/components/drop-menu/DropMenuItem.vue'
import Region from '@/pages-sub/home/components/Region.vue'
import UniType from '@/pages-sub/home/components/UniType.vue'
import Nature from '@/pages-sub/home/components/Nature.vue'
import { getBatchList } from '@/service/index/api'
const userStore = useUserStore()
const searchParams = ref({
locationCode: userStore.userInfo.estimatedAchievement.provinceCode || '370000',
locationName: userStore.userInfo.estimatedAchievement.provinceName || '山东省',
type: '',
searchNature: '',
Score: '',
})
const handleConfirm = () => {
getBatchListData()
}
const betweenScores = ref('')
const checkYearList = ref([])
const navigatorBack = () => {
uni.navigateBack()
}
const handleRegionChange = (val) => {
searchParams.value.locationName = val.join(',')
}
const handleRegionChangeCode = (val) => {
searchParams.value.locationCode = val[0]
getBatchListData()
}
const handleUniTypeChange = (val) => {
searchParams.value.type = val[0]
getBatchListData()
}
const handleNatureChange = (val) => {}
type LineItem = {
batch_id: number
batch_name: string
province_code: number
province_name: string
score: string
subject_id: number
subject_name: string
year: number
}
const lineList = ref<LineItem[]>([])
const getBatchListData = () => {
getBatchList({
locationCode: searchParams.value.locationCode,
year: '',
type: searchParams.value.type,
}).then((resp) => {
if (resp.code === 200 && resp.result !== '暂无数据') {
const _result = resp.result as {
configList: { yearList: { year: string; check: boolean }[] }
list: LineItem[]
}
checkYearList.value = _result.configList.yearList
lineList.value = _result.list
} else if (resp.code === 200 && resp.result === '暂无数据') {
lineList.value = []
}
})
}
onBeforeMount(() => {
getBatchListData()
})
</script>
<style lang="scss" scoped>
@import '@/pages-sub/home/styles/navbar-background.scss';
@import '@/pages-sub/home/styles/search-input.scss';
</style>