homeindex.js 3.0 KB
// pages/homeindex/homeindex.js

// const app = getApp();
// import menu from '../template/template'
const app=getApp()
Page({

  /**
   * 页面的初始数据
   */
  data: {
    imgUrls: [
      '../../img/banner.png',
      '../../img/banner.png',
      '../../img/banner.png'
    ],
    indicatorDots: false,
    autoplay: true,
    interval: 2000,
    duration: 1000,
    currentSwiper: 0,
    imgUrlsmiddle:[
      '../../img/middlebanner1.png',
      '../../img/middlebanner1.png',
      '../../img/middlebanner1.png',
      '../../img/middlebanner1.png'
    ],
    autoplaytwo:false,
    secondcurrentSwiper:0,
    num:1
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    
   
    this.gethomeinfo();
    this.getaccessToken()
    
  },



  getaccessToken() {
    let that = this;
    var url = '/Staff/GetAccessToken';
    var params = {
    }
    app.post(url, params).then((res) => {
      console.log(res);

    }).catch((err) => {

    })
  },

  gethomeinfo(){
    let that = this;
    var url = '/Notice/SelectNoticeMessage';
    var params = {
    }
    app.post(url, params).then((res) => {
      console.log(res);

    }).catch((err) => {

    })
  },
 
  jump(e) {
    console.log(e)
    var that = this;
    wx.setStorageSync('num', e.currentTarget.dataset.num)
    let number = e.currentTarget.dataset.num
    console.log(number)
    if (number == 1) {
      wx.reLaunch({
        url:'/pages/homeindex/homeindex'
      })

    } else if (number == 2) {
      wx.redirectTo({
       // url: '/pages/shop/goodtail/goodtail',
        url: '/pages/shopgoods/shopgoods'
      })
    } else if (number == 3) {

      wx.reLaunch({
        url: '/pages/shopcar/shopcar',
      })
    } else if (number == 4) {
      wx.reLaunch({
        url: '/pages/myorder/myorder',
      })
    } else if (number == 5) {
      let type = e.currentTarget.dataset.type;
      if (type == 1) {
        wx.reLaunch({
         // url: '/pages/visitormine/visitormine',
          //url: '/pages/guidemine/guidemine'
          url: '/pages/jingxiaoshangmine/jingxiaoshangmine'
        })
      }

    }
  },

  swiperChangetwo: function (e) {
    console.log(e)
    this.setData({
      secondcurrentSwiper: e.detail.current
    })
  },
  swiperChange(e){
    this.setData({
      currentSwiper: e.detail.current
    })
  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {
   
  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {

  }
})