123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295 |
- <template>
- <!-- style="margin: 20rpx 0;" -->
- <view>
- <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 class="title_name" style="margin-left: 10rpx;">{{menuItem.name}}</text>
- <view>
- <image src="/static/icon/up.png" class="icon_up" v-if="down"></image>
- <image src="/static/icon/down.png" class="icon_up" v-if="!down"></image>
- </view>
- </view>
- <view v-show="!down">
- <view v-for="(itemM,indexM) in list" :key="indexM">
- <!-- v-if='itemM.type != 2' -->
- <courseChapter v-if='itemM.type != 2' :orderGoodsId="orderGoodsId"
- :isLive="isLive" :preItem="list[indexM - 1] || preItem" :sectionMaxNum="sectionMaxNum" :needOpen="needOpen" @playEnd="playEnd($event)"
- @toDo="toDo($event)" :courseId="courseId" :learningOrder="learningOrder" :goodsId="goodsId" :isBuy="isBuy" :gradeId="gradeId"
- :isRebuild="isRebuild" :menuItem="itemM" :levelId="levelId+'-'+itemM.chapterId">
- </courseChapter>
- <u-line v-if="indexM<list.length-1"></u-line>
- <view v-if="itemM.type == 2">
- <view
- class="examBox"
- @click="
- toDoModuleExam(
- itemM.typeId,
- goodsId,
- itemM.moduleId,
- itemM.chapterId,
- itemM,
- indexM
- )
- "
- >
- <view class="exam">
- <view class="eTag">{{
- itemM.doType == 1 ? "练习" : "考试"
- }}</view>
- <view style="margin-left: 15rpx; flex: 1">{{ itemM.name }}</view>
- </view>
-
- <view>
- <view
- :class="{
- tagGreen: itemM.learning == 1,
- tagRe: itemM.learning == 0 || itemM.rebuild > 0,
- }"
- >
-
- <text v-if="itemM.learning == 1">合格</text>
- <text v-else>不合格</text>
- </view>
- </view>
- </view>
- </view>
-
- </view>
- </view>
- </view>
- </template>
- <script>
- import { mapGetters } from "vuex";
- import courseChapter from "@/components/course/courseChapter.vue";
- export default {
- name: 'courseModule',
- props: {
- isLive:false,
- orderGoodsId:{
- default:0
- },
- preItem:{
- default:undefined
- },
- learningOrder:{ //是否设置学习顺序 1 章节顺序 0不设置 2从头学到尾顺序
- type:Number,
- defaule:0
- },
- needOpen:{ //是否默认展开
- type:Boolean,
- default:false,
- },
- menuItem: {
- type: Object,
- default: {}
- },
- goodsId: {
- type: Number,
- default: 0
- },
- courseId: {
- type: Number,
- default: 0
- },
- isBuy: { //是否是已购买商品
- type: Boolean,
- default: false
- },
- levelId: {
- type: String,
- default: ""
- },
- isRebuild: { //是否重修目录
- type: Boolean,
- default: false
- },
- gradeId: { //重修需要班级ID
- type: Number,
- default: 0
- },
- sectionMaxNum:{
- default:undefined
- },
- // 商品类型 1视频2题库 3补考 4前培 5虚拟赠送题库 6直播
- goodsType: {
- type: [Number, String],
- default: 0,
- },
- },
- components: {
- courseChapter
- },
- data() {
- return {
- down:true,
- list:[],
- };
- },
- onLoad() {},
- created() {
-
- },
- mounted() {
- if(this.needOpen && this.chapterOpen) {
- this.openModule(this.menuItem)
- }
- },
- methods: {
- playEnd(isRebuild) {
- this.$emit('playEnd',{isRebuild:isRebuild.isRebuild})
- },
- toDo(item) {
- this.$emit('toDo',item)
- },
- openModule(item){
- this.down = !this.down
- if(!this.down&&this.list.length==0){
- if(this.isBuy){
- if(this.isRebuild){
- this.getReChapterList(item.id,item.courseId)
- }else{
- this.getBuyChapterList(item.id,item.courseId) //已购买目录
- }
- }else{
- this.getChapterList(item.id) //未购买目录
- }
-
- }
- },
- getChapterList(moduleId) {
- let self = this
- // url: '/app/common/course/chapterList/'+data,
- 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
- item.menuType = 2;
- }
- self.list = res.data.data
- }
- });
- },
- getReChapterList(moduleId,courseId) {
- let self = this
- this.$api.reChapterList({moduleId:moduleId,gradeId:this.gradeId,courseId:courseId,rebuild:1}).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
- }
- });
- },
- getBuyChapterList(moduleId,courseId) {
- let self = this
- this.$api.reChapterList({moduleId:moduleId,gradeId:this.gradeId,courseId:courseId}).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
- item.menuType = 2;
- }
- self.list = res.data.data
- }
- });
- },
- /**
- * 去做题
- */
- async toDoModuleExam(id, goodsId = 0, moduleId = 0, chapterId = 0, item, index) {
- uni.navigateTo({
- url:
- "/pages2/class/questionBank?courseId=" +
- this.courseId +
- "&gradeId=" +
- this.gradeId +
- "&isFromVideo=1&id=" +
- id +
- "&goodsid=" +
- goodsId +
- "&moduleId=" +
- moduleId +
- "&chapterId=" +
- chapterId +
- "&orderGoodsId=" +
- this.orderGoodsId +
- "&types=3",
- })
- },
-
- },
- computed: { ...mapGetters(['chapterOpen']) },
- };
- </script>
- <style lang="scss" scoped>
-
- .title{
- height: 70rpx;
- font-family: PingFang SC;
- // margin-bottom:30rpx;
- display: flex;
- justify-content: space-between;
- align-items: center;
- border-bottom: 1rpx solid #EEEEEE;
- .title_name {
- font-size: 24rpx;
- font-weight: 500;
- color: #333333;
- white-space:nowrap;
- overflow:hidden;
- text-overflow:ellipsis;
- }
- .icon_up{
- width: 24rpx;
- height: 24rpx;
- }
- }
- .examBox {
- display: flex;
- align-items: center;
- justify-content: space-between;
- .exam {
- font-size: 30rpx;
- display: flex;
- align-items: center;
- margin: 20rpx 0;
- }
- .eTag {
- width: 56rpx;
- height: 42rpx;
- text-align: center;
- line-height: 42rpx;
- font-size: 20rpx;
- background: #007aff;
- border-radius: 8rpx;
- color: #ffffff;
- }
- }
- .tagRe {
- width: 80rpx;
- height: 28rpx;
- background: #ff3b30;
- border-radius: 8rpx;
- font-size: 20rpx;
- color: #ffffff;
- text-align: center;
- }
- .tagGreen {
- width: 80rpx;
- height: 28rpx;
- background: #34c759;
- border-radius: 8rpx;
- font-size: 20rpx;
- color: #ffffff;
- text-align: center;
- }
- </style>
|