123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257 |
- <template>
- <view>
- <view class="cover">
- <image class="image" :src="detail.cover || ''" mode="aspectFill" />
- </view>
- <view class="head">
- <view class="title">{{ detail.title || '--' }}</view>
- <view class="text">
- <view class="teacher">讲师:{{ detail.teacher || ' --' }}</view>
- <view class="count">共{{ detail.courseware_count || 0 }}个课件 | {{ detail.study_count || 1 }}人已学习</view>
- </view>
- </view>
- <view style="height: 10px;" />
- <view class="tabs">
- <view class="tab-item" :class="tabsActive == '目录' ? 'active' : ''" @click="tabsActive = '目录'">
- 目录
- </view>
- <view class="tab-item" :class="tabsActive == '介绍' ? 'active' : ''" @click="tabsActive = '介绍'">
- 介绍
- </view>
- </view>
- <My_listbox v-show="tabsActive == '目录'" ref="List" @getlist="getList" boxBackground="#fff">
- <view class="catalog">
- <navigator class="item" :url="'/packageA/course/detail?id=' + item.sat_coursewaredetailid"
- v-for="item in list" :key="item.sat_coursewaredetailid">
- <view class="cover">
- <view class="u-icon" v-if="item.filetype == '视频' || item.filetype == '音频'">
- <u-icon name="play-right-fill" color="#FFFFFF" size="30" />
- </view>
- <image class="image" :src="item.cover" mode="aspectFill" lazy-load="true" />
- </view>
- <view class="title u-line-2">
- {{ item.title || '--' }}
- </view>
- </navigator>
- </view>
- </My_listbox>
- <My_listbox v-if="tabsActive == '介绍'" :pullDown="false" boxBackground="#fff">
- <view class="introduce">
- <view class="title">
- 课程介绍
- </view>
- <view class="description">
- {{ detail.description || '--' }}
- </view>
- </view>
- </My_listbox>
- </view>
- </template>
- <script>
- export default {
- data() {
- return {
- tabsActive: "目录",
- list: [],
- detail: {},
- "content": {
- "sat_coursewareid": 0,
- "where": {
- "condition": "",
- "status": ""
- }
- }
- }
- },
- onLoad(options) {
- this.content.sat_coursewareid = options.id;
- this.getList(true)
- this.$Http.basic({
- "id": 20240314134002,
- "content": {
- "sat_coursewareid": options.id
- }
- }).then(res => {
- console.log("获取课程详情", res)
- if (this.cutoff(res.msg)) return;
- res.data.cover = this.getSpecifiedImage(res.data.attinfos[0] || {})
- this.detail = res.data;
- uni.setNavigationBarTitle({
- title: res.data.title,
- })
- })
- },
- methods: {
- getList(init = false) {
- if (this.paging(this.content, init)) return;
- this.$Http.basic({
- "id": 20240315131602,
- content: this.content
- }).then(res => {
- this.$refs.List.RefreshToComplete()
- console.log("获取课件列表", res)
- if (this.cutoff(res.msg)) return;
- res.data = res.data.map(v => {
- v.cover = v.attinfos.length ? this.getSpecifiedImage(v.attinfos.find(s => s.usetype == "avatar") || v.attinfos[0]) : ''
- return v
- })
- this.list = res.pageNumber == 1 ? res.data : this.list.concat(res.data);
- this.content = this.$refs.List.paging(this.content, res)
- })
- }
- }
- }
- </script>
- <style lang="scss">
- .cover {
- width: 375px;
- height: 229px;
- background: #FFFFFF;
- box-sizing: border-box;
- overflow: hidden;
- .image {
- width: 375px;
- height: 229px;
- }
- }
- .head {
- padding: 10px;
- box-sizing: border-box;
- background: #fff;
- .title {
- line-height: 24px;
- font-family: Source Han Sans SC, Source Han Sans SC;
- font-weight: bold;
- font-size: 16px;
- color: #000000;
- }
- .text {
- display: flex;
- justify-content: space-between;
- align-items: flex-end;
- font-family: Source Han Sans SC, Source Han Sans SC;
- margin-top: 10px;
- .teacher {
- font-size: 14px;
- color: #999999;
- }
- .count {
- font-size: 12px;
- color: #666666;
- }
- }
- }
- .tabs {
- display: flex;
- align-items: center;
- justify-content: space-around;
- box-sizing: border-box;
- padding: 0 20px;
- width: 375px;
- height: 50px;
- background: #FFFFFF;
- .tab-item {
- line-height: 20px;
- font-family: Source Han Sans SC, Source Han Sans SC;
- font-size: 14px;
- color: #333333;
- padding: 10px;
- border-radius: 8px;
- }
- .active {
- position: relative;
- font-weight: bold;
- color: #C30D23;
- }
- .active::after {
- position: absolute;
- content: "";
- width: 14px;
- height: 3px;
- background: #C30D23;
- border-radius: 5px;
- bottom: 0;
- left: 50%;
- margin-left: -7px;
- }
- }
- .catalog {
- padding: 10px;
- display: flex;
- flex-wrap: wrap;
- justify-content: space-between;
- .item {
- flex-shrink: 0;
- margin-bottom: 10px;
- border-radius: 5px;
- .cover {
- position: relative;
- width: 173px;
- height: 106px;
- border-radius: 5px;
- overflow: hidden;
- .u-icon {
- position: absolute;
- display: flex;
- align-items: center;
- justify-content: center;
- width: 100%;
- height: 100%;
- z-index: 9999999;
- opacity: .9;
- }
- .image {
- width: 100%;
- height: 100%;
- }
- }
- .title {
- height: 34px;
- font-size: 12px;
- color: #333333;
- line-height: 17px;
- margin-top: 10px;
- width: 173px;
- }
- }
- }
- .introduce {
- padding: 10px;
- .title {
- line-height: 20px;
- font-family: Source Han Sans SC, Source Han Sans SC;
- font-weight: bold;
- font-size: 14px;
- color: #333333;
- }
- .description {
- font-size: 14px;
- color: #333333;
- line-height: 24px;
- }
- }
- </style>
|