...
|
...
|
@@ -20,7 +20,12 @@ Page({ |
|
|
list: [],
|
|
|
ifData: !1,
|
|
|
noMore: !1,
|
|
|
top:''
|
|
|
top:'',
|
|
|
interval: 2000,
|
|
|
duration: 1000,
|
|
|
currentSwiper:0,
|
|
|
indicatorDots: false,
|
|
|
autoplay: true,
|
|
|
},
|
|
|
|
|
|
/**
|
...
|
...
|
@@ -38,7 +43,12 @@ Page({ |
|
|
}
|
|
|
}), this.policyType(), this.getBanner();
|
|
|
},
|
|
|
swiperChange: function (e) {
|
|
|
this.setData({
|
|
|
currentSwiper: e.detail.current
|
|
|
})
|
|
|
|
|
|
},
|
|
|
//获取轮播图
|
|
|
getopbanner() {
|
|
|
let that=this
|
...
|
...
|
@@ -97,19 +107,20 @@ Page({ |
|
|
}) : '', b.getList(e.currentTarget.id, 1)
|
|
|
},
|
|
|
getList(id, page) {
|
|
|
let e = this, url = '/api/Party/index', params = {
|
|
|
let t = this, url = '/api/Party/index', params = {
|
|
|
category_id: id,
|
|
|
page: page,
|
|
|
header: true
|
|
|
}, list = page == 1 ? [] : t.data.list; app.post(url, params).then((res) => {
|
|
|
e.setData({
|
|
|
console.log(res)
|
|
|
t.setData({
|
|
|
list: list.concat(res.data),
|
|
|
page: res.current_page,
|
|
|
lastPage: res.last_page,
|
|
|
ifData: !0,
|
|
|
noMore: res.last_page == res.per_page ? !0 : !1
|
|
|
noMore: res.last_page == res.current_page ? !0 : !1
|
|
|
})
|
|
|
!e.data.list.concat(res.data).length ? e.setData({
|
|
|
!t.data.list.concat(res.data).length ? t.setData({
|
|
|
ifData: !1
|
|
|
}) : ''
|
|
|
wx.stopPullDownRefresh();
|
...
|
...
|
@@ -125,6 +136,26 @@ Page({ |
|
|
// + '&content=' + JSON.stringify(e.currentTarget.dataset.content)
|
|
|
})
|
|
|
},
|
|
|
|
|
|
getUserInfo() {
|
|
|
let d = this, url = '/api/user/index';
|
|
|
app.post(url, {}).then((r) => {
|
|
|
console.log(r.noticeNum)
|
|
|
d.setData({ userInfo: r.userInfo, noticeNum: r.noticeNum })
|
|
|
if (r.noticeNum != 0) {
|
|
|
let num = r.noticeNum
|
|
|
num = num.toString()
|
|
|
wx.setTabBarBadge({
|
|
|
index: 4,
|
|
|
text: num
|
|
|
})
|
|
|
} else {
|
|
|
wx.hideTabBarRedDot({
|
|
|
index: 4,
|
|
|
})
|
|
|
}
|
|
|
})
|
|
|
},
|
|
|
/**
|
|
|
* 生命周期函数--监听页面初次渲染完成 v
|
|
|
*/
|
...
|
...
|
@@ -136,7 +167,8 @@ Page({ |
|
|
* 生命周期函数--监听页面显示
|
|
|
*/
|
|
|
onShow: function () {
|
|
|
this.getopbanner()
|
|
|
this.getopbanner();
|
|
|
this.getUserInfo()
|
|
|
},
|
|
|
|
|
|
/**
|
...
|
...
|
@@ -162,6 +194,8 @@ Page({ |
|
|
page: 1
|
|
|
})
|
|
|
t.getList(t.data.category_id, 1)
|
|
|
|
|
|
t.getopbanner();
|
|
|
},
|
|
|
|
|
|
/**
|
...
|
...
|
@@ -173,6 +207,7 @@ Page({ |
|
|
page: t.data.page + 1
|
|
|
}), t.getList(t.data.category_id, t.data.page)) : wx.showToast({
|
|
|
title: '没有更多了',
|
|
|
icon:'none'
|
|
|
})
|
|
|
},
|
|
|
|
...
|
...
|
|