首页默认静默登陆

This commit is contained in:
李琦
2026-01-15 12:33:46 +08:00
parent c4f322edd6
commit 696cb2e0fa
9 changed files with 263 additions and 207 deletions

View File

@@ -77,28 +77,18 @@ export async function performLogin(options = { silent: false, toastRef: null })
}
// 5.3 处理门店切换/设置
// 优先使用已存在的 store_id(可能是扫码设置的),避免覆盖
const existingStoreId = uni.getStorageSync('store_id');
if (existingStoreId) {
// 如果已存在 store_id(可能是扫码设置的),使用现有的值进行门店切换
console.log('[登录调试] 使用已存在的 store_id 进行门店切换:', existingStoreId);
const storeId = uni.getStorageSync('store_id');
if (storeId) {
storeChange({
method: "post",
data: {
store_id: existingStoreId
store_id: storeId
}
}).catch((err) => {
console.error('[登录调试] 切换门店失败:', err);
console.error('切换门店失败:', err);
});
} else {
// 只有在 store_id 不存在时才使用服务器返回的值
const serverStoreId = res.data.data.data.store_id;
if (serverStoreId) {
console.log('[登录调试] store_id 不存在,使用服务器返回的值:', serverStoreId);
uni.setStorageSync('store_id', serverStoreId);
} else {
console.warn('[登录调试] 服务器未返回 store_id,保持默认值');
}
uni.setStorageSync('store_id', res.data.data.data.store_id);
}
// 5.4 清除 Guest 模式标记

View File

@@ -6,8 +6,8 @@ export function checkDev(key = '') {
// 判断某些模块是否开启
switch (key) {
case 'dev':
// return false;
return true;
return false;
// return true;
case 'open-im':
// return false;
return true;