| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144 |
- import {
- getGroupList,
- getPositionList
- } from '../../services/index.js'
- import {
- formatTime
- } from '../../utils/util.js'
- import {
- showToast
- } from '../../utils/tips.js'
- import {
- updataStorageData
- } from '../../utils/storage.js'
- import {
- imgServerUrl
- } from '../../config/config.js'
- const app = getApp();
- Page({
- data: {
- hasShare: true,
- imgServerUrl: imgServerUrl,
- cityCode: '',
- pageNo: 1, //当前分页
- isScroll: true, //是否可以滚动
- clearTimer: false,
- djsEnd: false,
- myFormat: ['天', ':', ':', ' '],
- list: [],
- showNoMore: "没有更多信息...", //显示已无更多
- },
- onLoad: function(options) {
- },
- onReady: function() {
- },
- onShow: function() {
- this.start();
- },
- start() {
- let cityName = wx.getStorageSync('city') || '无锡'
- let cityCode = wx.getStorageSync('cityCode') || '320200';
- console.log(cityName)
- console.log(cityCode)
- this.setData({
- cityName: cityName,
- cityCode: cityCode,
- pageNo: 1, //当前分页
- isScroll: true, //是否可以滚动
- list: []
- })
- this.fetchList()
- },
- //下拉刷新
- onPullDownRefresh: function() {
- this.setData({
- pageNo: 1, //当前分页
- isScroll: true, //是否可以滚动
- list: [],
- })
- this.start();
- wx.stopPullDownRefresh();
- },
- onReachBottom: function() {
- var pageNo = this.data.pageNo + 1;
- this.setData({
- pageNo
- })
- this.fetchList()
- },
- doArrow(e) {
- const index = e.currentTarget.dataset.index;
- const list = this.data.list;
- this.setData({
- [`list[${index}].up`]: !list[index].up
- })
- },
- //获取拼团列表数据
- fetchList() {
- if (!this.data.isScroll) {
- return false
- }
- let paramsObj = {
- cityCode: this.data.cityCode,
- pageNo: this.data.pageNo,
- }
- getGroupList(paramsObj).then(data => {
- var pageNo = data.data.pageNo;
- let setData = {};
- // 是否可以滚动加载数据
- if (data.data.isLast) {
- setData.isScroll = false
- }
- if (data.data.groupPosition.length != 0) {
- setData.list = this.data.list.concat(data.data.groupPosition)
- setData.currentTime = data.data.currentTime;
- setData.pageNo = pageNo;
- } else {
- setData.list = this.data.list;
- }
- this.setData({
- ...setData
- })
- })
- },
- //去详情页
- toDetail(e) {
- const {
- id,
- cate
- } = e.currentTarget.dataset
- wx.navigateTo({
- url: '../detail/index?hpPositionId=' + id + "&cate=" + cate,
- })
- },
- //去申请列表
- toApplyList() {
- wx.navigateTo({
- url: '../apply-list/index?type=pt'
- })
- },
- //倒计时结束回调
- myLinsterner() {
- // this.fetchPt()
- this.setData({
- djsEnd: true
- })
- },
- onShareAppMessage: function() {
- return {
- title: '快来开心工作看看吧',
- path: '/pages/index/index',
- imageUrl: ''
- }
- },
- onError(err) {
- app.aldstat.sendEvent('报错', {
- 'err': err
- });
- },
- })
|