商户角色判断

This commit is contained in:
weiwei committed 2025-04-01 20:13:36 +08:00
1 parent c64d88ee3a
commit 374717bc5c
3 files changed
+27 -5

No files matched your search

-2
View File
@@ -19,7 +19,6 @@ VITE_OAUTH2_APP_CLIENT='mini:mini'
# 图片访问基础地址
#VITE_IMAGE_BASE_PATH = http://localhost:9999
# VITE_IMAGE_BASE_PATH = http://192.168.101.81:9999 # 邓-本地
# VITE_IMAGE_BASE_PATH = https://123.156.230.15:8089/api # 线上
# VITE_IMAGE_BASE_PATH = http://220.191.229.171:8090/api # 线上
# VITE_IMAGE_BASE_PATH = http://pjcloud.center.takin.cc # 张
#VITE_IMAGE_BASE_PATH = http://59.202.170.152:81/api # 信创线上
@@ -30,7 +29,6 @@ VITE_IMAGE_BASE_PATH = https://stgl.pj.gov.cn/api # 域名线上
VITE_APP_DEV_SERVICE = https://stgl.pj.gov.cn/api # 域名线上
# VITE_APP_DEV_SERVICE = http://192.168.101.81:9999 # 邓-本地
# VITE_APP_DEV_SERVICE = http://127.0.0.1:9999
# VITE_APP_DEV_SERVICE = http://123.156.230.15:8089/api/ # 线上
# VITE_APP_DEV_SERVICE = http://220.191.229.171:8090/api # 线上
# VITE_APP_DEV_SERVICE = http://localhost:9999
# ******************** end 开发环境 end ********************
+18 -3
View File
@@ -1,4 +1,5 @@
<script lang="ts">
import user from "./sheep/api/user"
import isDevEnv from "./sheep/utils/isDevEnv"
// import { onLaunch, onShow, onHide } from "@dcloudio/uni-app"
@@ -69,8 +70,8 @@ export default {
onLaunch() {
console.log("环境判断")
// 诗画浦江获取用户信息进行环境判断
;(window as any).CP2.getAppInfo().then((res) => {
if (res.code == 0) {
;(window as any).CP2.getAppInfo().then(async (res) => {
if (res.code !== 0) {
// 不是诗画环境
const launchParam = new URL(window.location.href).searchParams.get("launchParam")
console.log("app launch 启动路径参数", launchParam)
@@ -86,7 +87,21 @@ export default {
}
} else {
// 是诗画环境
return uni.redirectTo({ url: "/pages/user/userRole" })
const userRole = uni.getStorageSync("userRole")
if (userRole && userRole == "user") uni.switchTab({ url: "/pages/tabbar/coopMerchant" })
if (userRole && userRole == "merchant") uni.switchTab({ url: "/pages/tabbar/individualOrder" })
const res = await user.isMerchant()
if (res.code == 0) {
if (res.data) {
return uni.redirectTo({ url: "/pages/user/userRole" })
} else {
uni.setStorageSync("userRole", "user")
uni.switchTab({ url: "/pages/tabbar/coopMerchant" })
}
} else {
uni.showToast({ title: "角色身份判断失败", icon: "none" })
}
}
})
},
+9
View File
@@ -87,4 +87,13 @@ export default {
},
})
},
// 判断是否是商户角色
isMerchant: (): Promise<any> =>
request({
url: "/admin/role/isMchUser",
method: "GET",
custom: {
showLoading: false,
},
}),
}