index.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396
  1. <template>
  2. <div class="template_details">
  3. <div
  4. v-if="isData && CourseData.is_release === 'true' && CourseData.is_deleted === 'false'"
  5. v-loading="loading"
  6. class="details_container"
  7. >
  8. <header class="title">{{ CourseData.name }}</header>
  9. <main class="main">
  10. <div v-for="(item, i) in CourseData.cs_item_list" :key="i" class="course-list">
  11. <div class="courseOne">
  12. <div class="title">
  13. <div>
  14. <span>{{ i + 1 }}.</span>
  15. <span>{{ item.name }}</span>
  16. </div>
  17. <div class="courseOne-time">{{ item.begin_time }} ~ {{ item.end_time }}</div>
  18. </div>
  19. </div>
  20. <div class="course-content">
  21. <el-collapse @change="handleChange(item.id)">
  22. <el-collapse-item :name="item.id">
  23. <div slot="title" class="Coursetasks">
  24. {{ $t('Key392') }}
  25. <img
  26. class="arrow"
  27. :src="
  28. openList.includes(item.id)
  29. ? require('../../assets/course_details/open1.png')
  30. : require('../../assets/course_details/open2.png')
  31. "
  32. />
  33. </div>
  34. <div class="courseContent">
  35. <template v-for="li in courseContentList">
  36. <div v-if="item[li.id].length > 0" :key="li.id" class="tasks">
  37. <div class="title">
  38. <span class="red-circle" /><span>{{ $t(li.name) }}</span>
  39. </div>
  40. <div class="content">
  41. <el-collapse-item v-for="(it, it_i) in item[li.id]" :key="it_i" :name="it.id">
  42. <div slot="title" :class="openList.includes(it.id) ? 'contenttitle2' : 'contenttitle'">
  43. <span :title="it.name">{{ it.name }}</span>
  44. <!-- <span class="content-image">
  45. <el-image :src="require('@/assets/course_details/people.png')" />
  46. </span> -->
  47. <span>
  48. <span class="gray">{{ it.begin_time }} ~ {{ it.end_time }}</span>
  49. <span class="gray">···</span>
  50. </span>
  51. </div>
  52. <div class="detail">
  53. <div>
  54. <span>{{ $t('Key393') }}</span>
  55. <p>
  56. {{ it.content }}
  57. </p>
  58. </div>
  59. <div v-if="it.courseware_list.length > 0">
  60. <span>{{ $t('Key309') }}</span>
  61. <div>
  62. <div
  63. v-for="(courseware, courseware_i) in it.courseware_list"
  64. :key="courseware_i"
  65. class="btn"
  66. >
  67. <img src="../../assets/course_details/file.png" alt="" />
  68. <span> {{ courseware.courseware_name }} </span>
  69. </div>
  70. </div>
  71. </div>
  72. <div v-if="it.accessory_list.length > 0">
  73. <span>{{ $t('Key394') }}</span>
  74. <div>
  75. <div
  76. v-for="(accessory, accessory_i) in it.accessory_list"
  77. :key="accessory_i"
  78. class="btn"
  79. >
  80. <img src="../../assets/course_details/fileType1.png" alt="" />
  81. <span> {{ accessory.file_name }} </span>
  82. </div>
  83. </div>
  84. </div>
  85. </div>
  86. </el-collapse-item>
  87. </div>
  88. </div>
  89. </template>
  90. </div>
  91. </el-collapse-item>
  92. </el-collapse>
  93. </div>
  94. </div>
  95. </main>
  96. </div>
  97. <div v-else-if="!loading" class="non-existent">
  98. {{
  99. CourseData.is_deleted === 'true'
  100. ? '无法查看,课程已删除'
  101. : CourseData.is_release === 'false'
  102. ? '无法查看,课程已下架'
  103. : '课程不存在'
  104. }}
  105. </div>
  106. </div>
  107. </template>
  108. <script>
  109. import { GetCourseInfoBox } from '@/api/course';
  110. export default {
  111. data() {
  112. const query = this.$route.query;
  113. return {
  114. id: query.id,
  115. CourseData: null,
  116. isData: false,
  117. loading: true,
  118. openList: [],
  119. courseContentList: [
  120. { id: 'pre_task_list', name: 'Key353' },
  121. { id: 'mid_task_list', name: 'Key354' },
  122. { id: 'after_task_list', name: 'Key355' }
  123. ]
  124. };
  125. },
  126. created() {
  127. GetCourseInfoBox({ id: this.id })
  128. .then(res => {
  129. this.CourseData = res;
  130. this.isData = 'id' in res;
  131. this.loading = false;
  132. })
  133. .catch(() => {
  134. this.loading = false;
  135. });
  136. },
  137. methods: {
  138. // 课程任务的打开和关闭
  139. handleChange(val) {
  140. this.openList.includes(val) ? this.openList.splice(this.openList.indexOf(val), 1) : this.openList.push(val);
  141. }
  142. }
  143. };
  144. </script>
  145. <style lang="scss" scoped>
  146. .template_details {
  147. min-height: 100%;
  148. padding: 52px 0 20px;
  149. background: #e5e5e5;
  150. .details_container {
  151. display: flex;
  152. flex-direction: column;
  153. row-gap: 24px;
  154. width: 1200px;
  155. min-height: calc(100vh - 168px);
  156. margin: 0 auto;
  157. }
  158. header.title {
  159. font-size: 20px;
  160. font-weight: 700;
  161. &::before {
  162. display: inline-block;
  163. width: 4px;
  164. height: 13px;
  165. margin-right: 16px;
  166. content: '';
  167. background-color: $basic-color;
  168. }
  169. }
  170. .main {
  171. flex: 1;
  172. width: 100%;
  173. padding: 40px;
  174. background-color: #fff;
  175. border-radius: 8px;
  176. .course-list {
  177. font-size: 18px;
  178. background: #fff;
  179. & + .course-list {
  180. margin-top: 30px;
  181. }
  182. > :not(.courseOne) {
  183. padding-left: 40px;
  184. margin-top: 16px;
  185. }
  186. .courseOne {
  187. .title {
  188. display: flex;
  189. justify-content: space-between;
  190. > div:nth-child(1) {
  191. font-size: 20px;
  192. font-weight: bold;
  193. span {
  194. margin-right: 24px;
  195. }
  196. }
  197. }
  198. &-time {
  199. color: #737373;
  200. }
  201. }
  202. .course-content {
  203. width: 670px;
  204. }
  205. .Coursetasks {
  206. display: flex;
  207. align-items: center;
  208. font-size: 16px;
  209. cursor: pointer;
  210. .arrow {
  211. width: 24px;
  212. margin-left: 8px;
  213. }
  214. }
  215. .courseContent {
  216. .tasks {
  217. padding-left: 10px;
  218. .title {
  219. font-size: 16px;
  220. color: #2c2c2c;
  221. .red-circle {
  222. position: relative;
  223. right: 3px;
  224. display: inline-block;
  225. width: 8px;
  226. height: 8px;
  227. margin-right: 16px;
  228. background: #fe6d68;
  229. border-radius: 50%;
  230. }
  231. }
  232. .content {
  233. padding-bottom: 10px;
  234. padding-left: 20px;
  235. margin-top: 16px;
  236. border-left: 1px solid #fe6d68;
  237. %contenttitle,
  238. .contenttitle {
  239. display: flex;
  240. align-items: center;
  241. justify-content: space-between;
  242. width: 670px;
  243. padding: 0 10px;
  244. font-size: 16px;
  245. cursor: pointer;
  246. background: #fff;
  247. border: 1px solid #e6e6e6;
  248. border-radius: 8px;
  249. img {
  250. width: 16px;
  251. margin-left: 8px;
  252. }
  253. .content-image {
  254. .el-image {
  255. width: 16px;
  256. height: 16px;
  257. vertical-align: middle;
  258. }
  259. }
  260. span {
  261. margin-left: 16px;
  262. }
  263. > span:first-child {
  264. width: 180px;
  265. overflow: hidden;
  266. text-overflow: ellipsis;
  267. white-space: nowrap;
  268. }
  269. .gray {
  270. opacity: 0.5;
  271. }
  272. }
  273. .contenttitle2 {
  274. @extend %contenttitle;
  275. background: #f9f9f9;
  276. border-bottom-right-radius: 0;
  277. border-bottom-left-radius: 0;
  278. }
  279. .detail {
  280. width: 100%;
  281. padding-bottom: 24px;
  282. background: #fff;
  283. border: 1px solid #e7e7e7;
  284. border-bottom-right-radius: 8px;
  285. border-bottom-left-radius: 8px;
  286. box-shadow: 0 2px 8px rgba(0, 0, 0, 10%);
  287. > div {
  288. display: flex;
  289. align-items: center;
  290. margin-top: 24px;
  291. > :nth-child(1) {
  292. width: 78px;
  293. min-width: 78px;
  294. margin-left: 24px;
  295. font-size: 16px;
  296. color: #000;
  297. }
  298. > :nth-child(2) {
  299. margin-left: 16px;
  300. img {
  301. width: 24px;
  302. }
  303. .btn {
  304. display: flex;
  305. align-items: center;
  306. width: 270px;
  307. height: 40px;
  308. cursor: pointer;
  309. background: #fff;
  310. border: 1px solid #dbdbdb;
  311. border-radius: 4px;
  312. img {
  313. margin-right: 8px;
  314. margin-left: 16px;
  315. }
  316. }
  317. .btn:not(:nth-child(1)) {
  318. margin-top: 8px;
  319. }
  320. }
  321. }
  322. }
  323. }
  324. }
  325. }
  326. }
  327. }
  328. }
  329. </style>
  330. <style lang="scss">
  331. .el-collapse {
  332. width: 670px;
  333. border-style: none;
  334. &-item + &-item {
  335. margin-top: 12px;
  336. }
  337. .el-collapse-item__header {
  338. border-style: none;
  339. .l-collapse-item__arrow,
  340. .el-icon-arrow-right {
  341. display: none;
  342. }
  343. }
  344. .el-collapse-item__wrap {
  345. border-style: none;
  346. }
  347. .el-collapse-item__content {
  348. padding-bottom: 0;
  349. }
  350. }
  351. </style>