<template>
  <div style="margin: 0 auto">
    <el-button
      type="primary"
      @click="testdownload4()"
      style="display: block; margin: 0 auto"
      :loading="isloading"
      >下载到手机</el-button
    >
    <div v-for="(item, index) in apidata.pics" :key="index" class="divbaseImg">
      <van-image
        :width="pic_width"
        :height="pic_height"
        :src="item"
        class="baseImg"
      />
    </div>
  </div>
</template>

<script>
// import pdf from "vue-pdf";
import { mgop } from "@aligov/jssdk-mgop";
export default {
  components: {},
  data() {
    return {
      url: "",
      apidata: {},
      pic_width: "100%",
      pic_height: "100%",
      isloading: true
    };
  },
  created() {
    this.onInit();
  },
  mounted() {},
  methods: {
    onInit() {
      const result = JSON.parse(JSON.stringify(this.$store.state.info));
      if (result.data && result.data.success == true) {
        console.log("result.data.data:", result.data.data);
        this.apidata = result.data.data;
        this.pic_width = "100%";
        this.pic_height = "100%";
        this.isloading = false;
      }
    },
    saveImages() {
      ZWJSBridge.onReady(() => {
        console.log("初始化完成后，执行bridge方法-saveImages");
        ZWJSBridge.saveImage({
          url: this.apidata.pdf
        })
          .then(result => {
            console.log("saveImage()成功:" + JSON.stringify(result));
          })
          .catch(error => {
            console.log("saveImage()失败:" + JSON.stringify(result));
            console.log(error);
          });
      });
    },
    testdownload4() {
      ZWJSBridge.onReady(() => {
        console.log("初始化完成后，执行bridge方法-testdownload4");
        ZWJSBridge.openLink({
          url: this.apidata.pdf
        })
          .then(result => {
            console.log("测试新开窗口():" + result);
          })
          .catch(error => {
            console.log(error);
          });
      });
    }
  }
};
</script>
<style lang="less" scoped>
.content {
  text-align: center;
  line-height: 200px;
  font-size: 30px;
  margin-bottom: 20px;
  height: 200px;
}
.bottom {
  text-align: center;
  margin-bottom: 20px;
}
.divbaseImg {
  display: block;
  margin: 0 auto;
}
.baseImg {
  display: block;
  margin: 0 auto;
  padding: 0;
}
</style>
