feat: 订单详情 & 问卷调查

This commit is contained in:
2025-09-10 16:56:24 +08:00
parent 8a1a2af1e9
commit d60445b850
31 changed files with 2054 additions and 723 deletions

View File

@@ -1,51 +1,51 @@
import React, { useEffect, useState } from 'react'
import Taro from '@tarojs/taro'
import { View } from '@tarojs/components'
import { check_login_status } from '@/services/loginService'
import React, { useEffect, useState } from "react";
import Taro from "@tarojs/taro";
import { View } from "@tarojs/components";
import { check_login_status } from "@/services/loginService";
export function getCurrentFullPath(): string {
const pages = Taro.getCurrentPages()
const currentPage = pages.at(-1)
const pages = Taro.getCurrentPages();
const currentPage = pages.at(-1);
if (currentPage) {
console.log(currentPage, 'currentPage get')
const route = currentPage.route
const options = currentPage.options || {}
console.log(currentPage, "currentPage get");
const route = currentPage.route;
const options = currentPage.options || {};
const query = Object.keys(options)
.map(key => `${key}=${options[key]}`)
.join('&')
.map((key) => `${key}=${options[key]}`)
.join("&");
return query ? `/${route}?${query}` : `/${route}`
return query ? `/${route}?${query}` : `/${route}`;
}
return ''
return "";
}
export default function withAuth<P extends object>(WrappedComponent: React.ComponentType<P>) {
export default function withAuth<P extends object>(
WrappedComponent: React.ComponentType<P>,
) {
const ComponentWithAuth: React.FC<P> = (props: P) => {
const [authed, setAuthed] = useState(false)
const [authed, setAuthed] = useState(false);
useEffect(() => {
const is_login = check_login_status()
setAuthed(is_login)
const is_login = check_login_status();
setAuthed(is_login);
if (!is_login) {
const currentPage = getCurrentFullPath()
const currentPage = getCurrentFullPath();
// Taro.redirectTo({
// url: `/pages/login/index/index${
// currentPage ? `?redirect=${encodeURIComponent(currentPage)}` : ''
// }`,
// })
}
}, [])
}, []);
// if (!authed) {
// return <View style={{ width: '100vh', height: '100vw', backgroundColor: 'white', position: 'fixed', top: 0, left: 0, zIndex: 999 }} /> // 空壳,避免 children 渲染出错
// }
return <WrappedComponent {...props} />
}
return <WrappedComponent {...props} />;
};
return ComponentWithAuth
}
return ComponentWithAuth;
}