boost.js 1.08 KB
// components/tips/boost.js
const cacheKey='A2L-INDEX'
Component({
  /**
   * 组件的属性列表
   */
  properties: {

  },
  lifetimes: {
    attached: function() {
      this.show()
    },
  },
  /**
   * 组件的初始数据
   */
  data: {
    disp:false,
    background:[{
      url:'http://nosqn.colorcun.com/boots/1.png',
      txt:'1.戳选地图上的商家,开始预订',
    },{
      url:'http://nosqn.colorcun.com/boots/2.png',
      txt:'2.搜索商家或位置,开始预订',
    }]
  },

  /**
   * 组件的方法列表
   */
  methods: {
    show(){
      wx.getStorage({
        key:cacheKey,
        fail:()=>{
          this.setData({
            disp:true,
          })
          this.triggerEvent('event',{act:'show',txt:'新用户'})
          //wx.setStorage({key:cacheKey, data:new Date().toISOString()})
        },
        success:()=>{
          this.triggerEvent('event',{act:'hide',txt:'老用户'})
        },
      })
    },
    hide(){
      this.setData({
        disp:false,
      })
      this.triggerEvent('event',{act:'hide',txt:'新用户'})
    },
  }
})