12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412 |
- <template>
- <div class="course_tree">
- <div v-for="(courseItem, courseIndex) in treeList" :key="courseIndex">
- <div v-if="courseItem.courseList" class="teacherList_name">
- <div
- v-for="tea in courseItem.courseList"
- :key="tea.courseId"
- class="names"
- :class="{ nactive: tea.courseId == courseItem.courseId }"
- @click="activeFunc(tea.courseId, courseIndex)"
- >
- {{ tea.aliasName }}
- </div>
- </div>
- <div
- class="item__title"
- @click="getMenuList(courseItem)"
- v-if="treeList.length != 1"
- >
- <i
- :class="{
- 'el-icon-caret-right': !courseItem.showList,
- 'el-icon-caret-bottom': courseItem.showList,
- }"
- ></i>
- {{ courseItem.courseName }}
- </div>
- <div
- v-if="courseItem.showList"
- :style="{ paddingLeft: treeList.length != 1 ? '12px' : '0' }"
- >
- <div class="item" v-for="(menu, index) in courseItem.list" :key="index">
- <template v-if="menu.type == 1">
- <div class="item__title" @click="openModule(menu)">
- <i
- :class="{
- 'el-icon-caret-right': !menu.showList,
- 'el-icon-caret-bottom': menu.showList,
- }"
- ></i>
- {{ menu.menuName }}
- </div>
- <div class="item__content">
- <div class="bank-chapter" v-if="menu.showList">
- <div
- class="bank-chapter__item"
- v-for="chapter in menu.list"
- :key="chapter.id"
- >
- <div
- v-if="chapter.type == 1"
- class="bank-chapter__item__text"
- @click="openChapter(chapter)"
- >
- <i
- :class="{
- 'el-icon-caret-right': !chapter.showList,
- 'el-icon-caret-bottom': chapter.showList,
- }"
- ></i
- >{{ chapter.name }}
- </div>
- <div
- class="bank-section"
- v-if="chapter.showList && chapter.type == 1"
- >
- <div
- class="bank-section__item"
- :class="{
- active: isActive(section),
- }"
- v-for="(section, sectionIndex) in chapter.list"
- :key="sectionIndex"
- @click="getResource(section, 1, courseIndex)"
- >
- <template v-if="section.type != 2">
- <template>
- <div
- class="note note--blue"
- v-if="section.sectionType == 1"
- >
- 视频
- </div>
- <div class="note" v-if="section.sectionType == 2">
- 直播
- </div>
- <div
- class="note note--yellow"
- v-if="section.sectionType == 3"
- >
- 回放
- </div>
- <div class="bank-section__item__text">
- {{ section.name }}
- <div
- style="font-size: 12px"
- v-if="section.liveStartTime > nowTime"
- >
- <span>{{
- $tools.timestampToTime(
- section.liveStartTime,
- (isDay = false)
- )
- }}</span
- >-
- <span>{{
- $tools.timestampToTime(
- section.liveEndTime,
- (isDay = false)
- )
- }}</span>
- </div>
- </div>
- </template>
- <div class="lear-state" v-if="isActive(section)">
- <img src="../../assets/learing.gif" alt="" />
- </div>
- <template v-if="section.durationTime > 0">
- <div class="during">
- {{ $tools.secondToDate(section.durationTime) }}
- </div>
- </template>
- <template>
- <div class="btn" v-if="section.rebuild > 0">
- 待重修
- </div>
- <template v-else>
- <div
- class="btn btn--green"
- v-if="section.learning == 1"
- >
- 已学完
- </div>
- </template>
- </template>
- <template
- v-if="
- section.liveStartTime && section.sectionType == 2
- "
- >
- <div
- class="live-btn live-btn--blue"
- v-if="section.liveStartTime > nowTime"
- >
- 待开播
- </div>
- <div
- class="live-btn live-btn--yellow"
- v-if="
- section.liveStartTime <= nowTime &&
- section.liveEndTime > nowTime
- "
- >
- 直播中
- </div>
- <div
- class="live-btn"
- v-if="section.liveEndTime < nowTime"
- >
- 已结束
- </div>
- </template>
- <template
- v-if="checkSection(section.sectionId, 'sectionExam')"
- >
- <div
- class="exercises"
- @click.stop="
- handelPracticeOrRxam(
- section,
- 2,
- courseItem.courseId
- )
- "
- >
- 习题
- <i class="el-icon-arrow-right icons"></i>
- </div>
- </template>
- </template>
- <template v-if="section.type == 2">
- <template>
- <div class="test-btn" v-if="section.doType == 1">
- 练习
- </div>
- <div class="test-btn" v-if="section.doType != 1">
- 考试
- </div>
- </template>
- <div class="bank-section__item__text">
- {{ section.name }}
- </div>
- <template>
- <div class="btn" v-if="section.rebuild > 0">
- 待重修
- </div>
- <template v-else>
- <div
- class="btn btn--green"
- v-if="section.learning == 1"
- >
- 合格
- </div>
- <div
- class="btn btn--red"
- v-if="section.learning == 0"
- >
- 不及格(需重考)
- </div>
- <div
- class="btn btn--green"
- v-if="section.rebuild > 0"
- >
- 待重测
- </div>
- </template>
- </template>
- </template>
- </div>
- </div>
- <div
- v-if="chapter.type == 2"
- class="bank-section__item"
- @click="getResource(chapter, 3, courseIndex)"
- >
- <template>
- <template>
- <div class="test-btn" v-if="chapter.doType == 1">
- 练习
- </div>
- <div class="test-btn" v-if="chapter.doType != 1">
- 考试
- </div>
- </template>
- <div class="bank-section__item__text">
- {{ chapter.name }}
- </div>
- <template>
- <div class="btn" v-if="chapter.rebuild > 0">待重修</div>
- <template v-else>
- <div
- class="btn btn--green"
- v-if="chapter.learning == 1"
- >
- 合格
- </div>
- <div
- class="btn btn--red"
- v-if="chapter.learning == 0"
- >
- 不及格(需重考)
- </div></template
- >
- </template>
- </template>
- </div>
- </div>
- </div>
- </div>
- </template>
- <template v-if="menu.type == 2">
- <div class="item__content">
- <div class="bank-chapter">
- <div class="bank-chapter__item">
- <div
- class="bank-chapter__item__text"
- @click="openChapter(menu)"
- >
- <i
- :class="{
- 'el-icon-caret-right': !menu.showList,
- 'el-icon-caret-bottom': menu.showList,
- }"
- ></i
- >{{ menu.menuName }}
- </div>
- <div class="bank-section" v-if="menu.showList">
- <div
- class="bank-section__item"
- :class="{
- active: isActive(section),
- }"
- v-for="(section, sectionIndex) in menu.list"
- :key="sectionIndex"
- @click="getResource(section, 1, courseIndex)"
- >
- <template v-if="section.type != 2">
- <template>
- <div
- class="note note--blue"
- v-if="section.sectionType == 1"
- >
- 视频
- </div>
- <div class="note" v-if="section.sectionType == 2">
- 直播
- </div>
- <div
- class="note note--yellow"
- v-if="section.sectionType == 3"
- >
- 回放
- </div>
- </template>
- <div class="bank-section__item__text">
- {{ section.name }}
- <div
- style="font-size: 12px"
- v-if="section.liveStartTime > nowTime"
- >
- <span>{{
- $tools.timestampToTime(
- section.liveStartTime,
- (isDay = false)
- )
- }}</span
- >-
- <span>{{
- $tools.timestampToTime(
- section.liveEndTime,
- (isDay = false)
- )
- }}</span>
- </div>
- </div>
- <div class="lear-state" v-if="isActive(section)">
- <img src="../../assets/learing.gif" alt="" />
- </div>
- <template v-if="section.durationTime > 0">
- <div class="during">
- {{ $tools.secondToDate(section.durationTime) }}
- </div>
- </template>
- <template>
- <div class="btn" v-if="section.rebuild > 0">
- 待重修
- </div>
- <template v-else>
- <div
- class="btn btn--green"
- v-if="section.learning == 1"
- >
- 已学完
- </div>
- </template>
- </template>
- <template
- v-if="
- section.liveStartTime && section.sectionType == 2
- "
- >
- <div
- class="live-btn live-btn--blue"
- v-if="section.liveStartTime > nowTime"
- >
- 待开播
- </div>
- <div
- class="live-btn live-btn--yellow"
- v-if="
- section.liveStartTime <= nowTime &&
- section.liveEndTime > nowTime
- "
- >
- 直播中
- </div>
- <div
- class="live-btn"
- v-if="section.liveEndTime < nowTime"
- >
- 已结束
- </div>
- </template>
- <template
- v-if="checkSection(section.sectionId, 'sectionExam')"
- >
- <div
- class="exercises"
- @click.stop="
- handelPracticeOrRxam(
- section,
- 2,
- courseItem.courseId
- )
- "
- >
- 习题
- <i class="el-icon-arrow-right icons"></i>
- </div>
- </template>
- </template>
- <template v-if="section.type == 2">
- <template>
- <div class="test-btn" v-if="section.doType == 1">
- 练习
- </div>
- <div class="test-btn" v-if="section.doType != 1">
- 考试
- </div>
- </template>
- <div class="bank-section__item__text">
- {{ section.name }}
- </div>
- <template>
- <div class="btn" v-if="section.rebuild > 0">
- 待重修
- </div>
- <template v-else>
- <div
- class="btn btn--green"
- v-if="section.learning == 1"
- >
- 合格
- </div>
- <div
- class="btn btn--red"
- v-if="section.learning == 0"
- >
- 不及格(需重考)
- </div>
- <div
- class="btn btn--green"
- v-if="section.rebuild > 0"
- >
- 待重测
- </div>
- </template>
- </template>
- </template>
- </div>
- </div>
- </div>
- </div>
- </div>
- </template>
- <template v-if="menu.type == 3">
- <div class="item__content">
- <div class="bank-section">
- <div
- class="bank-section__item"
- :class="{
- active: isActive(menu),
- }"
- @click="getResource(menu, 1, courseIndex)"
- >
- <template>
- <div class="note note--blue" v-if="menu.sectionType == 1">
- 视频
- </div>
- <div class="note" v-if="menu.sectionType == 2">直播</div>
- <div class="note note--yellow" v-if="menu.sectionType == 3">
- 回放
- </div>
- <div class="bank-section__item__text">
- {{ menu.name }}
- <div
- style="font-size: 12px"
- v-if="menu.liveStartTime > nowTime"
- >
- <span>{{
- $tools.timestampToTime(
- menu.liveStartTime,
- (isDay = false)
- )
- }}</span
- >-
- <span>{{
- $tools.timestampToTime(
- menu.liveEndTime,
- (isDay = false)
- )
- }}</span>
- </div>
- </div>
- </template>
- <div class="lear-state" v-if="isActive(menu)">
- <img src="../../assets/learing.gif" alt="" />
- </div>
- <template v-if="menu.durationTime > 0">
- <div class="during">
- {{ $tools.secondToDate(menu.durationTime) }}
- </div>
- </template>
- <template>
- <div class="btn" v-if="menu.rebuild > 0">待重修</div>
- <template v-else>
- <div class="btn btn--green" v-if="menu.learning == 1">
- 已学完
- </div>
- </template>
- </template>
- <template v-if="menu.liveStartTime && menu.sectionType == 2">
- <div
- class="live-btn live-btn--blue"
- v-if="menu.liveStartTime > nowTime"
- >
- 待开播
- </div>
- <div
- class="live-btn live-btn--yellow"
- v-if="
- menu.liveStartTime <= nowTime &&
- menu.liveEndTime > nowTime
- "
- >
- 直播中
- </div>
- <div class="live-btn" v-if="menu.liveEndTime < nowTime">
- 已结束
- </div>
- </template>
- <template v-if="checkSection(menu.menuId, 'sectionExamList')">
- <div
- class="exercises"
- @click.stop="
- handelPracticeOrRxam(menu, 3, courseItem.courseId)
- "
- >
- 习题
- <i class="el-icon-arrow-right icons"></i>
- </div>
- </template>
- </div>
- </div>
- </div>
- </template>
- </div>
- </div>
- </div>
- <el-dialog
- title="温馨提示"
- width="380px"
- center
- class="tip-dialog"
- :visible.sync="dialogPalyVisible"
- :close-on-click-modal="false"
- :close-on-press-escape="false"
- :show-close="false"
- >
- <template v-if="!isLastVideo">
- <p>当前视频已学完,继续学习下一个视频?</p>
- <div class="btn1">
- <el-button type="info" plain round @click="dialogPalyVisible = false"
- >取 消</el-button
- >
- <el-button type="primary" @click="comfirm" round>确定</el-button>
- </div>
- </template>
- <template v-else>
- <p>
- 当前是最后一个视频并已学习完,请检查所有章节的视频是否已学习完成。
- </p>
- <div class="btn2">
- <el-button type="primary" round @click="dialogPalyVisible = false"
- >确定</el-button
- >
- </div>
- </template>
- </el-dialog>
- </div>
- </template>
- <script>
- export default {
- props: {
- courseList: {
- type: Array,
- default: () => {
- return [];
- },
- },
- goodsLearningOrder: {
- type: Number,
- },
- sectionMaxNum: {
- type: Number,
- },
- sectionItem: {
- type: Object,
- default: () => {
- return {};
- },
- },
- rebuild: {
- type: Number,
- default: 0,
- },
- },
- data() {
- return {
- teaIndex: 0,
- nowTime: 0,
- treeList: [],
- sectionExam: [],
- sectionExamList: [],
- dialogPalyVisible: false,
- allSectionList: [],
- };
- },
- created() {
- this.init();
- },
- methods: {
- async init() {
- this.nowTime = Number(new Date().getTime() / 1000).toFixed(0);
- await this.getAllSectionList();
- this.treeList = await this.getDoubleTeacherList();
- let sectionItem = await this.backNextItem(
- this.treeList.find((e) => e.courseId == this.activeCourseId),
- 0,
- false
- );
- if (this.query.sectionType == 1 && !!this.query.rebuild == this.rebuild) {
- this.toPlay(sectionItem);
- }
- },
- activeFunc(courseId, index) {
- let { courseId: nowCourseId, courseList } = this.treeList[index];
- if (courseId == nowCourseId) {
- return;
- }
- let course = this.courseList.find((e) => e.courseId == courseId);
- if (course) {
- course.courseList = courseList;
- course.list = [];
- course.showList = false;
- }
- this.treeList.splice(index, 1, JSON.parse(JSON.stringify(course)));
- this.getMenuList(this.treeList[index]);
- },
- getMenuList(course, isFresh = false) {
- let { showList, courseId, list } = course;
- if (!isFresh) {
- course.showList = !showList;
- if (list.length) return;
- }
- this.$request
- .reSectionExamList({
- chapterId: 0,
- courseId,
- gradeId: this.gradeId,
- })
- .then((res) => {
- this.sectionExamList = res.data;
- });
- return this.$request
- .reMenuList({ courseId, gradeId: this.gradeId })
- .then((res) => {
- for (let i = 0; i < res.rows.length; i++) {
- let item = res.rows[i];
- item.id = item.menuId;
- item.name = item.menuName;
- item.menuType = item.type;
- item.showList = false;
- item.list = [];
- item.parent = course;
- }
- course.list = res.rows;
- return Promise.resolve(res.rows);
- });
- },
- openModule(module, isFresh = false) {
- console.log("openModule");
- let { list, isRebuild, id, courseId, showList } = module;
- if (!isFresh) {
- module.showList = !showList;
- if (list.length) return;
- }
- return this.$request
- .reChapterList({
- moduleId: id,
- gradeId: this.gradeId,
- courseId: courseId,
- rebuild: isRebuild ? 1 : undefined,
- })
- .then((res) => {
- for (let i = 0; i < res.data.length; i++) {
- let item = res.data[i];
- item.id = item.chapterId;
- item.showList = false;
- item.list = [];
- item.parent = module;
- isRebuild ? (item.isRebuild = 1) : (item.menuType = 2);
- }
- module.list = res.data;
- return Promise.resolve(res.data);
- });
- },
- openChapter(chapter, isFresh = false) {
- let {
- chapterId,
- menuId,
- list,
- moduleId,
- id,
- isRebuild,
- courseId,
- showList,
- } = chapter;
- if (!isFresh) {
- chapter.showList = !showList;
- if (list.length) return;
- }
- this.$request
- .reSectionExamList({
- chapterId: chapterId || menuId,
- courseId,
- gradeId: this.gradeId,
- })
- .then((res) => {
- this.sectionExam = [...this.sectionExam, ...res.data];
- });
- return this.$request
- .reSectionList({
- chapterId: id,
- gradeId: this.gradeId,
- courseId,
- rebuild: isRebuild ? 1 : undefined,
- moduleId: moduleId || 0,
- })
- .then((res) => {
- chapter.canLearn = res.data
- .filter((item) => item.type != 2)
- .every((item) => item.learning == 1);
- res.data.forEach((section) => {
- section.parent = chapter;
- section.courseId = courseId;
- });
- chapter.list = res.data;
- return Promise.resolve(chapter.list);
- });
- },
- getAllSectionList() {
- return this.$request
- .getAllSectionList({
- gradeId: this.gradeId,
- goodsId: this.goodsId,
- rebuild: this.rebuild,
- })
- .then((res) => {
- let { skipPort } = this.query;
- if (skipPort) {
- let { moduleId, chapterId, sectionId } = res.data[0];
- const query = JSON.parse(JSON.stringify(this.$route.query));
- query.moduleId = moduleId;
- query.chapterId = chapterId;
- query.sectionId = sectionId;
- query.skipPort = undefined;
- this.$router.push({ path: this.$route.path, query });
- }
- this.allSectionList = res.data;
- return Promise.resolve(res.data);
- });
- },
- /**
- * 判断是否是当前播放的节
- */
- isActive(section) {
- let moduleId = section.moduleId || 0;
- let chapterId = section.chapterId || 0;
- let sectionId = section.sectionId || section.menuId;
- let moduleId1 = this.sectionItem.moduleId || 0;
- let chapterId1 = this.sectionItem.chapterId || 0;
- let sectionId1 = this.sectionItem.sectionId || this.sectionItem.menuId;
- return (
- moduleId == moduleId1 &&
- chapterId == chapterId1 &&
- sectionId == sectionId1
- );
- },
- comfirm() {
- this.dialogPalyVisible = false;
- this.playNextVideo();
- },
- // 自动播放下一个视频
- async playNextVideo(sectionItem = this.sectionItem) {
- let { menuId, parent, courseId, projectId } = sectionItem;
- let list = (
- menuId
- ? this.treeList.find((e) => e.courseId == courseId).list
- : projectId
- ? this.treeList
- : parent.list
- ).filter((e) => !e.doType);
- let index = list.findIndex((e) => e.id == sectionItem.id);
- let nextItem = {};
- if (list.length - 1 > index) {
- nextItem = list[index + 1];
- this.toPlay(
- await this.backNextItem(nextItem, projectId ? 0 : nextItem.menuType)
- );
- } else {
- this.playNextVideo(parent);
- }
- },
- // 获取模块/章/节
- async backNextItem(nextItem, type, isNext = true) {
- if (type == undefined || type == 3) return nextItem;
- let key = ["getMenuList", "openModule", "openChapter"][type];
- let list = nextItem.list.length
- ? nextItem.list
- : await this[key](nextItem);
- if (isNext) {
- nextItem = type == 2 ? list.find((e) => e.type == 1) : list[0];
- } else {
- // 初始化 获取播放位置
- let { moduleId, chapterId, sectionId } = this.query;
- nextItem = list.find((e) => {
- if (moduleId * 1 && type == 0) {
- return e.menuId == moduleId;
- }
- if (chapterId * 1 && type < 2) {
- return e[moduleId * 1 ? "chapterId" : "menuId"] == chapterId;
- }
- return (
- e[moduleId * 1 || chapterId * 1 ? "sectionId" : "id"] == sectionId
- );
- });
- }
- return this.backNextItem(nextItem, nextItem.menuType, isNext);
- },
- async getResource(section, type, courseIndex) {
- if (
- section.type != 2 &&
- this.isActive(section) &&
- section.sectionType != 3
- ) {
- return;
- }
- if (!(await this.orderTopTobottom(section, type, courseIndex))) {
- this.clickLock = false;
- this.$message({
- type: "warning",
- message:
- section.type == 2
- ? "请学完视频课程再进行练习和测试"
- : "请按顺序学习视频课程",
- });
- return false;
- }
- //视频 回放
- if (section.sectionType == 1 || section.sectionType == 3) {
- if (!section.recordingUrl) {
- this.$message({
- type: "warning",
- message: `暂无播放地址数据`,
- });
- return false;
- }
- }
- // 直播
- if (section.sectionType == 2) {
- if (!section.liveUrl) {
- this.$message({
- type: "warning",
- message: `暂无直播地址数据`,
- });
- return false;
- }
- let data = await this.studyRecordGetChannelBasicInfo(section.liveUrl);
- if (data.watchStatus == "end" || data.watchStatus == "playback") {
- this.$message({
- type: "warning",
- message: `直播已结束`,
- });
- return false;
- }
- if (data.watchStatus == "waiting") {
- this.$message({
- type: "warning",
- message: `直播未开始`,
- });
- return false;
- }
- }
- // 学习次数
- if (!(await this.exceedLearnNum(section))) {
- return false;
- }
- section.type == 2
- ? this.toCourseExam(section, type, courseIndex)
- : this.toPlay(section);
- },
- async toCourseExam(section, type, courseIndex) {
- //试卷
- // 学习次数
- let num =
- this.goodsLearningOrder != 2 || section.rebuild
- ? await this.bankRecordDoNum(section.typeId)
- : section.doNum;
- if (
- (section.answerNum - num > 0 && section.answerNum > 0) ||
- section.answerNum == 0
- ) {
- this.$router.push({
- path: "/course-exam/" + this.goodsId,
- query: {
- courseId: this.treeList[courseIndex].courseId,
- gradeId: this.gradeId,
- moduleId: section.moduleId || 0,
- sectionId: section.sectionId || 0,
- examId: section.typeId,
- learning: section.learning,
- type: type,
- chapterId: section.chapterId || 0,
- orderGoodsId: this.orderGoodsId,
- },
- });
- } else {
- this.$message({
- type: "warning",
- message: "该试卷只能答题" + section.answerNum + "次",
- });
- return;
- }
- },
- // 节卷不需要控制
- handelPracticeOrRxam(section, type, courseId) {
- if (type == 3) {
- //节卷
- let data = this.sectionExamList.filter(
- (x) => x.sectionId == section.menuId
- );
- if (data && data.length > 0) {
- section = data[0];
- }
- } else if (type == 2) {
- //节卷
- let data = this.sectionExam.filter(
- (x) => x.sectionId == section.sectionId
- );
- if (data && data.length > 0) {
- section = data[0];
- }
- }
- this.$router.push({
- path: "/course-exam/" + this.goodsId,
- query: {
- courseId,
- gradeId: this.gradeId,
- moduleId: section.moduleId || 0,
- sectionId: section.sectionId || 0,
- examId: section.typeId,
- learning: section.learning,
- type: type,
- chapterId: section.chapterId || 0,
- orderGoodsId: this.orderGoodsId,
- },
- });
- },
- async exceedLearnNum(section) {
- let learnNum = await this.goodsTodayStudySectionNum();
- let hasLearn = await this.gradeCheckGoodsStudy(
- section.type == 2 ? section.typeId : section
- );
- if (this.sectionMaxNum > 0) {
- if (learnNum >= this.sectionMaxNum && !hasLearn) {
- this.$message({
- type: "warning",
- message: `每天最多学习${this.sectionMaxNum}节`,
- });
- return false;
- }
- }
- return true;
- },
- goodsTodayStudySectionNum() {
- return new Promise((resolve) => {
- this.$request
- .goodsTodayStudySectionNum({
- goodsId: this.goodsId,
- gradeId: this.gradeId,
- })
- .then((res) => {
- resolve(res.data);
- });
- });
- },
- gradeCheckGoodsStudy(option) {
- return new Promise((resolve) => {
- this.$request
- .gradeCheckGoodsStudy({
- goodsId: this.goodsId,
- gradeId: this.gradeId,
- moduleId: option.moduleId || 0,
- chapterId: option.chapterId || 0,
- sectionId: option.sectionId || option.menuId,
- })
- .then((res) => {
- resolve(res.data);
- });
- });
- },
- bankRecordDoNum(section) {
- return new Promise((resolve) => {
- this.$request
- .bankRecordDoNum({
- goodsId: this.goodsId,
- gradeId: this.gradeId,
- chapterId: section.chapterId,
- courseId: this.courseId,
- moduleId: 0,
- examId: section.typeId,
- })
- .then((res) => {
- resolve(res.data);
- });
- });
- },
- toPlay(section) {
- this.$emit("getResource", section, this.rebuild);
- },
- //获取商品双师资模板
- getDoubleTeacherList() {
- let rows = JSON.parse(JSON.stringify(this.courseList));
- rows.forEach((e) => {
- e.list = [];
- e.showList = false;
- e.id = e.courseId;
- });
- return this.$request
- .courseTeacherList({
- goodsId: this.$route.params.goodsId,
- })
- .then(({ data }) => {
- data.forEach((ele) => {
- rows.forEach((e, i) => {
- let actvieIndex = ele.courseIds.indexOf(this.activeCourseId);
- let index = ele.courseIds.indexOf(e.courseId);
- if (actvieIndex != -1 && index != -1) {
- if (e.courseId == this.activeCourseId) {
- e.courseList = ele.courseList;
- } else {
- delete rows[i];
- }
- } else {
- if (index == 0) {
- e.courseList = ele.courseList;
- }
- if (index > 0) {
- delete rows[i];
- }
- }
- });
- });
- return Promise.resolve(rows.filter((e) => e));
- });
- },
- async orderTopTobottom(section, type, courseIndex) {
- let { rebuild, moduleId, chapterId } = section;
- if (this.goodsLearningOrder != 2 || rebuild) {
- return true;
- }
- if (this.treeList.length > 1 && courseIndex > 0) {
- let isAllLear = this.treeList
- .filter((e, i) => i < courseIndex)
- .every((ele) => ele.stuAllNum == ele.secAllNum);
- if (!isAllLear) return false;
- }
- let list = await this.studyRecordMenuAllList(
- this.treeList[courseIndex].courseId
- );
- type = type == 1 && section.type == 2 ? 2 : type;
- if (type == 1) {
- let index = list.findIndex(
- (e) =>
- e.moduleId == moduleId &&
- e.chapterId == chapterId &&
- e.id == section.sectionId
- );
- list = list.slice(0, index);
- } else if (type != 3) {
- list = list.filter(
- (e) => e.moduleId == moduleId && e.chapterId == chapterId
- );
- }
- return list.every((item) => item.studyStatus == 1);
- },
- studyRecordMenuAllList(courseId) {
- return new Promise((resolve) => {
- this.$request
- .studyRecordMenuAllList({
- courseId,
- gradeId: this.gradeId,
- goodsId: this.goodsId,
- })
- .then((res) => {
- resolve(res.data);
- });
- });
- },
- //校验节是否有试卷
- checkSection(sectionId, key) {
- let _data = this[key];
- if (_data.length == 0) {
- return false;
- }
- return _data.some((section) => section.sectionId == sectionId);
- },
- // 刷新数据
- refreshList() {
- let { parent, menuId } = this.sectionItem;
- if (menuId) {
- this.getMenuList(playCourse, true);
- } else {
- this.openChapter(parent, true);
- }
- },
- studyRecordGetChannelBasicInfo(channelId) {
- return new Promise((resolve) => {
- this.$request
- .studyRecordGetChannelBasicInfo({
- channelId,
- })
- .then((res) => {
- resolve(res.data);
- })
- .catch((err) => {});
- });
- },
- },
- computed: {
- query() {
- return this.$route.query;
- },
- gradeId() {
- return this.query.gradeId;
- },
- activeCourseId() {
- let courseId = this.query.courseId;
- if (!courseId&&this.treeList.length) {
- courseId = this.treeList[0].courseId;
- }
- return courseId;
- },
- goodsId() {
- return this.$route.params.goodsId;
- },
- playCourseId() {
- return this.sectionItem.courseId;
- },
- playCourse() {
- return this.treeList.find((e) => e.courseId == this.playCourseId);
- },
- isLastVideo() {
- try {
- let { sectionId, chapterId, courseId } = this.sectionItem;
- let lastVideo = this.allSectionList.slice(-1)[0];
- return (
- sectionId == lastVideo.sectionId &&
- chapterId == lastVideo.chapterId &&
- courseId == lastVideo.courseId
- );
- } catch (error) {
- return false;
- }
- },
- orderGoodsId() {
- return this.query.orderGoodsId;
- },
- },
- };
- </script>
- <style scoped lang="scss">
- .course_tree {
- height: 380px;
- overflow-y: scroll;
- &::-webkit-scrollbar {
- display: none;
- }
- .item {
- &__title {
- padding-left: 12px;
- height: 40px;
- line-height: 40px;
- cursor: pointer;
- font-size: 14px;
- font-family: Microsoft YaHei;
- font-weight: bold;
- color: #fff;
- .el-icon-caret-right,
- .el-icon-caret-bottom {
- color: #999;
- }
- }
- &__content {
- .bank-chapter {
- &__item {
- color: #fff;
- font-size: 14px;
- &__text {
- padding: 8px 8px 8px 24px;
- cursor: pointer;
- flex: 1;
- .el-icon-caret-right,
- .el-icon-caret-bottom {
- color: #999;
- }
- }
- }
- }
- .bank-section {
- &__item {
- user-select: none;
- color: #fff;
- font-size: 14px;
- display: flex;
- align-items: center;
- .lear-state {
- height: 20px;
- padding-right: 8px;
- img {
- width: 20px;
- height: 20px;
- // margin-right: 4px;
- }
- }
- &.active {
- background: #132b4d;
- font-size: 14px;
- font-family: Microsoft YaHei;
- font-weight: bold;
- color: #3f8dfd;
- }
- &__text {
- flex: 1;
- padding: 8px 8px 8px 12px;
- height: 40px;
- display: flex;
- flex-direction: column;
- justify-content: center;
- cursor: pointer;
- .el-icon-caret-right,
- .el-icon-caret-bottom {
- color: #999;
- }
- }
- .test-btn {
- margin-left: 10px;
- width: 32px;
- height: 20px;
- background: #007aff;
- border-radius: 4px;
- line-height: 18px;
- color: #fff;
- text-align: center;
- }
- .note {
- margin-left: 10px;
- width: 32px;
- height: 20px;
- border: 1px solid #ff3b30;
- border-radius: 4px;
- line-height: 18px;
- color: #ff3b30;
- text-align: center;
- &--yellow {
- border-color: #ff9500;
- color: #ff9500;
- }
- &--blue {
- border-color: #3f8dfd;
- color: #3f8dfd;
- }
- }
- .during {
- color: #999;
- margin-right: 10px;
- }
- .btn {
- margin-right: 12px;
- padding: 0 2px;
- height: 20px;
- border: 1px solid #ff3b30;
- background: #ff3b30;
- border-radius: 4px;
- line-height: 18px;
- color: #fff;
- text-align: center;
- &--green {
- border: 1px solid #34c759;
- background: #34c759;
- }
- }
- .live-btn {
- margin-left: 20px;
- width: 60px;
- height: 20px;
- border-radius: 4px;
- background: #eeeeee;
- line-height: 18px;
- color: #666666;
- text-align: center;
- &--yellow {
- background: #fff7eb;
- color: #ff9500;
- }
- &--blue {
- border-color: #ebf4ff;
- color: #007aff;
- }
- }
- .exercises {
- cursor: pointer;
- font-size: 14px;
- color: #498afe;
- }
- }
- }
- }
- }
- .teacherList_name {
- display: flex;
- margin-left: 20px;
- margin-top: 10px;
- .names {
- font-size: 13px;
- color: #383838;
- margin-right: 8px;
- cursor: pointer;
- background: #818181;
- border-radius: 4px;
- padding: 3px 6px;
- &.nactive {
- background: #cccccc;
- }
- }
- }
- .tip-dialog {
- /deep/ {
- .el-dialog__body {
- padding: 6px 40px 44px;
- }
- .el-dialog__header {
- padding-top: 36px;
- }
- .el-dialog__title {
- font-weight: bold;
- color: #222222;
- }
- }
- p {
- color: #666666;
- font-size: 16px;
- text-align: center;
- }
- .btn1 {
- display: flex;
- justify-content: space-between;
- margin-top: 50px;
- .el-button {
- width: 140px;
- }
- }
- .btn2 {
- width: 200px;
- margin: 32px auto 0;
- .el-button {
- width: 200px;
- }
- }
- }
- }
- </style>
|