diff --git a/pages/course/index.vue b/pages/course/index.vue index c7695e3..76ae958 100644 --- a/pages/course/index.vue +++ b/pages/course/index.vue @@ -459,7 +459,12 @@ const requestAll = async () => { onMounted(() => { // 重置分类索引 currentIndex.value = 0 - + if(!uni.getStorageSync('state') && !uni.getStorageSync('token')) { + uni.navigateTo({ + url: '/pages/login/login' + }); + } + if(uni.getStorageSync('state')) uni.removeStorageSync('state') // 请求所有数据 requestAll() }) diff --git a/pages/login/login.vue b/pages/login/login.vue index d02c9a4..a10b9d9 100644 --- a/pages/login/login.vue +++ b/pages/login/login.vue @@ -401,6 +401,7 @@ const yszc = () => { * 页面跳转 */ const onPageSwitch = (url: string) => { + uni.setStorageSync('state', 'true'); uni.switchTab({ url: url, }) @@ -446,7 +447,6 @@ const getOS = () =>{ const oprateOs = uni.getSystemInfoSync().platform console.log(oprateOs, 'oprateOs'); isAndorid.value = oprateOs === "android" ? true : false - console.log(isAndorid.value); } onMounted(() => {