curriculumDetail.vue 13 KB

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