1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374 |
- //index.js
- var app = getApp();
- var utils = require('../../utils/util.js');
- Page({
- data: {
- imgUrls: [
- ],
- indicatorDots: true,
- autoplay: true,
- interval: 2000,
- duration: 1000,
- page:1,
- dataList: [
- ],
- hidden: true,
- listId:0
- },
- onLoad: function (options) {
- var that = this, source = '';
- if (options.source) {
- that.setData({source: options.source})
- }
- app.login(that);
- const dataParam = Object.assign({}, app.globalData.common, {version: 2, platform: app.globalData.platform});
- wx.request({
- url: app.globalData.HOST + '/user/product/homeact',
- method: 'POST',
- data: dataParam,
- success: function (res) {
- if (res.data.errno == '0'){
- that.setData({ imgUrls: res.data.rst.homeact});
- }
- }
- });
- utils.initList(that);
- },
- onShow () {
- wx.stopPullDownRefresh();
- wx.hideNavigationBarLoading();
- },
- onHide () {
- wx.stopPullDownRefresh()
- wx.hideNavigationBarLoading();
- },
- onPullDownRefresh: function () {
- //下拉
- var that = this, obj = { amount: 0, is_hot: 1, is_new: 0, search: 0, term: 0, user_title: "不限" };
- that.data.page = 1;
- setTimeout(()=>{
- utils.initList(that, obj, that.data.page);
- }, 800)
- },
- onReachBottom: function () {
- //上拉
- var that = this, obj = { amount: 0, is_hot: 1, is_new: 0, search: 0, term: 0, user_title: "不限" };
- if (that.data.hasNext) {
- utils.initList(that, obj, ++that.data.page);
- }
- },
- onShareAppMessage: function () {
- return {
- title: app.globalData.title,
- imageUrl: app.globalData.img,
- path: '/pages/index/index',
- success: function(res) {
- app.noticeModal('分享成功')
- },
- fail: function(res) {
- app.noticeModal('您取消了分享')
- }
- }
- }
- })
|