123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130 |
- // pages/hotDr/hotDr.js
- const app = getApp()
- Page({
- /**
- * 页面的初始数据
- */
- data: {
- hotDrList:[],
- page:1,
- pages:0,
- scrollTop:0
- },
- /**
- * 生命周期函数--监听页面加载
- */
- onLoad: function (options) {
- this.getHotDr()
- },
- goHrDetail(e){
- wx.navigateTo({
- url: '/pages/hrDetail/hrDetail?user_id=' + e.currentTarget.dataset.userid ,
- })
- },
- getHotDr(){//热门达人
- wx.hideLoading()
- wx.showLoading({
- title: '加载中',
- })
- app.func.req('/api/kwaiUser/redUserList', 'get', {
- 'page': this.data.page,
- 'starttime':app.func.getDay(-30,false),
- 'endtime':app.func.getDay(-1,false)
- }, (res) => {
- wx.hideLoading()
- if(res && res.errno == 0){
- //成功
- var list = res.rst.data;
- list.forEach((item)=>{
- if(item.categorys){
- item.categorys_arr = item.categorys.splice(',')
- }
- })
- var list2 = this.data.hotDrList.concat(list)
- this.setData({
- hotDrList: list2,
- pages: res.rst.pages
- })
- }else{
- wx.showToast({
- title: res.err,
- icon: 'none',
- duration: 2000
- })
- }
- },()=>{
- wx.hideLoading()
- })
- },
- onPageScroll: function(res) {//获取滑动的距离
- this.setData({
- scrollTop:res.scrollTop
- })
- },
- goScrolltop:function(e){//返回顶部
- if (wx.pageScrollTo) {
- wx.pageScrollTo({
- scrollTop: 0
- })
- } else {
- wx.showModal({
- title: '提示',
- content: '当前微信版本过低,无法使用该功能,请升级到最新微信版本后重试。'
- })
- }
- },
- /**
- * 生命周期函数--监听页面初次渲染完成
- */
- onReady: function () {
- },
- /**
- * 生命周期函数--监听页面显示
- */
- onShow: function () {
- },
- /**
- * 生命周期函数--监听页面隐藏
- */
- onHide: function () {
- },
- /**
- * 生命周期函数--监听页面卸载
- */
- onUnload: function () {
- },
- /**
- * 页面相关事件处理函数--监听用户下拉动作
- */
- onPullDownRefresh: function () {
- },
- /**
- * 页面上拉触底事件的处理函数
- */
- onReachBottom: function () {
- if(this.data.pages <= this.data.page){
- return
- }
- this.data.page ++;
- this.getHotDr()
- },
- /**
- * 用户点击右上角分享
- */
- onShareAppMessage: function () {
- }
- })
|