TableView.vue 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184
  1. <template>
  2. <div class="TableView" v-if="curQue">
  3. <div class="table">
  4. <table>
  5. <template v-if="curQue.headerList.length > 0">
  6. <tr>
  7. <th
  8. v-for="(item, headIndex) in curQue.headerList"
  9. :key="'header' + headIndex"
  10. :style="{ width: curQue.colWidthList[headIndex].con + '%' }"
  11. >
  12. {{ item.con }}
  13. </th>
  14. </tr>
  15. </template>
  16. <tr v-for="(row, rowIndex) in curQue.option" :key="'row' + rowIndex">
  17. <td
  18. v-for="(col, colIndex) in row"
  19. :key="'col' + colIndex"
  20. :style="{ width: curQue.colWidthList[colIndex].con + '%' }"
  21. >
  22. <template v-if="!col.isNumll">
  23. {{ col.con }}
  24. </template>
  25. <template v-else>
  26. <input type="text" v-model="col.con" />
  27. </template>
  28. </td>
  29. </tr>
  30. </table>
  31. </div>
  32. <div class="hint">
  33. <p>{{ curQue.hintTitle }}</p>
  34. <div>
  35. <div v-for="(item, i) in curQue.hintOtion" :key="'hint' + i">
  36. <p>{{ item.pinyin }}</p>
  37. <p>{{ item.con }}</p>
  38. </div>
  39. </div>
  40. </div>
  41. <div class="record">
  42. <Soundrecord @handleWav="handleWav" type="pro-plus" class="luyin-box" />
  43. </div>
  44. </div>
  45. </template>
  46. <script>
  47. //这里可以导入其它文件(比如:组件,工具js,第三方插件js,json文件,图片文件等等)
  48. //例如:import 《组件名称》from ‘《组件路径》';
  49. import Soundrecord from "../preview/Soundrecord.vue"; // 录音模板
  50. export default {
  51. //import引入的组件需要注入到对象中才能使用
  52. components: {
  53. Soundrecord,
  54. },
  55. props: ["curQue"],
  56. data() {
  57. //这里存放数据
  58. return {};
  59. },
  60. //计算属性 类似于data概念
  61. computed: {},
  62. //监控data中数据变化
  63. watch: {},
  64. //方法集合
  65. methods: {
  66. handleWav(data) {},
  67. },
  68. //生命周期 - 创建完成(可以访问当前this实例)
  69. created() {
  70. this.curQue.option.forEach((item) => {
  71. item.forEach((it) => {
  72. if (it.con == "") {
  73. it.isNumll = true;
  74. }
  75. });
  76. });
  77. },
  78. //生命周期 - 挂载完成(可以访问DOM元素)
  79. mounted() {},
  80. //生命周期-创建之前
  81. beforeCreated() {},
  82. //生命周期-挂载之前
  83. beforeMount() {},
  84. //生命周期-更新之前
  85. beforUpdate() {},
  86. //生命周期-更新之后
  87. updated() {},
  88. //生命周期-销毁之前
  89. beforeDestory() {},
  90. //生命周期-销毁完成
  91. destoryed() {},
  92. //如果页面有keep-alive缓存功能,这个函数会触发
  93. activated() {},
  94. };
  95. </script>
  96. <style lang="scss" scoped>
  97. /* @import url(); 引入css类 */
  98. .TableView {
  99. .hint {
  100. p {
  101. font-family: "robot";
  102. font-style: normal;
  103. font-weight: normal;
  104. font-size: 16px;
  105. line-height: 150%;
  106. color: #000000;
  107. }
  108. > div {
  109. display: flex;
  110. > div {
  111. min-width: 82px;
  112. min-height: 70px;
  113. padding: 8px 16px;
  114. background: #f7f7f7;
  115. border-radius: 8px;
  116. margin-right: 8px;
  117. p {
  118. margin: 0;
  119. }
  120. > :nth-child(1) {
  121. font-family: "GB-PINYINOK-B";
  122. font-style: normal;
  123. font-weight: normal;
  124. font-size: 16px;
  125. line-height: 150%;
  126. text-align: center;
  127. color: #000000;
  128. }
  129. > :nth-child(2) {
  130. font-family: "FZJCGFKTK";
  131. font-style: normal;
  132. font-weight: normal;
  133. font-size: 20px;
  134. line-height: 150%;
  135. text-align: center;
  136. color: #000000;
  137. }
  138. }
  139. }
  140. }
  141. .record {
  142. margin-top: 11px;
  143. width: 292px;
  144. height: 40px;
  145. padding: 0 12px;
  146. display: flex;
  147. align-items: center;
  148. justify-content: center;
  149. border: 1px solid rgba(0, 0, 0, 0.1);
  150. box-sizing: border-box;
  151. border-radius: 8px;
  152. }
  153. .table {
  154. width: 100%;
  155. table {
  156. width: 100%;
  157. border-collapse: collapse; //取消单元格之间的间距
  158. tr {
  159. width: 100%;
  160. th {
  161. background: rgba(236, 157, 99, 0.1);
  162. border: 1px solid #e2cfc1;
  163. height: 40px;
  164. }
  165. td {
  166. background: #ffffff;
  167. border: 1px solid #e2cfc1;
  168. height: 64px;
  169. text-align: center;
  170. input {
  171. width: 80%;
  172. outline: none;
  173. border: none;
  174. border-bottom: 1px solid black;
  175. }
  176. }
  177. }
  178. }
  179. }
  180. }
  181. </style>