Merge branch 'master' into dev
This commit is contained in:
18
src/app.ts
18
src/app.ts
@@ -5,6 +5,7 @@ import "./app.scss";
|
|||||||
import "./scss/qweather-icons/qweather-icons.css";
|
import "./scss/qweather-icons/qweather-icons.css";
|
||||||
import { useGlobalStore } from "./store/global";
|
import { useGlobalStore } from "./store/global";
|
||||||
import { removeStorage } from "./store/storage";
|
import { removeStorage } from "./store/storage";
|
||||||
|
import { sceneRedirectLogic } from './utils/helper'
|
||||||
|
|
||||||
interface AppProps {
|
interface AppProps {
|
||||||
children: ReactNode;
|
children: ReactNode;
|
||||||
@@ -17,25 +18,12 @@ function clearSpecStorage() {
|
|||||||
|
|
||||||
class App extends Component<AppProps> {
|
class App extends Component<AppProps> {
|
||||||
onLaunch(options) {
|
onLaunch(options) {
|
||||||
console.log('launch options: ', options)
|
|
||||||
console.log("小程序启动,初始化逻辑写这里");
|
console.log("小程序启动,初始化逻辑写这里");
|
||||||
clearSpecStorage()
|
clearSpecStorage()
|
||||||
Taro.onNeedPrivacyAuthorization((resolve) => {
|
Taro.onNeedPrivacyAuthorization((resolve) => {
|
||||||
// 这里可以自定义弹窗(或直接默认同意)
|
// 这里可以自定义弹窗(或直接默认同意)
|
||||||
resolve({ event: 'agree' }); // 同意隐私协议
|
resolve({ event: 'agree' }); // 同意隐私协议
|
||||||
});
|
});
|
||||||
|
|
||||||
// Taro.loadFontFace({
|
|
||||||
// family: 'Quicksand',
|
|
||||||
// source: 'url("https://bimwe.oss-cn-shanghai.aliyuncs.com/front/ball/other/57dc951f-f10e-45b7-9157-0b1e468187fd.ttf")',
|
|
||||||
// global: true, // 全局生效
|
|
||||||
// success(res) {
|
|
||||||
// console.log('字体加载成功', res);
|
|
||||||
// },
|
|
||||||
// fail(err) {
|
|
||||||
// console.error('字体加载失败', err);
|
|
||||||
// }
|
|
||||||
// })
|
|
||||||
}
|
}
|
||||||
|
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
@@ -44,7 +32,9 @@ class App extends Component<AppProps> {
|
|||||||
// this.getLocation()
|
// this.getLocation()
|
||||||
}
|
}
|
||||||
|
|
||||||
componentDidShow() { }
|
componentDidShow(options) {
|
||||||
|
sceneRedirectLogic(options.query, options.path);
|
||||||
|
}
|
||||||
|
|
||||||
componentDidHide() { }
|
componentDidHide() { }
|
||||||
|
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ import Participants from "./components/Participants";
|
|||||||
import SupplementalNotes from "./components/SupplementalNotes";
|
import SupplementalNotes from "./components/SupplementalNotes";
|
||||||
import OrganizerInfo from "./components/OrganizerInfo";
|
import OrganizerInfo from "./components/OrganizerInfo";
|
||||||
import SharePopup from "./components/SharePopup";
|
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 ArrowLeft from "@/static/detail/icon-arrow-left.svg";
|
||||||
import Logo from "@/static/detail/icon-logo-go.svg";
|
import Logo from "@/static/detail/icon-logo-go.svg";
|
||||||
import styles from "./index.module.scss";
|
import styles from "./index.module.scss";
|
||||||
@@ -37,8 +37,6 @@ function Index() {
|
|||||||
const { statusNavbarHeightInfo } = useGlobalState();
|
const { statusNavbarHeightInfo } = useGlobalState();
|
||||||
const { statusBarHeight, navBarHeight } = statusNavbarHeightInfo;
|
const { statusBarHeight, navBarHeight } = statusNavbarHeightInfo;
|
||||||
|
|
||||||
useSceneRedirect("game_pages/detail/index");
|
|
||||||
|
|
||||||
const isMyOwn = userInfo.id === myInfo.id;
|
const isMyOwn = userInfo.id === myInfo.id;
|
||||||
|
|
||||||
const sharePopupRef = useRef<any>(null);
|
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;
|
||||||
|
|||||||
@@ -1,6 +1,4 @@
|
|||||||
import Taro, {
|
import Taro from "@tarojs/taro";
|
||||||
useLoad,
|
|
||||||
} from "@tarojs/taro";
|
|
||||||
|
|
||||||
export function navto(url) {
|
export function navto(url) {
|
||||||
Taro.navigateTo({
|
Taro.navigateTo({
|
||||||
@@ -18,32 +16,6 @@ export function insertDotInTags(tags: string[]) {
|
|||||||
return tags.join("-·-").split("-");
|
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("&");
|
|
||||||
|
|
||||||
Taro.redirectTo({
|
|
||||||
url: query ? `/${defaultPage}?${query}` : `/${defaultPage}`,
|
|
||||||
});
|
|
||||||
} catch (err) {
|
|
||||||
console.error("scene 解析失败:", err);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
export function genNTRPRequirementText(min, max) {
|
export function genNTRPRequirementText(min, max) {
|
||||||
if (min && max && min !== max) {
|
if (min && max && min !== max) {
|
||||||
return `${min} - ${max} 之间`;
|
return `${min} - ${max} 之间`;
|
||||||
|
|||||||
@@ -24,6 +24,10 @@
|
|||||||
padding: 20px;
|
padding: 20px;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
background-color: #fafafa;
|
background-color: #fafafa;
|
||||||
|
|
||||||
|
.titleClassName {
|
||||||
|
color: #000;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.gameInfoContainer {
|
.gameInfoContainer {
|
||||||
|
|||||||
@@ -16,6 +16,10 @@
|
|||||||
width: 100%;
|
width: 100%;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
|
|
||||||
|
.titleClassName {
|
||||||
|
color: #000;
|
||||||
|
}
|
||||||
|
|
||||||
.list {
|
.list {
|
||||||
height: 100%;
|
height: 100%;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
|||||||
@@ -266,8 +266,8 @@ const OrderList = () => {
|
|||||||
style={{ paddingTop: `${totalHeight + 8}px` }}
|
style={{ paddingTop: `${totalHeight + 8}px` }}
|
||||||
>
|
>
|
||||||
<GeneralNavbar
|
<GeneralNavbar
|
||||||
title="订单列表"
|
title="球局订单"
|
||||||
titlePosition="left"
|
backgroundColor="transparent"
|
||||||
titleClassName={styles.titleClassName}
|
titleClassName={styles.titleClassName}
|
||||||
className={styles.navbar}
|
className={styles.navbar}
|
||||||
/>
|
/>
|
||||||
|
|||||||
26
src/utils/helper.ts
Normal file
26
src/utils/helper.ts
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
import Taro from "@tarojs/taro";
|
||||||
|
|
||||||
|
// 普通函数,不调用 useLoad
|
||||||
|
export const sceneRedirectLogic = (options, defaultPage: string) => {
|
||||||
|
if (!options.scene) return;
|
||||||
|
|
||||||
|
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) : "";
|
||||||
|
});
|
||||||
|
|
||||||
|
const query = Object.entries(params)
|
||||||
|
.map(([k, v]) => `${k}=${encodeURIComponent(v)}`)
|
||||||
|
.join("&");
|
||||||
|
|
||||||
|
Taro.redirectTo({
|
||||||
|
url: query ? `/${defaultPage}?${query}` : `/${defaultPage}`,
|
||||||
|
});
|
||||||
|
} catch (e) {
|
||||||
|
console.error(e);
|
||||||
|
}
|
||||||
|
};
|
||||||
Reference in New Issue
Block a user