界面设计

This commit is contained in:
comlibmb
2026-01-27 11:20:10 +08:00
parent 3fbd9a2b3d
commit a052ac1d7b
7 changed files with 1719 additions and 404 deletions

View File

@@ -29,22 +29,46 @@
export default {
onLoad() {
// 启动页:根据登录态重定向
setTimeout(() => {
console.log('boot onLoad: start redirect check')
this.checkAndRedirect();
},
onShow() {
// 启动页仅在首次进入时做一次跳转,避免影响 H5 手动输入 URL
},
methods: {
checkAndRedirect() {
console.log('boot: start redirect check')
try {
const sessionInfo = supa.getSession();
if (sessionInfo != null && sessionInfo.user != null) {
// 已登录 -> 直接进入消费者端首页
console.log('boot onLoad: found session, go consumer/index')
uni.reLaunch({ url: '/pages/mall/consumer/index' });
console.log('boot: found session, go consumer/index')
uni.reLaunch({
url: '/pages/mall/consumer/index',
success: () => {
console.log('boot: redirect to consumer/index success')
},
fail: (err) => {
console.error('boot: redirect to consumer/index failed', err)
}
});
return;
}
} catch (e) {}
} catch (e) {
console.error('boot: error checking session', e);
}
console.log('boot onLoad: no session, go login')
console.log('boot: no session, go login')
// 未登录 -> 登录页
uni.reLaunch({ url: '/pages/user/login' });
}, 0);
uni.reLaunch({
url: '/pages/user/login',
success: () => {
console.log('boot: redirect to login success')
},
fail: (err) => {
console.error('boot: redirect to login failed', err)
}
});
}
}
};
</script>