curriculumDetail.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413
  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. .el-scrollbar__bar.is-vertical {
  267. width: 5px;
  268. right: 1px;
  269. }
  270. }
  271. &:deep(.empty) {
  272. position: absolute;
  273. top: 50%;
  274. left: 50%;
  275. transform: translate(-50%, -50%);
  276. .el-empty__image {
  277. width: 278px;
  278. }
  279. }
  280. }
  281. }
  282. .teachingObjectives {
  283. padding: 16px 16px 20px;
  284. .head {
  285. width: 100%;
  286. height: 57px;
  287. background: #fff2e1;
  288. border-radius: 12px;
  289. display: flex;
  290. justify-content: space-between;
  291. align-items: center;
  292. padding: 0 18px;
  293. .leftTit {
  294. display: flex;
  295. align-items: center;
  296. & > img {
  297. width: 27px;
  298. height: 27px;
  299. }
  300. & > div {
  301. margin-left: 8px;
  302. font-weight: 500;
  303. font-size: 24px;
  304. color: #333333;
  305. }
  306. }
  307. .rightBtn {
  308. display: flex;
  309. align-items: center;
  310. cursor: pointer;
  311. &:hover {
  312. opacity: $opacity-hover;
  313. }
  314. & > img {
  315. margin-left: 4px;
  316. width: 10px;
  317. height: 17px;
  318. }
  319. & > div {
  320. margin-left: 8px;
  321. font-weight: 500;
  322. font-size: 20px;
  323. color: #f67146;
  324. }
  325. }
  326. }
  327. .title {
  328. line-height: 34px;
  329. font-weight: 400;
  330. font-size: 18px;
  331. color: #333333;
  332. }
  333. }
  334. .knowledgePoints {
  335. padding: 16px 0 20px 16px;
  336. .head {
  337. margin-right: 33px;
  338. height: 57px;
  339. background: #fff2e1;
  340. border-radius: 12px;
  341. display: flex;
  342. align-items: center;
  343. padding: 0 18px;
  344. .points {
  345. display: flex;
  346. align-items: center;
  347. & > img {
  348. width: 28px;
  349. height: 27px;
  350. }
  351. & > div {
  352. margin-left: 8px;
  353. font-weight: 500;
  354. font-size: 24px;
  355. color: #333333;
  356. }
  357. }
  358. }
  359. .content {
  360. & > :deep(.elScrollbar) {
  361. .el-scrollbar__view {
  362. padding-right: 33px;
  363. }
  364. }
  365. }
  366. }
  367. }
  368. }
  369. .curriculumStart {
  370. flex-shrink: 0;
  371. padding-top: 20px;
  372. display: flex;
  373. justify-content: center;
  374. .startBtn {
  375. width: 363px;
  376. height: 68px;
  377. background: linear-gradient(180deg, #ffffff 0%, #ffdbc1 100%);
  378. box-shadow: 4px 6px 0px 0px rgba(236, 102, 52, 0.45), inset 0px -8px 3px 0px rgba(254, 163, 138, 0.46);
  379. border-radius: 41px;
  380. font-weight: 500;
  381. font-size: 24px;
  382. color: #f67146;
  383. line-height: 68px;
  384. text-align: center;
  385. cursor: pointer;
  386. &:hover {
  387. opacity: $opacity-hover;
  388. }
  389. }
  390. }
  391. }
  392. </style>
  393. <style lang="scss">
  394. .h-modalFrame.curriculumDetail {
  395. /* prettier-ignore */
  396. --modalFrameTitHeight: 0PX;
  397. .modalFrameBox {
  398. background: linear-gradient(180deg, #ffdd5d 0%, #ffb93b 100%);
  399. border-radius: 57px;
  400. box-shadow: none;
  401. .modalFrameTitle {
  402. display: none;
  403. }
  404. }
  405. }
  406. </style>