CourseEvaluation.vue 8.7 KB

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