From e9ebe236e641b62a77b4fba3e1675172a163b590 Mon Sep 17 00:00:00 2001 From: YunaiV Date: Mon, 28 Apr 2025 00:01:33 +0800 Subject: [PATCH] =?UTF-8?q?sync=EF=BC=9A=E8=AE=A2=E5=8D=95=E7=BB=93?= =?UTF-8?q?=E6=9E=9C=E9=A1=B5=E6=B7=BB=E5=8A=A0=E6=94=AF=E4=BB=98=E8=AF=A2?= =?UTF-8?q?=E9=97=AE=E5=AF=B9=E8=AF=9D=E6=A1=86=EF=BC=8C=E7=89=88=E6=9C=AC?= =?UTF-8?q?=E8=8E=B7=E5=8F=96=E6=96=B9=E6=B3=95=E4=BF=AE=E6=94=B9=EF=BC=8C?= =?UTF-8?q?=E6=9B=B4=E6=96=B0README=20https://gitee.com/sheepjs/shopro-uni?= =?UTF-8?q?app/commit/024f311235266334063d25b7fec604b22e613ea9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .env | 2 +- App.vue | 12 +-- manifest.json | 4 +- pages/index/index.vue | 151 +++++++++++++++++---------------- pages/index/user.vue | 11 ++- pages/pay/result.vue | 31 +++++-- sheep/config/index.js | 6 +- sheep/ui/su-video/su-video.vue | 2 + 8 files changed, 123 insertions(+), 96 deletions(-) diff --git a/.env b/.env index 4ac51d4d..932f83dd 100644 --- a/.env +++ b/.env @@ -24,7 +24,7 @@ SHOPRO_DEV_PORT=3000 SHOPRO_STATIC_URL=http://test.yudao.iocoder.cn ### SHOPRO_STATIC_URL = https://file.sheepjs.com -# 是否开启直播 1 开启直播 | 0 关闭直播 (小程序官方后台未审核开通直播权限时请勿开启) +# 是否开启直播 1 开启直播 | 0 关闭直播 SHOPRO_MPLIVE_ON=0 # 租户ID 默认 1 diff --git a/App.vue b/App.vue index 40710b3f..50c799b4 100644 --- a/App.vue +++ b/App.vue @@ -3,14 +3,10 @@ import { ShoproInit } from './sheep'; onLaunch(() => { - // 延时隐藏原生导航栏 - setTimeout(() => { - try { - uni.hideNavigationBar(); - } catch (error) { - // 忽略该 error,不一定存在 - } - }, 200); + // 隐藏原生导航栏 使用自定义底部导航 + uni.hideTabBar({ + fail: () => {}, + }); // 加载Shopro底层依赖 ShoproInit(); diff --git a/manifest.json b/manifest.json index 47b8960f..54e620f8 100644 --- a/manifest.json +++ b/manifest.json @@ -90,9 +90,7 @@ "idfa": true }, "sdkConfigs": { - "speech": { - "ifly": {} - }, + "speech": {}, "ad": {}, "oauth": { "apple": {}, diff --git a/pages/index/index.vue b/pages/index/index.vue index 208c9591..d79e66dd 100644 --- a/pages/index/index.vue +++ b/pages/index/index.vue @@ -1,88 +1,93 @@ diff --git a/pages/index/user.vue b/pages/index/user.vue index 705451a4..42d769b2 100644 --- a/pages/index/user.vue +++ b/pages/index/user.vue @@ -8,7 +8,11 @@ :navbarStyle="template.navigationBar" onShareAppMessage > - + @@ -20,10 +24,11 @@ import sheep from '@/sheep'; // 隐藏原生tabBar - uni.hideTabBar(); + uni.hideTabBar({ + fail: () => {}, + }); const template = computed(() => sheep.$store('app').template.user); - const isLogin = computed(() => sheep.$store('user').isLogin); onShow(() => { sheep.$store('user').updateUserData(); diff --git a/pages/pay/result.vue b/pages/pay/result.vue index c52b1195..6382bbea 100644 --- a/pages/pay/result.vue +++ b/pages/pay/result.vue @@ -97,6 +97,24 @@ } }); + function showRepayModal() { + if (state.result !== 'failed') return; + uni.showModal({ + title: '确认支付', + content: '未检测到您的支付结果,请确认您是否已经支付完成?', + cancelText: '取消', + confirmText: '我已支付', + success: function (res) { + if (res.confirm) { + state.counter = 0; + setTimeout(() => { + getOrderInfo(state.orderId); + }, 100); + } + }, + }); + } + // 获得订单信息 async function getOrderInfo(id) { state.counter++; @@ -137,15 +155,16 @@ return; } } - // 2.1 情况三一:未支付,且轮询次数小于三次,则继续轮询 - if (state.counter < 3 && state.result === 'unpaid') { + // 2.1 情况三一:未支付,且轮询次数小于五次,则继续轮询 + if (state.counter < 5 && state.result === 'unpaid') { setTimeout(() => { getOrderInfo(id); - }, 1500); + }, 2000); } - // 2.2 情况二:超过三次检测才判断为支付失败 - if (state.counter >= 3) { + // 2.2 情况二:超过五次检测才判断为支付失败 + if (state.counter >= 5) { state.result = 'failed'; + showRepayModal(); } } @@ -203,7 +222,7 @@ if (options.payState === 'fail') { state.result = 'failed'; } else { - // 轮询三次检测订单支付结果 + // 轮询五次检测订单支付结果 await getOrderInfo(state.id); } }); diff --git a/sheep/config/index.js b/sheep/config/index.js index c03b7031..c365ce48 100644 --- a/sheep/config/index.js +++ b/sheep/config/index.js @@ -1,12 +1,14 @@ +import packageInfo from '@/package.json'; + +const { version } = packageInfo; + // 开发环境配置 export let baseUrl; -export let version; if (process.env.NODE_ENV === 'development') { baseUrl = import.meta.env.SHOPRO_DEV_BASE_URL; } else { baseUrl = import.meta.env.SHOPRO_BASE_URL; } -version = import.meta.env.SHOPRO_VERSION; if (typeof baseUrl === 'undefined') { console.error('请检查.env配置文件是否存在'); } else { diff --git a/sheep/ui/su-video/su-video.vue b/sheep/ui/su-video/su-video.vue index 010621cf..f52965fb 100644 --- a/sheep/ui/su-video/su-video.vue +++ b/sheep/ui/su-video/su-video.vue @@ -25,6 +25,7 @@