chore:提取公共常量

This commit is contained in:
weiwei committed 2025-08-26 20:12:22 +08:00
1 parent 97eb387436
commit 88e5660b29
8 files changed
+41 -19

No files matched your search

+14 -8
View File
@@ -137,13 +137,15 @@
import { reactive, nextTick } from "vue"
import { onLoad, onShow } from "@dcloudio/uni-app"
import { isEmpty } from "radash"
import { router } from "@@/index"
import { hooks, router } from "@@/index"
import { foodApi, merchantApi, payApi, shopApi } from "@@/api"
import { filePath } from "@@/utils/file"
import ProductRow from "./components/product-row.vue"
import ProductCart from "./components/product-cart.vue"
import ProductTotal from "./components/product-total.vue"
import ProductSku from "./components/product-sku.vue"
import { getAppInfo } from "@/sheep/utils/app"
import { APPENV } from "@/sheep/constant"
// 商品详情相关数据
const state = reactive<any>({
@@ -336,15 +338,19 @@ const submitPay = async () => {
}
// 联系商家
const doPhone = (item: string) => {
if (isEmpty(item)) {
uni.showToast({ title: "该商户没有预留电话", icon: "none" })
const doPhone = async (item: string) => {
if (isEmpty(item)) return uni.showToast({ title: "该商户没有预留电话", icon: "none" })
if ((await getAppInfo()) == APPENV.ZZD) {
;(window as any).dd
.callPhone({ phoneNum: item.trim() })
.then((res) => {})
.catch((err) => {})
return
}
if ((await getAppInfo()) == APPENV.SH) {
hooks.useMakePhoneCall(item.trim())
return
}
;(window as any).dd
.callPhone({ phoneNum: item.trim() })
.then((res) => {})
.catch((err) => {})
}
</script>
+3 -2
View File
@@ -1,4 +1,5 @@
<script setup lang="ts">
import { APPENV } from "@/sheep/constant"
import { getAppInfo, getLaunchParam, isDevEnv } from "@/sheep/utils/app"
import { onShow } from "@dcloudio/uni-app"
@@ -57,7 +58,7 @@ const jumpByParam = async () => {
const launchParam = getLaunchParam() // 获取启动参数
// 浙政钉环境
if (appInfo == "zzd") {
if (appInfo == APPENV.ZZD) {
switch (launchParam) {
case "canteen": // 食堂
uni.setStorageSync("launchParam", launchParam)
@@ -87,7 +88,7 @@ const jumpByParam = async () => {
}
// 诗画环境
if (appInfo == "sh") {
if (appInfo == APPENV.SH) {
const userRole = uni.getStorageSync("userRole") // 获取用户角色
if (!launchParam) return uni.hideTabBar()
+4 -3
View File
@@ -40,7 +40,7 @@
</view>
</view>
<view class="h-30rpx" />
<view v-if="state.appInfo == 'sh'" class="flex-col-center m-t-40rpx m-x-30rpx">
<view v-if="state.appInfo == APPENV.SH" class="flex-col-center m-t-40rpx m-x-30rpx">
<view class="w-full text-center sub-text-28 p-y-20rpx rounded-40rpx border-solid border border-#0094ff" @tap="doChangeRole">
切换角色
</view>
@@ -68,6 +68,7 @@ import { getAppInfo } from "@@/utils/app"
import { hooks, router, constant } from "@@/index"
import { userApi } from "@@/api"
import { isDevEnv } from "@/sheep/utils/app"
import { APPENV } from "@/sheep/constant"
const state = reactive<{
wallet: any[]
@@ -300,11 +301,11 @@ const scanCode = {
uni.showModal({ content: "开发环境不是浙政钉和诗画环境,扫码仅供测试,收款商家为测试商户超市" })
return testQrCode
} else if (state.appInfo == "zzd") {
} else if (state.appInfo == APPENV.ZZD) {
// 浙政钉扫码
const res: any = await (window as any).dd.scan({ type: "all" })
return res.text
} else if (state.appInfo == "sh") {
} else if (state.appInfo == APPENV.SH) {
// 诗画扫码
const res = await (window as any).CP2.showScanQr({ needResult: 1 })
if (res.code == 1) return res.data.qrCode