From 8febc5170850e98f99568f8fd6a367c9569ae2c0 Mon Sep 17 00:00:00 2001
From: hejianhao <15708179461@qq.com>
Date: 星期四, 20 八月 2026 17:29:07 +0800
Subject: [PATCH] feat0806: 解决首页直播间不能跳转
---
traditionalApp/pages/home/home.vue | 29 ++---------------------------
1 files changed, 2 insertions(+), 27 deletions(-)
diff --git a/traditionalApp/pages/home/home.vue b/traditionalApp/pages/home/home.vue
index ee85e3e..57164f0 100644
--- a/traditionalApp/pages/home/home.vue
+++ b/traditionalApp/pages/home/home.vue
@@ -331,7 +331,7 @@
/**
* 跳转后台配置的微赞直播 H5 页面。
*/
- const goWeiZanLive = async () => {
+ const goWeiZanLive = () => {
if (!weiZanLiveH5Url.value.trim()) {
uni.showToast({ title: '直播间地址暂未配置', icon: 'none' });
return;
@@ -340,37 +340,12 @@
return;
}
weiZanLiveOpening.value = true;
- uni.showLoading({ title: '正在进入直播间', mask: true });
try {
- const cachedUser = uni.getStorageSync('appUserInfo');
- const userId = cachedUser?.id;
- if (!userId) {
- uni.showToast({ title: '请先登录', icon: 'none' });
- return;
- }
- const res = await createLiveRoomEntry(userId);
- const targetUrl = res?.data?.url?.trim();
- if (res?.code !== 0 || !targetUrl || !isValidLiveRoomUrl(targetUrl)) {
- uni.showToast({ title: res?.msg || '获取直播间地址失败', icon: 'none' });
- return;
- }
uni.navigateTo({
- url: `/pages/webview/webview?url=${encodeURIComponent(targetUrl)}&title=${encodeURIComponent('微赞直播')}`
+ url: `/pages/webview/webview?url=${encodeURIComponent(weiZanLiveH5Url.value)}&title=${encodeURIComponent('微赞直播')}`
});
- } catch {
- uni.showToast({ title: '获取直播间地址失败', icon: 'none' });
} finally {
- uni.hideLoading();
weiZanLiveOpening.value = false;
- }
- };
-
- const isValidLiveRoomUrl = (targetUrl : string) => {
- try {
- const parsedUrl = new URL(targetUrl);
- return parsedUrl.protocol === 'https:';
- } catch {
- return false;
}
};
--
Gitblit v1.7.1