print.vue 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341
  1. <template>
  2. <div class="none_writeTable writeTable printTable" v-if="dataConfig">
  3. <div
  4. class="none_word_main_table"
  5. v-for="(data, indexT) in dataConfig.result"
  6. :key="indexT"
  7. >
  8. <div class="writeTop">
  9. <div
  10. class="writeTop-row"
  11. v-for="(itemR, indexR) in data"
  12. :key="indexR"
  13. :style="{ marginBottom: dataConfig.marginBottom }"
  14. >
  15. <div
  16. class="writeTop-item"
  17. :class="[indexI !== 0 ? 'writeTop-item-noLeft' : '']"
  18. v-for="(itemI, indexI) in itemR"
  19. :key="indexI"
  20. :style="{
  21. width: dataConfig.width,
  22. height: dataConfig.width,
  23. borderColor: dataConfig.borderColor,
  24. }"
  25. >
  26. <template
  27. v-if="
  28. itemI &&
  29. itemI.con &&
  30. !itemI.write &&
  31. !itemI.answer &&
  32. !itemI.miaoRed
  33. "
  34. >
  35. <Strockplay
  36. v-if="'writeTop-item-' + indexT + '-' + indexR + '-' + indexI"
  37. className="adult-strockplay"
  38. :strokePlayColor="dataConfig.borderColor"
  39. :Book_text="itemI.con"
  40. :playStorkes="false"
  41. :strokeColor="dataConfig.fontColor"
  42. :palyWidth="dataConfig.playWidth"
  43. :BoxbgType="dataConfig.BoxbgType"
  44. :curItem="itemI.hzDetail"
  45. :targetDiv="
  46. 'writeTop-item-' +
  47. indexT +
  48. '-' +
  49. indexR +
  50. '-' +
  51. indexI +
  52. itemI.con
  53. "
  54. />
  55. </template>
  56. <template v-else-if="itemI && itemI.answer">
  57. <StrockplayredlineTable
  58. :Book_text="itemI.con"
  59. :playStorkes="false"
  60. :strokeColorgray="dataConfig.miaoRedBgcolor"
  61. :strokeColor="dataConfig.fontColor"
  62. :strokeNumber="itemI.answer"
  63. :curItem="itemI.hzDetail"
  64. :BoxbgType="dataConfig.BoxbgType"
  65. :targetDiv="
  66. 'write-item-miaohong-' +
  67. indexT +
  68. '-' +
  69. indexR +
  70. '-' +
  71. indexI +
  72. itemI.con
  73. "
  74. :targetDivGray="
  75. 'write-item-miaohong-gray-' +
  76. indexT +
  77. '-' +
  78. indexR +
  79. '-' +
  80. indexI +
  81. itemI.con
  82. "
  83. />
  84. </template>
  85. <template v-else-if="itemI && itemI.miaoRed">
  86. <Strockred
  87. v-if="'write-item-' + indexT + '-' + indexR + '-' + indexI"
  88. className="adult-strockplay"
  89. :strokePlayColor="dataConfig.borderColor"
  90. :Book_text="itemI.con"
  91. :curItem="itemI.hzDetail"
  92. :hanzicolor="dataConfig.miaoRedBgcolor"
  93. :drawingColor="dataConfig.writeColor"
  94. :BoxbgType="dataConfig.BoxbgType"
  95. :targetDiv="
  96. 'write-item-' +
  97. indexT +
  98. '-' +
  99. indexR +
  100. '-' +
  101. indexI +
  102. itemI.con
  103. "
  104. />
  105. </template>
  106. <div
  107. v-else-if="itemI"
  108. class="tian-div"
  109. @click="freeWrite(itemI, indexR, indexI)"
  110. >
  111. <svg-icon
  112. icon-class="tian"
  113. className="tian"
  114. v-if="dataConfig.BoxbgType == 0"
  115. :style="{ color: '#DEDEDE' }"
  116. />
  117. <svg-icon
  118. icon-class="mi"
  119. className="tian"
  120. v-if="dataConfig.BoxbgType == 1"
  121. :style="{ color: '#DEDEDE' }"
  122. />
  123. <img
  124. v-if="itemI && itemI.strokes_image_url"
  125. :src="itemI.strokes_image_url"
  126. alt=""
  127. />
  128. </div>
  129. </div>
  130. </div>
  131. </div>
  132. <div class="writeBottom">
  133. <span>BLCUP 全球国际中文教学云平台</span>
  134. <b>{{ indexT + 1 + "/" + dataConfig.result.length }}</b>
  135. <a>www.chinesedu.com</a>
  136. </div>
  137. </div>
  138. </div>
  139. </template>
  140. <script>
  141. //这里可以导入其它文件(比如:组件,工具js,第三方插件js,json文件,图片文件等等)
  142. import StrockplayredlineTable from "../../components/corpus/StrockplayredlineTable.vue";
  143. import Strockplay from "../../components/corpus/Strockplay.vue";
  144. import Strockred from "../../components/corpus/Strockred.vue";
  145. import FreewriteLettle from "../../components/corpus/FreewriteLettle.vue";
  146. export default {
  147. //import引入的组件需要注入到对象中才能使用
  148. components: {
  149. StrockplayredlineTable,
  150. Strockplay,
  151. Strockred,
  152. FreewriteLettle,
  153. },
  154. //props: ["dataConfig", "data", "indexT", "totalNumber", "type", "none"],
  155. data() {
  156. //这里存放数据
  157. return {
  158. ifFreeShow: false,
  159. activeIndex: null,
  160. activeColIndex: null,
  161. dataConfig: null,
  162. loading: false,
  163. };
  164. },
  165. //计算属性 类似于data概念
  166. computed: {},
  167. //监控data中数据变化
  168. watch: {},
  169. //方法集合
  170. methods: {
  171. download2() {
  172. document.getElementsByClassName("printTable")[0].style.zoom = 2;
  173. //执行window.print打印功能
  174. window.print();
  175. this.$message({
  176. message: "操作成功",
  177. type: "success",
  178. });
  179. this.$router.replace({
  180. path: "/wordcard/cread",
  181. query: { cachesType: "push" },
  182. });
  183. return false;
  184. },
  185. changePraShow() {
  186. this.ifFreeShow = false;
  187. },
  188. closeifFreeShow(data, rowIndex, colIndex) {
  189. this.ifFreeShow = false;
  190. this.$forceUpdate();
  191. },
  192. freeWrite(item, row, col) {
  193. this.ifFreeShow = true;
  194. this.activeIndex = row;
  195. this.activeColIndex = col;
  196. // this.currentHz = this.curQue.option[indexs].rightOption[rightindex].con;
  197. if (item) {
  198. this.currenHzData = item;
  199. } else {
  200. this.currenHzData = {};
  201. }
  202. },
  203. ExerciseChangeCurQue(answer, rowIndex, colIndex) {
  204. if (answer) {
  205. this.data[rowIndex][colIndex].strokes_image_url =
  206. answer.strokes_image_url;
  207. this.data[rowIndex][colIndex].history = answer.history;
  208. this.$forceUpdate();
  209. }
  210. },
  211. },
  212. //生命周期 - 创建完成(可以访问当前this实例)
  213. created() {},
  214. //生命周期 - 挂载完成(可以访问DOM元素)
  215. mounted() {
  216. let _this = this;
  217. let writeTableData = localStorage.getItem("writeTableData");
  218. if (writeTableData) {
  219. _this.dataConfig = JSON.parse(writeTableData);
  220. setTimeout(() => {
  221. _this.download2();
  222. }, 2000);
  223. }
  224. },
  225. //生命周期-创建之前
  226. beforeCreated() {},
  227. //生命周期-挂载之前
  228. beforeMount() {},
  229. //生命周期-更新之前
  230. beforUpdate() {},
  231. //生命周期-更新之后
  232. updated() {},
  233. //生命周期-销毁之前
  234. beforeDestory() {},
  235. //生命周期-销毁完成
  236. destoryed() {},
  237. //如果页面有keep-alive缓存功能,这个函数会触发
  238. activated() {},
  239. };
  240. </script>
  241. <style lang="scss" scoped>
  242. .none_writeTable {
  243. width: 540px;
  244. display: flex;
  245. justify-content: center;
  246. align-items: flex-start;
  247. flex-wrap: wrap;
  248. padding-top: 10px;
  249. .writeTop {
  250. padding-top: 0;
  251. }
  252. }
  253. .writeTable {
  254. background: #ffffff;
  255. box-sizing: border-box;
  256. .writeTop {
  257. height: 760px;
  258. .writeTop-row {
  259. display: flex;
  260. justify-content: center;
  261. .writeTop-item {
  262. border: 1px solid #de4444;
  263. &.writeTop-item-noLeft {
  264. border-left: none;
  265. }
  266. }
  267. }
  268. }
  269. .writeBottom {
  270. display: flex;
  271. width: 100%;
  272. justify-content: space-between;
  273. padding: 0 38px;
  274. box-sizing: border-box;
  275. position: relative;
  276. span {
  277. font-weight: 500;
  278. font-size: 10px;
  279. line-height: 14px;
  280. color: #000000;
  281. opacity: 0.2;
  282. }
  283. b {
  284. font-weight: 400;
  285. font-size: 14px;
  286. line-height: 14px;
  287. color: #000000;
  288. width: 60px;
  289. text-align: center;
  290. position: absolute;
  291. left: 50%;
  292. margin-left: -30px;
  293. top: 0px;
  294. }
  295. a {
  296. font-weight: 500;
  297. font-size: 12px;
  298. line-height: 14px;
  299. color: #000000;
  300. opacity: 0.2;
  301. }
  302. }
  303. .tian-div {
  304. width: 100%;
  305. height: 100%;
  306. position: relative;
  307. .tian {
  308. width: 100%;
  309. height: 100%;
  310. }
  311. img {
  312. width: 100%;
  313. height: 100%;
  314. position: absolute;
  315. left: 0;
  316. top: 0;
  317. }
  318. }
  319. .practiceBox {
  320. position: fixed;
  321. left: 0;
  322. top: 0;
  323. z-index: 100100;
  324. width: 100%;
  325. height: 100vh;
  326. background: rgba(0, 0, 0, 0.19);
  327. box-sizing: border-box;
  328. overflow: hidden;
  329. overflow-y: auto;
  330. &.practiceBoxStrock {
  331. display: flex;
  332. justify-content: center;
  333. align-items: center;
  334. padding-top: 0px;
  335. }
  336. }
  337. }
  338. </style>