From ea5cc974cffef6d528a80eb5751bc6972c8d159f Mon Sep 17 00:00:00 2001 From: wlikett <2331964395@qq.com> Date: Sat, 9 Dec 2023 18:34:56 +0800 Subject: [PATCH] =?UTF-8?q?=E9=9C=80=E6=B1=82=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/http/api/equip.ts | 10 +- src/router/index.ts | 53 ++++++++--- src/views/Login.vue | 10 +- src/views/equip/detail.vue | 181 +++++++++++++++++++++++++------------ src/views/home/index.vue | 2 +- 5 files changed, 180 insertions(+), 76 deletions(-) diff --git a/src/http/api/equip.ts b/src/http/api/equip.ts index 9d2036b..dd5013e 100644 --- a/src/http/api/equip.ts +++ b/src/http/api/equip.ts @@ -2,7 +2,10 @@ import { post, get, put } from '../index' // 获取装备列表 export const getList = (params = {}) => { - return post('/zlpt-equip/dev/list', params) + return post('/zlpt-equip/dev/list', { + ...params, + maStatus:16 + }) } //获取装备详情 @@ -12,7 +15,10 @@ export const getDetail = (id = '') => { //获取 推荐装备列表 export const getHotList = (params) => { - return get('/zlpt-equip/dev/hotList', params) + return get('/zlpt-equip/dev/hotList', { + ...params, + maStatus:16 + }) } //装备收藏 取消收藏 diff --git a/src/router/index.ts b/src/router/index.ts index 3b362e7..3ebae2f 100644 --- a/src/router/index.ts +++ b/src/router/index.ts @@ -1,4 +1,4 @@ -import { createRouter, createWebHashHistory, RouteRecordRaw } from 'vue-router' +import {createRouter, createWebHashHistory, RouteRecordRaw, useRouter} from 'vue-router' import test from './module/test' import myInfo from './module/myInfo' @@ -116,6 +116,10 @@ const routes: Array = [ { path: '/collect', name: 'collect', + meta: { + title: '我的收藏', + isLogin:true + }, component: () => import('views/collect/index.vue') }, // 个人中心 @@ -139,7 +143,8 @@ const routes: Array = [ meta: { title: '基础信息', keepAlive: true, - AuthFlag: false + AuthFlag: false, + isLogin:true }, }, @@ -151,7 +156,8 @@ const routes: Array = [ meta: { title: '订单管理(求租)', keepAlive: true, - AuthFlag: false + AuthFlag: false, + isLogin:true }, }, /* 订单管理(退租) */ @@ -162,7 +168,8 @@ const routes: Array = [ meta: { title: '订单管理(退租)', keepAlive: true, - AuthFlag: false + AuthFlag: false, + isLogin:true }, }, /* 订单管理(续租) */ @@ -173,7 +180,8 @@ const routes: Array = [ meta: { title: '订单管理(续租)', keepAlive: true, - AuthFlag: false + AuthFlag: false, + isLogin:true }, }, { @@ -183,7 +191,8 @@ const routes: Array = [ meta: { title: '子账号管理', keepAlive: true, - AuthFlag: false + AuthFlag: false, + isLogin:true }, }, { @@ -193,7 +202,8 @@ const routes: Array = [ meta: { title: '订单管理(承租)', keepAlive: true, - AuthFlag: false + AuthFlag: false, + isLogin:true }, }, /* 订单管理(结算) */ @@ -204,7 +214,8 @@ const routes: Array = [ meta: { title: '订单管理(结算)', keepAlive: true, - AuthFlag: false + AuthFlag: false, + isLogin:true }, }, { @@ -214,7 +225,8 @@ const routes: Array = [ meta: { title: '基础信息', keepAlive: true, - AuthFlag: false + AuthFlag: false, + isLogin:true }, }, { @@ -224,7 +236,8 @@ const routes: Array = [ meta: { title: '基础信息', keepAlive: true, - AuthFlag: false + AuthFlag: false, + isLogin:true }, }, { @@ -234,7 +247,8 @@ const routes: Array = [ meta: { title: '基础信息', keepAlive: true, - AuthFlag: false + AuthFlag: false, + isLogin:true }, }, { @@ -244,7 +258,8 @@ const routes: Array = [ meta: { title: '订单详情', keepAlive: true, - AuthFlag: false + AuthFlag: false, + isLogin:true }, }, { @@ -254,7 +269,8 @@ const routes: Array = [ meta: { title: '订单确认', keepAlive: true, - AuthFlag: false + AuthFlag: false, + isLogin:true }, } ] @@ -276,7 +292,16 @@ const router = createRouter({ // 使页面跳转后滚动条恢复至顶部 router.beforeEach((to, from, next) => { const store = useStore() - next() + if(to.meta.isLogin){ + if(store.token){ + next() + }else { + next(`/login?redirect=${encodeURIComponent(to.fullPath)}`) + } + }else { + next() + } + // if (store.token || to.path == '/login' || to.path == '/' || to.path == '/home' || to.path == '/register' || to.path == '/equipList' || to.path == '/equipDetail') { diff --git a/src/views/Login.vue b/src/views/Login.vue index 0cb1730..8480b4c 100644 --- a/src/views/Login.vue +++ b/src/views/Login.vue @@ -1,10 +1,11 @@ diff --git a/src/views/equip/detail.vue b/src/views/equip/detail.vue index daaefba..7cee99f 100644 --- a/src/views/equip/detail.vue +++ b/src/views/equip/detail.vue @@ -11,17 +11,17 @@
{{ pageData.modelName }}{{ pageData.deviceName }}
-
{{ pageData.maStatus == '16' ? '待租' : pageData.maStatus }}
+
{{ pageData.maStatusStr }}
已审核
-
浏览{{ pageData.searchNum || 1050 }}
+
浏览{{ pageData.searchNum }}
{{ v.label }}:
{{ v.key.split(',').map(key => { - return pageData[key] || v.default + return pageData[key] }).join('') }}
@@ -96,7 +96,7 @@
为您推荐
-
换一批
+
换一批
- + @@ -159,8 +159,14 @@ - - + + @@ -205,7 +211,7 @@