修改 列表 时间格式化问题

This commit is contained in:
张成
2025-10-18 20:17:31 +08:00
parent da72c92458
commit 9f5fdfd1a5
5 changed files with 239 additions and 30 deletions

View File

@@ -8,24 +8,16 @@ const LoginPage: React.FC = () => {
const [is_loading, set_is_loading] = useState(false);
const [agree_terms, set_agree_terms] = useState(false);
const [show_terms_layer, set_show_terms_layer] = useState(false);
const [pending_login_type, set_pending_login_type] = useState<'wechat' | 'phone' | null>(null); // 记录待执行的登录类型
const [pending_phone_event, set_pending_phone_event] = useState<any>(null); // 记录微信登录的事件数据
const { params: { redirect } } = useRouter();
// 微信授权登录
const handle_wechat_login = async (e: any) => {
if (!agree_terms) {
set_show_terms_layer(true);
Taro.showToast({
title: '请先同意用户协议',
icon: 'none',
duration: 2000
});
return;
}
// 执行微信登录的核心逻辑
const execute_wechat_login = async (e: any) => {
// 检查是否获取到手机号
if (!e.detail || !e.detail.code) {
Taro.showToast({
@@ -68,9 +60,12 @@ const LoginPage: React.FC = () => {
}
};
// 手机号验证码登录
const handle_phone_login = async () => {
// 微信授权登录
const handle_wechat_login = async (e: any) => {
if (!agree_terms) {
// 记录待执行的登录类型和事件数据
set_pending_login_type('wechat');
set_pending_phone_event(e);
set_show_terms_layer(true);
Taro.showToast({
title: '请先同意用户协议',
@@ -80,16 +75,54 @@ const LoginPage: React.FC = () => {
return;
}
// 如果已同意条款,直接执行登录
await execute_wechat_login(e);
};
// 执行手机号登录的核心逻辑
const execute_phone_login = () => {
// 跳转到验证码页面
Taro.navigateTo({
url: `/login_pages/verification/index?redirect=${redirect}`
});
};
// 同意协议并关闭浮层
// 手机号验证码登录
const handle_phone_login = async () => {
if (!agree_terms) {
// 记录待执行的登录类型
set_pending_login_type('phone');
set_show_terms_layer(true);
Taro.showToast({
title: '请先同意用户协议',
icon: 'none',
duration: 2000
});
return;
}
// 如果已同意条款,直接执行登录
execute_phone_login();
};
// 同意协议并关闭浮层,继续执行未完成的登录
const handle_agree_terms = () => {
set_agree_terms(true);
set_show_terms_layer(false);
// 根据待执行的登录类型,继续执行登录
if (pending_login_type === 'wechat' && pending_phone_event) {
// 继续执行微信登录
execute_wechat_login(pending_phone_event);
// 清空待执行状态
set_pending_login_type(null);
set_pending_phone_event(null);
} else if (pending_login_type === 'phone') {
// 继续执行手机号登录
execute_phone_login();
// 清空待执行状态
set_pending_login_type(null);
}
};
// 切换协议同意状态(复选框用)