CourseEvaluation.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476
  1. <template>
  2. <div>
  3. <m-header v-if="headerStatus" />
  4. <van-cell-group>
  5. <van-cell title="课程班名称" :value="classGroupName" />
  6. </van-cell-group>
  7. <van-cell-group>
  8. <van-cell title="课程类型" >
  9. <template #default>
  10. {{ classType | coursesType }}
  11. </template>
  12. </van-cell>
  13. </van-cell-group>
  14. <van-cell-group>
  15. <van-cell title="上课时间" :value="classTimer" />
  16. </van-cell-group>
  17. <van-cell-group>
  18. <van-cell title="乐器" :value="subjectNames" />
  19. </van-cell-group>
  20. <van-cell-group>
  21. <van-field
  22. required
  23. rows="4"
  24. class="textarea"
  25. v-model="teachingMaterial"
  26. maxlength="255"
  27. autosize
  28. label=" 教材内容"
  29. type="textarea"
  30. placeholder="请输入(1-255字)"
  31. />
  32. </van-cell-group>
  33. <van-cell-group>
  34. <van-field required label="曲目" input-align="right" placeholder="请输入曲目名" v-model="song" />
  35. </van-cell-group>
  36. <van-cell-group>
  37. <van-cell>
  38. <template slot="title">
  39. <div class="title-item">
  40. <span class="text">发音</span>
  41. <van-rate v-model="pronunciation" :size="25" void-color="#eee" void-icon="star" />
  42. </div>
  43. <div class="title-item">
  44. <span class="text">节奏</span>
  45. <van-rate :size="25" void-color="#eee" v-model="tempo" void-icon="star" />
  46. </div>
  47. <div class="title-item">
  48. <span class="text">乐理</span>
  49. <van-rate :size="25" v-model="musicTheory" void-color="#eee" void-icon="star" />
  50. </div>
  51. </template>
  52. </van-cell>
  53. </van-cell-group>
  54. <van-cell-group>
  55. <van-field
  56. rows="4"
  57. required
  58. class="textarea"
  59. maxlength="255"
  60. v-model="memo"
  61. autosize
  62. label="评价备注"
  63. type="textarea"
  64. placeholder="请输入(1-255字)"
  65. />
  66. </van-cell-group>
  67. <!-- <van-cell-group v-if="!isReset || (isReset && homeWork)">
  68. <van-field
  69. rows="4"
  70. class="textarea"
  71. :disabled="isReset"
  72. maxlength="255"
  73. v-model="homeWork"
  74. autosize
  75. label="布置作业"
  76. type="textarea"
  77. placeholder="请输入(1-255字)"
  78. />
  79. </van-cell-group> -->
  80. <van-cell-group v-if="classType != 'VIP'">
  81. <van-cell title="是否完成双向沟通" value-class="twoConnect">
  82. <template slot="default">
  83. <van-radio-group required v-model="hasLiaison" direction="horizontal">
  84. <van-radio name="1">是</van-radio>
  85. <van-radio name="0">否</van-radio>
  86. </van-radio-group>
  87. </template>
  88. </van-cell>
  89. </van-cell-group>
  90. <!--
  91. <van-cell-group v-if="isReset">
  92. <van-cell title="是否完成作业" value-class="twoConnect">
  93. <template slot="default">
  94. <van-radio-group required v-model="handHomework" direction="horizontal">
  95. <van-radio name="1">是</van-radio>
  96. <van-radio name="0">否</van-radio>
  97. </van-radio-group>
  98. </template>
  99. </van-cell>
  100. </van-cell-group> -->
  101. <div class="button-group" v-if="!reviewId">
  102. <van-button type="primary" round size="large" @click="submitReview">提交评价</van-button>
  103. </div>
  104. <div class="button-group btn-operation" v-if="reviewId">
  105. <van-button type="primary" :disabled="homeWork?true: false" round @click="onWork(isAssignHomework)">{{ homeWork ? '已布置作业' : '布置作业' }}</van-button>
  106. <van-button type="primary" round class="btn-plain" @click="submitReview">修改评价</van-button>
  107. </div>
  108. <van-popup v-model="showWork">
  109. <van-icon class="closeable" @click="onClose" name="cross" />
  110. <div class="popup_container">
  111. <p class="content">评价成功<br/>{{ isAssignHomework ? '您课程所在周已经布置作业,是否继续布置?' : '是否布置作业?' }}</p>
  112. <div class="btn_group">
  113. <span @click="onClose">取消</span>
  114. <span @click="onWork(0)">布置作业</span>
  115. </div>
  116. </div>
  117. </van-popup>
  118. </div>
  119. </template>
  120. <script>
  121. /* eslint-disable */
  122. import {
  123. getCourseInfoHead,
  124. courseReviewAdd,
  125. getReviewInfo,
  126. updateReviewInfo,
  127. checkeIsAssignHomework
  128. } from "@/api/teacher";
  129. import { browser } from "@/common/common";
  130. import MHeader from "@/components/MHeader";
  131. export default {
  132. name: "teacherList",
  133. components: { MHeader },
  134. data() {
  135. return {
  136. headerStatus: true,
  137. showWork: false, // 是否布置作业
  138. radio: 1,
  139. voice: 0,
  140. courseId: null,
  141. reviewId: null,
  142. classTimer: null,
  143. classGroupName: null,
  144. classType: null, // 课程类型
  145. teachingMaterial: null, //教材
  146. song: null, // 曲目
  147. pronunciation: null, // 发音
  148. tempo: null, //节奏
  149. musicTheory: null, // 乐理
  150. memo: null, // 备注
  151. homeWork: null, // 作业
  152. handHomework: null, // 是否完成作业
  153. hasLiaison: null,
  154. subjectNames: null,
  155. // isReset: false,
  156. isInside: false,
  157. isAssignHomework: 0, // 是否有布置作业,0 => 否 1 => 是
  158. };
  159. },
  160. created() {
  161. let params = this.$route.query;
  162. if (params.Authorization) {
  163. localStorage.setItem("Authorization", decodeURI(params.Authorization));
  164. localStorage.setItem("userInfo", decodeURI(params.Authorization));
  165. }
  166. this.courseId = this.$route.query.id;
  167. this.reviewId = parseInt(this.$route.query.reviewId);
  168. this.isInside = this.$route.query.isInside;
  169. if (!this.courseId) {
  170. this.$toast("课程信息错误");
  171. }
  172. },
  173. mounted() {
  174. let params = this.$route.query;
  175. if (params.Authorization) {
  176. localStorage.setItem("Authorization", decodeURI(params.Authorization));
  177. localStorage.setItem("userInfo", decodeURI(params.Authorization));
  178. }
  179. if(browser().android || browser().iPhone) {
  180. this.headerStatus = false
  181. }
  182. // 获取头部信息
  183. if (this.reviewId) {
  184. // 获取老评价
  185. this.$toast.loading({
  186. message: '加载中...',
  187. duration: 10000,
  188. forbidClick: true,
  189. loadingType: 'spinner',
  190. })
  191. getReviewInfo({ id: this.reviewId }).then(res => {
  192. this.$toast.clear()
  193. if (res.data.code == 200) {
  194. let result = res.data.data
  195. let teacherClassHeadInfo = result.teacherClassHeadInfo
  196. this.classTimer =
  197. teacherClassHeadInfo.classDate +
  198. teacherClassHeadInfo.startClassTime +
  199. "-" +
  200. teacherClassHeadInfo.endClassTime;
  201. this.subjectNames = teacherClassHeadInfo.subjectNames;
  202. this.classGroupName = teacherClassHeadInfo.classGroupName;
  203. this.classType = teacherClassHeadInfo.courseScheduleType
  204. // 评价内容
  205. let courseScheduleReview = result.courseScheduleReview
  206. this.teachingMaterial = courseScheduleReview.teachingMaterial;
  207. this.song = courseScheduleReview.song;
  208. this.pronunciation = courseScheduleReview.pronunciation;
  209. this.tempo = courseScheduleReview.tempo;
  210. this.musicTheory = courseScheduleReview.musicTheory;
  211. this.memo = courseScheduleReview.memo;
  212. this.homeWork = courseScheduleReview.homeWork;
  213. this.hasLiaison = courseScheduleReview.hasLiaison.toString();
  214. this.handHomework = courseScheduleReview.handHomework.toString();
  215. }
  216. });
  217. } else {
  218. getCourseInfoHead({ courseId: this.courseId }).then(res => {
  219. if (res.data.code == 200) {
  220. let result = res.data.data
  221. this.classTimer =
  222. result.classDate +
  223. result.startClassTime +
  224. "-" +
  225. result.endClassTime;
  226. this.subjectNames = result.subjectNames;
  227. this.classGroupName = result.classGroupName;
  228. this.classType = result.courseScheduleType
  229. }
  230. });
  231. }
  232. checkeIsAssignHomework({ courseScheduleId: this.courseId }).then(res => {
  233. let result = res.data
  234. if(result.code == 200) {
  235. this.isAssignHomework = result.data.isAssignHomework
  236. } else {
  237. this.$toast(result.msg)
  238. }
  239. })
  240. },
  241. methods: {
  242. submitReview() {
  243. if (!this.teachingMaterial) {
  244. this.$toast("请填写教材");
  245. return;
  246. }
  247. if (!this.song) {
  248. this.$toast("请填写曲目");
  249. return;
  250. }
  251. if (!this.memo) {
  252. this.$toast("请输入备注");
  253. return;
  254. }
  255. // VIP课程是没有双向沟通的
  256. if (!this.hasLiaison && this.classType != 'VIP') {
  257. this.$toast("请勾选双向沟通");
  258. return;
  259. }
  260. let obj = {
  261. teachingMaterial: this.teachingMaterial, //教材
  262. song: this.song, // 曲目
  263. pronunciation: this.pronunciation, // 发音
  264. tempo: this.tempo, //节奏
  265. musicTheory: this.musicTheory, // 乐理
  266. memo: this.memo, // 备注
  267. // homeWork: this.homeWork,
  268. hasLiaison: this.hasLiaison,
  269. handHomework: this.handHomework,
  270. courseScheduleId: this.courseId
  271. };
  272. if (this.reviewId) {
  273. obj.id = this.reviewId;
  274. updateReviewInfo(obj).then(res => {
  275. this.$toast("修改成功")
  276. setTimeout(res => {
  277. if (this.isInside) {
  278. this.$router.replace({ path: "/manageEvaluation" });
  279. } else {
  280. this.onAppBack();
  281. }
  282. }, 1000);
  283. });
  284. } else {
  285. courseReviewAdd(obj).then(res => {
  286. if (res.data.code == 200) {
  287. // this.$toast("提交成功");
  288. this.showWork = true
  289. // setTimeout(res => {
  290. // if (this.isInside) {
  291. // this.$router.push({ path: "/manageEvaluation" });
  292. // } else {
  293. // this.onAppBack();
  294. // }
  295. // }, 1000);
  296. }
  297. });
  298. }
  299. },
  300. onWork(isAssignHomework) {
  301. if(isAssignHomework == 1) {
  302. this.$dialog.confirm({
  303. message: '您课程所在周已经布置作业,是否继续布置?',
  304. confirmButtonText: '布置作业'
  305. })
  306. .then(() => {
  307. // on confirm
  308. this.$router.replace({
  309. path: '/arrangeWork',
  310. query: {
  311. courseId: this.courseId
  312. }
  313. })
  314. })
  315. .catch(() => {
  316. // on cancel
  317. })
  318. } else {
  319. this.$router.replace({
  320. path: '/arrangeWork',
  321. query: {
  322. courseId: this.courseId
  323. }
  324. })
  325. }
  326. },
  327. onClose() { // 关闭弹窗
  328. if (this.isInside) {
  329. this.$router.replace({ path: "/manageEvaluation" });
  330. } else {
  331. this.onAppBack();
  332. }
  333. },
  334. onAppBack() {
  335. if (browser().android) {
  336. DAYA.postMessage(JSON.stringify({ api: "back" }));
  337. } else if (browser().iPhone) {
  338. window.webkit.messageHandlers.DAYA.postMessage(
  339. JSON.stringify({ api: "back" })
  340. );
  341. }
  342. }
  343. },
  344. destroyed() {
  345. this.$toast.clear()
  346. }
  347. };
  348. </script>
  349. <style lang="less" scoped>
  350. @import url("../../assets/commonLess/variable.less");
  351. /deep/.van-cell-group {
  352. margin-top: 0.15rem;
  353. /deep/.van-cell {
  354. padding: 0.14rem 0.16rem;
  355. font-size: .17rem;
  356. line-height: .24rem;
  357. }
  358. }
  359. .title-item {
  360. display: flex;
  361. padding: 0.05rem 0;
  362. .text {
  363. margin-right: 0.15rem;
  364. font-size: 0.17rem;
  365. color: #1a1a1a;
  366. }
  367. /deep/.van-rate {
  368. line-height: 0;
  369. }
  370. }
  371. /deep/.van-cell__title {
  372. font-size: 0.17rem;
  373. color: #1a1a1a;
  374. flex: auto 1;
  375. width: 1.2rem;
  376. }
  377. /deep/.van-field__control,
  378. /deep/.van-cell__value {
  379. font-size: 0.17rem;
  380. color: #666;
  381. width: 70%;
  382. flex: auto;
  383. }
  384. .textarea {
  385. flex-direction: column;
  386. /deep/.van-cell__value {
  387. margin-top: 0.1rem;
  388. width: 100%;
  389. }
  390. }
  391. .twoConnect {
  392. width: 55%;
  393. }
  394. /deep/.van-radio-group {
  395. display: flex;
  396. justify-content: flex-end;
  397. height: .24rem;
  398. /deep/.van-radio {
  399. margin-left: 0.18rem;
  400. }
  401. }
  402. /deep/.van-radio__icon .van-icon {
  403. border-color: @sFontColor;
  404. }
  405. /deep/.van-radio__icon--checked {
  406. .van-icon {
  407. border-color: #14928a;
  408. background: #14928a;
  409. }
  410. }
  411. .button-group {
  412. margin: 0.3rem 0.26rem 0.2rem;
  413. .van-button--primary {
  414. background: @mColor;
  415. border: 1px solid @mColor;
  416. font-size: 0.18rem;
  417. height: .5rem;
  418. line-height: .48rem;
  419. }
  420. &.btn-operation {
  421. margin: 0.3rem 0.16rem 0.2rem;
  422. display: flex;
  423. justify-content: space-between;
  424. button {
  425. width: 48%;
  426. }
  427. }
  428. .btn-plain {
  429. color: #14928A;
  430. background: #F3F4F8;
  431. }
  432. }
  433. .van-popup {
  434. width: 90%;
  435. border-radius: .05rem;
  436. }
  437. /deep/.van-popup__close-icon {
  438. color: #888;
  439. font-size: 24px;
  440. }
  441. .closeable {
  442. font-size: 24px;
  443. color: #888;
  444. position: absolute;
  445. right: .1rem;
  446. top: .1rem;
  447. }
  448. .popup_container {
  449. .content {
  450. text-align: center;
  451. font-size: .15rem;
  452. color: #000;
  453. padding-top: .5rem;
  454. padding-bottom: .35rem;
  455. }
  456. .btn_group {
  457. font-size: .14rem;
  458. color: #009688;
  459. padding: .03rem .25rem .2rem;
  460. display: flex;
  461. justify-content: space-between;
  462. span {
  463. width: .8rem;
  464. text-align: center;
  465. }
  466. }
  467. }
  468. </style>