writeTable.vue 8.6 KB

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