CourseEvaluation.vue 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275
  1. <template>
  2. <div>
  3. <van-cell-group>
  4. <van-cell title="课程班名称" :value="classGroupName" />
  5. </van-cell-group>
  6. <van-cell-group>
  7. <van-cell title="上课时间" :value="classTimer" />
  8. </van-cell-group>
  9. <van-cell-group>
  10. <van-cell title="乐器" :value="subjectNames" />
  11. </van-cell-group>
  12. <van-cell-group>
  13. <van-field
  14. rows="4"
  15. class="textarea"
  16. v-model="teachingMaterial"
  17. maxlength="255"
  18. autosize
  19. label="教材内容"
  20. type="textarea"
  21. placeholder="请输入(1-255字)"
  22. />
  23. </van-cell-group>
  24. <van-cell-group>
  25. <van-field label="曲目" input-align="right" placeholder="请输入曲目名" v-model="song" />
  26. </van-cell-group>
  27. <van-cell-group>
  28. <van-cell>
  29. <template slot="title">
  30. <div class="title-item">
  31. <span class="text">发音</span>
  32. <van-rate v-model="pronunciation" :size="25" void-color="#eee" void-icon="star" />
  33. </div>
  34. <div class="title-item">
  35. <span class="text">节奏</span>
  36. <van-rate :size="25" void-color="#eee" v-model="tempo" void-icon="star" />
  37. </div>
  38. <div class="title-item">
  39. <span class="text">乐理</span>
  40. <van-rate :size="25" v-model="musicTheory" void-color="#eee" void-icon="star" />
  41. </div>
  42. </template>
  43. </van-cell>
  44. </van-cell-group>
  45. <van-cell-group>
  46. <van-field
  47. rows="4"
  48. class="textarea"
  49. maxlength="255"
  50. v-model="memo"
  51. autosize
  52. label="评价备注"
  53. type="textarea"
  54. placeholder="请输入(1-255字)"
  55. />
  56. </van-cell-group>
  57. <van-cell-group>
  58. <van-field
  59. rows="4"
  60. class="textarea"
  61. maxlength="255"
  62. v-model="homeWork"
  63. autosize
  64. label="布置作业"
  65. type="textarea"
  66. placeholder="请输入(1-255字)"
  67. />
  68. </van-cell-group>
  69. <van-cell-group>
  70. <van-cell title="是否完成双向沟通" value-class="twoConnect">
  71. <template slot="default">
  72. <van-radio-group v-model="hasLiaison" direction="horizontal">
  73. <van-radio name="1">是</van-radio>
  74. <van-radio name="0">否</van-radio>
  75. </van-radio-group>
  76. </template>
  77. </van-cell>
  78. </van-cell-group>
  79. <div class="button-group">
  80. <van-button type="primary" v-if="!reviewId" round size="large" @click="submitReview">提交评价</van-button>
  81. <van-button type="primary" v-if="reviewId" round size="large" @click="submitReview">修改评价</van-button>
  82. </div>
  83. </div>
  84. </template>
  85. <script>
  86. import {
  87. getCourseInfoHead,
  88. courseReviewAdd,
  89. getReviewInfo,
  90. updateReviewInfo
  91. } from "@/api/teacher";
  92. import { browser } from "@/common/common";
  93. import MHeader from "@/components/MHeader";
  94. export default {
  95. name: "teacherList",
  96. data() {
  97. return {
  98. radio: 1,
  99. voice: 0,
  100. courseId: null,
  101. reviewId: null,
  102. classTimer: null,
  103. classGroupName: null,
  104. teachingMaterial: null, //教材
  105. song: null, // 曲目
  106. pronunciation: null, // 发音
  107. tempo: null, //节奏
  108. musicTheory: null, // 乐理
  109. memo: null, // 备注
  110. homeWork: null, // 作业
  111. hasLiaison: null,
  112. subjectNames:null,
  113. };
  114. },
  115. created() {
  116. this.courseId = this.$route.query.id;
  117. this.reviewId =parseInt( this.$route.query.reviewId);
  118. if (!this.courseId) {
  119. this.$toast("课程信息错误");
  120. }
  121. },
  122. mounted() {
  123. // 获取头部信息
  124. if (this.reviewId) {
  125. // 获取老评价
  126. getReviewInfo({ id: this.reviewId }).then(res => {
  127. if (res.data.code == 200) {
  128. this.classTimer =
  129. res.data.data.teacherClassHeadInfo.classDate +
  130. res.data.data.teacherClassHeadInfo.startClassTime +
  131. "-" +
  132. res.data.data.teacherClassHeadInfo.endClassTime;
  133. this.subjectNames = res.data.data.teacherClassHeadInfo.subjectNames;
  134. this.classGroupName = res.data.data.teacherClassHeadInfo.classGroupName;
  135. // 评价内容
  136. this.teachingMaterial = res.data.data.courseScheduleReview.teachingMaterial
  137. this.song = res.data.data.courseScheduleReview.song
  138. this.pronunciation = res.data.data.courseScheduleReview.pronunciation
  139. this.tempo = res.data.data.courseScheduleReview.tempo
  140. this.musicTheory = res.data.data.courseScheduleReview.musicTheory
  141. this.memo = res.data.data.courseScheduleReview.memo
  142. this.homeWork = res.data.data.courseScheduleReview.homeWork
  143. this.hasLiaison = res.data.data.courseScheduleReview.hasLiaison.toString()
  144. }
  145. });
  146. } else {
  147. getCourseInfoHead({ courseId: this.courseId }).then(res => {
  148. if (res.data.code == 200) {
  149. this.classTimer =
  150. res.data.data.classDate +
  151. res.data.data.startClassTime +
  152. "-" +
  153. res.data.data.endClassTime;
  154. this.subjectNames = res.data.data.subjectNames;
  155. this.classGroupName = res.data.data.classGroupName;
  156. }
  157. });
  158. }
  159. },
  160. methods: {
  161. submitReview() {
  162. let obj = {
  163. teachingMaterial: this.teachingMaterial, //教材
  164. song: this.song, // 曲目
  165. pronunciation: this.pronunciation, // 发音
  166. tempo: this.tempo, //节奏
  167. musicTheory: this.musicTheory, // 乐理
  168. memo: this.memo, // 备注
  169. homeWork: this.homeWork,
  170. hasLiaison: this.hasLiaison,
  171. courseScheduleId: this.courseId
  172. };
  173. if (this.reviewId) {
  174. obj.id = this.reviewId;
  175. updateReviewInfo(obj).then(res => {
  176. this.$toast("修改成功");
  177. setTimeout(res => {
  178. this.onAppBack();
  179. }, 1000);
  180. });
  181. } else {
  182. courseReviewAdd(obj).then(res => {
  183. if (res.data.code == 200) {
  184. this.$toast("提交成功");
  185. setTimeout(res => {
  186. this.onAppBack();
  187. }, 1000);
  188. }
  189. });
  190. }
  191. },
  192. onAppBack() {
  193. if (browser().android) {
  194. DAYA.postMessage(JSON.stringify({ api: "back" }));
  195. } else if (browser().iPhone) {
  196. window.webkit.messageHandlers.DAYA.postMessage(
  197. JSON.stringify({ api: "back" })
  198. );
  199. }
  200. }
  201. }
  202. };
  203. </script>
  204. <style lang="less" scoped>
  205. @import url("../../assets/commonLess/variable.less");
  206. /deep/.van-cell-group {
  207. margin-top: 0.15rem;
  208. /deep/.van-cell {
  209. padding: 0.14rem 0.16rem;
  210. }
  211. }
  212. .title-item {
  213. display: flex;
  214. padding: 0.05rem 0;
  215. .text {
  216. margin-right: 0.15rem;
  217. font-size: 0.17rem;
  218. color: #1a1a1a;
  219. }
  220. /deep/.van-rate {
  221. line-height: 0;
  222. }
  223. }
  224. /deep/.van-cell__title {
  225. font-size: 0.17rem;
  226. color: #1a1a1a;
  227. flex: auto 1;
  228. }
  229. /deep/.van-field__control,
  230. /deep/.van-cell__value {
  231. font-size: 0.17rem;
  232. color: #666;
  233. width: 70%;
  234. flex: auto;
  235. }
  236. .textarea {
  237. flex-direction: column;
  238. /deep/.van-cell__value {
  239. margin-top: 0.1rem;
  240. width: 100%;
  241. }
  242. }
  243. .twoConnect {
  244. width: 55%;
  245. }
  246. /deep/.van-radio-group {
  247. display: flex;
  248. justify-content: flex-end;
  249. /deep/.van-radio {
  250. margin-left: 0.18rem;
  251. }
  252. }
  253. /deep/.van-radio__icon .van-icon {
  254. border-color: @sFontColor;
  255. }
  256. /deep/.van-radio__icon--checked {
  257. .van-icon {
  258. border-color: #14928a;
  259. background: #14928a;
  260. }
  261. }
  262. .button-group {
  263. margin: 0.3rem 0.26rem 0.2rem;
  264. .van-button--primary {
  265. background: @mColor;
  266. border: 1px solid @mColor;
  267. font-size: 0.18rem;
  268. }
  269. }
  270. </style>