This commit is contained in:
dzc committed 2026-08-02 17:33:25 +08:00
1 parent cf1244187f
commit cb0244a1e2
1 file changed
+5 -3
+5 -3
View File
@@ -2,6 +2,8 @@ import { router } from ".."
import { APPENV } from "../constant"
import { getAppInfo, isDevEnv } from "../utils/app"
const normalizeScanResult = (scanResult: string) => scanResult.replace("https://stgl.pj.gov.cn", "https://www.pjzhhq.cn")
export function useScanCode(actModalShow) {
async function scanCodeAction(): Promise<string | undefined> {
const appInfo = await getAppInfo()
@@ -24,19 +26,19 @@ export function useScanCode(actModalShow) {
// 测试环境(自营商家)-老县府超市
// testQrCode = "https://stgl.pj.gov.cn/h5/#/pages/pay/scanPay?id=1905816898011865090"
uni.showModal({ content: "开发环境不是浙政钉和诗画环境,扫码仅供测试" })
return Promise.resolve(testQrCode)
return normalizeScanResult(testQrCode)
}
if (appInfo == APPENV.ZZD) {
// 浙政钉扫码
const res: any = await (window as any).dd.scan({ type: "all" })
return res.text || ""
return normalizeScanResult(res.text || "")
}
if (appInfo == APPENV.SH) {
// 诗画扫码
const res = await (window as any).CP2.showScanQr({ needResult: 1 })
if (res.code == 1) return res.data.qrCode || ""
if (res.code == 1) return normalizeScanResult(res.data.qrCode || "")
return ""
}
uni.showToast({ title: "当前环境未知", icon: "none" })