Prechádzať zdrojové kódy

feat: 新增关联试卷

xuqiaoying 3 rokov pred
rodič
commit
8a485eede3

+ 14 - 0
common/httpList/course.js

@@ -208,4 +208,18 @@ export default {
 			data:data
 		})
 	},
+	reSectionExamList(data) {
+		return myRequest({
+			url: '/course/sectionExamList',
+			method: 'get',
+			data: data
+		})
+	},
+	reSectionExamList(data) {
+		return myRequest({
+			url: '/course/sectionExamList',
+			method: 'get',
+			data: data
+		})
+	},
 }

+ 2 - 2
common/request.js

@@ -5,8 +5,8 @@ import api from './api.js'
 var num = 1
 //接口api   
 // export const BASE_URL = 'https://api.xyyxt.net'   //release
-export const BASE_URL = 'https://test.xyyxt.net'   //预发布
-// export const BASE_URL = 'http://120.79.166.78:19012' // 测试环境
+// export const BASE_URL = 'https://test.xyyxt.net'   //预发布
+export const BASE_URL = 'http://120.79.166.78:19012' // 测试环境
 // export const BASE_URL = 'http://42.192.164.187:19005'    //test(后端本地)
 // export const BASE_URL = 'http://192.168.1.222:5055'    //后端本地更新到222
 // export const BASE_URL = 'http://192.168.1.24:5055'    //后端本地

+ 22 - 2
components/course/courseChapter.vue

@@ -12,6 +12,7 @@
       <view v-for="(itemM, indexM) in list" :key="indexM">
         <view v-if="itemM.type != 2">
           <courseSection
+            ref="ChapterSection"
             :isLive="isLive"
             :orderGoodsId="orderGoodsId"
             :sectionMaxNum="sectionMaxNum"
@@ -26,6 +27,9 @@
             :gradeId="gradeId"
             :menuItem="itemM"
             :levelId="levelId + '-' + itemM.sectionId"
+            :testType="2"
+            :sectionExam='sectionExam'
+            @togoBack='togoBack()'
           ></courseSection>
           <u-line v-if="indexM < list.length - 1"></u-line>
         </view>
@@ -141,6 +145,7 @@ export default {
       list: [],
       examList: {},
       canLearn: false, //是否全部视频看完才可以练习、测试
+      sectionExam: [],
     };
   },
   onLoad() {},
@@ -158,6 +163,10 @@ export default {
   },
   methods: {
     ...mapMutations(["updateChapterOpen"]),
+    togoBack(value) {
+      console.log('章的节', value , this.$refs.ChapterSection)
+      this.$refs.ChapterSection[0].ChapterExam()
+    },
     goodsTodayStudySectionNum() {
       return new Promise((resolve) => {
         this.$api
@@ -491,11 +500,22 @@ export default {
           });
       });
     },
-    openChapter(item) {
+    async openChapter(item) {
       console.log('---zhang',this.menuItem, this.down,this.list, item.id, item.courseId, item.moduleId);
       this.down = !this.down;
       if (!this.down && this.list.length == 0) {
         console.log(item.id, 69);
+        //获取所有节试卷列表
+        await this.$api.reSectionExamList({
+          chapterId: item.chapterId || item.menuId,
+          courseId: item.courseId,
+          gradeId: item.gradeId
+        }).then((res) => {
+          if (res.data.code == 200) {
+            this.sectionExam = res.data.data || []
+          }
+        })
+
         if (this.isBuy) {
           let moduleId = item.moduleId ? item.moduleId : 0;
           if (this.isRebuild) {
@@ -509,6 +529,7 @@ export default {
         }
       }
     },
+
     getMenuExamList(chapterId, courseId, moduleId) {
       let self = this;
       this.$api
@@ -632,7 +653,6 @@ export default {
             });
             self.list = res.data.data;
             console.log('=============1', self.list)
-            this.$emit('sectionList', self.list)
           }
         });
     },

+ 43 - 2
components/course/courseModule.vue

@@ -12,9 +12,50 @@
 		</view>
 		<view v-show="!down">
 			<view v-for="(itemM,indexM) in list" :key="indexM">
