CourseEvaluation.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634
  1. <template>
  2. <div style="overflow: hidden">
  3. <m-header v-if="headerStatus" />
  4. <div class="course-header">
  5. <div class="title-info">
  6. <span class="teachMode" v-if="teachMode">
  7. {{ teachMode == 'ONLINE' ? '线上' : null }}
  8. {{ teachMode == 'OFFLINE' ? '线下' : null }}
  9. </span>
  10. <span :class="['courseType', classType]">{{ classType | coursesType }}</span>
  11. <span style="font-size: .18rem; font-weight: 500; color: #333;line-height: 18px;vertical-align: middle;">{{ classGroupName }}</span>
  12. </div>
  13. <div class="title-time">
  14. {{ classTimer }}
  15. </div>
  16. </div>
  17. <van-cell-group>
  18. <div class="dot"></div>
  19. <!-- v-if="enableAssignHomework" -->
  20. <van-cell class="input" :is-link="!isAssignHomework ? true : false" title="课后训练" :value='isAssignHomework ? "已布置" : "未布置"' @click="onWork()"></van-cell>
  21. </van-cell-group>
  22. <van-cell-group>
  23. <div class="dot"></div>
  24. <van-field
  25. required
  26. rows="3"
  27. class="textarea"
  28. v-model="teachingMaterial"
  29. maxlength="255"
  30. autosize
  31. label="教材内容"
  32. type="textarea"
  33. placeholder="请输入本课程学习内容"
  34. show-word-limit
  35. />
  36. </van-cell-group>
  37. <van-cell-group>
  38. <div class="dot"></div>
  39. <van-field
  40. required
  41. rows="1"
  42. label="曲目"
  43. type="textarea"
  44. placeholder="请输入曲目名"
  45. class="textarea"
  46. v-model="song"
  47. />
  48. </van-cell-group>
  49. <!-- <van-cell-group >
  50. </van-cell-group> -->
  51. <!-- label="评价备注" -->
  52. <van-cell-group>
  53. <div class="dot"></div>
  54. <p class="evTitle">评价</p>
  55. <van-cell class="start">
  56. <template slot="title">
  57. <div class="title-item">
  58. <span class="text">发音</span>
  59. <van-rate
  60. v-model="pronunciation"
  61. :size="25"
  62. color="#F7B500"
  63. void-color="#eee"
  64. void-icon="star"
  65. />
  66. </div>
  67. <div class="title-item">
  68. <span class="text">节奏</span>
  69. <van-rate
  70. :size="25"
  71. color="#F7B500"
  72. void-color="#eee"
  73. v-model="tempo"
  74. void-icon="star"
  75. />
  76. </div>
  77. <div class="title-item">
  78. <span class="text">乐理</span>
  79. <van-rate
  80. :size="25"
  81. v-model="musicTheory"
  82. color="#F7B500"
  83. void-color="#eee"
  84. void-icon="star"
  85. />
  86. </div>
  87. </template>
  88. </van-cell>
  89. <van-field
  90. rows="3"
  91. required
  92. class="textarea"
  93. maxlength="255"
  94. v-model="memo"
  95. autosize
  96. type="textarea"
  97. placeholder="请输入本课程学习内容"
  98. show-word-limit
  99. />
  100. </van-cell-group>
  101. <van-cell-group v-if="classType != 'VIP'">
  102. <div class="dot"></div>
  103. <van-cell title="是否完成双向沟通" value-class="twoConnect" class="talk">
  104. <template slot="default">
  105. <van-radio-group required v-model="hasLiaison" direction="horizontal">
  106. <van-radio name="1">是</van-radio>
  107. <van-radio name="0">否</van-radio>
  108. </van-radio-group>
  109. </template>
  110. </van-cell>
  111. </van-cell-group>
  112. <div class="button-group">
  113. <van-button type="primary" round size="large" @click="submitReview">
  114. {{ !reviewId ? '提交评价' : '修改评价' }}
  115. </van-button>
  116. </div>
  117. <!-- <van-popup v-model="showWork">
  118. <van-icon class="closeable" @click="onClose" name="cross" />
  119. <div class="popup_container">
  120. <p class="content">
  121. 评价成功<br />{{
  122. isAssignHomework
  123. ? "您课程所在周已经布置作业,是否继续布置?"
  124. : "是否布置作业?"
  125. }}
  126. </p>
  127. <div class="btn_group">
  128. <span @click="onClose">取消</span>
  129. <span @click="onWork(0)">布置作业</span>
  130. </div>
  131. </div>
  132. </van-popup> -->
  133. </div>
  134. </template>
  135. <script>
  136. /* eslint-disable */
  137. import {
  138. getCourseInfoHead,
  139. courseReviewAdd,
  140. getReviewInfo,
  141. updateReviewInfo,
  142. checkeIsAssignHomework
  143. } from "@/api/teacher";
  144. import { browser } from "@/common/common";
  145. import MHeader from "@/components/MHeader";
  146. export default {
  147. name: "teacherList",
  148. components: { MHeader },
  149. data() {
  150. return {
  151. headerStatus: true,
  152. // showWork: false, // 是否布置作业
  153. radio: 1,
  154. voice: 0,
  155. courseId: null,
  156. reviewId: null,
  157. classTimer: null,
  158. classGroupName: null,
  159. teachMode: null,
  160. classType: null, // 课程类型
  161. teachingMaterial: '', //教材
  162. song: null, // 曲目
  163. pronunciation: null, // 发音
  164. tempo: null, //节奏
  165. musicTheory: null, // 乐理
  166. memo: '', // 备注
  167. homeWork: null, // 作业
  168. hasLiaison: null,
  169. subjectNames: null,
  170. // isReset: false,
  171. isInside: false,
  172. isAssignHomework: 0, // 是否有布置作业,0 => 否 1 => 是
  173. enableAssignHomework: 0, // 是否要布置作业 0 否 1 是
  174. memberStatus: 0, // 是否有学生或者乐团是会员
  175. };
  176. },
  177. async mounted() {
  178. let params = this.$route.query;
  179. if (params.Authorization) {
  180. localStorage.setItem("Authorization", decodeURI(params.Authorization));
  181. localStorage.setItem("userInfo", decodeURI(params.Authorization));
  182. }
  183. console.log(params)
  184. this.courseId = params.id;
  185. this.reviewId = parseInt(params.reviewId);
  186. this.isInside = params.isInside;
  187. if (!this.courseId) {
  188. this.$toast("课程信息错误");
  189. }
  190. if (browser().android || browser().iPhone) {
  191. this.headerStatus = false;
  192. }
  193. this.$toast.loading({
  194. message: "加载中...",
  195. duration: 10000,
  196. forbidClick: true,
  197. loadingType: "spinner",
  198. });
  199. await checkeIsAssignHomework({ courseScheduleId: this.courseId }).then((res) => {
  200. let result = res.data;
  201. if (result.code == 200) {
  202. let tempData = result.data || {}
  203. this.isAssignHomework = tempData.isAssignHomework;
  204. this.enableAssignHomework = tempData.enableAssignHomework;
  205. const memberNum = tempData.memberNum;
  206. const courseStudentNum = tempData.courseStudentNum;
  207. if(courseStudentNum == memberNum) {
  208. this.memberStatus = 1
  209. }
  210. } else {
  211. this.$toast(result.msg);
  212. }
  213. });
  214. // 获取头部信息
  215. if (this.reviewId) {
  216. // 获取老评价
  217. await getReviewInfo({ id: this.reviewId }).then((res) => {
  218. if (res.data.code == 200) {
  219. let result = res.data.data;
  220. let teacherClassHeadInfo = result.teacherClassHeadInfo;
  221. this.classTimer =
  222. teacherClassHeadInfo.classDate +
  223. teacherClassHeadInfo.startClassTime +
  224. "-" +
  225. teacherClassHeadInfo.endClassTime;
  226. this.subjectNames = teacherClassHeadInfo.subjectNames;
  227. this.classGroupName = teacherClassHeadInfo.classGroupName;
  228. this.teachMode = teacherClassHeadInfo.teachMode
  229. this.classType = teacherClassHeadInfo.courseScheduleType;
  230. // 评价内容
  231. let courseScheduleReview = result.courseScheduleReview;
  232. this.teachingMaterial = courseScheduleReview.teachingMaterial;
  233. this.song = courseScheduleReview.song;
  234. this.pronunciation = courseScheduleReview.pronunciation;
  235. this.tempo = courseScheduleReview.tempo;
  236. this.musicTheory = courseScheduleReview.musicTheory;
  237. this.memo = courseScheduleReview.memo;
  238. this.homeWork = courseScheduleReview.homeWork;
  239. this.hasLiaison = courseScheduleReview.hasLiaison.toString();
  240. }
  241. });
  242. } else {
  243. await getCourseInfoHead({ courseId: this.courseId }).then((res) => {
  244. if (res.data.code == 200) {
  245. let result = res.data.data;
  246. this.classTimer =
  247. result.classDate +
  248. result.startClassTime +
  249. "-" +
  250. result.endClassTime;
  251. this.subjectNames = result.subjectNames;
  252. this.classGroupName = result.classGroupName;
  253. this.teachMode = result.teachMode
  254. this.classType = result.courseScheduleType;
  255. }
  256. });
  257. // 只有添加的时候才会有缓存数据
  258. let courseEvaluationObj = sessionStorage.getItem('courseEvaluationObj')
  259. courseEvaluationObj = courseEvaluationObj ? JSON.parse(courseEvaluationObj) : null
  260. sessionStorage.removeItem('courseEvaluationObj')
  261. if(courseEvaluationObj) {
  262. this.teachingMaterial = courseEvaluationObj.teachingMaterial
  263. this.song = courseEvaluationObj.song
  264. this.pronunciation = courseEvaluationObj.pronunciation
  265. this.tempo = courseEvaluationObj.tempo
  266. this.musicTheory = courseEvaluationObj.musicTheory
  267. this.memo = courseEvaluationObj.memo
  268. this.hasLiaison = courseEvaluationObj.hasLiaison
  269. this.courseId = courseEvaluationObj.courseScheduleId
  270. }
  271. }
  272. this.$toast.clear();
  273. },
  274. methods: {
  275. submitReview() {
  276. if(!this.isAssignHomework && this.enableAssignHomework) {
  277. this.$toast('请布置课后训练')
  278. return
  279. }
  280. if (!this.teachingMaterial) {
  281. this.$toast("请填写教材");
  282. return;
  283. }
  284. if (!this.song) {
  285. this.$toast("请填写曲目");
  286. return;
  287. }
  288. if (!this.memo) {
  289. this.$toast("请输入本课程学习内容");
  290. return;
  291. }
  292. // VIP课程是没有双向沟通的
  293. if (!this.hasLiaison && this.classType != "VIP") {
  294. this.$toast("请勾选双向沟通");
  295. return;
  296. }
  297. let obj = {
  298. teachingMaterial: this.teachingMaterial, //教材
  299. song: this.song, // 曲目
  300. pronunciation: this.pronunciation, // 发音
  301. tempo: this.tempo, //节奏
  302. musicTheory: this.musicTheory, // 乐理
  303. memo: this.memo, // 备注
  304. hasLiaison: this.hasLiaison,
  305. courseScheduleId: this.courseId,
  306. };
  307. if (this.reviewId) {
  308. obj.id = this.reviewId;
  309. updateReviewInfo(obj).then((res) => {
  310. this.$toast("修改成功");
  311. setTimeout((res) => {
  312. if (this.isInside) {
  313. this.$router.replace({ path: "/manageEvaluation" });
  314. } else {
  315. this.onAppBack();
  316. }
  317. }, 1000);
  318. });
  319. } else {
  320. courseReviewAdd(obj).then((res) => {
  321. if (res.data.code == 200) {
  322. this.$toast("提交成功");
  323. setTimeout((res) => {
  324. if (this.isInside) {
  325. this.$router.push({ path: "/manageEvaluation" });
  326. } else {
  327. this.onAppBack();
  328. }
  329. }, 1000);
  330. } else {
  331. this.$toast(res.data.msg)
  332. }
  333. });
  334. }
  335. },
  336. onWork() {
  337. const obj = {
  338. teachingMaterial: this.teachingMaterial, //教材
  339. song: this.song, // 曲目
  340. pronunciation: this.pronunciation, // 发音
  341. tempo: this.tempo, //节奏
  342. musicTheory: this.musicTheory, // 乐理
  343. memo: this.memo, // 备注
  344. hasLiaison: this.hasLiaison,
  345. handHomework: this.handHomework,
  346. courseScheduleId: this.courseId,
  347. }
  348. if(this.isAssignHomework == 1) {
  349. return
  350. }
  351. sessionStorage.setItem('courseEvaluationObj', JSON.stringify(obj))
  352. this.$router.push({
  353. path: "/arrangeWork",
  354. query: {
  355. courseId: this.courseId,
  356. memberNum: this.memberStatus,
  357. classGroupName: this.classGroupName,
  358. ...this.$route.query
  359. },
  360. });
  361. // if (this.enableAssignHomework == 1) {
  362. // this.$dialog
  363. // .confirm({
  364. // message: "您课程所在周已经布置作业,是否继续布置?",
  365. // confirmButtonText: "布置作业",
  366. // confirmButtonColor: '#01C1B5'
  367. // })
  368. // .then(() => {
  369. // // on confirm
  370. // sessionStorage.setItem('courseEvaluationObj', JSON.stringify(obj))
  371. // this.$router.push({
  372. // path: "/arrangeWork",
  373. // query: {
  374. // courseId: this.courseId,
  375. // memberNum: this.memberStatus,
  376. // classGroupName: this.classGroupName,
  377. // ...this.$route.query
  378. // }
  379. // });
  380. // })
  381. // .catch(() => {
  382. // // on cancel
  383. // });
  384. // } else {
  385. // sessionStorage.setItem('courseEvaluationObj', JSON.stringify(obj))
  386. // this.$router.push({
  387. // path: "/arrangeWork",
  388. // query: {
  389. // courseId: this.courseId,
  390. // memberNum: this.memberStatus,
  391. // classGroupName: this.classGroupName,
  392. // ...this.$route.query
  393. // },
  394. // });
  395. // }
  396. },
  397. onClose() {
  398. // 关闭弹窗
  399. if (this.isInside) {
  400. this.$router.replace({ path: "/manageEvaluation" });
  401. } else {
  402. this.onAppBack();
  403. }
  404. },
  405. onAppBack() {
  406. if (browser().android) {
  407. DAYA.postMessage(JSON.stringify({ api: "back" }));
  408. } else if (browser().iPhone) {
  409. window.webkit.messageHandlers.DAYA.postMessage(
  410. JSON.stringify({ api: "back" })
  411. );
  412. }
  413. },
  414. },
  415. destroyed() {
  416. this.$toast.clear();
  417. },
  418. };
  419. </script>
  420. <style lang="less" scoped>
  421. @import url("../../assets/commonLess/variable.less");
  422. /deep/.van-cell-group {
  423. margin-top: 0.1rem;
  424. }
  425. /deep/.van-cell {
  426. padding: 16px 16px;
  427. font-size: 16px;
  428. line-height: 0.24rem;
  429. }
  430. .title-item {
  431. display: flex;
  432. padding: 0.05rem 0;
  433. .text {
  434. margin-right: 0.15rem;
  435. font-size: 16px;
  436. color: #1a1a1a;
  437. }
  438. /deep/.van-rate {
  439. line-height: 0;
  440. }
  441. }
  442. /deep/.van-cell__title {
  443. font-size: 16px;
  444. color: #1a1a1a;
  445. flex: auto 1;
  446. width: 1.2rem;
  447. }
  448. /deep/.van-field__control,
  449. /deep/.van-cell__value {
  450. font-size: 16px;
  451. color: #1A1A1A !important;
  452. width: 70%;
  453. flex: auto;
  454. }
  455. .textarea {
  456. flex-direction: column;
  457. padding:16px .21rem;
  458. /deep/.van-cell__value {
  459. margin-top: 0.1rem;
  460. width: 100%;
  461. }
  462. }
  463. .input {
  464. padding:16px .21rem;
  465. }
  466. .twoConnect {
  467. width: 55%;
  468. }
  469. /deep/.van-radio-group {
  470. display: flex;
  471. justify-content: flex-end;
  472. height: 0.24rem;
  473. /deep/.van-radio {
  474. margin-left: 0.18rem;
  475. }
  476. }
  477. /deep/.van-radio__icon .van-icon {
  478. border-color:#d3d3d3;
  479. }
  480. /deep/.van-radio__icon--checked {
  481. .van-icon {
  482. border-color: @mColor;
  483. background: @mColor;
  484. }
  485. }
  486. .button-group {
  487. margin: 0.3rem .16rem 0.2rem;
  488. .van-button--primary {
  489. background: @mColor;
  490. border: 1px solid @mColor;
  491. font-size: 0.18rem;
  492. height: 0.5rem;
  493. line-height: 0.48rem;
  494. }
  495. &.btn-operation {
  496. margin: 0.3rem .16rem 0.2rem;
  497. display: flex;
  498. justify-content: space-around;
  499. button {
  500. width: 48%;
  501. }
  502. }
  503. .btn-plain {
  504. color: @mColor;
  505. background: #f3f4f8;
  506. width: 3.2rem;
  507. }
  508. }
  509. .course-header {
  510. margin-top: .1rem;
  511. background: #fff;
  512. padding: 16px 0.21rem 16px .12rem;
  513. .title-info {
  514. padding-bottom: 10px;
  515. }
  516. .title-time {
  517. color: #a1a1a1;
  518. }
  519. }
  520. .van-popup {
  521. width: 90%;
  522. border-radius: 0.05rem;
  523. }
  524. /deep/.van-popup__close-icon {
  525. color: #888;
  526. font-size: 24px;
  527. }
  528. .closeable {
  529. font-size: 24px;
  530. color: #888;
  531. position: absolute;
  532. right: 0.1rem;
  533. top: 0.1rem;
  534. }
  535. .popup_container {
  536. .content {
  537. text-align: center;
  538. font-size: 0.15rem;
  539. color: #000;
  540. padding-top: 0.5rem;
  541. padding-bottom: 0.35rem;
  542. }
  543. .btn_group {
  544. font-size: 0.14rem;
  545. color: #009688;
  546. padding: 0.03rem 0.25rem 0.2rem;
  547. display: flex;
  548. justify-content: space-between;
  549. span {
  550. width: 0.8rem;
  551. text-align: center;
  552. }
  553. }
  554. }
  555. .start.van-cell {
  556. padding:16px .21rem 0;
  557. &:not(:last-child) {
  558. &:after {
  559. border-bottom: 1px solid transparent
  560. }
  561. }
  562. }
  563. .talk {
  564. padding:16px .21rem;
  565. }
  566. .evTitle {
  567. padding: 16px .21rem 0;
  568. color: #333;
  569. font-weight: 500;
  570. }
  571. .dot {
  572. width: 4px;
  573. height: 0.17rem;
  574. background: #01c1b5;
  575. border-radius: 3px;
  576. position: absolute;
  577. z-index: 98;
  578. top: 19px;
  579. left: 0.12rem;
  580. }
  581. .van-cell--required{
  582. &:before {
  583. color:transparent;
  584. }
  585. }
  586. input::-webkit-input-placeholder,
  587. textarea::-webkit-input-placeholder {
  588. color: #777 !important;
  589. font-size: .14rem;
  590. }
  591. input:-moz-placeholder,
  592. textarea:-moz-placeholder {
  593. color: #777 !important;
  594. font-size: .14rem;
  595. }
  596. input::-moz-placeholder,
  597. textarea::-moz-placeholder {
  598. color: #777 !important;
  599. font-size: .14rem;
  600. }
  601. input:-ms-input-placeholder,
  602. textarea:-ms-input-placeholder {
  603. color: #777 !important;
  604. font-size: .14rem;
  605. }
  606. .teachMode {
  607. background: #F2FFFC;
  608. border-radius: .03rem;
  609. border: 1px solid #01C1B5;
  610. font-size: 12px;
  611. color: #01C1B5;
  612. display: inline-block;
  613. // height: 16px;
  614. line-height: 16px;
  615. padding: 0 5px;
  616. }
  617. </style>