curriculumDetail.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409
  1. <!--
  2. * @FileDescription: 课程详情
  3. * @Author: 黄琪勇
  4. * @Date:2024-04-01 16:27:48
  5. -->
  6. <template>
  7. <div class="curriculumDetail">
  8. <div class="close" @click="close"></div>
  9. <div v-loading="loading" class="curriculumDetailCon">
  10. <img class="imgMid" src="@/img/curriculum/mid.png" />
  11. <div class="curriculumDetailBox">
  12. <div class="teachingObjectives">
  13. <div class="head">
  14. <div class="leftTit">
  15. <img src="@/img/curriculum/jxmb.png" />
  16. <div>教学目标</div>
  17. </div>
  18. <div v-if="coursewareShow" class="rightBtn" @click="handleSetUpCourseware(props.modalData.id)">
  19. <div>{{ curriculumDetailData.id ? "更换课件" : "配置课件" }}</div>
  20. <img src="@/img/curriculum/jt1.png" />
  21. </div>
  22. </div>
  23. <div class="content">
  24. <ElScrollbar class="elScrollbar">
  25. <div class="title" v-for="tit in curriculumDetailData.targetDesc.split('\n')" :key="tit">{{ tit }}</div>
  26. </ElScrollbar>
  27. <el-empty
  28. v-if="!curriculumDetailData.targetDesc && !loading"
  29. class="empty"
  30. :image="require('@/img/layout/empty.png')"
  31. description="暂无教学目标"
  32. />
  33. </div>
  34. </div>
  35. </div>
  36. <div class="curriculumDetailBox">
  37. <div class="knowledgePoints">
  38. <div class="head">
  39. <div class="points">
  40. <img src="@/img/curriculum/zsd.png" />
  41. <div>知识点</div>
  42. </div>
  43. </div>
  44. <div class="content">
  45. <ElScrollbar class="elScrollbar">
  46. <courseCollapse :courseList="curriculumDetailData.pointList" @handleClick="handleCourseClick" />
  47. </ElScrollbar>
  48. <el-empty
  49. v-if="!curriculumDetailData.pointList.length && !loading"
  50. class="empty"
  51. :image="require('@/img/layout/empty.png')"
  52. description="暂无知识点"
  53. />
  54. </div>
  55. </div>
  56. </div>
  57. </div>
  58. <div class="curriculumStart" v-if="['ING', 'UNDERWAY'].includes(statusVal) && !loading">
  59. <div class="startBtn" @click="handleStartClass(modalData.id)">开始上课</div>
  60. </div>
  61. </div>
  62. </template>
  63. <script setup lang="ts">
  64. import courseCollapse from "./components/courseCollapse"
  65. import { useSetUpCourseware } from "./index"
  66. import {
  67. getCourseScheduleDetail_gyt,
  68. getLessonCoursewareDetail_gyt,
  69. getCurrentCourseDetail_gym,
  70. getLessonCourseDetail_gym
  71. } from "@/api/curriculum.api"
  72. import { httpAjaxErrMsg } from "@/plugin/httpAjax"
  73. import { ref, shallowRef, computed } from "vue"
  74. import { handleStartClass_gyt, handleStartClass_gym, isONLINE_gym } from "./hooks/useStartClass"
  75. import userStore from "@/store/modules/user"
  76. import router from "@/router"
  77. const userStoreHook = userStore()
  78. const props = defineProps<{
  79. modalData: {
  80. id: string
  81. }
  82. }>()
  83. const emits = defineEmits<{
  84. (e: "onClose"): void
  85. }>()
  86. function close() {
  87. emits("onClose")
  88. }
  89. const loading = ref(false)
  90. const statusVal = ref("") //课程状态 ING 和 UNDERWAY 代表可以上课
  91. const teachModeVal = ref("") //课程类型 ONLINE课的时候提示去app
  92. const coursewareFlagVal = ref(false) // 管乐团能否配置课件 coursewareFlag字段为true并且不是结束就能配置
  93. const coursewareShow = computed(() => {
  94. if (userStoreHook.roles === "GYM") {
  95. return statusVal.value === "UNDERWAY"
  96. } else {
  97. return coursewareFlagVal.value && statusVal.value !== "COMPLETE"
  98. }
  99. })
  100. const curriculumDetailData = shallowRef<{
  101. pointList: any[]
  102. targetDesc: string
  103. id: string
  104. }>({
  105. pointList: [],
  106. targetDesc: "",
  107. id: ""
  108. })
  109. getCurriculumDetailData()
  110. function getCurriculumDetailData() {
  111. userStoreHook.roles === "GYM" ? getCurriculumDetailData_gym() : getCurriculumDetailData_gyt()
  112. }
  113. /* 处理管乐迷 */
  114. function getCurriculumDetailData_gym() {
  115. loading.value = true
  116. httpAjaxErrMsg(getCurrentCourseDetail_gym, props.modalData.id).then(res => {
  117. if (res.code === 200) {
  118. const { coursewareDetailId, courseStatus, teachMode } = res.data || {}
  119. statusVal.value = courseStatus
  120. teachModeVal.value = teachMode
  121. if (coursewareDetailId) {
  122. httpAjaxErrMsg(getLessonCourseDetail_gym, coursewareDetailId).then(resData => {
  123. loading.value = false
  124. if (resData.code === 200) {
  125. const { lessonTargetDesc, id, knowledgePointList } = resData.data || {}
  126. curriculumDetailData.value = {
  127. pointList: knowledgePointList || [],
  128. targetDesc: lessonTargetDesc,
  129. id
  130. }
  131. }
  132. })
  133. } else {
  134. loading.value = false
  135. }
  136. } else {
  137. loading.value = false
  138. }
  139. })
  140. }
  141. /* 处理管乐团 */
  142. function getCurriculumDetailData_gyt() {
  143. loading.value = true
  144. httpAjaxErrMsg(getCourseScheduleDetail_gyt, props.modalData.id).then(res => {
  145. if (res.code === 200) {
  146. const { lessonCoursewareDetailId, status, coursewareFlag } = res.data || {}
  147. statusVal.value = status
  148. coursewareFlagVal.value = coursewareFlag
  149. if (lessonCoursewareDetailId) {
  150. httpAjaxErrMsg(getLessonCoursewareDetail_gyt, lessonCoursewareDetailId).then(resData => {
  151. loading.value = false
  152. if (resData.code === 200) {
  153. const { lessonTargetDesc, id, knowledgePointList } = resData.data || {}
  154. curriculumDetailData.value = {
  155. pointList: knowledgePointList || [],
  156. targetDesc: lessonTargetDesc,
  157. id
  158. }
  159. }
  160. })
  161. } else {
  162. loading.value = false
  163. }
  164. } else {
  165. loading.value = false
  166. }
  167. })
  168. }
  169. // 开始上课
  170. function handleStartClass(id: string) {
  171. if (userStoreHook.roles === "GYM") {
  172. if (isONLINE_gym(teachModeVal.value)) {
  173. return
  174. }
  175. handleStartClass_gym(id)
  176. } else {
  177. handleStartClass_gyt(id)
  178. }
  179. }
  180. // 选择更换课件
  181. function handleSetUpCourseware(id: string) {
  182. useSetUpCourseware(id, () => {
  183. //选择课件成功后的回调
  184. // 刷新数据
  185. getCurriculumDetailData()
  186. })
  187. }
  188. function handleCourseClick(item: any) {
  189. const url = router.resolve({
  190. name: "coursewarePlay",
  191. params: { id: curriculumDetailData.value.id },
  192. query: {
  193. materialId: item.id
  194. }
  195. }).href
  196. window.open(url, "_blank")
  197. }
  198. </script>
  199. <style lang="scss" scoped>
  200. .curriculumDetail {
  201. width: 100%;
  202. height: 100%;
  203. padding: 20px 20px 30px 20px;
  204. display: flex;
  205. flex-direction: column;
  206. .close {
  207. position: absolute;
  208. top: -9px;
  209. right: -9px;
  210. width: 47px;
  211. height: 49px;
  212. cursor: pointer;
  213. background: url("@/img/useDialogConfirm/close.png") no-repeat;
  214. background-size: cover;
  215. z-index: 1;
  216. &:hover {
  217. background: url("@/img/useDialogConfirm/closeHover.png") no-repeat;
  218. background-size: cover;
  219. }
  220. }
  221. .curriculumDetailCon {
  222. flex-grow: 1;
  223. overflow: hidden;
  224. display: flex;
  225. position: relative;
  226. & > :deep(.el-loading-mask) {
  227. border-radius: 35px;
  228. }
  229. .imgMid {
  230. width: 62px;
  231. height: 470px;
  232. position: absolute;
  233. left: 50%;
  234. top: 50%;
  235. transform: translate(-50%, -50%);
  236. z-index: 1;
  237. }
  238. .curriculumDetailBox {
  239. width: 50%;
  240. height: 100%;
  241. background: #fff2e1;
  242. border-radius: 35px;
  243. padding: 10px;
  244. overflow: hidden;
  245. &:nth-child(3) {
  246. margin-left: 10px;
  247. }
  248. .teachingObjectives,
  249. .knowledgePoints {
  250. width: 100%;
  251. height: 100%;
  252. background: #ffffff;
  253. border-radius: 35px;
  254. .content {
  255. position: relative;
  256. padding-top: 18px;
  257. padding-left: 18px;
  258. height: calc(100% - 57px);
  259. & > :deep(.elScrollbar) {
  260. .el-scrollbar__view {
  261. width: 100%;
  262. }
  263. .el-scrollbar__wrap {
  264. overflow-x: hidden;
  265. }
  266. }
  267. &:deep(.empty) {
  268. position: absolute;
  269. top: 50%;
  270. left: 50%;
  271. transform: translate(-50%, -50%);
  272. .el-empty__image {
  273. width: 278px;
  274. }
  275. }
  276. }
  277. }
  278. .teachingObjectives {
  279. padding: 16px 16px 20px;
  280. .head {
  281. width: 100%;
  282. height: 57px;
  283. background: #fff2e1;
  284. border-radius: 12px;
  285. display: flex;
  286. justify-content: space-between;
  287. align-items: center;
  288. padding: 0 18px;
  289. .leftTit {
  290. display: flex;
  291. align-items: center;
  292. & > img {
  293. width: 27px;
  294. height: 27px;
  295. }
  296. & > div {
  297. margin-left: 8px;
  298. font-weight: 500;
  299. font-size: 24px;
  300. color: #333333;
  301. }
  302. }
  303. .rightBtn {
  304. display: flex;
  305. align-items: center;
  306. cursor: pointer;
  307. &:hover {
  308. opacity: $opacity-hover;
  309. }
  310. & > img {
  311. margin-left: 4px;
  312. width: 10px;
  313. height: 17px;
  314. }
  315. & > div {
  316. margin-left: 8px;
  317. font-weight: 500;
  318. font-size: 20px;
  319. color: #f67146;
  320. }
  321. }
  322. }
  323. .title {
  324. line-height: 34px;
  325. font-weight: 400;
  326. font-size: 18px;
  327. color: #333333;
  328. }
  329. }
  330. .knowledgePoints {
  331. padding: 16px 0 20px 16px;
  332. .head {
  333. margin-right: 33px;
  334. height: 57px;
  335. background: #fff2e1;
  336. border-radius: 12px;
  337. display: flex;
  338. align-items: center;
  339. padding: 0 18px;
  340. .points {
  341. display: flex;
  342. align-items: center;
  343. & > img {
  344. width: 28px;
  345. height: 27px;
  346. }
  347. & > div {
  348. margin-left: 8px;
  349. font-weight: 500;
  350. font-size: 24px;
  351. color: #333333;
  352. }
  353. }
  354. }
  355. .content {
  356. & > :deep(.elScrollbar) {
  357. .el-scrollbar__view {
  358. padding-right: 33px;
  359. }
  360. }
  361. }
  362. }
  363. }
  364. }
  365. .curriculumStart {
  366. flex-shrink: 0;
  367. padding-top: 20px;
  368. display: flex;
  369. justify-content: center;
  370. .startBtn {
  371. width: 363px;
  372. height: 68px;
  373. background: linear-gradient(180deg, #ffffff 0%, #ffdbc1 100%);
  374. box-shadow: 4px 6px 0px 0px rgba(236, 102, 52, 0.45), inset 0px -8px 3px 0px rgba(254, 163, 138, 0.46);
  375. border-radius: 41px;
  376. font-weight: 500;
  377. font-size: 24px;
  378. color: #f67146;
  379. line-height: 68px;
  380. text-align: center;
  381. cursor: pointer;
  382. &:hover {
  383. opacity: $opacity-hover;
  384. }
  385. }
  386. }
  387. }
  388. </style>
  389. <style lang="scss">
  390. .h-modalFrame.curriculumDetail {
  391. /* prettier-ignore */
  392. --modalFrameTitHeight: 0PX;
  393. .modalFrameBox {
  394. background: linear-gradient(180deg, #ffdd5d 0%, #ffb93b 100%);
  395. border-radius: 57px;
  396. box-shadow: none;
  397. .modalFrameTitle {
  398. display: none;
  399. }
  400. }
  401. }
  402. </style>