// pages/index/sw/index.js
Component({
  /**
   * 组件的属性列表
   */
  properties: {
    paramAtoB: String,
    from: String,
    data: {
      value: {},
      type: Object
    },
  },

  /**
   * 组件的初始数据
   */
  data: {
    isshare: true,
  },
  methods: {
      /**
   * 隐藏分享弹框
   */
  hidemodal: function() {
    this.setData({
      isshare: false,
    })
  },
  /**
   * 显示分享海报
   */
  /* showPoster: function() {
    //跳转到海报生成页
    wx.navigateTo({
      url: `/pages/canvas/index?merchantId=${this.data.id}`
    })
  }, */
  showPoster: function() {
    //跳转到海报生成页
    console.log(this.data.fromflag)
    let that = this;
      Http.get({
        url: config.api.checkUserStatus,
        data: {
          token: app.globalData.token
        }
      }).then(res => {
        wx.navigateTo({
          url: `/pages/canvas/index?couponChannelId=${that.data.id}`
        })
      }).catch(err => {
        console.log(err)
        if (err.code == 11004) {
          // 用户昵称未授权
          wx.redirectTo({
            url: `/pages/getuserinfo/index?couponChannelId=${that.data.id}&fromflag=poster`
          })
          
        }
      })

    
    
  },




  }
});