From 543d9a5ef66e1e512dadb2a78a8279141e7e6acc Mon Sep 17 00:00:00 2001 From: huyuanxiang <273637057@qq.com> Date: Wed, 14 Jun 2023 17:17:46 +0800 Subject: [PATCH] =?UTF-8?q?[fix]=E6=9B=B4=E6=8D=A2=E8=83=8C=E6=99=AF?= =?UTF-8?q?=E5=9B=BE=EF=BC=8C=E7=BA=BF=E4=B8=8A=E6=95=B0=E6=8D=AE=E6=B8=85?= =?UTF-8?q?=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- App.vue | 40 ++++++++++++++++++++++++++------- config/index.js | 2 +- pages/views/tabBar/cart.vue | 2 +- pages/views/tabBar/category.vue | 3 +++ pages/views/tabBar/user.vue | 3 ++- 5 files changed, 39 insertions(+), 11 deletions(-) diff --git a/App.vue b/App.vue index 3b37698..2209f96 100644 --- a/App.vue +++ b/App.vue @@ -3,11 +3,37 @@ import { getConfig, setConfig, getCart, getToken ,getCartNumber } from "./utils/ import myconfig from "./utils/config"; import request from "./utils/request"; import {setTabBarBadge } from'./utils/util.js' - +import CONFIG from '@/config' uni.$ajax = request; //挂载全局请求方法 export default { onShow() { - + const hasLocalType = uni.getStorageSync('_SH_DPD_1') + let isDiff = false + let type = 1 + if (!hasLocalType) { + isDiff = true + } else { + if (CONFIG.isPro && hasLocalType !== 1) { + isDiff = true + } + if (!CONFIG.isPro && hasLocalType === 1) { + isDiff = true + type = 2 + } + } + if (isDiff) { + uni.clearStorageSync() + uni.setStorageSync('_SH_DPD_1', type) + uni.navigateTo({ + url: '/pages/login/index1' + }) + return + } + if (!getToken()) { + uni.navigateTo({ + url: '/pages/login/index1' + }) + } }, onLaunch: function () { @@ -69,12 +95,7 @@ export default { selectedIconPath: v }); }) - if (!getToken()) { - uni.navigateTo({ - url: '/pages/login/index1' - }) - return - } + /** * 模拟获取购物车的数量 getCart */ @@ -204,6 +225,9 @@ $black: #333333; } } &.userbox { + .userHeader { + background-color: $color; + } .iconfont { color: $color; } diff --git a/config/index.js b/config/index.js index 94a83db..9e3704f 100644 --- a/config/index.js +++ b/config/index.js @@ -1,4 +1,4 @@ -const isPro = false +const isPro = true export default { imgUrl: 'http://store-admin.nhet.cloud:8080/jeecg-boot/sys/common/static/', apiUrl: isPro ? 'http://store-admin.nhet.cloud:8080/jeecg-boot' : 'http://store-admin.nhet.cloud:8080/jeecg-boot', diff --git a/pages/views/tabBar/cart.vue b/pages/views/tabBar/cart.vue index a5c264b..5b3acd0 100644 --- a/pages/views/tabBar/cart.vue +++ b/pages/views/tabBar/cart.vue @@ -263,7 +263,7 @@ onsub(item, index) { //减少 //已失效商品不做操作 - if (tem.number <= 1) { + if (item.number <= 1) { return } let number = item.number - 1 diff --git a/pages/views/tabBar/category.vue b/pages/views/tabBar/category.vue index 73a1eb5..82f252f 100644 --- a/pages/views/tabBar/category.vue +++ b/pages/views/tabBar/category.vue @@ -112,6 +112,9 @@ var app = getApp(); const carts = getCart() setTabBarBadge(carts.length) } else { + uni.navigateTo({ + url: '/pages/login/index1' + }) this.hasToken = false setTabBarBadge(0) } diff --git a/pages/views/tabBar/user.vue b/pages/views/tabBar/user.vue index 40b4db4..4d71e3e 100644 --- a/pages/views/tabBar/user.vue +++ b/pages/views/tabBar/user.vue @@ -1,7 +1,7 @@