-				<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>
+				<!-- 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="
+						toDo(
+							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-if="itemM.learning == 0">不合格</text>
+							</view>
+						</view>
+					</view>
+					</view>
+				
+
 			</view>
 		</view>
 	</view>

+ 36 - 0
components/course/courseSection.vue

@@ -62,6 +62,8 @@
 					<view v-if="menuItem.learning==1" class="tagGreen">已看完</view>
 				</view>
 			</template>
+
+			<view v-if="checkTest()">习题</view>
 			
 			
 		</view>
@@ -75,6 +77,7 @@
 import { mapGetters } from 'vuex';
 import eventHub from '@/common/eventHub.js'
 import {WEBVIEW_URL} from '@/common/request.js'
+import { some } from '../../pages3/static/polyv-sdk/common/chat/emotionList';
 export default {
 	name: 'courseSection',
 	props: {
@@ -124,6 +127,16 @@ export default {
 		sectionMaxNum:{
 			default:undefined,
 		},
+		// 章->所有节试卷列表
+		sectionExam: {
+			type: Array,
+			default: () => [],
+		},
+		// 区分是模块试卷还是章试卷,3是模块试卷
+		testType: {
+			type: Number,
+			default: 0,
+		}
 	},
 	watch:{
 		menuItem(val) {
@@ -136,6 +149,7 @@ export default {
 			newId:0,
 			playId:'',
 			clickLock:false, //点击锁,防止连续点击多次
+			moduleSectionExam: [], // 模块下的所有节试卷列表
 		};
 	},
 	onLoad() {
@@ -144,6 +158,7 @@ export default {
 		
 	},
 	mounted() {
+		console.log('testType', this.testType)
 		this.nowTime = Number(new  Date().getTime()/1000).toFixed(0)
 		this.newId= this.menuItem.sectionId>0?this.menuItem.sectionId:this.menuItem.menuId
 		// console.log(this.newId,'this.newId', this.playNextId)
@@ -213,6 +228,24 @@ export default {
 				return false;
 			}
 			
+		},
+		checkTest() {
+			console.log(this.menuItem)
+			if (!this.sectionExam.length) {
+				return false
+			}
+			if (this.sectionExam.some((e) => e.sectionId == this.menuItem.sectionId)) {
+				return true
+			} else {
+				return false
+			}
+		},
+		ChapterExam() {
+			let item = this.sectionExam.find((e) => e.sectionId == this.menuItem.sectionId)
+			console.log('item', item)
+		},
+		ModuleExam() {
+			
 		},
 		studyRecordMenuAllList() {
 			return new Promise(resolve => {
@@ -254,6 +287,9 @@ export default {
 			})
 		},
 		async getVideo(){
+			console.log('---点击节', )
+			this.$emit('togoBack', 1)
+			return
 			if(this.clickLock) {
 				return;
 			}

+ 6 - 0
pages2/bank/questionBank.vue

@@ -915,9 +915,11 @@ export default {
       examData: {},
       orderGoodsId: "",
       cgType: 0, //对应设计稿弹窗编码
+      courseId: '',
     };
   },
   async onLoad(option) {
+    this.courseId = option.courseId
     this.orderGoodsId = option.orderGoodsId || 0;
     this.current = +option.current || 0;
     this.id = option.id;
@@ -1480,6 +1482,8 @@ export default {
           goodsId: this.goodsId,
           totalQuestionNum: questionList,
           allQuestionNum: this.questionList.length,
+          courseId: this.courseId,
+          // type: ''
         })
         .then((res) => {
           this.recordId = res.data.data;
@@ -2131,6 +2135,7 @@ export default {
       //交卷
       this.$api
         .examRecordEdit({
+          courseId: this.courseId,
           examId: this.id,
           goodsId: this.goodsId,
           reportStatus: reportStatus,
@@ -2149,6 +2154,7 @@ export default {
           examTime: parseInt(this.allTimes),
           doTime: parseInt(this.allTimes) - parseInt(this.lastTime),
           historyExamJson: JSON.stringify(this.questionList),
+          // type: ''
         })
         .then((res) => {
           this.isSubmit = true;

+ 1 - 0
pages2/class/questionBank.vue

@@ -1792,6 +1792,7 @@ export default {
 
         this.$api
           .bankRecord({
+            courseId: this.courseId,
             chapterExamId: this.chapterId || 0,
             moduleExamId: this.moduleId || 0,
             examId: this.id,

+ 5 - 3
pages3/polyv/detail.vue

@@ -167,12 +167,12 @@
                 :menuItem="item"
                 :levelId="'0-' + item.menuId"
                 :goodsType='1'
-                @sectionList='sectionList($event, index)'
               ></courseChapter
             ></view>
             <!--节 -->
             <view v-if="item.type == 3"
               ><courseSection
+                ref="MoudleSection"
                 v-if="reStart"
 								:orderGoodsId="orderGoodsId"
                 :sectionMaxNum="goodsData.sectionMaxNum"
@@ -185,6 +185,8 @@
                 :isBuy="true"
                 :menuItem="item"
                 :levelId="'0-0-' + item.menuId"
+                :testType="3"
+                @togoBack="togoBack($event)"
               ></courseSection
             ></view>
           </view>
@@ -764,8 +766,8 @@ export default {
   },
   methods: {
     ...mapMutations(["updateChapterOpen","updateLiveLast"]),
-    sectionList(value) {
-      console.log('返回返回', value)
+    togoBack(value) {
+      console.log('模块的节', value , this.$refs.MoudleSection)
     },
     // 新增微信公众号模板消息点击数据
     clickOfficial() {