123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293 |
- <template>
- <view style="margin: 20rpx 0;">
- <view class="title" @click="openModule(menuItem)">
- <image src="/static/icon/up1.png" class="icon_up" v-if="down"></image>
- <image src="/static/icon/down1.png" class="icon_up" v-if="!down"></image>
- <text style="margin-left: 10rpx;">{{menuItem.name}}</text>
- </view>
- <view v-if="!down">
- <view v-for="(itemM,indexM) in list" >
- <courseChapter :isBuy="isBuy" :isRebuild="isRebuild" :menuItem="itemM" :levelId="levelId+'-'+itemM.chapterId"></courseChapter>
- <u-line v-if="indexM<list.length-1"></u-line>
- </view>
- </view>
- </view>
- </template>
- <script>
- import courseChapter from '@/components/course/courseChapter.vue';
- export default {
- name: 'courseModule',
- props: {
- menuItem: {
- type: Object,
- default: {}
- },
- isBuy: {
- type: Boolean,
- default: false
- },
- levelId: {
- type: String,
- default: ""
- },
- isRebuild: {
- type: Boolean,
- default: false
- }
- },
- components: {
- courseChapter
- },
- data() {
- return {
- down:true,
- list:[]
- };
- },
- onLoad() {},
- created() {
-
- },
- mounted() {
-
- },
- methods: {
- openModule(item){
- this.down = !this.down
- if(!this.down&&this.list.length==0){
- this.getChapterList(item.id)
- }
- },
- getChapterList(moduleId) {
- let self = this
- this.$api.chapterList(moduleId).then(res => {
- if(res.data.code==200){
- for(let i=0;i<res.data.data.length;i++){
- let item = res.data.data[i]
- item.id = item.chapterId
-
- }
- self.list = res.data.data
- }
- });
- },
- }
- };
- </script>
- <style scoped>
- .icon_up{
- width: 24rpx;
- height: 24rpx;
- }
- .title{
- font-size: 30rpx;
- font-family: PingFang SC;
- font-weight: bold;
- color: #333333;
- white-space:nowrap;
- overflow:hidden;
- text-overflow:ellipsis;
- }
- </style>
|