CourseEvaluation.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639
  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. tenantId: null, // 当前机构编号
  173. isAssignHomework: 0, // 是否有布置作业,0 => 否 1 => 是
  174. enableAssignHomework: 0, // 是否要布置作业 0 否 1 是
  175. memberStatus: 0, // 是否有学生或者乐团是会员
  176. };
  177. },
  178. created() {
  179. this.tenantId = sessionStorage.getItem('tenantId') || null
  180. },
  181. async mounted() {
  182. let params = this.$route.query;
  183. if (params.Authorization) {
  184. localStorage.setItem("Authorization", decodeURI(params.Authorization));
  185. localStorage.setItem("userInfo", decodeURI(params.Authorization));
  186. }
  187. this.courseId = params.id;
  188. this.reviewId = parseInt(params.reviewId);
  189. this.isInside = params.isInside;
  190. if (!this.courseId) {
  191. this.$toast("课程信息错误");
  192. }
  193. if (browser().android || browser().iPhone) {
  194. this.headerStatus = false;
  195. }
  196. this.$toast.loading({
  197. message: "加载中...",
  198. duration: 10000,
  199. forbidClick: true,
  200. loadingType: "spinner",
  201. });
  202. await checkeIsAssignHomework({ courseScheduleId: this.courseId }).then((res) => {
  203. let result = res.data;
  204. if (result.code == 200) {
  205. let tempData = result.data || {}
  206. this.isAssignHomework = tempData.isAssignHomework;
  207. this.enableAssignHomework = tempData.enableAssignHomework;
  208. const memberNum = tempData.memberNum;
  209. const courseStudentNum = tempData.courseStudentNum;
  210. if(courseStudentNum == memberNum) {
  211. this.memberStatus = 1
  212. }
  213. } else {
  214. this.$toast(result.msg);
  215. }
  216. });
  217. // 获取头部信息
  218. if (this.reviewId) {
  219. // 获取老评价
  220. await getReviewInfo({ id: this.reviewId }).then((res) => {
  221. if (res.data.code == 200) {
  222. let result = res.data.data;
  223. let teacherClassHeadInfo = result.teacherClassHeadInfo;
  224. this.classTimer =
  225. teacherClassHeadInfo.classDate +
  226. teacherClassHeadInfo.startClassTime +
  227. "-" +
  228. teacherClassHeadInfo.endClassTime;
  229. this.subjectNames = teacherClassHeadInfo.subjectNames;
  230. this.classGroupName = teacherClassHeadInfo.classGroupName;
  231. this.teachMode = teacherClassHeadInfo.teachMode
  232. this.classType = teacherClassHeadInfo.courseScheduleType;
  233. // 评价内容
  234. let courseScheduleReview = result.courseScheduleReview;
  235. this.teachingMaterial = courseScheduleReview.teachingMaterial;
  236. this.song = courseScheduleReview.song;
  237. this.pronunciation = courseScheduleReview.pronunciation;
  238. this.tempo = courseScheduleReview.tempo;
  239. this.musicTheory = courseScheduleReview.musicTheory;
  240. this.memo = courseScheduleReview.memo;
  241. this.homeWork = courseScheduleReview.homeWork;
  242. this.hasLiaison = courseScheduleReview.hasLiaison.toString();
  243. }
  244. });
  245. } else {
  246. await getCourseInfoHead({ courseId: this.courseId }).then((res) => {
  247. if (res.data.code == 200) {
  248. let result = res.data.data;
  249. this.classTimer =
  250. result.classDate +
  251. result.startClassTime +
  252. "-" +
  253. result.endClassTime;
  254. this.subjectNames = result.subjectNames;
  255. this.classGroupName = result.classGroupName;
  256. this.teachMode = result.teachMode
  257. this.classType = result.courseScheduleType;
  258. }
  259. });
  260. // 只有添加的时候才会有缓存数据
  261. let courseEvaluationObj = sessionStorage.getItem('courseEvaluationObj')
  262. courseEvaluationObj = courseEvaluationObj ? JSON.parse(courseEvaluationObj) : null
  263. sessionStorage.removeItem('courseEvaluationObj')
  264. if(courseEvaluationObj) {
  265. this.teachingMaterial = courseEvaluationObj.teachingMaterial
  266. this.song = courseEvaluationObj.song
  267. this.pronunciation = courseEvaluationObj.pronunciation
  268. this.tempo = courseEvaluationObj.tempo
  269. this.musicTheory = courseEvaluationObj.musicTheory
  270. this.memo = courseEvaluationObj.memo
  271. this.hasLiaison = courseEvaluationObj.hasLiaison
  272. this.courseId = courseEvaluationObj.courseScheduleId
  273. }
  274. }
  275. this.$toast.clear();
  276. },
  277. methods: {
  278. submitReview() {
  279. // 不是大雅机构则作业非必填
  280. if(!this.isAssignHomework && this.enableAssignHomework && this.tenantId == 1) {
  281. this.$toast('请布置课后训练')
  282. return
  283. }
  284. if (!this.teachingMaterial) {
  285. this.$toast("请填写教材");
  286. return;
  287. }
  288. if (!this.song) {
  289. this.$toast("请填写曲目");
  290. return;
  291. }
  292. if (!this.memo) {
  293. this.$toast("请输入本课程学习内容");
  294. return;
  295. }
  296. // VIP课程是没有双向沟通的
  297. if (!this.hasLiaison && this.classType != "VIP") {
  298. this.$toast("请勾选双向沟通");
  299. return;
  300. }
  301. let obj = {
  302. teachingMaterial: this.teachingMaterial, //教材
  303. song: this.song, // 曲目
  304. pronunciation: this.pronunciation, // 发音
  305. tempo: this.tempo, //节奏
  306. musicTheory: this.musicTheory, // 乐理
  307. memo: this.memo, // 备注
  308. hasLiaison: this.hasLiaison,
  309. courseScheduleId: this.courseId,
  310. };
  311. if (this.reviewId) {
  312. obj.id = this.reviewId;
  313. updateReviewInfo(obj).then((res) => {
  314. this.$toast("修改成功");
  315. setTimeout((res) => {
  316. // 硬编码,判断是否是大雅机构,其它机构则可以不用布置作业
  317. if (this.isInside && this.tenantId == 1) {
  318. this.$router.replace({ path: "/manageEvaluation" });
  319. } else {
  320. this.onAppBack();
  321. }
  322. }, 1000);
  323. });
  324. } else {
  325. courseReviewAdd(obj).then((res) => {
  326. if (res.data.code == 200) {
  327. this.$toast("提交成功");
  328. setTimeout((res) => {
  329. if (this.isInside && this.tenantId == 1) {
  330. this.$router.push({ path: "/manageEvaluation" });
  331. } else {
  332. this.onAppBack();
  333. }
  334. }, 1000);
  335. } else {
  336. this.$toast(res.data.msg)
  337. }
  338. });
  339. }
  340. },
  341. onWork() {
  342. const obj = {
  343. teachingMaterial: this.teachingMaterial, //教材
  344. song: this.song, // 曲目
  345. pronunciation: this.pronunciation, // 发音
  346. tempo: this.tempo, //节奏
  347. musicTheory: this.musicTheory, // 乐理
  348. memo: this.memo, // 备注
  349. hasLiaison: this.hasLiaison,
  350. handHomework: this.handHomework,
  351. courseScheduleId: this.courseId,
  352. }
  353. if(this.isAssignHomework == 1) {
  354. return
  355. }
  356. sessionStorage.setItem('courseEvaluationObj', JSON.stringify(obj))
  357. this.$router.push({
  358. path: "/arrangeWork",
  359. query: {
  360. courseId: this.courseId,
  361. memberNum: this.memberStatus,
  362. classGroupName: this.classGroupName,
  363. ...this.$route.query
  364. },
  365. });
  366. // if (this.enableAssignHomework == 1) {
  367. // this.$dialog
  368. // .confirm({
  369. // message: "您课程所在周已经布置作业,是否继续布置?",
  370. // confirmButtonText: "布置作业",
  371. // confirmButtonColor: '#01C1B5'
  372. // })
  373. // .then(() => {
  374. // // on confirm
  375. // sessionStorage.setItem('courseEvaluationObj', JSON.stringify(obj))
  376. // this.$router.push({
  377. // path: "/arrangeWork",
  378. // query: {
  379. // courseId: this.courseId,
  380. // memberNum: this.memberStatus,
  381. // classGroupName: this.classGroupName,
  382. // ...this.$route.query
  383. // }
  384. // });
  385. // })
  386. // .catch(() => {
  387. // // on cancel
  388. // });
  389. // } else {
  390. // sessionStorage.setItem('courseEvaluationObj', JSON.stringify(obj))
  391. // this.$router.push({
  392. // path: "/arrangeWork",
  393. // query: {
  394. // courseId: this.courseId,
  395. // memberNum: this.memberStatus,
  396. // classGroupName: this.classGroupName,
  397. // ...this.$route.query
  398. // },
  399. // });
  400. // }
  401. },
  402. onClose() {
  403. // 关闭弹窗
  404. if (this.isInside && this.tenantId == 1) {
  405. this.$router.replace({ path: "/manageEvaluation" });
  406. } else {
  407. this.onAppBack();
  408. }
  409. },
  410. onAppBack() {
  411. if (browser().android) {
  412. DAYA.postMessage(JSON.stringify({ api: "back" }));
  413. } else if (browser().iPhone) {
  414. window.webkit.messageHandlers.DAYA.postMessage(
  415. JSON.stringify({ api: "back" })
  416. );
  417. }
  418. },
  419. },
  420. destroyed() {
  421. this.$toast.clear();
  422. },
  423. };
  424. </script>
  425. <style lang="less" scoped>
  426. @import url("../../assets/commonLess/variable.less");
  427. /deep/.van-cell-group {
  428. margin-top: 0.1rem;
  429. }
  430. /deep/.van-cell {
  431. padding: 16px 16px;
  432. font-size: 16px;
  433. line-height: 0.24rem;
  434. }
  435. .title-item {
  436. display: flex;
  437. padding: 0.05rem 0;
  438. .text {
  439. margin-right: 0.15rem;
  440. font-size: 16px;
  441. color: #1a1a1a;
  442. }
  443. /deep/.van-rate {
  444. line-height: 0;
  445. }
  446. }
  447. /deep/.van-cell__title {
  448. font-size: 16px;
  449. color: #1a1a1a;
  450. flex: auto 1;
  451. width: 1.2rem;
  452. }
  453. /deep/.van-field__control,
  454. /deep/.van-cell__value {
  455. font-size: 16px;
  456. color: #1A1A1A !important;
  457. width: 70%;
  458. flex: auto;
  459. }
  460. .textarea {
  461. flex-direction: column;
  462. padding:16px .21rem;
  463. /deep/.van-cell__value {
  464. margin-top: 0.1rem;
  465. width: 100%;
  466. }
  467. }
  468. .input {
  469. padding:16px .21rem;
  470. }
  471. .twoConnect {
  472. width: 55%;
  473. }
  474. /deep/.van-radio-group {
  475. display: flex;
  476. justify-content: flex-end;
  477. height: 0.24rem;
  478. /deep/.van-radio {
  479. margin-left: 0.18rem;
  480. }
  481. }
  482. /deep/.van-radio__icon .van-icon {
  483. border-color:#d3d3d3;
  484. }
  485. /deep/.van-radio__icon--checked {
  486. .van-icon {
  487. border-color: @mColor;
  488. background: @mColor;
  489. }
  490. }
  491. .button-group {
  492. margin: 0.3rem .16rem 0.2rem;
  493. .van-button--primary {
  494. background: @mColor;
  495. border: 1px solid @mColor;
  496. font-size: 0.18rem;
  497. height: 0.5rem;
  498. line-height: 0.48rem;
  499. }
  500. &.btn-operation {
  501. margin: 0.3rem .16rem 0.2rem;
  502. display: flex;
  503. justify-content: space-around;
  504. button {
  505. width: 48%;
  506. }
  507. }
  508. .btn-plain {
  509. color: @mColor;
  510. background: #f3f4f8;
  511. width: 3.2rem;
  512. }
  513. }
  514. .course-header {
  515. margin-top: .1rem;
  516. background: #fff;
  517. padding: 16px 0.21rem 16px .12rem;
  518. .title-info {
  519. padding-bottom: 10px;
  520. }
  521. .title-time {
  522. color: #a1a1a1;
  523. }
  524. }
  525. .van-popup {
  526. width: 90%;
  527. border-radius: 0.05rem;
  528. }
  529. /deep/.van-popup__close-icon {
  530. color: #888;
  531. font-size: 24px;
  532. }
  533. .closeable {
  534. font-size: 24px;
  535. color: #888;
  536. position: absolute;
  537. right: 0.1rem;
  538. top: 0.1rem;
  539. }
  540. .popup_container {
  541. .content {
  542. text-align: center;
  543. font-size: 0.15rem;
  544. color: #000;
  545. padding-top: 0.5rem;
  546. padding-bottom: 0.35rem;
  547. }
  548. .btn_group {
  549. font-size: 0.14rem;
  550. color: #009688;
  551. padding: 0.03rem 0.25rem 0.2rem;
  552. display: flex;
  553. justify-content: space-between;
  554. span {
  555. width: 0.8rem;
  556. text-align: center;
  557. }
  558. }
  559. }
  560. .start.van-cell {
  561. padding:16px .21rem 0;
  562. &:not(:last-child) {
  563. &:after {
  564. border-bottom: 1px solid transparent
  565. }
  566. }
  567. }
  568. .talk {
  569. padding:16px .21rem;
  570. }
  571. .evTitle {
  572. padding: 16px .21rem 0;
  573. color: #333;
  574. font-weight: 500;
  575. }
  576. .dot {
  577. width: 4px;
  578. height: 0.17rem;
  579. background: #01c1b5;
  580. border-radius: 3px;
  581. position: absolute;
  582. z-index: 98;
  583. top: 19px;
  584. left: 0.12rem;
  585. }
  586. .van-cell--required{
  587. &:before {
  588. color:transparent;
  589. }
  590. }
  591. input::-webkit-input-placeholder,
  592. textarea::-webkit-input-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::-moz-placeholder,
  602. textarea::-moz-placeholder {
  603. color: #777 !important;
  604. font-size: .14rem;
  605. }
  606. input:-ms-input-placeholder,
  607. textarea:-ms-input-placeholder {
  608. color: #777 !important;
  609. font-size: .14rem;
  610. }
  611. .teachMode {
  612. background: #F2FFFC;
  613. border-radius: .03rem;
  614. border: 1px solid #01C1B5;
  615. font-size: 12px;
  616. color: #01C1B5;
  617. display: inline-block;
  618. // height: 16px;
  619. line-height: 16px;
  620. padding: 0 5px;
  621. }
  622. </style>