const navigationBarHeight = (getApp().statusBarHeight + 60) + 'px'
const util = require("../../utils/util.js");
const Http = require("../../utils/HttpBasics");
const config = require("../../config/config");
const imgurl = require("../../utils/imgurl");
Page({
  data: {
    navigationBarHeight,
    imageList: [],
  },
  previewImage(e) {
    let index = e.currentTarget.dataset.index
    let { imageList } = this.data;
    let arr = []
    imageList.map(item=>{
      arr.push(item.url)
    })
    console.log(imageList[index].url,imageList);

    tt.previewImage({
      current: imageList[index].url,
      urls: arr,
      success: () => {
        console.log("previewImage success");
      },
      fail: (err) => {
        tt.showModal({
          title: "预览失败",
          content: err.errMsg,
          showCancel: false,
        });
      },
      complete: () => {
        console.log("预览完成");
      },
    });
  },
  getCertification(){
    Http.get({
      url:config.api.certification,
      data:{
        id:this.data.id
      }
    }).then(res=>{
      console.log(res);
      if(res.data&&res.data.corpContractPath){
        let arr = JSON.parse(res.data.corpContractPath)
        console.log(arr);
        this.setData({
          imageList:arr
        })
      }
    })
  },
  onLoad: function (options) {
    this.setData({
      id:options.id
    })
    this.getCertification()
  }
})