feat: 找大学编写中

master
xjs 2025-03-03 18:07:04 +08:00
parent 6950ec7ed2
commit 9c56a6952a
34 changed files with 486 additions and 307 deletions

View File

@ -123,6 +123,7 @@
"useNewsList": true,
"newsList": true,
"useLogin": true,
"useWxInfo": true
"useWxInfo": true,
"useUniversityInfo": true
}
}

2
env/.env vendored
View File

@ -2,7 +2,7 @@ VITE_APP_TITLE = '六维志愿'
VITE_APP_PORT = 9000
VITE_UNI_APPID = 'H57F2ACE4'
VITE_WX_APPID = '__UNI__7AE2402'
VITE_WX_APPID = 'wx05e75004e657527c'
# h5部署网站的base配置到 manifest.config.ts 里的 h5.router.base
VITE_APP_PUBLIC_BASE=

View File

@ -1,7 +1,7 @@
<template>
<wd-checkbox-group
v-model="defValue"
custom-class="flex flex-wrap gap-[16rpx] justify-items-center items-center"
custom-class="flex flex-wrap gap-[16rpx] px-[32rpx] pb-[16rpx] items-center"
checked-color="#1580FF"
@change="handleChange"
>
@ -11,8 +11,8 @@
:model-value="item[valueKey]"
cell
shape="button"
custom-class="w-[152rpx]! h-[76rpx] p-0! mr-0!"
custom-label-class="w-[152rpx]! h-[76rpx]! rounded-[8rpx]! checkbox-item-border bg-[#f7f8fa]!"
custom-class="w-auto! h-[76rpx] p-0! mr-0!"
custom-label-class="min-w-[152rpx]! h-[76rpx]! rounded-[8rpx]! checkbox-item-border bg-[#f7f8fa]!"
>
{{ item[labelKey] }}
</wd-checkbox>
@ -55,7 +55,7 @@ watch(
{ immediate: true },
)
const handleChange = (val: string[]) => {
const handleChange = (val: unknown) => {
emits('change', val)
}
</script>

View File

@ -15,7 +15,12 @@ import { useNatureList } from '@/hooks/useFilterSchool'
const { natureList: infoList } = useNatureList()
const defaultInfo = ref<string[]>([])
const handleChange = (val: string[]) => {
console.log(val)
const emits = defineEmits(['changeName'])
const handleChange = (val: any) => {
const names = infoList.value
.filter((item) => val.value.includes(item.id))
.map((item) => item.name)
emits('changeName', names)
}
</script>

View File

@ -17,10 +17,22 @@ defineOptions({
})
const { regionList } = useRegionInfo()
const regionInfo = ref<string[]>(['110000', '120000'])
const handleChange = (val: string[]) => {
console.log(val)
const props = defineProps({
regionInfo: {
type: Array as PropType<string[]>,
default: () => [],
},
})
const emits = defineEmits(['change', 'changeName'])
const handleChange = (val: any) => {
const names = regionList.value
.filter((item) => val.value.includes(item.code))
.map((item) => item.name)
emits('changeName', names)
emits('change', val)
}
</script>

View File

@ -15,7 +15,13 @@ import { useUniversityType } from '@/hooks/useFilterSchool'
const { typeList: infoList } = useUniversityType()
const defaultInfo = ref<string[]>([])
const handleChange = (val: string[]) => {
console.log(val)
const emits = defineEmits(['change', 'changeName'])
const handleChange = (val: any) => {
const names = infoList.value
.filter((item) => val.value.includes(item.id))
.map((item) => item.name)
emits('changeName', names)
emits('change', val)
}
</script>

View File

@ -1,7 +1,7 @@
<template>
<wd-overlay :show="show" @click="handleClose">
<wd-overlay :show="show">
<view
class="fixed top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 z-[10071] flex flex-col items-center bg-white p-[40rpx] rounded-[32rpx]"
class="fixed top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 flex flex-col items-center bg-white p-[40rpx] rounded-[32rpx]"
>
<image
class="w-[200rpx] h-[200rpx]"
@ -15,14 +15,14 @@
<wd-button
size="large"
custom-class="w-[493rpx] mb-[40rpx]"
@click="handleClick"
@click.stop="handleClick"
open-type="getPhoneNumber"
@getphonenumber="getPhoneNumber"
>
手机号快捷登录
</wd-button>
<view class="flex items-center flex-nowrap" @click="checked = true">
<view class="flex items-center flex-nowrap" @click.stop="checked = true">
<wd-radio-group v-model="checked" custom-class="mr-10rpx">
<wd-radio :value="true" shape="dot"></wd-radio>
</wd-radio-group>
@ -38,9 +38,15 @@
<script lang="ts" setup>
import { useToast } from 'wot-design-uni'
import { useLogin, useWxInfo } from '@/hooks/useUserInfo'
import { getSessionKey } from '@/service/index/api'
import { useLogin } from '@/hooks/useUserInfo'
import {
getSessionKey,
getVolunteerInitialization,
getWxUserInfo,
setWxInfo,
} from '@/service/index/api'
import { useUserStore } from '@/store'
import { City } from '@/types/app-type'
const props = defineProps({
show: {
@ -54,12 +60,13 @@ defineOptions({
},
})
const emits = defineEmits(['update:close'])
const emits = defineEmits(['update:show', 'authReady'])
const toast = useToast()
const userStore = useUserStore()
const handleClose = () => {
emits('update:close', false)
emits('update:show', false)
}
const phone = ref(true) //
@ -74,8 +81,7 @@ const getPhoneNumber = async (e: any) => {
code: e.code,
}
getPhoneInfo.value = _getPhoneInfo
getUserInfo(e.code)
// this.phone = false
await getUserInfo(e.code)
} else if (e.errMsg == 'getPhoneNumber:fail not login') {
toast.warning('请先登录')
} else {
@ -91,21 +97,44 @@ const handleClick = () => {
const getUserInfo = async (code: string) => {
let userInfo = (await useLogin()) as { code: string; errMsg: string }
console.log(userInfo)
if (userInfo.errMsg == 'login:ok') {
const resp = await getSessionKey({ JsCode: userInfo.code })
if (resp.code == 200) {
const result = resp.result as { accessToken: string; openId: string }
userStore.setUserToken(result.accessToken)
userStore.setUserOpenId(result.openId)
setWxInfo({ code: userInfo.code, openId: result.openId })
//
getWxUserInfo().then((resp) => {
const infoData = resp.result as unknown as { userExtend: { provinceCode: string } }
userStore.setEstimatedAchievement(infoData.userExtend)
if (resp.code === 200) {
//
getVolunteerInitialization().then((res) => {
let list = res.result as any[]
let code = infoData.userExtend ? infoData.userExtend.provinceCode : ''
let addressItem: City
if (code !== '') {
for (let i = 0; i < list.length; i++) {
if (list[i].code == code) {
addressItem = list[i]
}
}
}
userStore.setUserCity(addressItem)
handleClose()
emits('authReady')
})
}
})
}
// useWxInfo({ code, OpenId: (resp.result as { openId: string }).openId })
} else {
toast.warning('您需先授权')
}
}
const parsePhoneNumber = (code: string, openId: string) => {
//
}
</script>
<style lang="scss" scoped>

View File

@ -1,170 +0,0 @@
<template>
<view class="content">
<!-- 使用 scroll-view 组件来实现滚动 -->
<scroll-view
ref="list"
:scroll-y="true"
class="list-container"
@scroll="handleScroll"
:scroll-top="state.startOffset"
>
<view class="list-phantom" :style="{ height: `${listHeight}${itemSizeUnit}` }"></view>
<view class="list" :style="{ transform: getTransform }">
<view
v-for="(item, index) in visibleData"
class="list-item"
:key="index"
:ref="setItemRef"
:style="`height:${state.itemHeights[index]}${itemSizeUnit}`"
>
<!-- <slot name="cell" :item="item" :index="index"></slot> -->
<text class="">
{{ item.name }}
</text>
</view>
</view>
</scroll-view>
</view>
</template>
<script setup lang="ts">
import { reactive, onMounted, computed } from 'vue'
const state = reactive({
listHeight: 0,
screenHeight: 0, //
startOffset: 0, //
startIndex: 0, //
endIndex: 0, //
itemHeights: [] as number[], //
})
const props = defineProps({
listData: {
type: Array<{ name: string; id: number }>,
default: () => [],
},
//
itemSize: {
type: Number,
default: 200,
},
itemSizeUnit: {
type: String,
default: 'px',
},
})
// const listHeight = computed(() => {
// return props.listData.length * props.itemSize
// })
const listHeight = computed(() => {
//
return state.itemHeights.reduce((sum, height) => sum + height, 0) || 0
})
const visibleCount = computed(() => {
return Math.ceil(state.screenHeight / props.itemSize) || 0
})
const getTransform = computed(() => {
return `translate3d(0,${state.startOffset}${props.itemSizeUnit},0)`
})
const visibleData = computed(() => {
return props.listData.slice(state.startIndex, Math.min(state.endIndex, props.listData.length))
})
onMounted(() => {
init()
})
const init = () => {
getScreenHeight()
// state.startIndex = 0 num state.startIndex = num state.startOffset = num * props.itemSize
// state.startIndex = 0
state.startIndex = 0
state.startOffset = 0
state.endIndex = state.startIndex + visibleCount.value
}
//
const getScreenHeight = () => {
uni.getSystemInfo({
success: function (res) {
state.screenHeight = res.screenHeight
},
})
}
// debounce
const debounce = (fn, delay, _this) => {
var delay = delay || 200
var timer = null
return function () {
let self = _this
let args = arguments
timer && clearTimeout(timer)
timer = setTimeout(function () {
timer = null
fn.apply(self, args)
}, delay)
}
}
const handleScroll = debounce(
(e) => {
//
let scrollTop = e.detail.scrollTop
//
state.startIndex = Math.floor(scrollTop / props.itemSize)
//
state.endIndex = state.startIndex + visibleCount.value
//
state.startOffset = scrollTop - (scrollTop % props.itemSize)
},
10,
'',
)
const itemRefs = ref([])
const setItemRef = (el) => {
if (el) {
itemRefs.value.push(el)
}
}
//
const calculateItemHeights = () => {
state.itemHeights = props.listData.map((_, index) => {
const refItem = itemRefs.value[index]
return refItem && refItem.$el ? refItem.$el.offsetHeight : props.itemSize // 使
})
}
watch(itemRefs.value, () => {
calculateItemHeights()
})
//
</script>
<style lang="scss" scoped>
.content {
height: 100%;
}
.list-container {
height: 100%;
overflow: auto;
position: relative;
.list-phantom {
position: absolute;
left: 0;
top: 0;
right: 0;
z-index: -1;
}
.list {
left: 0;
right: 0;
top: 0;
position: absolute;
.list-item {
text-align: center;
border-bottom: 1px solid #ccc;
}
}
}
</style>

View File

@ -1,9 +1,4 @@
import {
getNewsTop,
getVolunteerInitialization,
getNewsDetailInfo,
getNewsList,
} from '@/service/index/api'
import { getNewsTop, getProvinceInitialization, getNewsDetailInfo } from '@/service/index/api'
import { useCityStore } from '@/store/city'
import { useUserStore } from '@/store/user'
import { City, News, NewsDetail } from '@/types/app-type'
@ -18,7 +13,7 @@ const userStore = useUserStore()
export const cities = []
export const useCityInfo = () => {
getVolunteerInitialization().then((res) => {
getProvinceInitialization().then((res) => {
if (res.result) {
const list = res.result as Province[]
const li = groupByFirstLetter(list)

View File

@ -1,4 +1,5 @@
import { getWxInfo } from '@/service/index/api'
import { getUniversityInfo, setWxInfo } from '@/service/index/api'
import { useUserStore } from '@/store'
//uniapp 登陆获取用户信息
export const useLogin = () => {
@ -18,10 +19,24 @@ export const useLogin = () => {
})
}
export const useWxInfo = ({ code, OpenId }) => {
getWxInfo({ code, OpenId }).then((res) => {
export const useWxInfo = ({ code, openId }) => {
setWxInfo({ code, openId }).then((res) => {
if (res.code === 200) {
console.log(res.result)
}
})
}
export const useUniversityInfo = (provinceCode: number) => {
const userStore = useUserStore()
const universityBaseInfo = ref({})
getUniversityInfo({ Cid: userStore.userInfo.estimatedAchievement.id, Id: provinceCode }).then(
(res) => {
if (res.code === 200) {
universityBaseInfo.value = res.result
}
},
)
return { universityBaseInfo }
}

View File

@ -55,7 +55,7 @@
},
"quickapp": {},
"mp-weixin": {
"appid": "__UNI__7AE2402",
"appid": "wx05e75004e657527c",
"setting": {
"urlCheck": false
},

View File

@ -26,7 +26,7 @@
<view class="py-[48rpx] mx-[48rpx] avatar-border flex justify-center items-center">
<image
class="w-[144rpx] h-[144rpx] rounded-full"
src="@/pages-sub/static/images/customerService/avatar.svg"
src="@/pages-sub/static/images/customerService/avatar.jpg"
></image>
<view class="flex flex-col text-[#000] ml-[32rpx]">
<text class="mb-[12rpx] font-normal text-[28rpx]">专属客服为您服务</text>

View File

@ -4,6 +4,7 @@
style: {
navigationStyle: 'custom',
},
needLogin: true,
}
</route>
<template>
@ -26,7 +27,7 @@
<image
class="w-[286rpx] h-[286rpx] mt-[134rpx]"
src="@/pages-sub/static/images/autoFill/auto-fill.svg"
src="@/pages-sub/static/images/autoFill/auto-fill.jpg"
></image>
</view>
<FilterMenu v-model:show="show" />
@ -34,7 +35,7 @@
</template>
<script lang="ts" setup>
import FilterMenu from '@/components-sub/FilterMenu/FilterMenu.vue'
import FilterMenu from '@/components/filterMenu/FilterMenu.vue'
const navigatorBack = () => {
uni.navigateBack()

View File

@ -42,8 +42,8 @@ const navigatorBack = () => {
const chooseCity = (city: City) => {
userStore.setUserCity(city)
if (
userStore.userInfo.estimatedAchievement.cityCode &&
userStore.userInfo.estimatedAchievement.cityCode !== city.code
userStore.userInfo.estimatedAchievement.provinceCode &&
userStore.userInfo.estimatedAchievement.provinceCode !== city.code
) {
userStore.clearUserEstimatedAchievement()
}

View File

@ -1,5 +1,173 @@
<route lang="json5" type="page">
{
style: {
navigationStyle: 'custom',
},
needLogin: true,
}
</route>
<template>
<text>找大学</text>
<view class="content">
<z-paging
ref="paging"
use-virtual-list
:force-close-inner-list="true"
cell-height-mode="dynamic"
@virtualListChange="virtualListChange"
@query="queryList"
:auto-show-system-loading="true"
>
<template #top>
<wd-navbar
safeAreaInsetTop
custom-class="bg-white!"
:bordered="false"
left-arrow
@click-left="navigatorBack"
>
<template #title>
<wd-input
type="text"
v-model="searchValue"
placeholder="院校名称"
@confirm="handleChange"
no-border
prefixIcon="search"
custom-class="rounded-[48rpx] bg-[#F7F7F7]! flex items-center border-none! px-[24rpx] py-[12rpx]"
custom-input-class="h-full flex items-center"
/>
</template>
</wd-navbar>
<wd-drop-menu>
<wd-drop-menu-item
v-for="item in subMenu"
:key="item.id"
:title="item.title"
@open="handleOpenSubMenu(item.id)"
custom-class="flex items-center"
>
<Region v-show="currentMenu === 1" @changeName="handleRegionChange" />
<UniType v-show="currentMenu === 2" @changeName="handleUniTypeChange" />
<Nature v-show="currentMenu === 3" @changeName="handleNatureChange" />
</wd-drop-menu-item>
</wd-drop-menu>
</template>
<view
class="item-wrapper"
:id="`zp-id-${item.zp_index}`"
:key="item.zp_index"
v-for="(item, index) in schoolList"
@click="itemClick(item, item.zp_index)"
>
<view class="flex items-center p-[32rpx] w-full">
<image class="w-[80rpx] h-[80rpx] ml-[18rpx] mr-[24rpx]" :src="item.logo"></image>
<view class="flex justify-between items-center flex-1">
<view class="flex flex-col" hover-class="none">
<text class="text-[28rpx] text-[#333] font-semibold mb-[6rpx]">
{{ item.name }}
</text>
<view class="flex items-center gap-[8rpx] mb-[16rpx]">
<view
class="truncate max-w-[176rpx] bg-[#f8f8f8] rounded-[4rpx] text-[20rpx] px-[8rpx] py-[2rpx]"
v-for="(fea, fIndex) in item.features.slice(0, 5)"
:key="fIndex"
>
{{ fea }}
</view>
</view>
<text class="text-[22rpx] text-[#999] font-normal">
{{ item.cityName }}.{{ item.nature }}
</text>
</view>
</view>
</view>
<view class="w-full h-[2rpx] bg-[#eee]" hover-class="none"></view>
</view>
</z-paging>
</view>
</template>
<script lang="ts" setup></script>
<script lang="ts" setup>
import Region from '@/components/filterMenu/Region.vue'
import UniType from '@/components/filterMenu/UniType.vue'
import Nature from '@/components/filterMenu/Nature.vue'
import { getUniversityList } from '@/service/index/api'
const searchValue = ref('')
const handleChange = (e: any) => {
paging.value.reload()
}
const navigatorBack = () => {
uni.navigateBack()
}
const subMenu = [
{ id: 1, title: '省份' },
{ id: 2, title: '层次' },
{ id: 3, title: '类型' },
]
const regionInfo = ref([]) //
const uniTypeInfo = ref([]) //
const natureInfo = ref([]) //
const currentMenu = ref(1)
const handleOpenSubMenu = (id: number) => {
currentMenu.value = id
}
const schoolList = ref([])
const paging = ref(null)
const queryList = (page: number, pageSize: number) => {
getUniversityList({
pageIndex: page,
pageSize,
name: searchValue.value,
provinceName: regionInfo.value,
utype: uniTypeInfo.value,
nature: natureInfo.value,
}).then((res) => {
if (res.code === 200) {
paging.value.complete((res.result as { rows: any[] }).rows)
}
})
}
const virtualListChange = (_vList) => {
schoolList.value = _vList
}
const itemClick = (item, index) => {
uni.navigateTo({ url: `/pages-sub/home/college/info?collegeCode=${item.collegeCode}` })
}
const handleRegionChange = (val) => {
regionInfo.value = val
paging.value.reload()
}
const handleUniTypeChange = (val) => {
uniTypeInfo.value = val
paging.value.reload()
}
const handleNatureChange = (val) => {
natureInfo.value = val
paging.value.reload()
}
</script>
<style lang="scss" scoped>
:deep(.wd-navbar__content) {
display: flex;
align-items: center;
.wd-navbar__title {
display: flex;
align-items: center;
margin-left: 112rpx;
}
}
</style>

View File

@ -0,0 +1,55 @@
<route lang="json5" type="page">
{
layout: 'page',
style: {
navigationStyle: 'custom',
},
}
</route>
<template>
<view class="h-screen pb-safe flex flex-col">
<view class="relative">
<wd-navbar
safeAreaInsetTop
custom-class="bg-transparent!"
:bordered="false"
left-arrow
@click-left="navigatorBack"
></wd-navbar>
<view class="custom-background h-[250rpx] w-full absolute top-0 left-0 z-[-1]"></view>
</view>
<view class="pb-safe flex-1"></view>
</view>
</template>
<script lang="ts" setup>
import { useUniversityInfo } from '@/hooks/useUserInfo'
const navigatorBack = () => {
uni.navigateBack()
}
onLoad((options) => {
const collegeCode = Number(options.collegeCode) || 0
const { universityBaseInfo } = useUniversityInfo(collegeCode)
})
</script>
<style lang="scss" scoped>
:deep(.custom-background) {
background-image: linear-gradient(
180deg,
rgb(177, 221, 250) 0,
rgb(177, 221, 250) 14%,
rgb(232, 244, 252) 68%,
rgba(255, 255, 255, 1) 86%,
rgba(255, 255, 255, 1) 100%,
rgba(255, 255, 255, 1) 100%
);
background-position: 50% 50%;
background-origin: padding-box;
background-clip: border-box;
background-size: auto auto;
}
</style>

View File

@ -130,7 +130,7 @@ const navigatorBack = () => {
}
//
const score = ref<number | string>(userStore.userInfo.estimatedAchievement.score || '')
const score = ref<number | string>(userStore.userInfo.estimatedAchievement.expectedScore || '')
const handleChange = (e: any) => {
const _score = Number(score.value) || 0
if (_score > userStore.userInfo.city.allscore) {

View File

@ -8,8 +8,6 @@
</route>
<template>
<view class="content">
<!-- 如果页面中的cell高度是固定不变的则不需要设置cell-height-mode如果页面中高度是动态改变的则设置cell-height-mode="dynamic" -->
<!-- 原先的v-model修改为@virtualListChange="virtualListChange"并赋值处理后的虚拟列表 -->
<z-paging
ref="paging"
use-virtual-list
@ -110,7 +108,6 @@ const itemClick = (item, index) => {
}
const tabsChange = (index, name) => {
tabIndex.value = name
// tabreloadqueryList
paging.value.reload()
}
const { unSortTypeList } = useUnSortType()

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 1.0 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.9 KiB

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 1.1 MiB

View File

@ -137,7 +137,8 @@
"layout": "page",
"style": {
"navigationStyle": "custom"
}
},
"needLogin": true
},
{
"path": "home/career/index",
@ -153,7 +154,19 @@
},
{
"path": "home/college/index",
"type": "page"
"type": "page",
"style": {
"navigationStyle": "custom"
},
"needLogin": true
},
{
"path": "home/college/info",
"type": "page",
"layout": "page",
"style": {
"navigationStyle": "custom"
}
},
{
"path": "home/distinguish/index",
@ -212,31 +225,6 @@
}
}
]
},
{
"root": "components-sub",
"pages": [
{
"path": "FilterMenu/FilterMenu",
"type": "page"
},
{
"path": "FilterMenu/Nature",
"type": "page"
},
{
"path": "FilterMenu/Phase",
"type": "page"
},
{
"path": "FilterMenu/Region",
"type": "page"
},
{
"path": "FilterMenu/UniType",
"type": "page"
}
]
}
]
}

View File

@ -19,10 +19,7 @@
</view>
</template>
</wd-navbar>
<image
class="h-[700rpx] w-full absolute top-0 left-0 z-[-1]"
src="/static/images/home/home-background.png"
/>
<view class="h-[700rpx] w-full custom-background absolute top-0 left-0 z-[-1]"></view>
</view>
<view class="h-full mt-[48rpx]">
<Banner />
@ -84,4 +81,18 @@ const onRefresherRefresh = async () => {
font-size: 32rpx;
color: #000;
}
.custom-background {
background-image: linear-gradient(
173deg,
rgb(177, 221, 250) 0,
rgb(177, 221, 250) 13%,
rgba(255, 255, 255, 1) 80%,
rgba(255, 255, 255, 1) 100%
);
background-position: 50% 50%;
background-origin: padding-box;
background-clip: border-box;
background-size: auto auto;
}
</style>

View File

@ -22,19 +22,24 @@
></image>
<wd-button @click="handleLogin"></wd-button>
</view>
<LoginMask v-bind:show="show" />
<LoginMask v-model:show="show" @auth-ready="handleAuthReady" />
</view>
</template>
<script setup lang="ts">
import { useUserStore } from '@/store/user'
import LoginMask from '@/components/login/LoginMask.vue'
// import { useUserStore } from '@/store/user'
const userStore = useUserStore()
const { token } = userStore.userInfo as unknown as IUserInfo
// const userStore = useUserStore()
// const { token } = userStore.userInfo as unknown as IUserInfo
const show = ref(false)
const handleLogin = () => {
show.value = true
}
//
const handleAuthReady = () => {
uni.navigateBack()
}
</script>

View File

@ -9,7 +9,7 @@ export const sysDictType = (params: any) => {
return http.get('/api/sysDictData/dicStatus', params)
}
export const getVolunteerInitialization = () => {
export const getProvinceInitialization = () => {
return http.get('/api/busProvinceInitialization/list')
}
@ -69,6 +69,30 @@ export const getSessionKey = (params: { JsCode: string }) => {
return http.get('/api/sysWxOpen/wxOpenId', params)
}
export const getWxInfo = (params: { code: string; OpenId: string }) => {
return http.get('/api/weChatUserEx/wxInfo', params)
export const setWxInfo = (params: { code: string; openId: string }) => {
return http.post('/api/weChatUserEx/wxInfo', params)
}
export const getWxUserInfo = () => {
return http.get('/api/weChatUserEx/userInfo')
}
export const getVolunteerInitialization = () => {
return http.get('/api/v1/base/volunteerInitialization.json', { staticType: 'static' })
}
export const getUniversityList = (params: {
pageIndex: number
pageSize: number
name?: string
provinceName?: string[]
utype?: string[]
nature?: string[]
}) => {
return http.post('/api/zhiYuan/university', params)
}
// 获取大学信息
export const getUniversityInfo = (params: { Cid: number; Id: number }) => {
return http.get('/api/zhiYuan/universityDetail', params)
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 139 KiB

View File

@ -16,14 +16,39 @@ const initState = {
},
estimatedAchievement: {
year: 0, // 学期
score: '', // 成绩
expectedScore: '', // 成绩
requireSubject: { code: 0, name: '', simplename: '' },
optionalSubject: [],
cityCode: '',
provinceCode: '',
className: null,
createTime: '',
createUserId: 0,
createUserName: null,
id: 0,
init: false,
isDelete: false,
isUpdateScore: 0,
isVIP: false,
provinceName: '',
rank: 0,
schoolName: null,
sp: 0,
subjectGroup: '',
updateTime: null,
updateUserId: null,
updateUserName: null,
uuid: null,
vipCode: null,
wxId: 0,
},
userFilterParams: {
phase: 0,
},
token: '',
openid: '',
}
export const useUserStore = defineStore(
@ -43,12 +68,35 @@ export const useUserStore = defineStore(
// 设置预估成绩
const setEstimatedAchievement = (val: any) => {
userInfo.value.estimatedAchievement = val
userInfo.value.estimatedAchievement = Object.assign(userInfo.value.estimatedAchievement, val)
}
// 设置用户token
const setUserToken = (val: string) => {
userInfo.value.token = val
}
const setUserOpenId = (val: string) => {
userInfo.value.openid = val
}
const setUserNickName = (val: string) => {
userInfo.value.nickname = val
}
const setUserAvatar = (val: string) => {
userInfo.value.avatar = val
}
// 清除预估成绩
const clearUserEstimatedAchievement = () => {
userInfo.value.estimatedAchievement = { ...initState.estimatedAchievement }
userInfo.value.estimatedAchievement = Object.assign(userInfo.value.estimatedAchievement, {
year: 0, // 学期
expectedScore: '', // 成绩
requireSubject: { code: 0, name: '', simplename: '' },
optionalSubject: [],
provinceCode: '',
})
}
// 清除用户信息
@ -70,6 +118,10 @@ export const useUserStore = defineStore(
setUserCity,
setEstimatedAchievement,
clearUserEstimatedAchievement,
setUserToken,
setUserOpenId,
setUserNickName,
setUserAvatar,
}
},
{

View File

@ -28,10 +28,32 @@ export type ExtraUserInfo = {
city?: City
estimatedAchievement: {
year: number
score: number | string
expectedScore: number | string
requireSubject: Rule
optionalSubject: Rule[]
cityCode: string
provinceCode: string
className: string | null
createTime: string // "YYYY-MM-DD HH:MM:SS"
createUserId: number
createUserName: string | null
id: number
init: boolean
isDelete: boolean
isUpdateScore: number
isVIP: boolean
provinceName: string
rank: number
schoolName: string | null
sp: number
subjectGroup: string // "物,化,生"
updateTime: string | null // "YYYY-MM-DD HH:MM:SS"
updateUserId: number | null
updateUserName: string | null
uuid: string | null
vipCode: string | null
wxId: number
}
} & IUserInfo

View File

@ -105,6 +105,7 @@ declare global {
const useSlots: typeof import('vue')['useSlots']
const useTemplateRef: typeof import('vue')['useTemplateRef']
const useUnSortType: typeof import('../hooks/useUnSortType')['useUnSortType']
const useUniversityInfo: typeof import('../hooks/useUserInfo')['useUniversityInfo']
const useUniversityLevel: typeof import('../hooks/useFilterSchool')['useUniversityLevel']
const useUniversityRank: typeof import('../hooks/useUnSortType')['useUniversityRank']
const useUniversityType: typeof import('../hooks/useFilterSchool')['useUniversityType']
@ -222,6 +223,7 @@ declare module 'vue' {
readonly useSlots: UnwrapRef<typeof import('vue')['useSlots']>
readonly useTemplateRef: UnwrapRef<typeof import('vue')['useTemplateRef']>
readonly useUnSortType: UnwrapRef<typeof import('../hooks/useUnSortType')['useUnSortType']>
readonly useUniversityInfo: UnwrapRef<typeof import('../hooks/useUserInfo')['useUniversityInfo']>
readonly useUniversityLevel: UnwrapRef<typeof import('../hooks/useFilterSchool')['useUniversityLevel']>
readonly useUniversityRank: UnwrapRef<typeof import('../hooks/useUnSortType')['useUniversityRank']>
readonly useUniversityType: UnwrapRef<typeof import('../hooks/useFilterSchool')['useUniversityType']>

View File

@ -16,6 +16,7 @@ interface NavigateToOptions {
"/pages-sub/home/career/index" |
"/pages-sub/home/city/index" |
"/pages-sub/home/college/index" |
"/pages-sub/home/college/info" |
"/pages-sub/home/distinguish/index" |
"/pages-sub/home/evaluation/index" |
"/pages-sub/home/expand/index" |
@ -25,12 +26,7 @@ interface NavigateToOptions {
"/pages-sub/home/news/index" |
"/pages-sub/home/news/newsList" |
"/pages-sub/home/rank/index" |
"/pages-sub/home/schoolRank/index" |
"/components-sub/FilterMenu/FilterMenu" |
"/components-sub/FilterMenu/Nature" |
"/components-sub/FilterMenu/Phase" |
"/components-sub/FilterMenu/Region" |
"/components-sub/FilterMenu/UniType";
"/pages-sub/home/schoolRank/index";
}
interface RedirectToOptions extends NavigateToOptions {}

View File

@ -55,7 +55,7 @@ export default ({ command, mode }) => {
routeBlockLang: 'json5', // 虽然设了默认值但是vue文件还是要加上 lang="json5", 这样才能很好地格式化
// homePage 通过 vue 文件的 route-block 的type="home"来设定
// pages 目录为 src/pages分包目录不能配置在pages目录下
subPackages: ['src/pages-sub', 'src/components-sub'], // 是个数组可以配置多个但是不能为pages里面的目录
subPackages: ['src/pages-sub'], // 是个数组可以配置多个但是不能为pages里面的目录
dts: 'src/types/uni-pages.d.ts',
}),
UniLayouts(),