<script>
export default {
  onPageNotFound(){
    mpvue.reLaunch({
      url:'/pages/index/main'
    })
  },
  //外发
  onShow(options){
      let query = options.query.other
      console.log('进入小程序了',options)
      // 有无参数
      if(query){
        console.log('外发给你')
        wx.setStorageSync("is_out", true);
      }else{
        wx.setStorageSync("is_out", false);
      }
      // 判断是啥券
      if(query == 1){
        console.log("外发其它券")
        wx.setStorageSync("is_other", true);
      }else{
        wx.setStorageSync("is_other", false);
      }
  },
  onHide(){
     wx.removeStorageSync("is_out");
     wx.removeStorageSync("is_other");
  },
  created() {

    // 调用API从本地缓存中获取数据
    /*
     * 平台 api 差异的处理方式:  api 方法统一挂载到 mpvue 名称空间, 平台判断通过 mpvuePlatform 特征字符串
     * 微信：mpvue === wx, mpvuePlatform === 'wx'
     * 头条：mpvue === tt, mpvuePlatform === 'tt'
     * 百度：mpvue === swan, mpvuePlatform === 'swan'
     * 支付宝(蚂蚁)：mpvue === my, mpvuePlatform === 'my'
     */

    // let logs
    // if (mpvuePlatform === 'my') {
    //   logs = mpvue.getStorageSync({key: 'logs'}).data || []
    //   logs.unshift(Date.now())
    //   mpvue.setStorageSync({
    //     key: 'logs',
    //     data: logs
    //   })
    // } else {
    //   logs = mpvue.getStorageSync('logs') || []
    //   logs.unshift(Date.now())
    //   mpvue.setStorageSync('logs', logs)
    // }
  },
  log() {
    console.log(`log at:${Date.now()}`)
  }
}
</script>

<style>
@import "../static/colorui/main.wxss";
@import "../static/colorui/icon.wxss";
.not_show{
  visibility: hidden;
}

.full_img {
  width: 100%;
}

.main_banner {
  height: 241px;
}


.title_color {
  color: #4C4C4C;
}

.cu-btn-primary {
  background-image: url("https://img.shuimuai.com/web/Rectangle.png");
  background-position: center;
  background-size: 100% 100%;
  width: 100%;
}

.under_line {
  text-decoration: underline;
}

.text-primary {
  color: #6858C4;
}

.bg-primary {
  background-color: #6858C4;
}

/* this rule will be remove */
* {
  transition: width 2s;
  -moz-transition: width 2s;
  -webkit-transition: width 2s;
  -o-transition: width 2s;
  margin: 0px;
  padding: 0px;
  font-family: MicrosoftYaHei-Bold;
}
</style>
