Compare commits

..

2 Commits

Author SHA1 Message Date
xjs a53bb0789a feat: 登陆拦截逻辑 2025-02-28 18:06:48 +08:00
xjs b7f984161b feat: 新闻总页面及逻辑 2025-02-28 16:55:03 +08:00
25 changed files with 272 additions and 262 deletions

View File

@ -119,6 +119,8 @@
"useCityNewTop": true,
"useCityNewDetail": true,
"newDetail": true,
"newsDetail": true
"newsDetail": true,
"useNewsList": true,
"newsList": true
}
}

View File

@ -26,27 +26,27 @@ export default defineUniPages({
spacing: '3px',
list: [
{
iconPath: 'static/tabBar/home.png',
selectedIconPath: 'static/tabBar/home-active.png',
iconPath: '/static/tabBar/home.png',
selectedIconPath: '/static/tabBar/home-active.png',
pagePath: 'pages/home/index/index',
text: '首页',
},
{
iconPath: 'static/tabBar/news.png',
selectedIconPath: 'static/tabBar/news-active.png',
pagePath: 'pages/news/index/index',
iconPath: '/static/tabBar/news.png',
selectedIconPath: '/static/tabBar/news-active.png',
pagePath: 'pages/evaluation/index/index',
text: '测评',
},
{
iconPath: 'static/tabBar/place.png',
selectedIconPath: 'static/tabBar/place-active.png',
pagePath: 'pages/place/index/index',
iconPath: '/static/tabBar/place.png',
selectedIconPath: '/static/tabBar/place-active.png',
pagePath: 'pages/expert/index/index',
text: '专家',
},
{
iconPath: 'static/tabBar/center.png',
selectedIconPath: 'static/tabBar/center-active.png',
iconPath: '/static/tabBar/center.png',
selectedIconPath: '/static/tabBar/center-active.png',
pagePath: 'pages/ucenter/index/index',
text: '我的',
},
@ -61,34 +61,6 @@ export default defineUniPages({
navigationStyle: 'custom',
},
},
{
path: 'pages/place/index/index',
type: 'page',
style: {
navigationBarTitleText: '专家',
},
},
{
path: 'pages/aiService/index/index',
type: 'page',
style: {
navigationBarTitleText: '六维管家',
},
},
{
path: 'pages/news/index/index',
type: 'page',
style: {
navigationBarTitleText: '测评',
},
},
{
path: 'pages/ucenter/index/index',
type: 'page',
style: {
navigationBarTitleText: '我的',
},
},
],
preloadRule: {
'pages/home/index/index': {

Binary file not shown.

Before

Width:  |  Height:  |  Size: 116 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 134 KiB

View File

@ -1,5 +1,5 @@
<template>
<wd-fab :draggable="true" :expandable="false" :gap="{ bottom: 170 }">
<wd-fab :draggable="true" :expandable="false" :gap="{ bottom: 100 }">
<template #trigger>
<view class="btn-wrapper" @click="handleClick">
<image

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="toNewsPage"
></image>
</view>
<view class="my-[30rpx]" hover-class="none" :hover-stop-propagation="false">
@ -27,14 +31,22 @@
</template>
<script lang="ts" setup>
import { useCityNewTop } from '@/hooks/useCityInfoHook'
import { useCityNewTop, newsList } from '@/hooks/useCityInfoHook'
import { News } from '@/types/app-type'
const { newsList } = useCityNewTop()
onShow(() => {
useCityNewTop()
})
const handleClick = (item: News) => {
uni.navigateTo({
url: `/pages-sub/home/news/index?newsId=${item.id}`,
})
}
const toNewsPage = () => {
uni.navigateTo({
url: '/pages-sub/home/news/newsList',
})
}
</script>

View File

@ -1,4 +1,9 @@
import { getNewsTop, getVolunteerInitialization, getNewsDetailInfo } from '@/service/index/api'
import {
getNewsTop,
getVolunteerInitialization,
getNewsDetailInfo,
getNewsList,
} from '@/service/index/api'
import { useCityStore } from '@/store/city'
import { useUserStore } from '@/store/user'
import { City, News, NewsDetail } from '@/types/app-type'
@ -48,9 +53,8 @@ const groupByFirstLetter = (lis: Province[]): { letter: string; provinces: Provi
.map((key) => ({ letter: key, provinces: grouped[key] }))
}
export const newsList = ref([])
export const useCityNewTop = () => {
const newsList = ref([])
const fetchNewTopFun = (provinceCode) => {
getNewsTop({ Top: 2, CategoryId: 1, provinceCode }).then((res) => {
if (res.code === 200) {
@ -68,8 +72,6 @@ export const useCityNewTop = () => {
} else {
fetchNewTopFun(userStore.userInfo.city.code)
}
return { newsList }
}
export const newsDetail = ref<NewsDetail>({

View File

@ -9,7 +9,7 @@ sysDictType({ id: 619330547859525 }).then((res) => {
const _tabbarList = [
{
id: 0,
path: '../../home/index/index',
path: '/pages/home/index/index',
icon: '/static/tabBar/home.png',
selectIcon: '/static/tabBar/home-active.png',
text: '首页',
@ -17,7 +17,7 @@ sysDictType({ id: 619330547859525 }).then((res) => {
},
{
id: 3,
path: '../../news/index/index',
path: '/pages/evaluation/index/index',
icon: '/static/tabBar/news.png',
selectIcon: '/static/tabBar/news-active.png',
text: '测评',
@ -25,7 +25,7 @@ sysDictType({ id: 619330547859525 }).then((res) => {
},
{
id: 2,
path: '../../aiService/index/index',
path: '/pages/aiService/index/index',
icon: '/static/tabBar/ai.png',
selectIcon: '/static/tabBar/ai-active.png',
text: '',
@ -33,7 +33,7 @@ sysDictType({ id: 619330547859525 }).then((res) => {
},
{
id: 1,
path: '../../place/index/index',
path: '/pages/expert/index/index',
icon: '/static/tabBar/place.png',
selectIcon: '/static/tabBar/place-active.png',
text: '专家',
@ -41,7 +41,7 @@ sysDictType({ id: 619330547859525 }).then((res) => {
},
{
id: 4,
path: '../../ucenter/index/index',
path: '/pages/ucenter/index/index',
icon: '/static/tabBar/center.png',
selectIcon: '/static/tabBar/center-active.png',
text: '我的',

View File

@ -12,7 +12,7 @@ const loginRoute = '/pages/login/index'
const isLogined = () => {
const userStore = useUserStore()
return userStore.isLogined
return userStore.isLoginFlag
}
const isDev = import.meta.env.DEV

View File

@ -0,0 +1,11 @@
<route lang="json5" type="page">
{
layout: 'page',
style: {
navigationStyle: 'custom',
},
}
</route>
<template></template>
<script setup lang="ts"></script>

View File

@ -0,0 +1,107 @@
<route lang="json5" type="page">
{
layout: 'page',
style: {
navigationStyle: 'custom',
},
}
</route>
<template>
<view class="flex flex-col h-screen">
<z-paging
ref="paging"
use-virtual-list
:force-close-inner-list="true"
cell-height-mode="dynamic"
@virtualListChange="virtualListChange"
@query="queryList"
>
<!-- 需要固定在顶部不滚动的view放在slot="top"的view中如果需要跟着滚动则不要设置slot="top" -->
<template #top>
<view class="relative h-max" hover-class="none" :hover-stop-propagation="false">
<wd-navbar
title="高考头条"
left-arrow
@click-left="navigatorBack"
safeAreaInsetTop
:bordered="false"
custom-class="bg-transparent! z-[99]"
></wd-navbar>
</view>
</template>
<view
class="item-wrapper"
:id="`zp-id-${item.zp_index}`"
:key="item.zp_index"
v-for="item in newsList"
@click="itemClick(item, item.zp_index)"
>
<view class="flex flex-col items-left p-[32rpx] w-full">
<text class="font-semibold text-[28rpx] text-[#1F2329] max-w-full text-left">
{{ item.title }}
</text>
<view
class="mt-[24rpx] flex justify-between items-center text-[#8F959E] font-normal font-normal w-full"
>
<text class="text-[24rpx]">来源:&nbsp;{{ item.source }}</text>
<text class="text-[22rpx]">{{ item.createTime }}</text>
</view>
</view>
<view class="w-full h-[2rpx] bg-[#eee]" hover-class="none"></view>
</view>
</z-paging>
<view class="flex-1 overflow-auto pb-safe"></view>
</view>
</template>
<script lang="ts" setup>
import useNavbarWeixin from '@/hooks/useNavbarWeixin'
import { getNewsList } from '@/service/index/api'
import { useUserStore } from '@/store/user'
const { safeAreaInsets } = useNavbarWeixin()
const navigatorBack = () => {
uni.navigateBack()
}
const userStore = useUserStore()
const newsList = ref([])
const paging = ref(null)
const virtualListChange = (_vList) => {
newsList.value = _vList
}
const itemClick = (item, index) => {
uni.navigateTo({
url: `/pages-sub/home/news/index?newsId=${item.id}`,
})
}
const queryList = (page: number, pageSize: number) => {
getNewsList({
CategoryId: 1,
provinceCode: userStore.userInfo.city.code,
PageIndex: page,
PageSize: pageSize,
}).then((res) => {
paging.value?.complete((res.result as { data: any[] }).data)
})
}
</script>
<style lang="scss" scoped>
.item-wrapper {
position: relative;
display: flex;
flex-direction: column;
align-items: center;
justify-content: space-between;
padding: 0 32rpx;
}
</style>

View File

@ -52,7 +52,7 @@
@change="tabsChange"
ref="tabsRef"
>
<block v-for="item in unSortTypeList" :key="item.type" :name="item.type">
<block v-for="item in unSortTypeList" :key="item.type">
<wd-tab :title="`${item.name}`" :name="item.type">
<!-- <view class="content">内容{{ item}}</view> -->
</wd-tab>
@ -61,7 +61,7 @@
</view>
</template>
<view
class="item"
class="item-wrapper"
:id="`zp-id-${item.zp_index}`"
:key="item.zp_index"
v-for="(item, index) in schoolList"
@ -160,7 +160,7 @@ const virtualListChange = (_vList) => {
background: linear-gradient(270deg, #f2ce95 0%, #f8deba 100%);
}
.item {
.item-wrapper {
position: relative;
display: flex;
flex-direction: column;
@ -170,28 +170,6 @@ const virtualListChange = (_vList) => {
padding: 0 32rpx;
}
.item-content {
flex: 1;
margin-left: 20rpx;
}
.item-detail {
margin-top: 10rpx;
border-radius: 10rpx;
font-size: 28rpx;
color: #aaaaaa;
word-break: break-all;
}
.item-line {
position: absolute;
bottom: 0rpx;
left: 0rpx;
height: 1px;
width: 100%;
background-color: #eeeeee;
}
/* #ifdef H5 */
:deep(.uni-scroll-view-content) {
display: flex;

View File

@ -23,26 +23,26 @@
"spacing": "3px",
"list": [
{
"iconPath": "static/tabBar/home.png",
"selectedIconPath": "static/tabBar/home-active.png",
"iconPath": "/static/tabBar/home.png",
"selectedIconPath": "/static/tabBar/home-active.png",
"pagePath": "pages/home/index/index",
"text": "首页"
},
{
"iconPath": "static/tabBar/news.png",
"selectedIconPath": "static/tabBar/news-active.png",
"pagePath": "pages/news/index/index",
"iconPath": "/static/tabBar/news.png",
"selectedIconPath": "/static/tabBar/news-active.png",
"pagePath": "pages/evaluation/index/index",
"text": "测评"
},
{
"iconPath": "static/tabBar/place.png",
"selectedIconPath": "static/tabBar/place-active.png",
"pagePath": "pages/place/index/index",
"iconPath": "/static/tabBar/place.png",
"selectedIconPath": "/static/tabBar/place-active.png",
"pagePath": "pages/expert/index/index",
"text": "专家"
},
{
"iconPath": "static/tabBar/center.png",
"selectedIconPath": "static/tabBar/center-active.png",
"iconPath": "/static/tabBar/center.png",
"selectedIconPath": "/static/tabBar/center-active.png",
"pagePath": "pages/ucenter/index/index",
"text": "我的"
}
@ -58,39 +58,37 @@
}
},
{
"path": "pages/about/about",
"path": "pages/login/index",
"type": "page",
"style": {
"navigationBarTitleText": "关于"
}
"style": {}
},
{
"path": "pages/aiService/index/index",
"type": "page",
"style": {
"navigationBarTitleText": "六维管家"
}
"style": {}
},
{
"path": "pages/news/index/index",
"path": "pages/evaluation/index/index",
"type": "page",
"layout": "demo",
"style": {
"navigationBarTitleText": "测评"
}
"navigationBarTitleText": "测评师"
},
"needLogin": true
},
{
"path": "pages/place/index/index",
"path": "pages/expert/index/index",
"type": "page",
"layout": "demo",
"style": {
"navigationBarTitleText": "专家"
}
"navigationBarTitleText": "测评师"
},
"needLogin": true
},
{
"path": "pages/ucenter/index/index",
"type": "page",
"style": {
"navigationBarTitleText": "我的"
}
"style": {}
}
],
"preloadRule": {
@ -123,6 +121,14 @@
"navigationStyle": "custom"
}
},
{
"path": "home/aiAutoFill/index",
"type": "page",
"layout": "page",
"style": {
"navigationStyle": "custom"
}
},
{
"path": "home/autoFill/index",
"type": "page",
@ -183,6 +189,14 @@
"navigationStyle": "custom"
}
},
{
"path": "home/news/newsList",
"type": "page",
"layout": "page",
"style": {
"navigationStyle": "custom"
}
},
{
"path": "home/rank/index",
"type": "page"

View File

@ -1,36 +0,0 @@
<route lang="json5">
{
style: {
navigationBarTitleText: '关于',
},
}
</route>
<template>
<view
class="bg-white overflow-hidden pt-2 px-4"
:style="{ marginTop: safeAreaInsets?.top + 'px' }"
>
<view class="text-center text-3xl mt-8">
鸽友们好我是
<text class="text-red-500">菲鸽</text>
</view>
<!-- <RequestComp /> -->
<UploadComp />
</view>
</template>
<script lang="ts" setup>
// import RequestComp from './components/request.vue'
import UploadComp from './components/upload.vue'
//
const { safeAreaInsets } = uni.getSystemInfoSync()
</script>
<style lang="scss" scoped>
.test-css {
// mt-4=>1rem=>16px;
margin-top: 16px;
}
</style>

View File

@ -1,67 +0,0 @@
<route lang="json5">
{
layout: 'demo',
style: {
navigationBarTitleText: '请求',
},
}
</route>
<template>
<view class="p-6 text-center">
<view class="my-2">使用的是 laf 云后台</view>
<view class="text-green-400">我的推荐码可以获得佣金</view>
<!-- #ifdef H5 -->
<view class="my-2">
<a class="my-2" :href="recommendUrl" target="_blank">{{ recommendUrl }}</a>
</view>
<!-- #endif -->
<!-- #ifndef H5 -->
<view class="my-2 text-left text-sm">{{ recommendUrl }}</view>
<!-- #endif -->
<!-- http://localhost:9000/#/pages/index/request -->
<wd-button @click="run" class="my-6">发送请求</wd-button>
<view class="h-16">
<view v-if="loading">loading...</view>
<block v-else>
<view class="text-xl">请求数据如下</view>
<view class="text-green leading-8">{{ JSON.stringify(data) }}</view>
</block>
</view>
<wd-button type="error" @click="reset" class="my-6" :disabled="!data">重置数据</wd-button>
</view>
</template>
<script lang="ts" setup>
import { getFooAPI, postFooAPI, IFooItem } from '@/service/index/foo'
import { findPetsByStatusQueryOptions } from '@/service/app'
import { useQuery } from '@tanstack/vue-query'
const recommendUrl = ref('http://laf.run/signup?code=ohaOgIX')
// const initialData = {
// name: 'initialData',
// id: '1234',
// }
const initialData = undefined
// Service
const { loading, error, data, run } = useRequest<IFooItem>(() => getFooAPI('菲鸽'), {
immediate: true,
initialData,
})
// 使 vue-query useQuery 使
const {
data: data2,
error: error2,
isLoading: isLoading2,
refetch,
} = useQuery(findPetsByStatusQueryOptions({ params: { status: ['available'] } }))
const reset = () => {
data.value = initialData
}
</script>

View File

@ -1,30 +0,0 @@
<route lang="json5" type="page">
{
layout: 'default',
style: {
navigationBarTitleText: '上传-状态一体化',
},
}
</route>
<template>
<view class="p-4 text-center">
<wd-button @click="run"></wd-button>
<view v-if="loading" class="text-blue h-10">...</view>
<template v-else>
<view class="m-2">上传后返回的接口数据</view>
<view class="m-2">{{ data }}</view>
<view class="h-80 w-full">
<image v-if="data" :src="data || data" mode="scaleToFill" />
</view>
</template>
</view>
</template>
<script lang="ts" setup>
const { loading, data, run } = useUpload({ user: '菲鸽' })
</script>
<style lang="scss" scoped>
//
</style>

View File

@ -0,0 +1,18 @@
<route lang="json5" type="page">
{
layout: 'demo',
style: {
navigationBarTitleText: '测评师',
},
needLogin: true,
}
</route>
<template>
<view class="">测评</view>
<TabBar :current-page="3"></TabBar>
</template>
<script lang="ts" setup>
import TabBar from '@/components/bar/TabBar.vue'
</script>

View File

@ -0,0 +1,19 @@
<route lang="json5" type="page">
{
layout: 'demo',
style: {
navigationBarTitleText: '测评师',
},
needLogin: true,
}
</route>
<template>
<view class="">
<text>庄家</text>
<TabBar :current-page="1"></TabBar>
</view>
</template>
<script lang="ts" setup>
import TabBar from '@/components/bar/TabBar.vue'
</script>

12
src/pages/login/index.vue Normal file
View File

@ -0,0 +1,12 @@
<template>
<view class="login">
<view class="logo">
<image
class="pic"
src="https://api.static.ycymedu.com/images/logo.png"
mode="aspectFit"
></image>
</view>
<view style="width: 360rpx" class="w-[360rpx]">登陆</view>
</view>
</template>

View File

@ -1,10 +0,0 @@
<template>
<view class="">
<text>庄家</text>
<TabBar :current-page="3"></TabBar>
</view>
</template>
<script lang="ts" setup>
import TabBar from '@/components/bar/TabBar.vue'
</script>

View File

@ -1,8 +0,0 @@
<template>
<view class="">专家</view>
<TabBar :current-page="1"></TabBar>
</template>
<script lang="ts" setup>
import TabBar from '@/components/bar/TabBar.vue'
</script>

View File

@ -55,3 +55,12 @@ export const getNewsTop = (params: { Top: number; CategoryId: number; provinceCo
export const getNewsDetailInfo = (params: { id: number }) => {
return http.get('/api/ZyNews/detail', params)
}
export const getNewsList = (params: {
CategoryId: number
provinceCode: string
PageIndex: number
PageSize: number
}) => {
return http.get('/api/ZyNews/newsPage', params)
}

View File

@ -59,13 +59,13 @@ export const useUserStore = defineStore(
const reset = () => {
userInfo.value = { ...initState }
}
const isLogined = computed(() => !!userInfo.value.token)
const isLoginFlag = computed(() => !!userInfo.value.token)
return {
userInfo,
setUserInfo,
clearUserInfo,
isLogined,
isLoginFlag,
reset,
setUserCity,
setEstimatedAchievement,

View File

@ -26,6 +26,7 @@ declare global {
const markRaw: typeof import('vue')['markRaw']
const newDetail: typeof import('../hooks/useCityInfoHook')['newDetail']
const newsDetail: typeof import('../hooks/useCityInfoHook')['newsDetail']
const newsList: typeof import('../hooks/useCityInfoHook')['newsList']
const nextTick: typeof import('vue')['nextTick']
const onActivated: typeof import('vue')['onActivated']
const onAddToFavorites: typeof import('@dcloudio/uni-app')['onAddToFavorites']
@ -96,6 +97,7 @@ declare global {
const useModel: typeof import('vue')['useModel']
const useNatureList: typeof import('../hooks/useFilterSchool')['useNatureList']
const useNavbarWeixin: typeof import('../hooks/useNavbarWeixin')['default']
const useNewsList: typeof import('../hooks/useCityInfoHook')['useNewsList']
const useRegionInfo: typeof import('../hooks/useFilterSchool')['useRegionInfo']
const useRequest: typeof import('../hooks/useRequest')['default']
const useRules: typeof import('../hooks/useRules')['useRules']
@ -142,6 +144,7 @@ declare module 'vue' {
readonly isRef: UnwrapRef<typeof import('vue')['isRef']>
readonly markRaw: UnwrapRef<typeof import('vue')['markRaw']>
readonly newsDetail: UnwrapRef<typeof import('../hooks/useCityInfoHook')['newsDetail']>
readonly newsList: UnwrapRef<typeof import('../hooks/useCityInfoHook')['newsList']>
readonly nextTick: UnwrapRef<typeof import('vue')['nextTick']>
readonly onActivated: UnwrapRef<typeof import('vue')['onActivated']>
readonly onAddToFavorites: UnwrapRef<typeof import('@dcloudio/uni-app')['onAddToFavorites']>

View File

@ -5,12 +5,13 @@
interface NavigateToOptions {
url: "/pages/home/index/index" |
"/pages/about/about" |
"/pages/login/index" |
"/pages/aiService/index/index" |
"/pages/news/index/index" |
"/pages/place/index/index" |
"/pages/evaluation/index/index" |
"/pages/expert/index/index" |
"/pages/ucenter/index/index" |
"/pages-sub/customerService/index/index" |
"/pages-sub/home/aiAutoFill/index" |
"/pages-sub/home/autoFill/index" |
"/pages-sub/home/career/index" |
"/pages-sub/home/city/index" |
@ -22,6 +23,7 @@ interface NavigateToOptions {
"/pages-sub/home/line/index" |
"/pages-sub/home/major/index" |
"/pages-sub/home/news/index" |
"/pages-sub/home/news/newsList" |
"/pages-sub/home/rank/index" |
"/pages-sub/home/schoolRank/index" |
"/components-sub/FilterMenu/FilterMenu" |
@ -33,7 +35,7 @@ interface NavigateToOptions {
interface RedirectToOptions extends NavigateToOptions {}
interface SwitchTabOptions {
url: "/pages/home/index/index" | "/pages/news/index/index" | "/pages/place/index/index" | "/pages/ucenter/index/index"
url: "/pages/home/index/index" | "/pages/evaluation/index/index" | "/pages/expert/index/index" | "/pages/ucenter/index/index"
}
type ReLaunchOptions = NavigateToOptions | SwitchTabOptions;