123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108 |
- //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 = '';
- const userInfo = wx.getStorageSync('userInfo');
- let tel= wx.getStorageSync('tel'), user = wx.getStorageSync('user');
- if (userInfo) {
- app.globalData.userInfo = userInfo;
- if (tel == 0 && user.user_id == 0) {
- wx.redirectTo({url: '/pages/getPhone/getPhone'})
- }
- }else{
- wx.redirectTo({url: '/pages/login/login'})
- }
- if (options.source) {
- that.setData({source: options.source})
- }
- 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('您取消了分享')
- }
- }
- },
- //FormId
- formSubmit(e) {
- const formId = e.detail.formId, id = e.target.dataset.id;
- const userInfo = app.globalData.userInfo;
- this.getFromid(formId,id);
- wx.navigateTo({
- url: '/pages/details/details?id='+id
- })
- // console.log(formId + "formID首页")
- },
- getFromid(formId,ids) {
- wx.request({
- url: app.globalData.HOST + '/user/wx/getFromid',
- method: "POST",
- data: Object.assign({}, app.globalData.common, { from_id: formId }),
- success: function (res) {
- },
- complete: function () {
- }
- });
- },
- test (e) {
- wx.setStorageSync('flag', 1);
- console.log(e);
- }
- })
|