WIP on master: a3c3469 代码更新

develop
xjs 2025-02-28 14:38:18 +08:00
commit e38180cd4b
17 changed files with 273 additions and 80 deletions

View File

@ -115,6 +115,10 @@
"useRegionInfo": true,
"useUniversityLevel": true,
"useNatureList": true,
"useUniversityRank": true
"useUniversityRank": true,
"useCityNewTop": true,
"useCityNewDetail": true,
"newDetail": true,
"newsDetail": true
}
}

View File

@ -5,7 +5,7 @@
v-for="(item, index) in tabbarList"
:key="index"
:class="[item.centerItem ? 'center-item' : '']"
@click.stop="changeItem(item)"
@click="changeItem(item)"
>
<view class="item-top w-[48rpx] h-[48rpx] p-[10rpx]">
<image

View File

@ -1,7 +1,7 @@
<template>
<wd-fab :draggable="true" :expandable="false" :gap="{ bottom: 170 }">
<template #trigger>
<view class="btn-wrapper" @click.stop="handleClick">
<view class="btn-wrapper" @click="handleClick">
<image
class="w-full h-full rounded-full"
src="/static/images/home/customerService.svg"

View File

@ -13,7 +13,7 @@
custom-class="w-[240rpx]! h-[88rpx]! border-[#1580FF]! text-[#1580FF]! text-[28rpx]! font-normal! mr-[32rpx]"
:round="false"
plain
@click.stop="navigatorTo"
@click="navigatorTo"
>
一键填报
</wd-button>

View File

@ -11,18 +11,30 @@
<view class="my-[30rpx]" hover-class="none" :hover-stop-propagation="false">
<view
class="truncate flex flex-col p-[32rpx]"
class="truncate flex flex-col py-[32rpx]"
style="border-bottom: 2rpx solid #eee"
v-for="item in 3"
v-for="item in newsList"
:key="item"
@click="handleClick(item)"
>
<text class="truncate text-[28rpx] text-[#333333] font-normal mb-[16rpx] max-w-[70%]">
家长请注意六纬志愿VIP卡即将恢复家长请注意六纬志愿VIP卡即将恢复家长请注意六纬志愿VIP卡即将恢复家长请注意六纬志愿VIP卡即将恢复
<text class="truncate text-[28rpx] text-[#333333] font-normal mb-[16rpx] max-w-[80%]">
{{ item.title }}
</text>
<text class="text-[24rpx] color-[#999999] font-normal">2024.12.04</text>
<text class="text-[24rpx] color-[#999999] font-normal">{{ item.createTime }}</text>
</view>
</view>
</view>
</template>
<script lang="ts" setup></script>
<script lang="ts" setup>
import { useCityNewTop } from '@/hooks/useCityInfoHook'
import { News } from '@/types/app-type'
const { newsList } = useCityNewTop()
const handleClick = (item: News) => {
uni.navigateTo({
url: `/pages-sub/home/news/index?newsId=${item.id}`,
})
}
</script>

View File

