123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396 |
- <template>
- <div class="template_details">
- <div
- v-if="isData && CourseData.is_release === 'true' && CourseData.is_deleted === 'false'"
- v-loading="loading"
- class="details_container"
- >
- <header class="title">{{ CourseData.name }}</header>
- <main class="main">
- <div v-for="(item, i) in CourseData.cs_item_list" :key="i" class="course-list">
- <div class="courseOne">
- <div class="title">
- <div>
- <span>{{ i + 1 }}.</span>
- <span>{{ item.name }}</span>
- </div>
- <div class="courseOne-time">{{ item.begin_time }} ~ {{ item.end_time }}</div>
- </div>
- </div>
- <div class="course-content">
- <el-collapse @change="handleChange(item.id)">
- <el-collapse-item :name="item.id">
- <div slot="title" class="Coursetasks">
- {{ $t('Key392') }}
- <img
- class="arrow"
- :src="
- openList.includes(item.id)
- ? require('../../assets/course_details/open1.png')
- : require('../../assets/course_details/open2.png')
- "
- />
- </div>
- <div class="courseContent">
- <template v-for="li in courseContentList">
- <div v-if="item[li.id].length > 0" :key="li.id" class="tasks">
- <div class="title">
- <span class="red-circle" /><span>{{ $t(li.name) }}</span>
- </div>
- <div class="content">
- <el-collapse-item v-for="(it, it_i) in item[li.id]" :key="it_i" :name="it.id">
- <div slot="title" :class="openList.includes(it.id) ? 'contenttitle2' : 'contenttitle'">
- <span :title="it.name">{{ it.name }}</span>
- <!-- <span class="content-image">
- <el-image :src="require('@/assets/course_details/people.png')" />
- </span> -->
- <span>
- <span class="gray">{{ it.begin_time }} ~ {{ it.end_time }}</span>
- <span class="gray">···</span>
- </span>
- </div>
- <div class="detail">
- <div>
- <span>{{ $t('Key393') }}</span>
- <p>
- {{ it.content }}
- </p>
- </div>
- <div v-if="it.courseware_list.length > 0">
- <span>{{ $t('Key309') }}</span>
- <div>
- <div
- v-for="(courseware, courseware_i) in it.courseware_list"
- :key="courseware_i"
- class="btn"
- >
- <img src="../../assets/course_details/file.png" alt="" />
- <span> {{ courseware.courseware_name }} </span>
- </div>
- </div>
- </div>
- <div v-if="it.accessory_list.length > 0">
- <span>{{ $t('Key394') }}</span>
- <div>
- <div
- v-for="(accessory, accessory_i) in it.accessory_list"
- :key="accessory_i"
- class="btn"
- >
- <img src="../../assets/course_details/fileType1.png" alt="" />
- <span> {{ accessory.file_name }} </span>
- </div>
- </div>
- </div>
- </div>
- </el-collapse-item>
- </div>
- </div>
- </template>
- </div>
- </el-collapse-item>
- </el-collapse>
- </div>
- </div>
- </main>
- </div>
- <div v-else-if="!loading" class="non-existent">
- {{
- CourseData.is_deleted === 'true'
- ? '无法查看,课程已删除'
- : CourseData.is_release === 'false'
- ? '无法查看,课程已下架'
- : '课程不存在'
- }}
- </div>
- </div>
- </template>
- <script>
- import { GetCourseInfoBox } from '@/api/course';
- export default {
- data() {
- const query = this.$route.query;
- return {
- id: query.id,
- CourseData: null,
- isData: false,
- loading: true,
- openList: [],
- courseContentList: [
- { id: 'pre_task_list', name: 'Key353' },
- { id: 'mid_task_list', name: 'Key354' },
- { id: 'after_task_list', name: 'Key355' }
- ]
- };
- },
- created() {
- GetCourseInfoBox({ id: this.id })
- .then(res => {
- this.CourseData = res;
- this.isData = 'id' in res;
- this.loading = false;
- })
- .catch(() => {
- this.loading = false;
- });
- },
- methods: {
- // 课程任务的打开和关闭
- handleChange(val) {
- this.openList.includes(val) ? this.openList.splice(this.openList.indexOf(val), 1) : this.openList.push(val);
- }
- }
- };
- </script>
- <style lang="scss" scoped>
- .template_details {
- min-height: 100%;
- padding: 52px 0 20px;
- background: #e5e5e5;
- .details_container {
- display: flex;
- flex-direction: column;
- row-gap: 24px;
- width: 1200px;
- min-height: calc(100vh - 168px);
- margin: 0 auto;
- }
- header.title {
- font-size: 20px;
- font-weight: 700;
- &::before {
- display: inline-block;
- width: 4px;
- height: 13px;
- margin-right: 16px;
- content: '';
- background-color: $basic-color;
- }
- }
- .main {
- flex: 1;
- width: 100%;
- padding: 40px;
- background-color: #fff;
- border-radius: 8px;
- .course-list {
- font-size: 18px;
- background: #fff;
- & + .course-list {
- margin-top: 30px;
- }
- > :not(.courseOne) {
- padding-left: 40px;
- margin-top: 16px;
- }
- .courseOne {
- .title {
- display: flex;
- justify-content: space-between;
- > div:nth-child(1) {
- font-size: 20px;
- font-weight: bold;
- span {
- margin-right: 24px;
- }
- }
- }
- &-time {
- color: #737373;
- }
- }
- .course-content {
- width: 670px;
- }
- .Coursetasks {
- display: flex;
- align-items: center;
- font-size: 16px;
- cursor: pointer;
- .arrow {
- width: 24px;
- margin-left: 8px;
- }
- }
- .courseContent {
- .tasks {
- padding-left: 10px;
- .title {
- font-size: 16px;
- color: #2c2c2c;
- .red-circle {
- position: relative;
- right: 3px;
- display: inline-block;
- width: 8px;
- height: 8px;
- margin-right: 16px;
- background: #fe6d68;
- border-radius: 50%;
- }
- }
- .content {
- padding-bottom: 10px;
- padding-left: 20px;
- margin-top: 16px;
- border-left: 1px solid #fe6d68;
- %contenttitle,
- .contenttitle {
- display: flex;
- align-items: center;
- justify-content: space-between;
- width: 670px;
- padding: 0 10px;
- font-size: 16px;
- cursor: pointer;
- background: #fff;
- border: 1px solid #e6e6e6;
- border-radius: 8px;
- img {
- width: 16px;
- margin-left: 8px;
- }
- .content-image {
- .el-image {
- width: 16px;
- height: 16px;
- vertical-align: middle;
- }
- }
- span {
- margin-left: 16px;
- }
- > span:first-child {
- width: 180px;
- overflow: hidden;
- text-overflow: ellipsis;
- white-space: nowrap;
- }
- .gray {
- opacity: 0.5;
- }
- }
- .contenttitle2 {
- @extend %contenttitle;
- background: #f9f9f9;
- border-bottom-right-radius: 0;
- border-bottom-left-radius: 0;
- }
- .detail {
- width: 100%;
- padding-bottom: 24px;
- background: #fff;
- border: 1px solid #e7e7e7;
- border-bottom-right-radius: 8px;
- border-bottom-left-radius: 8px;
- box-shadow: 0 2px 8px rgba(0, 0, 0, 10%);
- > div {
- display: flex;
- align-items: center;
- margin-top: 24px;
- > :nth-child(1) {
- width: 78px;
- min-width: 78px;
- margin-left: 24px;
- font-size: 16px;
- color: #000;
- }
- > :nth-child(2) {
- margin-left: 16px;
- img {
- width: 24px;
- }
- .btn {
- display: flex;
- align-items: center;
- width: 270px;
- height: 40px;
- cursor: pointer;
- background: #fff;
- border: 1px solid #dbdbdb;
- border-radius: 4px;
- img {
- margin-right: 8px;
- margin-left: 16px;
- }
- }
- .btn:not(:nth-child(1)) {
- margin-top: 8px;
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
- </style>
- <style lang="scss">
- .el-collapse {
- width: 670px;
- border-style: none;
- &-item + &-item {
- margin-top: 12px;
- }
- .el-collapse-item__header {
- border-style: none;
- .l-collapse-item__arrow,
- .el-icon-arrow-right {
- display: none;
- }
- }
- .el-collapse-item__wrap {
- border-style: none;
- }
- .el-collapse-item__content {
- padding-bottom: 0;
- }
- }
- </style>
|