@@ -27,6 +27,7 @@
getGoodsList
} from '@/api/goods.js'
import {bannerList} from '@/api/banner.js'
+ import {checkLogin} from '@/api/login.js'
export default {
components: {
},
@@ -42,6 +43,16 @@
onLoad() {
this.pageInit()
+ onShow() {
+ // 是否登录
+ checkLogin().then(res => {
+ if(res.status != 200){
+ uni.navigateTo({
+ url:"/pages/login/login"
+ })
+ }
+ },
// 下拉刷新
onPullDownRefresh() {
console.log('refresh')
@@ -48,10 +48,13 @@
onShow() {
checkLogin().then(res => {
- console.log(res,'checkLogin')
this.hasLogin = res.status == 200
if(this.hasLogin){
this.getUserInfo()
+ }else{
}
})