@ -6,7 +6,11 @@
:hover-stop-propagation="false"
>
<text class="text-[32rpx] text-[#333333] font-semibold">热门排行榜</text>
<image class="w-[40rpx] h-[40rpx]" src="/static/images/home/right.svg"></image>
<image
class="w-[40rpx] h-[40rpx]"
src="/static/images/home/right.svg"
@click="toSchool('0')"
></image>
</view>
<view
@ -18,31 +22,34 @@
class="hot-rank-item flex-none pt-[32rpx] pb-[38rpx] px-[32rpx]"
hover-class="none"
:hover-stop-propagation="false"
v-for="item in unSortTypeList"
:key="item.type"
@click="toSchool(item.type)"
v-for="typeWrap in universityTypeRankList"
:key="typeWrap.type"
@click="toSchool(typeWrap.type)"
v-show="typeWrap.rows.length > 0"
>
<text class="font-semibold text-[#303030] text-[32rpx] inline-block">
{{ item.name }}
{{ typeWrap.name }}
</text>
<view
class="flex items-center justify-left mt-[30rpx]"
v-for="(item, index) in 3"
v-for="(item, index) in typeWrap.rows"
:key="index"
>
<text class="font-[28rpx] text-[#999999] font-normal mr-[10rpx]">
{{ index + 1 }}
{{ item.rank }}
</text>
<image
class="w-[80rpx] h-[80rpx] rounded-full flex-none mr-[16rpx]"
:src="`/static/images/home/rank.svg`"
:src="item.logo"
></image>
<view class="truncate flex flex-col" hover-class="none">
<text class="font-normal text-[#333333] text-[28rpx] truncate">
北京大学 北京大学北京大学北京大学
{{ item.universityName }}
</text>
<text class="text-[22rpx] text-[#999999] font-normal mt-[10rpx]">
{{ item.cityName }}.{{ item.uType }}
</text>
<text class="text-[22rpx] text-[#999999] font-normal mt-[10rpx]">北京.综合类</text>
</view>
</view>
</view>
@ -51,7 +58,8 @@
</template>
<script lang="ts" setup>
import { useUnSortType, useUniversityRank } from '@/hooks/useUnSortType'
import { useUnSortType } from '@/hooks/useUnSortType'
import { getUniversityRank } from '@/service/index/api'
const toSchool = (id: string) => {
uni.navigateTo({
@ -60,18 +68,28 @@ const toSchool = (id: string) => {
}
const { unSortTypeList } = useUnSortType()
let universityRankList = ref([])
let universityTypeRankList = ref([])
watch(
() => unSortTypeList.value,
(newVal) => {
const { universityRankList } = useUniversityRank({
Year: 2023,
Type: newVal[0].type,
PageIndex: 1,
PageSize: 3,
Promise.all(
newVal.map((item) =>
getUniversityRank({
Year: 2023,
Type: item.type,
PageIndex: 1,
PageSize: 3,
}),
),
).then((res) => {
res.forEach((item, index) => {
universityTypeRankList.value.push({
...newVal[index],
rows: (item.result as { rows: any[] }).rows,
})
})
})
console.log(universityRankList)
},
)
</script>

View File

@ -1,7 +1,7 @@
import { getVolunteerInitialization } from '@/service/index/api'
import { getNewsTop, getVolunteerInitialization, getNewsDetailInfo } from '@/service/index/api'
import { useCityStore } from '@/store/city'
import { useUserStore } from '@/store/user'
import { City } from '@/types/app-type'
import { City, News, NewsDetail } from '@/types/app-type'
import { pinyin } from 'pinyin-pro'
interface Province {
@ -47,3 +47,45 @@ const groupByFirstLetter = (lis: Province[]): { letter: string; provinces: Provi
.sort()
.map((key) => ({ letter: key, provinces: grouped[key] }))
}
export const useCityNewTop = () => {
const newsList = ref([])
const fetchNewTopFun = (provinceCode) => {
getNewsTop({ Top: 2, CategoryId: 1, provinceCode }).then((res) => {
if (res.code === 200) {
newsList.value = res.result as { title: string }[]
}
})
}
if (userStore.userInfo.city.code === '0') {
userStore.$subscribe((mutation, state) => {
if ((mutation.events as { key: string }).key === 'city') {
fetchNewTopFun(state.userInfo.city.code)
}
})
} else {
fetchNewTopFun(userStore.userInfo.city.code)
}
return { newsList }
}
export const newsDetail = ref<NewsDetail>({
coverImg: '',
createTime: '',
id: 0,
summary: '',
title: '',
author: '',
click: 0,
detail: '',
})
export const useCityNewDetail = (id: number) => {
getNewsDetailInfo({ id }).then((res) => {
if (res.code === 200) {
newsDetail.value = res.result as NewsDetail
}
})
}

View File

@ -26,7 +26,8 @@ export const useUniversityRank = ({
let universityRankList = ref([])
getUniversityRank({ Year, Type, PageSize, PageIndex }).then((res) => {
if (res.code === 200) {
console.log(res.result)
const _res = res.result as { rows: any[] }
universityRankList.value = _res.rows
}
})

View File

@ -14,11 +14,7 @@
<text class="text-[#1F2329] text-[36rpx] font-medium">在线客服</text>
</template>
<template #left>
<wd-icon
name="thin-arrow-left"
custom-style="icon-style"
@click.stop="handleBack"
></wd-icon>
<wd-icon name="thin-arrow-left" custom-style="icon-style" @click="handleBack"></wd-icon>
</template>
</wd-navbar>
@ -37,7 +33,7 @@
<view class="flex items-center">
<text class="text-[44rpx] font-medium whitespace-nowrap">400-621-1003</text>
<view
@click.stop="makePhoneCall"
@click="makePhoneCall"
class="rounded-[8rpx] w-[88rpx] h-[44rpx] btn-border text-[#1580FF] text-[24rpx] font-normal flex items-center justify-center ml-[44rpx]"
>
拨打

View File

@ -18,7 +18,7 @@
v-for="city in item.provinces"
:key="city.id"
:title="city.provincename"
@click.stop="chooseCity(city)"
@click="chooseCity(city)"
></wd-cell>
</view>
</wd-index-bar>

View File

@ -0,0 +1,49 @@
<route lang="json5" type="page">
{
layout: 'page',
style: {
navigationStyle: 'custom',
},
}
</route>
<template>
<view class="flex flex-col h-screen">
<wd-navbar
title="详细信息"
left-arrow
@click-left="navigatorBack"
safeAreaInsetTop
:bordered="false"
custom-class="bg-transparent! z-[99]"
></wd-navbar>
<view class="flex-1 overflow-auto pb-safe">
<view class="flex flex-col px-[32rpx]">
<text class="font-semibold text-[28rpx] text-[#1F2329]">
{{ newsDetail.title }}
</text>
<view
class="mt-[24rpx] flex justify-between items-center text-[#8F959E] font-normal font-normal"
>
<text class="text-[22rpx]">{{ newsDetail.createTime }}</text>
<text class="text-[24rpx]">来源:&nbsp;{{ newsDetail.author }}</text>
</view>
</view>
<wd-divider custom-class="my-[16rpx]"></wd-divider>
<view class="px-[32rpx]" v-html="newsDetail.detail"></view>
</view>
</view>
</template>
<script lang="ts" setup>
import { useCityNewDetail, newsDetail } from '@/hooks/useCityInfoHook'
const navigatorBack = () => {
uni.navigateBack()
}
onLoad((option) => {
let newsId = option.newsId
useCityNewDetail(newsId)
})
</script>

View File

@ -43,21 +43,21 @@
src="@/pages-sub/static/images/schoolRank/trophy.svg"
/>
</view>
<view class="flex items-center justify-center mt-[24rpx] px-[32rpx] w-full overflow-auto">
<view
:class="[
'swiper-box',
'flex',
'items-center',
'justify-center',
Number(tabIndex) === Number(item.type) ? 'active' : '',
]"
v-for="item in unSortTypeList"
:key="item.type"
@click="tabIndex = item.type"
<view class="px-[32rpx] my-[24rpx]">
<wd-tabs
v-model="tabIndex"
custom-class="tab-custom"
slidable="always"
swipeable
@change="tabsChange"
ref="tabsRef"
>
{{ item.name }}
</view>
<block v-for="item in unSortTypeList" :key="item.type" :name="item.type">
<wd-tab :title="`${item.name}`" :name="item.type">
<!-- <view class="content">内容{{ item}}</view> -->
</wd-tab>
</block>
</wd-tabs>
</view>
</template>
<view
@ -68,20 +68,19 @@
@click="itemClick(item, item.zp_index)"
>
<view class="flex items-center py-[32rpx] w-full">
<text class="text-[28rpx] text-[#999] font-normal">{{ item.zp_index }}</text>
<image
class="w-[80rpx] h-[80rpx] ml-[18rpx] mr-[24rpx]"
src="/static/images/schoolRank/background.svg"
></image>
<text class="text-[28rpx] text-[#999] font-normal">{{ item.rank }}</text>
<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-medium mb-[10rpx]">
{{ item.name }}
{{ item.universityName }}
</text>
<text class="text-[22rpx] text-[#999] font-normal">
{{ item.cityName }}.{{ item.uType }}
</text>
<text class="text-[22rpx] text-[#999] font-normal">北京.综合类</text>
</view>
<view class="flex flex-col">
<text class="text-[28rpx] text-[#333] font-medium mb-[10rpx]">100</text>
<text class="text-[28rpx] text-[#333] font-medium mb-[10rpx]">{{ item.score }}</text>
<text class="text-[22rpx] text-[#999] font-normal">综合得分</text>
</view>
</view>
@ -94,6 +93,7 @@
<script lang="ts" setup>
import useNavbarWeixin from '@/hooks/useNavbarWeixin'
import { getUniversityRank } from '@/service/index/api'
import { useUnSortType } from '@/hooks/useUnSortType'
const { safeAreaInsets } = useNavbarWeixin()
@ -103,46 +103,36 @@ const navigatorBack = () => {
}
const tabIndex = ref<number>(0)
const tabsRef = ref(null)
const itemClick = (item, index) => {
console.log('点击了', item)
}
const tabsChange = (index) => {
tabIndex.value = index
const tabsChange = (index, name) => {
tabIndex.value = name
// tabreloadqueryList
paging.value.reload()
}
const { unSortTypeList } = useUnSortType()
onLoad((option) => {
tabIndex.value = option?.type || '1'
tabIndex.value = Number(option?.type) || 0
tabsRef.value?.setActiveTab(tabIndex.value)
})
const schoolList = ref([])
const paging = ref(null)
const queryList = (page: number, pageSize: number) => {
request(page, pageSize).then((res) => {
paging.value?.complete(res)
})
getUniversityRank({ Type: tabIndex.value, PageIndex: page, PageSize: pageSize, Year: 2023 }).then(
(res) => {
paging.value?.complete((res.result as { rows: any[] }).rows)
},
)
}
const virtualListChange = (_vList) => {
schoolList.value = _vList
}
const request = (page, pageSize) => {
return new Promise((resolve, reject) => {
setTimeout(() => {
const vList = Array.from({ length: 10 }).map((_, i) => {
return {
id: (page - 1) * pageSize + i + 1,
name: `${(page - 1) * pageSize + i + 1}`,
}
})
resolve(vList)
}, 1000)
})
}
</script>
<style lang="scss" scoped>
@ -201,4 +191,41 @@ const request = (page, pageSize) => {
width: 100%;
background-color: #eeeeee;
}
/* #ifdef H5 */
:deep(.uni-scroll-view-content) {
display: flex;
align-items: center;
}
/* #endif */
:deep(.wd-tabs__nav-container) {
gap: 16rpx;
align-items: center;
.wd-tabs__nav-item {
width: 160rpx;
height: 52rpx;
font-size: 28rpx;
font-weight: 500;
color: #a28c6c;
background-color: #f5efe1;
border-radius: 8rpx;
padding: 0 !important;
}
.wd-tabs__nav-item.is-active {
color: #684817;
background: linear-gradient(270deg, #f2ce95 0%, #f8deba 100%);
}
.wd-tabs__line {
display: none;
}
}
:deep(.tab-custom) {
--wot-tabs-nav-height: 52rpx;
}
</style>

View File

@ -175,6 +175,14 @@
"path": "home/major/index",
"type": "page"
},
{
"path": "home/news/index",
"type": "page",
"layout": "page",
"style": {
"navigationStyle": "custom"
}
},
{
"path": "home/rank/index",
"type": "page"

View File

@ -47,3 +47,11 @@ export const getUniversityRank = (params: {
}) => {
return http.get('/api/zhiYuan/universityRank', { ...params })
}
export const getNewsTop = (params: { Top: number; CategoryId: number; provinceCode: string }) => {
return http.get('/api/ZyNews/top', params)
}
export const getNewsDetailInfo = (params: { id: number }) => {
return http.get('/api/ZyNews/detail', params)
}

View File

@ -34,3 +34,23 @@ export type ExtraUserInfo = {
cityCode: string
}
} & IUserInfo
export type News = {
coverImg: string
createTime: string
id: number
source: string
summary: string
title: string
}
export type NewsDetail = {
author: string
click: number
coverImg: string
createTime: string
detail: string
id: number
summary: string
title: string
}

View File

@ -24,6 +24,8 @@ declare global {
const isReadonly: typeof import('vue')['isReadonly']
const isRef: typeof import('vue')['isRef']
const markRaw: typeof import('vue')['markRaw']
const newDetail: typeof import('../hooks/useCityInfoHook')['newDetail']
const newsDetail: typeof import('../hooks/useCityInfoHook')['newsDetail']
const nextTick: typeof import('vue')['nextTick']
const onActivated: typeof import('vue')['onActivated']
const onAddToFavorites: typeof import('@dcloudio/uni-app')['onAddToFavorites']
@ -86,6 +88,8 @@ declare global {
const unref: typeof import('vue')['unref']
const useAttrs: typeof import('vue')['useAttrs']
const useCityInfo: typeof import('../hooks/useCityInfoHook')['useCityInfo']
const useCityNewDetail: typeof import('../hooks/useCityInfoHook')['useCityNewDetail']
const useCityNewTop: typeof import('../hooks/useCityInfoHook')['useCityNewTop']
const useCssModule: typeof import('vue')['useCssModule']
const useCssVars: typeof import('vue')['useCssVars']
const useId: typeof import('vue')['useId']
@ -137,6 +141,7 @@ declare module 'vue' {
readonly isReadonly: UnwrapRef<typeof import('vue')['isReadonly']>
readonly isRef: UnwrapRef<typeof import('vue')['isRef']>
readonly markRaw: UnwrapRef<typeof import('vue')['markRaw']>
readonly newsDetail: UnwrapRef<typeof import('../hooks/useCityInfoHook')['newsDetail']>
readonly nextTick: UnwrapRef<typeof import('vue')['nextTick']>
readonly onActivated: UnwrapRef<typeof import('vue')['onActivated']>
readonly onAddToFavorites: UnwrapRef<typeof import('@dcloudio/uni-app')['onAddToFavorites']>
@ -197,6 +202,8 @@ declare module 'vue' {
readonly unref: UnwrapRef<typeof import('vue')['unref']>
readonly useAttrs: UnwrapRef<typeof import('vue')['useAttrs']>
readonly useCityInfo: UnwrapRef<typeof import('../hooks/useCityInfoHook')['useCityInfo']>
readonly useCityNewDetail: UnwrapRef<typeof import('../hooks/useCityInfoHook')['useCityNewDetail']>
readonly useCityNewTop: UnwrapRef<typeof import('../hooks/useCityInfoHook')['useCityNewTop']>
readonly useCssModule: UnwrapRef<typeof import('vue')['useCssModule']>
readonly useCssVars: UnwrapRef<typeof import('vue')['useCssVars']>
readonly useId: UnwrapRef<typeof import('vue')['useId']>

View File

@ -21,6 +21,7 @@ interface NavigateToOptions {
"/pages-sub/home/inputScore/index" |
"/pages-sub/home/line/index" |
"/pages-sub/home/major/index" |
"/pages-sub/home/news/index" |
"/pages-sub/home/rank/index" |
"/pages-sub/home/schoolRank/index" |
"/components-sub/FilterMenu/FilterMenu" |