evaluateDetail.vue 8.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297
  1. <template>
  2. <div class="m-container">
  3. <el-page-header @back="onCancel"
  4. content="评价详情"></el-page-header>
  5. <div class="m-core">
  6. <div class="left">
  7. <el-table style="width: 100%"
  8. :header-cell-style="{background:'#EDEEF0',color:'#444'}"
  9. :data="tableData">
  10. <el-table-column align="center"
  11. prop="month"
  12. label="时间"></el-table-column>
  13. <el-table-column align="center"
  14. label="操作">
  15. <template slot-scope="scope">
  16. <div>
  17. <el-button type="text"
  18. @click="getReviews(scope.row.id)">查看</el-button>
  19. </div>
  20. </template>
  21. </el-table-column>
  22. </el-table>
  23. <!-- <pagination
  24. :total="rules.total"
  25. :page.sync="rules.page"
  26. :limit.sync="rules.limit"
  27. :page-sizes="rules.page_size"
  28. @pagination="getList"
  29. />-->
  30. </div>
  31. <div class="right"
  32. v-if="isLook">
  33. <el-card class="box-card">
  34. 评价详情
  35. <div class="cardWrap">
  36. <div class="cardWrapleft">
  37. <p class="title">课程信息</p>
  38. <el-divider></el-divider>
  39. <p class="row">评价时间:{{commitWrap.time | dateForMinFormat}}</p>
  40. <p class="row">老师: {{commitWrap.teacher}}</p>
  41. <p class="row">声部:{{ commitWrap.soundName }}</p>
  42. <p class="row">训练次数:{{ commitWrap.count }}</p>
  43. <p class="row">训练时长:{{ commitWrap.timers }}</p>
  44. <div v-if="version == 2">
  45. <p class="title">授课内容</p>
  46. <el-divider></el-divider>
  47. <p class="row">乐理:{{ musicTheory }}</p>
  48. <p class="row">曲子: {{ song}}</p>
  49. <p class="row">教材: {{teachingMaterial }}</p>
  50. </div>
  51. </div>
  52. <div class="cardWrapright">
  53. <p class="title">课程点评</p>
  54. <el-divider></el-divider>
  55. <div v-if="version == 1">
  56. <p class="row"
  57. v-for="(item,index) in askList"
  58. :key="index">{{subjectJsonOld[index+1].title+' : '+item}}</p>
  59. </div>
  60. <div v-if="version == 2">
  61. <p class="row"
  62. v-for="(item,index) in askList"
  63. :key="index">{{item}}</p>
  64. </div>
  65. <!-- <div class="textWrap"></div> -->
  66. </div>
  67. </div>
  68. </el-card>
  69. </div>
  70. </div>
  71. </div>
  72. </template>
  73. <script>
  74. import pagination from "@/components/Pagination/index";
  75. import { getGroupReviews, getReviewsInfo } from "@/api/buildTeam";
  76. import { subjectJsonOld, subjectJson } from "@/utils/questionJson";
  77. export default {
  78. components: { pagination },
  79. data () {
  80. return {
  81. tableData: [],
  82. id: null,
  83. isLook: false,
  84. rules: {
  85. // 分页规则
  86. limit: 10, // 限制显示条数
  87. page: 1, // 当前页
  88. total: 0, // 总条数
  89. page_size: [10, 20, 40, 50] // 选择限制显示条数
  90. },
  91. subjectJsonOld: subjectJsonOld,
  92. subjectJson: subjectJson,
  93. askList: [],
  94. commitWrap: {
  95. time: "",
  96. teacher: "",
  97. soundName: "",
  98. count: "",
  99. timers: ""
  100. },
  101. version: null,
  102. musicTheory: null,
  103. teachingMaterial: null,
  104. song: null,
  105. Fsearch: null,
  106. Frules: null
  107. };
  108. },
  109. activated () {
  110. this.init();
  111. },
  112. created () {
  113. this.init();
  114. },
  115. methods: {
  116. init () {
  117. this.id = this.$route.query.id;
  118. this.evaluateId = this.$route.query.evaluateId;
  119. if (this.$route.query.search) {
  120. this.Fsearch = this.$route.query.search;
  121. }
  122. if (this.$route.query.rules) {
  123. this.Frules = this.$route.query.rules
  124. }
  125. // 获取列表
  126. this.getList();
  127. // 获取评论详情
  128. if (this.evaluateId > 0) {
  129. this.getReviews(this.evaluateId);
  130. }
  131. },
  132. getList () {
  133. getGroupReviews({ groupId: this.id }).then(res => {
  134. if (res.code == 200) {
  135. // this.tableData = res.data.rows;
  136. // this.rules.total = res.data.total;
  137. this.tableData = res.data;
  138. }
  139. });
  140. },
  141. getReviews (id) {
  142. getReviewsInfo({ id }).then(res => {
  143. if (res.code == 200) {
  144. this.isLook = true;
  145. this.version = res.data.version;
  146. if (res.data.version == 1) {
  147. this.askList = res.data.item.split(",").map((item, index) => {
  148. return this.subjectJsonOld[index + 1][item];
  149. });
  150. } else if (res.data.version == 2) {
  151. // this.askList = res.data.item.split(",").map((item, index) => {
  152. // return this.subjectJson[index + 1][item];
  153. // });
  154. let some = {
  155. one: 1,
  156. two: 2,
  157. three: 3,
  158. four: 4,
  159. five: 5,
  160. six: 6,
  161. seven: 7,
  162. eight: 8
  163. };
  164. this.item = JSON.parse(res.data.item);
  165. // console.log(this.item);
  166. this.askList = []
  167. for (let key in this.item) {
  168. switch (key) {
  169. case "one": {
  170. this.askList.push(this.subjectJson[1].title + ' : ' + this.subjectJson[1][this.item[key]])
  171. break;
  172. }
  173. case "two": {
  174. this.askList.push(this.subjectJson[2].title + ' : ' + this.subjectJson[2][this.item[key]])
  175. break;
  176. }
  177. case "three": {
  178. this.askList.push(this.subjectJson[3].title + ' : ' + this.subjectJson[3][this.item[key]])
  179. break;
  180. }
  181. case "four": {
  182. this.askList.push(this.subjectJson[4].title + ' : ' + this.subjectJson[4][this.item[key]])
  183. break;
  184. }
  185. case "five": {
  186. this.askList.push(this.subjectJson[5].title + ' : ' + this.subjectJson[5][this.item[key]])
  187. break;
  188. }
  189. case "six": {
  190. if (this.item['six']) {
  191. this.askList.push(this.subjectJson[6].title + ' : ' + this.subjectJson[6][this.item[key]])
  192. }
  193. break;
  194. }
  195. case "seven":
  196. {
  197. if (this.item['seven']) {
  198. this.askList.push(this.subjectJson[7].title + ' : ' + this.subjectJson[7][this.item[key]])
  199. }
  200. break;
  201. }
  202. case "eight": {
  203. if (this.item['eight']) {
  204. this.askList.push(this.subjectJson[8].title + ' : ' + this.subjectJson[8][this.item[key]])
  205. }
  206. break;
  207. }
  208. }
  209. // this.askList.push(this.subjectJson[])
  210. }
  211. this.askList.sort((a, b) => {
  212. return parseInt(a) - parseInt(b)
  213. })
  214. // console.log( this.askList)
  215. this.musicTheory = JSON.parse(res.data.musicTheory)
  216. .map(item => {
  217. return item.str;
  218. })
  219. .join(",");
  220. this.teachingMaterial = JSON.parse(res.data.teachingMaterial)
  221. .map(item => {
  222. return item.str;
  223. })
  224. .join(",");
  225. this.song = res.data.song;
  226. }
  227. this.commitWrap = {
  228. time: res.data.createTime,
  229. teacher: res.data.teacher && res.data.teacher.name,
  230. soundName: res.data.subjectName,
  231. count: res.data.times,
  232. timers: res.data.totalMinutes
  233. };
  234. }
  235. });
  236. },
  237. onCancel () {
  238. this.$store.dispatch('delVisitedViews', this.$route)
  239. this.$router.push({ path: '/commentManager', query: { search: this.Fsearch, rules: this.Frules, activeIndex: '1' } })
  240. }
  241. }
  242. };
  243. </script>
  244. <style lang="scss" scoped>
  245. .m-core {
  246. display: flex;
  247. flex-direction: row;
  248. .left {
  249. width: 550px;
  250. }
  251. .right {
  252. margin-left: 30px;
  253. min-width: 600px;
  254. .box-card {
  255. width: 100%;
  256. min-height: 500px;
  257. .cardWrap {
  258. display: flex;
  259. flex-direction: row;
  260. justify-content: space-between;
  261. width: 100%;
  262. margin-top: 30px;
  263. .row {
  264. line-height: 30px;
  265. font-size: 14px;
  266. }
  267. .title {
  268. text-align: center;
  269. }
  270. .cardWrapleft {
  271. width: 48%;
  272. }
  273. .cardWrapright {
  274. width: 48%;
  275. .textWrap {
  276. margin-top: 20px;
  277. width: 100%;
  278. border: 1px solid #999;
  279. min-height: 100px;
  280. }
  281. }
  282. }
  283. }
  284. }
  285. }
  286. </style>