feat: 扫码进入问题修复

This commit is contained in:
2025-11-15 10:39:36 +08:00
parent 9fffb85b47
commit 7221a86214
4 changed files with 34 additions and 36 deletions

View File

@@ -18,7 +18,7 @@ import Participants from "./components/Participants";
import SupplementalNotes from "./components/SupplementalNotes";
import OrganizerInfo from "./components/OrganizerInfo";
import SharePopup from "./components/SharePopup";
import { navto, toast, useSceneRedirect } from "./utils/helper";
import { navto, toast } from "./utils/helper";
import ArrowLeft from "@/static/detail/icon-arrow-left.svg";
import Logo from "@/static/detail/icon-logo-go.svg";
import styles from "./index.module.scss";
@@ -37,8 +37,6 @@ function Index() {
const { statusNavbarHeightInfo } = useGlobalState();
const { statusBarHeight, navBarHeight } = statusNavbarHeightInfo;
useSceneRedirect("game_pages/detail/index");
const isMyOwn = userInfo.id === myInfo.id;
const sharePopupRef = useRef<any>(null);
@@ -254,4 +252,6 @@ function Index() {
);
}
export default withAuth(Index);
// export default withAuth(Index);
const ExportPage = withAuth(Index);
export default ExportPage;

View File

@@ -1,6 +1,4 @@
import Taro, {
useLoad,
} from "@tarojs/taro";
import Taro from "@tarojs/taro";
export function navto(url) {
Taro.navigateTo({
@@ -18,34 +16,6 @@ export function insertDotInTags(tags: string[]) {
return tags.join("-·-").split("-");
}
export const useSceneRedirect = (defaultPage: string) => {
useLoad((options) => {
if (options.scene) {
try {
const decoded = decodeURIComponent(options.scene || "");
const params: Record<string, string> = {};
decoded.split("&").forEach((pair) => {
const [key, value] = pair.split("=");
if (key) params[key] = value ? decodeURIComponent(value) : "";
});
// 拼接成 URL query
const query = Object.entries(params)
.map(([k, v]) => `${k}=${encodeURIComponent(v)}`)
.join("&");
console.log('scan query', query)
Taro.redirectTo({
url: query ? `/${defaultPage}?${query}` : `/${defaultPage}`,
});
} catch (err) {
console.error("scene 解析失败:", err);
}
}
});
};
export function genNTRPRequirementText(min, max) {
if (min && max && min !== max) {
return `${min} - ${max} 之间`;