var app = getApp();
Component({
  /**
	 * 组件的属性列表
	 */
  properties: {},
  /**
	 * 组件的初始数据
	 */
  data: {},
  /**
	 * 组件的方法列表
	 */
  methods: {
    //点击即触发获取formId
    catchSubmit: function(e) {
      console.log(e);
      try {
        if (e.detail.formId != 'the formId is a mock one') {
          // var that = this;
          let urlStr = app.getNetAddresss("order.mini-app.form-id");
          let uid = "";
          let formId = e.detail.formId;
          try {
            const value = wx.getStorageSync('uid');
            if (value) {
              uid = value;
              // Do something with return value
            }
          } catch (e) {
            // Do something when catch error
          }
          urlStr += '&formID=' + formId;
          urlStr += '&memberId=' + uid;
          app._getNetWork({
            url: urlStr,
            success: function(resdata) {
              var res = resdata.data;
              if (res.result == 1) {
                console.log(res.result);
              }
            },
            fail: function(res) {
              console.log(res);
            }
          });
        }
      } catch (err) {
        //todo
      }
      //触发回调
      this.callback(e);
    },
    /**
		 * 捕获点击回调
		 */
    callback: function(e) {
      try {
        this.triggerEvent("callback", e);
      } catch (err) {
        //todo
      }
    }
  }
});
