修复:优化访客模式

This commit is contained in:
2025-12-18 14:03:01 +08:00
parent 9e04533bdc
commit 56772970e2
2 changed files with 7 additions and 2 deletions

View File

@@ -459,7 +459,12 @@ const requestAll = async () => {
onMounted(() => { onMounted(() => {
// 重置分类索引 // 重置分类索引
currentIndex.value = 0 currentIndex.value = 0
if(!uni.getStorageSync('state') && !uni.getStorageSync('token')) {
uni.navigateTo({
url: '/pages/login/login'
});
}
if(uni.getStorageSync('state')) uni.removeStorageSync('state')
// 请求所有数据 // 请求所有数据
requestAll() requestAll()
}) })

View File

@@ -401,6 +401,7 @@ const yszc = () => {
* 页面跳转 * 页面跳转
*/ */
const onPageSwitch = (url: string) => { const onPageSwitch = (url: string) => {
uni.setStorageSync('state', 'true');
uni.switchTab({ uni.switchTab({
url: url, url: url,
}) })
@@ -446,7 +447,6 @@ const getOS = () =>{
const oprateOs = uni.getSystemInfoSync().platform const oprateOs = uni.getSystemInfoSync().platform
console.log(oprateOs, 'oprateOs'); console.log(oprateOs, 'oprateOs');
isAndorid.value = oprateOs === "android" ? true : false isAndorid.value = oprateOs === "android" ? true : false
console.log(isAndorid.value);
} }
onMounted(() => { onMounted(() => {