<script>
export default {
  globalData: {
    shareTicket: "",
    openGid: "",
  },
  onLaunch: function() {
  },
  onShow: function(options) {
    let that = this;
    if (options && options.scene == 1044) {
      that.globalData.shareTicket = options.shareTicket;
			that.getShareTiket()
    }
		console.log(options)
    console.log(JSON.stringify(options));
  },

  methods: {
    getShareTiket: function(cb) {
      let that = this;
      // 展示本地存储能力
      if (that.globalData.shareTicket) {
        wx.getShareInfo({
          shareTicket: that.globalData.shareTicket,
          success: function(res) {
						console.log(res)
            let js_encryptedData = res.encryptedData;
            let js_iv = res.iv;
            // wx.login({
            //   success: function(res) {
            //     let js_code = res.code;
            //     console.log("code-->" + js_code);
            //     wx.request({
            //       url: "xxxxxxxx",
            //       method: "POST",
            //       data: {
            //         code: js_code,
            //         appId: "xxxxx",
            //         encryptedData: js_encryptedData,
            //         iv: js_iv,
            //       },
            //       success: function(res) {
            //         that.globalData.openGid = res.data.openGId;
            //         console.log("openGid:" + that.globalData.openGid
            //         );
            //         typeof cb == "function" && cb(that.globalData);
            //       },
            //       fail: function(err) {
            //         console.log("getShareTiket---err" + JSON.stringify(err));
            //       }
            //     });
            //   },
            // });
          },
        });
      } else {
        console.log("不存在shareTicket");
      }
    },
  },
  onHide: function() {
    console.log("App Hide");
  },
};
</script>

<style lang="scss">
@import "uview-ui/index.scss";
@import "common/common.scss";
/*每个页面公共css */
</style>
