writeTable.vue 8.5 KB

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