chunk-435e9696.af8fdc5a.js 4.0 KB

1
  1. (window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-435e9696"],{"4dba":function(t,e,i){"use strict";var a=i("d732"),s=i.n(a);s.a},"5f06":function(t,e,i){"use strict";i.r(e);var a=function(){var t=this,e=t.$createElement,i=t._self._c||e;return i("div",{staticClass:"preview"},[i("div",{staticClass:"preview-card"},[i("toPdfHtml",{ref:"toPdfHtml"})],1),i("div",{staticClass:"btn-box"},[i("button",{staticClass:"btn btn-go-back",on:{click:t.goBack}},[t._v("关闭")]),i("button",{staticClass:"btn btn-card-down",on:{click:t.downPdf}},[t._v("下载样例")])])])},s=[],r=(i("4160"),i("a9e3"),i("b64b"),i("159b"),i("5530")),n=i("ab12"),h=i("29d1"),c=i("2f62"),o=i("60a6"),d={name:"Preview",components:{toPdfHtml:n["a"]},filters:{},props:{},data:function(){return{testFormData:{}}},computed:Object(r["a"])(Object(r["a"])({},Object(c["b"])("answerSheet",["cardSetting","sizeConfig"])),{},{calcPaperSize:function(){var t=this.cardSetting.paperSize,e=this.cardSetting.direction,i=this.sizeConfig[t].width,a=this.sizeConfig[t].height,s=1===e?a:i,r=1===e?i:a;return{width:s,height:r}}}),watch:{},created:function(){},mounted:function(){this.getDefaultData()},methods:Object(r["a"])(Object(r["a"])({},Object(c["c"])("answerSheet",{setCardSetting:o["c"],setBigTopicArr:o["b"],setPaperListData:o["k"],setBigTopicPageArr:o["j"],setAnswerCardType:o["a"],setPaperSource:o["l"],setInitPageFlag:o["f"],setTestFormData:o["n"],setIsPreviewBack:o["i"],setSubject:o["m"]})),{},{getDefaultData:function(){if(0==this.cardSetting.examGroupId){if(this.cardSetting.examGroupId=this.$route.query.exam_group_id,this.cardType=Number(this.$route.query.card_type),void 0===this.cardType)return this.$message.error("无法获取答题卡类型!"),!1;if(void 0===this.cardSetting.examGroupId)return this.$message.error("无法获取考试id!"),!1;if(1===this.cardType)console.log("知心慧学直接预览");else{var t=JSON.parse(localStorage.getItem("previewPosition")),e=JSON.parse(t.savePrintInfo).position;this.cardSettings=e.cardSetting,this.cardSettings.title=t.testFormData.examName,this.testFormData=t.testFormData,this.setSubject(Number(t.testFormData.subjectId)),this.setCardSetting(this.cardSettings),this.setBigTopicArr(e.bigTopicArr),this.setPaperListData(e.paperListData),this.setBigTopicPageArr(JSON.parse(JSON.stringify(e.bigTopicPageArr))),this.$refs.toPdfHtml.getDefaultData()}}},goBack:function(){this.setIsPreviewBack(!0),window.history.back()},downPdf:function(){var t=this,e={width:"210mm",height:"297mm",name:"pdf",examGroupId:"12345678",pdfHtml:"pdfHtml"},i="";i+="<!DOCTYPE html>",i+='<html lang="en">',i+="<head>",i+='<meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta http-equiv="X-UA-Compatible" content="ie=edge">',i+="<title>Document</title>",i=i+'<link rel="stylesheet" href="'+{apiBaseUrl:"http://zsyas2.zhixinhuixue.com",siteUrl:"http://zsyas2.zhixinhuixue.com/vue/index.html#",phpPath:"http://zsyas2.zhixinhuixue.com/vue",phpBaseUrl:"/"}.phpPath+'/answer-sheet/toPdfHtml.css">',i=i+'<link rel="stylesheet" href="'+{apiBaseUrl:"http://zsyas2.zhixinhuixue.com",siteUrl:"http://zsyas2.zhixinhuixue.com/vue/index.html#",phpPath:"http://zsyas2.zhixinhuixue.com/vue",phpBaseUrl:"/"}.phpPath+'/answer-sheet/fonts/iconfont.css">',i+="</head>",i+="<body>",i+=this.$refs.toPdfHtml.$el.outerHTML,i+="</body></html>",e.width=this.calcPaperSize.width+"mm",e.height=this.calcPaperSize.height+"mm",e.name=this.cardSetting.title,e.pdfHtml=i;var a=new FormData;Object.keys(e).forEach((function(t){a.append(t,e[t])})),Object(h["b"])(a).then((function(e){if(0==e.success)return t.$message.error("生成pdf失败,请稍后再试!"),!1;location.href={apiBaseUrl:"http://zsyas2.zhixinhuixue.com",siteUrl:"http://zsyas2.zhixinhuixue.com/vue/index.html#",phpPath:"http://zsyas2.zhixinhuixue.com/vue",phpBaseUrl:"/"}.apiBaseUrl+"/third/download?url="+e.data+"&title=pdf-"+t.cardSetting.title+".pdf"}))}})},p=d,u=(i("4dba"),i("2877")),l=Object(u["a"])(p,a,s,!1,null,"ef1f1b62",null);e["default"]=l.exports},d732:function(t,e,i){}}]);