fix: some
All checks were successful
构建并部署前端到生产环境 / build-and-deploy (push) Successful in 2m14s

This commit is contained in:
luo
2026-10-13 16:11:02 +08:00
parent da95a914e3
commit 97dec4dc65
9 changed files with 71 additions and 61 deletions

View File

@@ -47,8 +47,6 @@
import { getPhoneBindingMode } from '@/utils/phone-bind.js';
import { getSessionContext, isCurrentSession } from '@/utils/session-context.js';
const POST_BIND_RELOGIN_NOTICE_KEY = 'postBindReloginNotice';
const userStore = useUserStore();
const initializing = ref(true);
const submitting = ref(false);
@@ -85,12 +83,8 @@
fromLogin.value = options.fromLogin === 'true';
if (userStore.state.customerPhone) bind.phone = userStore.state.customerPhone;
// Mandatory binding ends with a new login. Do not consume the day's
// one-time expiry reminder here merely to prefill a phone input.
if (fromLogin.value) {
initializing.value = false;
return;
}
// Binding keeps the current session. Any one-time expiry reminder from
// this prefill request is retained by the shared receiver for the homepage.
const token = uni.getStorageSync('token');
const identifier = userStore.state.identifier || uni.getStorageSync('identifier') || '';
if (!token || !identifier) {
@@ -114,23 +108,6 @@
}
});
const prepareManualRelogin = () => {
const preservedIdentifier = userStore.state.identifier || uni.getStorageSync('identifier') || '';
userStore.clearUser();
if (preservedIdentifier) {
userStore.setIdentifier(preservedIdentifier);
}
uni.setStorageSync(POST_BIND_RELOGIN_NOTICE_KEY, '1');
// #ifdef H5
if (typeof sessionStorage !== 'undefined') {
sessionStorage.removeItem('assetToken');
}
// #endif
};
const getCode = async () => {
if (cooldown.value > 0 || initializing.value || assetConflict.value || bindingMode.value === 'none') return;
if (!bind.phone) {
@@ -187,8 +164,8 @@
userStore.completePhoneBinding(submittedPhone, mode);
if (fromLogin.value) {
prepareManualRelogin();
uni.reLaunch({ url: '/pages/login/login' });
uni.removeStorageSync('postBindReloginNotice');
uni.reLaunch({ url: '/pages/index/index' });
return;
}

View File

@@ -71,8 +71,6 @@
import { useUserStore } from '@/store/index.js';
import { initWxConfig, wxScan, isInWechat } from '@/utils/wxsdk.js';
const POST_BIND_RELOGIN_NOTICE_KEY = 'postBindReloginNotice';
const userStore = useUserStore();
const identifier = ref(uni.getStorageSync('identifier') || '');
const loading = ref(false);
@@ -86,6 +84,8 @@
};
onMounted(async () => {
// Remove the obsolete post-bind re-login notice from older client builds.
uni.removeStorageSync('postBindReloginNotice');
const urlIdentifier = getPathDeviceId();
const token = uni.getStorageSync('token');
const storedIdentifier = uni.getStorageSync('identifier') || '';
@@ -112,7 +112,6 @@
return;
}
showPostBindReloginNotice();
handleWechatCallback();
// 初始化微信 SDK (仅在微信浏览器内执行)
@@ -140,19 +139,6 @@
resetLoadingState();
});
const showPostBindReloginNotice = () => {
if (uni.getStorageSync(POST_BIND_RELOGIN_NOTICE_KEY) !== '1') {
return;
}
uni.removeStorageSync(POST_BIND_RELOGIN_NOTICE_KEY);
uni.showToast({
title: '绑定手机号成功,请重新登录',
icon: 'none',
duration: 2500
});
};
const getCode = () => {
const params = new URLSearchParams(window.location.search);
return params.get('code');