index.vue 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228
  1. <template>
  2. <div class="ev_box">
  3. <div class="ev_box_left">
  4. <left :title="title" :detail="detail" :checkJson="checkJson" :checkType="checkType" @setType="setType">
  5. </left>
  6. </div>
  7. <div class="ev_box_right">
  8. <right :checkJson="checkJson" :checkType="checkType" @setType="setType" :work="work" @setWork="setWork">
  9. </right>
  10. </div>
  11. <div class="ev_btn">
  12. <el-button type="primary" style="padding: 5px 10px;font-size: 14px;height: 30px;" size="mini" :disabled="!(checkType == (checkJson.length - 1))" @click="addEnglishWork">点击提交</el-button>
  13. </div>
  14. </div>
  15. </template>
  16. <script>
  17. import right from './component/right.vue'
  18. import left from './component/left.vue'
  19. export default {
  20. components: {
  21. right,
  22. left
  23. },
  24. props: {
  25. englishVoiceJson: {
  26. type: Object
  27. },
  28. userid:{
  29. type:String
  30. },
  31. id:{
  32. type:String
  33. },
  34. courseType:{
  35. type:Number
  36. },
  37. taskCount:{
  38. type:Number
  39. },
  40. toolindex:{
  41. type:Number
  42. },
  43. englishVoiceJsonWork:{
  44. type: Array
  45. }
  46. },
  47. data() {
  48. return {
  49. checkJson: [],
  50. checkJson2: {},
  51. title: '',
  52. detail: '',
  53. checkType: 0,
  54. work: [],
  55. wScore: 0,
  56. scoreDetail: "",
  57. }
  58. },
  59. methods: {
  60. handleClose(done) {
  61. this.close();
  62. done();
  63. },
  64. // confirm() {
  65. // this.close2();
  66. // },
  67. setJson(val) {
  68. this.checkJson = val;
  69. this.$forceUpdate()
  70. },
  71. setVoiceJson(val) {
  72. let a = JSON.parse(JSON.stringify(val));
  73. this.checkJson2 = JSON.parse(JSON.stringify(a));
  74. this.title = a.title;
  75. this.detail = a.detail;
  76. this.checkJson = a.array
  77. this.checkType = 0
  78. this.work=[]
  79. this.work.length = a.array.length
  80. let works = JSON.parse(
  81. JSON.stringify(this.englishVoiceJsonWork)
  82. );
  83. for (var i = 0; i < this.work.length; i++) {
  84. if(i > (works.length - 1)){
  85. break
  86. }
  87. this.work[i] = works[i];
  88. }
  89. },
  90. setType(index) {
  91. this.checkType = index
  92. },
  93. setWork(url, index, text, star) {
  94. if(this.checkJson[index].type == 'createRole'){
  95. console.log(url);
  96. this.work[index] = JSON.parse(JSON.stringify(url))
  97. this.$forceUpdate()
  98. }else{
  99. if(star){
  100. let score = parseInt(star.AccuracyScore / 20)
  101. this.work[index] = {
  102. audio:url,
  103. text:text,
  104. score:score,
  105. star:star
  106. }
  107. }else{
  108. this.work[index] = {
  109. audio:url,
  110. text:text
  111. }
  112. }
  113. }
  114. },
  115. addEnglishWork() {
  116. let params = [
  117. {
  118. uid: this.userid,
  119. cid: this.id,
  120. stage: this.courseType,
  121. task: this.taskCount,
  122. tool: this.toolindex,
  123. content: JSON.stringify(this.work),
  124. type: 17,
  125. atool: 70,
  126. text: "",
  127. },
  128. ];
  129. this.ajax
  130. .post(this.$store.state.api + "addCourseWorks5", params)
  131. .then((res) => {
  132. this.$message({
  133. message: "提交成功",
  134. type: "success",
  135. });
  136. // this.$emit('selectSWorks')
  137. // this.$emit('selectStudent')
  138. // this.close2();
  139. })
  140. .catch((err) => {
  141. this.$message.error("提交失败");
  142. console.error(err);
  143. });
  144. },
  145. },
  146. mounted() {
  147. this.setVoiceJson(this.englishVoiceJson);
  148. },
  149. }
  150. </script>
  151. <style scoped>
  152. .dialog_diy>>>.el-dialog {
  153. height: 100%;
  154. margin: 0vh auto !important;
  155. }
  156. .dialog_diy>>>.el-dialog__header {
  157. background: #454545 !important;
  158. padding: 15px 20px;
  159. }
  160. .dialog_diy>>>.el-dialog__body {
  161. height: calc(100% - 54px);
  162. box-sizing: border-box;
  163. padding: 0px;
  164. }
  165. .dialog_diy>>>.el-dialog__title {
  166. color: #fff;
  167. }
  168. .dialog_diy>>>.el-dialog__headerbtn {
  169. top: 19px;
  170. }
  171. .dialog_diy>>>.el-dialog__headerbtn .el-dialog__close {
  172. color: #fff;
  173. }
  174. .dialog_diy>>>.el-dialog__headerbtn .el-dialog__close:hover {
  175. color: #fff;
  176. }
  177. .dialog_diy>>>.el-dialog__body,
  178. .dialog_diy>>>.el-dialog__footer {
  179. background: #e8ebf1;
  180. overflow: hidden;
  181. }
  182. .ev_box {
  183. width: 100%;
  184. height: 100%;
  185. display: flex;
  186. justify-content: space-between;
  187. padding: 20px;
  188. box-sizing: border-box;
  189. }
  190. .ev_box_left {
  191. width: 280px;
  192. margin-right: 15px;
  193. border-radius: 10px;
  194. background: #fff;
  195. overflow: hidden;
  196. }
  197. .ev_box_right {
  198. width: calc(100% - 280px - 15px);
  199. border-radius: 10px;
  200. background: #fff;
  201. overflow: hidden;
  202. }
  203. .ev_btn {
  204. position: absolute;
  205. bottom: 0;
  206. right: 80px;
  207. height: 210px;
  208. display: flex;
  209. align-items: center;
  210. }</style>