// packageE/others/case_library/mycomponents/service.js
const app = getApp();
Component({
  /**
   * 组件的属性列表
   */
  properties: {

  },

  /**
   * 组件的初始数据
   */
  data: {
    show: false,
    service_phone: '',
    service_qr_code_src: ''
  },
  lifetimes: {
    // 生命周期函数，可以为函数，或一个在methods段中定义的方法名
    attached() {
      this.getDatas();
    },
    moved() {},
    detached() {},
  },
  /**
   * 组件的方法列表
   */
  methods: {
    tapImg(){
      let arr = [];
      arr.push(this.data.service_qr_code_src);
      wx.previewImage({
        urls: arr,
      });
    },
    closeWin(){
      this.setData({
        show:false
      });
    },
    getDatas() {
      var that = this;
      let urlStr = app.getNetAddresss('plugin.case-library.api.case.get-set');
      app._postNetWork({
        url: urlStr,
        success: function (resdata) {
          var res = resdata.data;
          if (res.result == 1) {
            wx.setStorageSync('setCaseLibrary',res.data);
            that.setData({
              service_phone:res.data.set.service_phone,
              service_qr_code_src:res.data.set.service_qr_code_src
            });
          } else {
            wx.showToast({
              title: res.msg,
              icon: "none",
              duration: 1000,
            });
          }
        },
        fail: function (res) {
          console.log(res);
        }
      });
    },
    openWin() {
      this.setData({
        show:true
      });
    },
  },
  check(){
    let info = wx.getStorageSync('setCaseLibrary');
    console.log(info,'111121');
  }
});