<template>
  <div class="hello">
    <h1>{{ msg }}</h1>
    <count-down times=300 bottomOffset="10" rightOffset="10" fontSize="18" ref="child"></count-down>
    <lay-button type="primary" @click="updateTimes">修改倒计时</lay-button>
	<lay-button type="primary" @click="toMaterial">办件资料</lay-button>
	<lay-button type="danger" @click="toSummary">办事指南</lay-button>
	<lay-button type="warm" @click="toScanMaterial">资料扫描</lay-button>
	<lay-button type="warm" @click="toAuditing">资料审核中</lay-button>
	<lay-button type="danger" @click="toReport">预审报告</lay-button>
  <lay-button type="danger" @click="toInformation">资料袋</lay-button>
    <lay-button type="danger" @click="getBase64">获取base64</lay-button>
    <lay-button type="danger" @click="towWorkGuide">办事指南打印word</lay-button>
    <lay-button type="danger" @click="towinquiryUnemployment">询问失业原因</lay-button>
    <lay-button type="danger" @click="toCopyApply">复印</lay-button>
    <p>
      For a guide and recipes on how to configure / customize this project,<br>
      check out the
      <a href="https://cli.vuejs.org" target="_blank" rel="noopener">vue-cli documentation</a>
	  
	  <a href="/about" >About</a>
    </p>
    <h3>Installed CLI Plugins</h3>
    <ul>
      <li><a href="https://github.com/vuejs/vue-cli/tree/dev/packages/%40vue/cli-plugin-babel" target="_blank" rel="noopener">babel</a></li>
      <li><a href="https://github.com/vuejs/vue-cli/tree/dev/packages/%40vue/cli-plugin-router" target="_blank" rel="noopener">router</a></li>
      <li><a href="https://github.com/vuejs/vue-cli/tree/dev/packages/%40vue/cli-plugin-vuex" target="_blank" rel="noopener">vuex</a></li>
    </ul>
    <h3>Essential Links</h3>
    <ul>
      <li><a href="https://vuejs.org" target="_blank" rel="noopener">Core Docs</a></li>
      <li><a href="https://forum.vuejs.org" target="_blank" rel="noopener">Forum</a></li>
      <li><a href="https://chat.vuejs.org" target="_blank" rel="noopener">Community Chat</a></li>
      <li><a href="https://twitter.com/vuejs" target="_blank" rel="noopener">Twitter</a></li>
      <li><a href="https://news.vuejs.org" target="_blank" rel="noopener">News</a></li>
    </ul>
    <h3>Ecosystem</h3>
    <ul>
      <li><a href="https://router.vuejs.org" target="_blank" rel="noopener">vue-router</a></li>
      <li><a href="https://vuex.vuejs.org" target="_blank" rel="noopener">vuex</a></li>
      <li><a href="https://github.com/vuejs/vue-devtools#vue-devtools" target="_blank" rel="noopener">vue-devtools</a></li>
      <li><a href="https://vue-loader.vuejs.org" target="_blank" rel="noopener">vue-loader</a></li>
      <li><a href="https://github.com/vuejs/awesome-vue" target="_blank" rel="noopener">awesome-vue</a></li>
    </ul>
  </div>
</template>

