首页默认静默登陆

This commit is contained in:
李琦
2026-01-14 20:59:32 +08:00
parent 7ed22e2d58
commit c4f322edd6
5 changed files with 108 additions and 55 deletions

View File

@@ -398,13 +398,20 @@ export default {
this.getBannered();
} else {
this.storeinfo = res.data.data.list.filter((item) => item.is_online == 1)
uni.setStorageSync('store_id', this.storeinfo[0].store.id)
this.headerTitle = this.storeinfo[0].store['name']
// 只在 store_id 不存在时才设置,避免覆盖扫码设置的 store_id
if (!uni.getStorageSync('store_id') && this.storeinfo.length > 0) {
uni.setStorageSync('store_id', this.storeinfo[0].store.id)
}
if (this.storeinfo.length > 0) {
this.headerTitle = this.storeinfo[0].store['name']
}
this.getBannered();
}
} else {
// 未登录时不跳转,使用默认store_id=11001
uni.setStorageSync('store_id', '11001');
// 接口失败时,只在 store_id 不存在时才设置默认值,避免覆盖扫码设置的 store_id
if (!uni.getStorageSync('store_id')) {
uni.setStorageSync('store_id', '11001');
}
this.getBannered();
}
})