detail.vue 9.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297
  1. <template>
  2. <div class="detail">
  3. <item :isComment="false" :dataInfo="dataInfo" />
  4. <van-cell-group class="section">
  5. <p class="work title">
  6. <van-icon :name="icon_content" size="22" style="padding-right: .06rem;" />
  7. 教学内容
  8. </p>
  9. <van-field
  10. rows="1"
  11. type="textarea"
  12. :disabled="isReview || this.groupType === 'MUSIC'"
  13. v-model="memo"
  14. placeholder="请输入本课程教学内容"
  15. />
  16. </van-cell-group>
  17. <van-cell-group class="section" v-if="enableAssignHomework && enableAssignHomework == 1 || tenantId != 1">
  18. <van-cell
  19. :is-link="!isAssignHomework && !isReview"
  20. :value="isAssignHomework ? '已布置' : '未布置'"
  21. @click="onWork()"
  22. title-class="work"
  23. >
  24. <template #title>
  25. <van-icon :name="icon_class" size="22" style="padding-right: .06rem;" />
  26. 课后练习
  27. </template>
  28. </van-cell>
  29. </van-cell-group>
  30. <van-cell-group class="section" :style="{ marginBottom: isReview ? '.2rem' : '1rem' }">
  31. <p class="work title">
  32. <van-icon :name="icon_nice" size="22" style="padding-right: .06rem;" />
  33. 学员是否达到学习标准
  34. </p>
  35. <div style="padding: .08rem 0;">
  36. <template v-if="studentList && studentList.length >0">
  37. <van-cell center title-class="titleStyle" v-for="(item, index) in studentList" :key="index" :border="false">
  38. <template #icon>
  39. <img class="student-icon" v-if="item.avatar" :src="item.avatar" alt="" />
  40. <img class="student-icon" v-else src="../../assets/images/icon_student.png" alt="" />
  41. </template>
  42. <template #title>
  43. <span>{{ item.username }}</span>
  44. {{ item.subjectName }}
  45. </template>
  46. <template #default>
  47. <div v-if="isReview">
  48. <van-button type="primary" size="small" style="min-width: 58px" disabled round :plain="item.qualifiedFlag !== 1">{{ item.qualifiedFlag == 1 ? '达标' : '不达标' }}</van-button>
  49. </div>
  50. <div v-else>
  51. <van-button type="primary" size="small" style="min-width: 58px" @click="item.qualifiedFlag = 1" round :plain="item.qualifiedFlag !== 1">达标</van-button>
  52. <van-button type="primary" size="small" style="min-width: 58px" @click="item.qualifiedFlag = 0" round :plain="item.qualifiedFlag !== 0">不达标</van-button>
  53. </div>
  54. </template>
  55. </van-cell>
  56. </template>
  57. <MEmpty v-else msg="暂无学员" />
  58. </div>
  59. </van-cell-group>
  60. <div class="button-group" v-if="!isReview">
  61. <van-button type="primary" round size="large" @click="submitReview">
  62. 提交评价
  63. </van-button>
  64. </div>
  65. </div>
  66. </template>
  67. <script>
  68. import { queryTeacherInfo } from "@/api/app";
  69. import { getReviewInfo, studyStandardList, checkeIsAssignHomework, courseReviewAdd, getCurrentCourseDetail } from './api'
  70. import Item from "./modal/item";
  71. import MEmpty from '@/components/MEmpty';
  72. export default {
  73. name: "afterClassEvaluateDetail",
  74. components: { Item, MEmpty },
  75. data() {
  76. const query = this.$route.query;
  77. return {
  78. id: query.id,
  79. isInside: query.isInside,
  80. evaluateFlag: query.evaluateFlag,
  81. groupType: query.groupType,
  82. reviewId: query.reviewId,
  83. isAssignHomework: 0, // 是否有布置练习,0 => 否 1 => 是
  84. enableAssignHomework: 0, // 是否要布置练习 0 否 1 是
  85. memberStatus: 0, // 是否有学生或者乐团是会员
  86. tenantId: null, // 当前机构编号
  87. icon_content: require('@/views/afterClassEvaluate/images/icon_content.png'),
  88. icon_class: require('@/views/afterClassEvaluate/images/icon_class.png'),
  89. icon_nice: require('@/views/afterClassEvaluate/images/icon_nice.png'),
  90. dataInfo: {},
  91. studentList: [],
  92. memo: null,
  93. };
  94. },
  95. computed: {
  96. isReview() {
  97. return !!(this.evaluateFlag && this.evaluateFlag > 0);
  98. },
  99. },
  100. async mounted() {
  101. try {
  102. await queryTeacherInfo().then((res) => {
  103. const result = res.data || null;
  104. const tenantId = result.data.tenantId || 0;
  105. this.tenantId = tenantId
  106. sessionStorage.setItem("tenantId", tenantId);
  107. });
  108. // 获取是否有布置练习
  109. const homeWork = await checkeIsAssignHomework({ courseScheduleId: this.id });
  110. let tempData = homeWork.data || {}
  111. this.isAssignHomework = tempData.isAssignHomework;
  112. this.enableAssignHomework = tempData.enableAssignHomework;
  113. const memberNum = tempData.memberNum;
  114. const courseStudentNum = tempData.courseStudentNum;
  115. if(courseStudentNum == memberNum) {
  116. this.memberStatus = 1
  117. }
  118. const detail = await getCurrentCourseDetail({ courseID: this.id })
  119. const resultDetail = detail.data
  120. let tempMemo = resultDetail.coursePlan
  121. this.dataInfo = {
  122. classStartTime: resultDetail.startClassTime,
  123. classEndTime: resultDetail.endClassTime,
  124. courseType: resultDetail.courseType,
  125. courseName: resultDetail.courseScheduleName,
  126. teachMode: resultDetail.teachMode,
  127. schoolName: resultDetail.address,
  128. courseScheduleId: this.id
  129. }
  130. if(this.isReview && this.reviewId && this.reviewId > 0) {
  131. const res = await getReviewInfo({ id: this.reviewId });
  132. const result = res.data
  133. tempMemo = result.courseScheduleReview.memo
  134. }
  135. this.memo = tempMemo
  136. if(this.groupType === 'MUSIC' || this.isReview) {
  137. this.memo = this.memo || '该课程未设置教学内容'
  138. }
  139. // else {
  140. // const res = await getCourseInfoHead({
  141. // courseId: this.id
  142. // });
  143. // const result = res.data
  144. // params = {
  145. // classStartTime: result.classDate + ' ' + result.startClassTime + ':00',
  146. // classEndTime: result.endClassTime + ':00',
  147. // courseType: result.courseScheduleType,
  148. // courseName: result.classGroupName,
  149. // teachMode: result.teachMode,
  150. // schoolName: null,
  151. // courseScheduleId: this.id
  152. // }
  153. // }
  154. // this.dataInfo = params
  155. // 获取学生列表
  156. const studyList = await studyStandardList({ courseScheduleId: this.id, page: 1, rows: 200 })
  157. const resultStudy = studyList.data
  158. this.studentList = resultStudy.rows || []
  159. if(!this.isReview) {
  160. this.studentList.forEach(item => {
  161. item.qualifiedFlag = 1
  162. })
  163. }
  164. } catch {
  165. //
  166. }
  167. },
  168. methods: {
  169. async submitReview() {
  170. // 不是大雅机构则练习非必填
  171. if(!this.isAssignHomework && this.enableAssignHomework && this.tenantId == 1) {
  172. this.$toast('请布置课后练习')
  173. return
  174. }
  175. try {
  176. let params = []
  177. this.studentList.forEach(item => {
  178. params.push({
  179. userId: item.userId,
  180. qualifiedFlag: item.qualifiedFlag
  181. })
  182. })
  183. let obj = {
  184. memo: this.memo, // 备注
  185. courseScheduleId: this.id,
  186. studentStandardDtos: params
  187. };
  188. await courseReviewAdd(obj)
  189. this.$toast("提交成功");
  190. setTimeout(() => {
  191. // && this.tenantId == 1
  192. if (this.isInside) {
  193. this.$router.push({ path: "/afterClassEvaluate" });
  194. } else {
  195. this.onAppBack();
  196. }
  197. }, 1000);
  198. } catch {
  199. //
  200. }
  201. },
  202. onWork() {
  203. if(this.isAssignHomework == 1 || this.isReview) {
  204. return
  205. }
  206. this.$router.push({
  207. path: "/arrangeWork",
  208. query: {
  209. id: this.courseId,
  210. isNewJoin: 1, // 新的入口
  211. memberNum: this.memberStatus,
  212. classGroupName: this.dataInfo.courseName,
  213. ...this.$route.query
  214. },
  215. });
  216. },
  217. }
  218. };
  219. </script>
  220. <style lang="less" scoped>
  221. @import url("../../assets/commonLess/variable.less");
  222. .detail {
  223. min-height: 100vh;
  224. overflow: hidden;
  225. position: relative;
  226. }
  227. /deep/.van-button--plain {
  228. background: #fff;
  229. color: @mColor;
  230. }
  231. /deep/.van-button+.van-button {
  232. margin-left: 8px;
  233. }
  234. .section {
  235. margin: 0.1rem 0.12rem 0;
  236. border-radius: .1rem;
  237. overflow: hidden;
  238. .work {
  239. display: flex;
  240. align-items: center;
  241. font-size:16px;
  242. color: #333;
  243. }
  244. .title {
  245. padding: 12px 16px 0;
  246. }
  247. .student-icon {
  248. width: 32px;
  249. height: 32px;
  250. border-radius: 50%;
  251. }
  252. .titleStyle {
  253. font-size: 16px;
  254. color: #666666;
  255. span {
  256. color: #1A1A1A;
  257. padding: 0 .1rem;
  258. }
  259. }
  260. }
  261. .button-group {
  262. position: fixed;
  263. bottom: 0;
  264. left: 0;
  265. right: 0;
  266. padding: 0.2rem .16rem 0.15rem;
  267. background: #f3f4f8;
  268. border: 0.01rem solid #f3f4f8;
  269. .van-button--primary {
  270. font-size: 0.18rem;
  271. height: 0.48rem;
  272. line-height: 0.48rem;
  273. }
  274. }
  275. /deep/.mempty .icon {
  276. margin-top: 0;
  277. }
  278. /deep/.van-button--disabled {
  279. opacity: 0.8;
  280. }
  281. /deep/.van-field__control:disabled {
  282. color: #a1a1a1 !important;
  283. -webkit-text-fill-color: #a1a1a1 !important;
  284. }
  285. </style>