feat: 登陆拦截逻辑

develop
xjs 2025-02-28 18:06:48 +08:00
parent b7f984161b
commit a53bb0789a
16 changed files with 95 additions and 227 deletions

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

@ -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

@ -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": {

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

@ -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

@ -5,10 +5,10 @@
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" |
@ -35,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;