check.vue 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212
  1. <template>
  2. <div class="check_box">
  3. <div class="check_div" v-for="(item, index) in checkData" :key="index">
  4. <div class="check_div_title">
  5. <div class="check_div_open" :class="{ active: item.open}" @click="openC(index)"></div>
  6. <div class="check_div_name">{{ item.name }}</div>
  7. </div>
  8. <div class="check_div_children" v-show="item.open">
  9. <div class="check_div_child" v-for="(item2) in item.children" :key="item2.type" @click="addCheck(item2)">
  10. <div class="check_icon">
  11. <img :src="item2.icon" alt="">
  12. </div>
  13. <div class="check_div_child_name">{{ item2.name }}</div>
  14. </div>
  15. </div>
  16. </div>
  17. </div>
  18. </template>
  19. <script>
  20. // import u_arrow from '../../../../assets/icon/new/u_arrow.png'
  21. import icon_check_addUser from '../../../../assets/icon/englishVoice/icon_check_addUser.png'
  22. import icon_check_qa from '../../../../assets/icon/englishVoice/icon_check_qa.png'
  23. import icon_check_sentence from '../../../../assets/icon/englishVoice/icon_check_sentence.png'
  24. import icon_check_theme from '../../../../assets/icon/englishVoice/icon_check_theme.png'
  25. import icon_check_user from '../../../../assets/icon/englishVoice/icon_check_user.png'
  26. import icon_check_word from '../../../../assets/icon/englishVoice/icon_check_word.png'
  27. import minxin from '../minxins/minxin'
  28. export default {
  29. mixins: [minxin],
  30. props: {
  31. checkJson: {
  32. type: Array,
  33. },
  34. },
  35. data() {
  36. return {
  37. checkData:[
  38. {
  39. name:'朗读',
  40. open: true,
  41. children:[
  42. {
  43. icon:icon_check_word,
  44. name:'单词/词组',
  45. type:'word'
  46. },
  47. {
  48. icon:icon_check_sentence,
  49. name:'句子/短文',
  50. type:'sentence'
  51. }
  52. ]
  53. },
  54. {
  55. name:'回答',
  56. open: true,
  57. children:[
  58. {
  59. icon:icon_check_qa,
  60. name:'题目',
  61. type:'QA'
  62. }
  63. ]
  64. },
  65. // {
  66. // name:'对话',
  67. // open: false,
  68. // children:[
  69. // {
  70. // icon:icon_check_addUser,
  71. // name:'创建角色',
  72. // type:'createRole'
  73. // }
  74. // ]
  75. // },
  76. {
  77. name:'主题陈述',
  78. open: false,
  79. children:[
  80. {
  81. icon:icon_check_theme,
  82. name:'新建主题',
  83. type:'theme'
  84. }
  85. ]
  86. }
  87. ],
  88. checkArray:[]
  89. }
  90. },
  91. methods: {
  92. openC(index) {
  93. this.checkData[index].open = !this.checkData[index].open
  94. this.$forceUpdate()
  95. },
  96. addCheck(item){
  97. if(item.type == 'word'){
  98. this.checkArray.push({
  99. type:'word',
  100. title:'',
  101. img:'',
  102. content:'' //单词/词组
  103. })
  104. }else if(item.type == 'sentence'){
  105. this.checkArray.push({
  106. type:'sentence',
  107. title:'',
  108. img:'',
  109. content:'' //句子/短文
  110. })
  111. }else if(item.type == 'QA'){
  112. this.checkArray.push({
  113. type:'QA',
  114. title:'',
  115. img:'',
  116. content:'' //题目
  117. })
  118. }else if(item.type == 'theme'){
  119. this.checkArray.push({
  120. type:'theme',
  121. title:'',
  122. img:'',
  123. content:'' , //题目
  124. content2:'', //内容
  125. rTime: 1, //准备时间
  126. oTime: 1, //演讲时间
  127. })
  128. }
  129. this.$forceUpdate()
  130. this.$emit('setJson', this.checkArray)
  131. }
  132. },
  133. watch: {
  134. checkJson: {
  135. handler: function (newVal, oldVal) {
  136. this.checkArray = this.depthCopy(newVal);
  137. },
  138. deep: true,
  139. }
  140. },
  141. mounted(){
  142. this.checkArray = this.depthCopy(this.checkJson);
  143. }
  144. }
  145. </script>
  146. <style scoped>
  147. .check_box{
  148. width: 100%;
  149. }
  150. .check_div{
  151. width: 100%;
  152. }
  153. .check_div + .check_div{
  154. margin-top: 16px;
  155. }
  156. .check_div_title{
  157. width: 100%;
  158. display: flex;
  159. align-items: center;
  160. margin-bottom: 8px;
  161. }
  162. .check_div_open{
  163. width: 11px;
  164. height: 11px;
  165. background-image: url('../../../../assets/icon/new/u_arrow.png');
  166. background-size: 100% 100%;
  167. margin-right: 7px;
  168. cursor: pointer;
  169. transition: all 0.3s;
  170. transform: rotate(-90deg);
  171. }
  172. .check_div_open.active{
  173. transform: rotate(0deg);
  174. }
  175. .check_div_name{
  176. font-size: 14px;
  177. color: #000;
  178. font-weight: bold;
  179. }
  180. .check_div_children{}
  181. .check_div_child{
  182. cursor: pointer;
  183. display: flex;
  184. width: 100%;
  185. padding: 8px 8px;
  186. box-sizing: border-box;
  187. background: rgb(240, 242, 245);
  188. border-radius: 4px;
  189. align-items: center;
  190. }
  191. .check_div_child+ .check_div_child{
  192. margin-top: 8px;
  193. }
  194. .check_icon{
  195. display: flex;
  196. width: 16px;
  197. height: 16px;
  198. align-items: center;
  199. justify-content: center;
  200. margin-right: 5px;
  201. }
  202. .check_icon > img{
  203. width: 100%;
  204. height: 100%;
  205. object-fit: contain;
  206. }
  207. .check_div_child_name{}
  208. </style>