Files
quinn-wx/pages/foot-tab/foot-tab.js
2022-12-16 17:32:49 +08:00

85 lines
2.1 KiB
JavaScript

// pages/component/foot-tab.js
Component({
/**
* 组件的属性列表
*/
properties: {
iconList: {
type: Array,
value: null
}
},
/**
* 组件的初始数据
*/
data: {
message: {dot: true}
},
/**
* 组件的方法列表
*/
methods: {
setIconData(cur){
this.setData({
'iconList[0]': 'check-rectangle',
'iconList[1]': 'star',
'iconList[2]': 'notification',
'iconList[3]': 'info-circle'
});
if (cur == 1){
this.setData({
'iconList[0]': 'check-rectangle-filled',
})
wx.redirectTo({
url: '../task/index'
})
}
if (cur == 2){
this.setData({
'iconList[1]': 'star-filled'
})
wx.redirectTo({
url: '../anniversary/index'
})
}
if (cur == 3){
this.setData({
'iconList[2]': 'notification-filled'
})
wx.redirectTo({
url: '../message/index'
})
}
if (cur == 4){
this.setData({
'iconList[3]': 'info-circle-filled'
})
wx.redirectTo({
url: '../myself/index'
})
}
},
checkLogin(){
let userInfo = wx.getStorageSync('userInfo');
let token = wx.getStorageSync('userToken');
console.log('userInfo===' + userInfo);
console.log('token===' + token);
if (userInfo && token){
return true;
}else {
return false;
}
},
onChange(event) {
if (!this.checkLogin()){
wx.redirectTo({url:"/pages/login/index"});
}
this.setIconData(event.detail.value);
},
}
})