|
|
@@ -6,7 +6,7 @@ Page({
|
|
|
* 页面的初始数据
|
|
|
*/
|
|
|
data: {
|
|
|
- bannerList: null, //banner列表
|
|
|
+ bannerList: [], //banner列表
|
|
|
user: {},
|
|
|
annunciateList: [], //通告列表
|
|
|
gridList: [],
|
|
|
@@ -14,6 +14,7 @@ Page({
|
|
|
notice: "",
|
|
|
msgCount: 1,
|
|
|
subassembly: [], //首页部件
|
|
|
+ msgList: [], //消息列表
|
|
|
},
|
|
|
|
|
|
/**
|
|
|
@@ -93,10 +94,14 @@ Page({
|
|
|
gridList,
|
|
|
subassembly
|
|
|
})
|
|
|
+ } else {
|
|
|
+ setTimeout(this.refreshData, 10);
|
|
|
+ return;
|
|
|
}
|
|
|
- /* 获取banner */
|
|
|
- this.setData({
|
|
|
- bannerList: wx.getStorageSync('banner_list')[0].ads
|
|
|
+ /* 获取首页banner */
|
|
|
+ let banner = wx.getStorageSync('banner_list').find(v => v.location == "index_top");
|
|
|
+ if (banner) this.setData({
|
|
|
+ bannerList: banner.ads
|
|
|
})
|
|
|
this.queryNoticeList(0); //获取通告列表
|
|
|
},
|
|
|
@@ -170,9 +175,10 @@ Page({
|
|
|
msgList: res.data,
|
|
|
notice: res.data[0]
|
|
|
})
|
|
|
- this.startDataCarousel();
|
|
|
+ if (this.data.msgList.length > 2) this.startDataCarousel();
|
|
|
})
|
|
|
},
|
|
|
+ /* 开启消息轮播 */
|
|
|
startDataCarousel() {
|
|
|
clearInterval(DataCarousel);
|
|
|
DataCarousel = setInterval(() => {
|
|
|
@@ -220,18 +226,12 @@ Page({
|
|
|
})
|
|
|
}
|
|
|
},
|
|
|
- /**
|
|
|
- * 生命周期函数--监听页面显示
|
|
|
- */
|
|
|
onShow() {
|
|
|
this.getTabBar().init();
|
|
|
- this.startDataCarousel();
|
|
|
+ if (this.data.msgList.length > 2) this.startDataCarousel();
|
|
|
this.getCount(); //更新徽标数据
|
|
|
this.queryMessage(0); //更新最新消息
|
|
|
},
|
|
|
- /**
|
|
|
- * 生命周期函数--监听页面隐藏
|
|
|
- */
|
|
|
onHide() {
|
|
|
clearInterval(DataCarousel);
|
|
|
},
|