<script>
import commonUtil from '../assets/js/commonUtil';
export default {
  name: 'HelloWorld',
  props: {
    msg: String
  },
  data() {
	  return {
      msg: '',

      // caseData:{
      //   serviceId : 'S100015',
      //   projectId : '8160180',
      //   projectName : '失业保险金申领（测试使用）',
      //   name : '李超',
      //   mobile : '17607199997',
      //   idcard : '421023199403230439',
      //   fileData : [
      //     {"fileId":"90c55d4d13df4ed8986e85d20fcdb080","name": "失业证明", "fileUrl":"http://192.168.2.78:9999/group1/M00/00/4C/wKgCTmMoMdmANqGiAASVi8vfksA467.jpg","artificialType":"1","type":"01"},
      //     {"fileId":"c02ae780d12c4dd0965a0c620efe8623","name": "身份证银行卡复印件", "fileUrl":"http://192.168.2.78:9999/group1/M00/00/4C/wKgCTmMoMbiAc6p9AAQwkKu2NnA683.jpg","artificialType":"2","type":"03,08"},
      //     {"fileId":"6e3c720196214eabbd9b7c5aea02da31","name": "申请表", "fileUrl":"http://192.168.2.78:9999/group1/M00/00/4C/wKgCTmMoLmmAGG6aAAicN5-8HPA709.jpg","artificialType":"3","type":"02"}
      //   ]
      // }
      caseData:{
        serviceId : 'S100309',
        projectId : '8530863',
        projectName : '公共卫生许可证新办（武昌）',
        name : '李超',
        mobile : '17607199997',
        idcard : '421023199403230439',
        fileData : [
          {"fileId":"9fd65af02ba646b99f2f49f7b9654d7d","name": "身份证", "fileUrl":"https://robot.egovrobot.com/group1/M00/00/03/O6-UHmOpUr-ABeq1AAJoVVIm0m8826.jpg","artificialType":"0","type":"01"},
          {"fileId":"90af13b60ba34f85ac44707b8c02d1e3","name": "营业执照", "fileUrl":"https://robot.egovrobot.com/group1/M00/00/03/O6-UHmOpUrCAD3UIAAYnjhDqQ2A589.jpg","artificialType":"0","type":"03,08"}
        ]
      }
    }

	},
  created() {
    var ychy = this.$route.query.ychy;
    if(ychy != null){
      this.getAllCaseInfo();
      this.$router.push({ path: '/information' });
    }
  },
	methods:{
		toMaterial() {
			this.$router.push({ path: '/material' , query: {projectId: '8592554'}});
			// this.$router.push({ name: 'material' , params: {projectId: '8160561'}});//8160561
		},
		toSummary() {
			this.$router.push({ path: '/summary' , query: {projectId: '6781754'}});
		},
		toScanMaterial() {
			this.$router.push({ path: '/scanMaterial' , query: {projectId: '6781754'}});
		},
		toAuditing() {
      this.$LocalStorage.SessionPut("caseData", this.caseData);
			this.$router.push({ path: '/auditing'});
		},
		toReport() {
			this.$router.push({ path: '/report' , query: {projectId: '8160561'}});
		},
    towWorkGuide() {
      this.$router.push({ path: '/workGuide'});
    },
    towinquiryUnemployment() {
      this.$router.push({ path: '/inquiryUnemployment'});
    },
    toInformation() {
      this.$router.push({ path: '/information' });
    },
    toCopyApply() {
      this.$router.push({ path: '/copyList' });
    },
    getBase64() {
      var url = "http://192.168.2.180:8099/lilo/aiCase/casePdfPrint?fileUrl=group1/M00/00/51/wKgCTmMsAlaATMY4AABxw8Q2YTg310.pdf&batchId=202292214355711268686";

      url = encodeURIComponent(url);
      $.ajax({
        type: "get",
        url: 'http://192.168.2.180:8099/lilo/aiCase/base64TransToFile',
        async: false, //改为同步请求
        data: {fileUrl: url, flag: true},
        success: function (data) {
          debugger;
          if (data.success) {
            console.log(data.obj);
            console.log(data.msg);
          } else {
            alert(data.msg);
          }
        }, error: function () {
          debugger;
          alert(data.msg);
        }
      })
      //var base = commonUtil.getBase64(url);
    },
    getAllCaseInfo() {
		  var _this = this;
      $.ajax({
        type: "get",
        url: 'https://api.egovrobot.com/lilo/aiCase/getAllCaseInfo',
        async: false, //改为同步请求
        data: {batchId: '20221010155458756625'},
        success: function (data) {
          if (data.success) {
            var caseInfo = data.obj.caseInfo;
            //this.$LocalStorage.SessionGet("caseData");
            var caseData = {};
            caseData.totalNum = caseInfo.fileData.length;
            caseData.projectId = caseInfo.projectId;
            caseData.batchId = caseInfo.batchId;
            caseData.serviceId = caseInfo.serviceId;
            caseData.projectName = caseInfo.serviceId;
            caseData.enterpriseId = caseInfo.enterpriseId;
            _this.$LocalStorage.SessionPut("caseData", caseData);
          } else {
            alert(data.msg);
          }
        }, error: function () {
          debugger;
          alert(data.msg);
        }
      })
      //var base = commonUtil.getBase64(url);
    },
    showMsg() {
      alert("倒计时完成");
    },
    updateTimes(){
      this.$refs.child.counter=20; //修改子组件data
    }
  }
}
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>
h3 {
  margin: 40px 0 0;
}
ul {
  list-style-type: none;
  padding: 0;
}
li {
  display: inline-block;
  margin: 0 10px;
}
a {
  color: #42ff83;
}
</style>
