detail.vue 71 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547
  1. <template>
  2. <view class="polyv_detail">
  3. <uni-nav-bar
  4. left-icon="back"
  5. :statusBar="true"
  6. fixed="true"
  7. :title="detail.courseName || '课程详情'"
  8. @clickLeft="clickLeft"
  9. ></uni-nav-bar>
  10. <view id="top">
  11. <view class="video_box" v-if="!startStatus">
  12. <image
  13. :src="$method.splitImgHost(goodsData.coverUrl)"
  14. mode="widthFix"
  15. style="width: 100%; height: 421rpx"
  16. ></image>
  17. </view>
  18. <view v-else>
  19. <my-player
  20. v-if="playVID"
  21. ref="player"
  22. :playVid="playVID"
  23. :autoplay="autoplay"
  24. :allowSeek="isAllowSeek"
  25. :playbackRate="playbackRate"
  26. :videoCurrentTime="recordObj.videoCurrentTime || 0"
  27. @playing="playing"
  28. @pause="pause"
  29. @ended="ended"
  30. @loadedmetadata="loadedmetadata"
  31. @timeupdate="timeupdate"
  32. @playerError="playerError"
  33. ></my-player>
  34. </view>
  35. <view class="course_name">
  36. <view class="course_titles">
  37. <view class="video_t1" :class="{ one: !goodsData.buyNote }">{{
  38. detail.courseName
  39. }}</view>
  40. <view class="notice_wrap" v-if="goodsData.buyNote">
  41. <view class="video_t1_t" @click="studyNotice"> 学员须知 </view>
  42. </view>
  43. <view
  44. class="toggle_course"
  45. v-if="goodsTeacher.length > 1"
  46. @click="changeCourses()"
  47. >
  48. <image
  49. class="img"
  50. src="/pages3/static/imgs/toggle.png"
  51. mode="widthFix"
  52. ></image>
  53. <view class="toggle_name">切换课程</view>
  54. <!-- courseTotal -->
  55. <view class="numbers">共{{ goodsTeacher.length }}门</view>
  56. </view>
  57. </view>
  58. </view>
  59. <u-line color="#D6D6DB" />
  60. <view>
  61. <view>
  62. <u-tabs
  63. :item-width="itemWidth()"
  64. :list="list"
  65. font-size="32"
  66. bar-width="24"
  67. :current="current"
  68. @change="change"
  69. active-color="#007AFF"
  70. ></u-tabs>
  71. </view>
  72. </view>
  73. <u-line color="#D6D6DB" />
  74. </view>
  75. <view class="box" :class="{ first_ml: current == 0 }">
  76. <scroll-view class="box_in" scroll-y="true">
  77. <!--目录 -->
  78. <view v-show="current == 0">
  79. <view
  80. class="top__header"
  81. v-if="livingItem"
  82. @click="goLive(livingItem)"
  83. >
  84. <image
  85. class="img"
  86. src="/pages3/static/imgs/live.png"
  87. mode="widthFix"
  88. ></image>
  89. <view class="note">正在直播中</view>
  90. <view class="title">{{ livingItem.sectionName }}</view>
  91. </view>
  92. <course-tree
  93. v-if="sectionItem.id || sectionItem.sectionId"
  94. :orderGoodsId="orderGoodsId"
  95. :sectionMaxNum="goodsData.sectionMaxNum"
  96. :courseId="courseId"
  97. :learningOrder="orderNum"
  98. :goodsId="goodsId"
  99. :gradeId="gradeId"
  100. :isRebuild="false"
  101. :isBuy="true"
  102. :goodsType="1"
  103. :menuAllList="menuAllList"
  104. :sectionItem="sectionItem"
  105. ></course-tree>
  106. </view>
  107. <!--讲义 -->
  108. <view v-if="current == 1">
  109. <handouts-box :handoutsId="goodsData.handoutsId"></handouts-box>
  110. </view>
  111. <!--笔记 -->
  112. <view v-if="current == 2">
  113. <note-Box
  114. :isPlayRebuild="sectionItem.rebuild"
  115. :refPlv="refPlv"
  116. @jumpNote="jumpNote"
  117. :params="params()"
  118. ></note-Box>
  119. </view>
  120. <!--答疑 -->
  121. <view v-if="current == 3">
  122. <answer-box :userId="userInfo ? userInfo.userId : 0"></answer-box>
  123. </view>
  124. <!--目录 -->
  125. <view v-if="current == 4">
  126. <course-tree
  127. v-if="sectionItem.id || sectionItem.sectionId"
  128. :orderGoodsId="orderGoodsId"
  129. :sectionMaxNum="goodsData.sectionMaxNum"
  130. :courseId="courseId"
  131. :learningOrder="orderNum"
  132. :goodsId="goodsId"
  133. :gradeId="gradeId"
  134. :isRebuild="true"
  135. :isBuy="true"
  136. :goodsType="1"
  137. :menuAllList="menuAllList"
  138. :sectionItem="sectionItem"
  139. ></course-tree>
  140. </view>
  141. </scroll-view>
  142. </view>
  143. <u-popup
  144. v-model="noticeShow"
  145. class="notice_modal"
  146. mode="center"
  147. border-radius="28"
  148. width="650rpx"
  149. height="622rpx"
  150. :mask-close-able="false"
  151. @close="closeNotice"
  152. >
  153. <view class="content">
  154. <view class="title">学员须知</view>
  155. <scroll-view scroll-y="true">
  156. <view
  157. class="text"
  158. v-html="
  159. goodsData.buyNote && goodsData.buyNote.replace(/\n|\r\n/g, '<br>')
  160. "
  161. >
  162. </view>
  163. </scroll-view>
  164. <view
  165. class="had_read"
  166. :class="{ gray: CountTo >= 0 }"
  167. @click="noticeConfirm()"
  168. >
  169. <text v-if="CountTo >= 0">请阅读学员须知,30s后可关闭</text>
  170. <text v-else>我已阅读学员须知</text>
  171. <text v-if="CountTo >= 0">{{ " " + CountTo + "s" }}</text>
  172. </view>
  173. </view>
  174. </u-popup>
  175. <!-- 倒计时提交 -->
  176. <u-popup
  177. v-model="noticeShow1"
  178. class="notice_modal"
  179. mode="center"
  180. border-radius="28"
  181. width="650rpx"
  182. height="262rpx"
  183. :mask-close-able="false"
  184. >
  185. <view class="content">
  186. <view class="title">提示</view>
  187. <view class="had_read">
  188. <text v-if="CountTo1 >= 0">视频学习时长不达标,请等待</text>
  189. <text v-if="CountTo1 >= 0">{{ " " + CountTo1 + "s" }}</text>
  190. </view>
  191. </view>
  192. </u-popup>
  193. <u-modal
  194. v-model="showMark"
  195. title="提示"
  196. @confirm="markConfirm"
  197. @cancel="toBack"
  198. confirm-text="复制学习网址"
  199. :show-cancel-button="true"
  200. cancel-text="关闭"
  201. >
  202. <view class="slot-content">
  203. <view>您的学习账号已经开通,请按照步骤操作,进行学习。</view>
  204. <view>1.复制学习地址:{{ markContent }}</view>
  205. <view>2.在【浏览器中】打开复制的学习网址</view>
  206. <view>3.打开学习网址后,选择【个人用户】进行登录</view>
  207. <view>(1)账号:您个人的身份证号码</view>
  208. <view>(2)密码:身份证号码,再加111111</view>
  209. </view>
  210. </u-modal>
  211. <!-- 切换课程弹窗 -->
  212. <u-popup
  213. v-model="toggleCourseShow"
  214. mode="bottom"
  215. border-radius="40"
  216. :mask-close-able="false"
  217. >
  218. <view class="popup_box">
  219. <view class="check_head">
  220. <view class="headers">
  221. <view class="grade">切换课程</view>
  222. <u-icon
  223. name="close"
  224. color="#9C9C9C"
  225. size="40"
  226. @click="closePop()"
  227. ></u-icon>
  228. </view>
  229. <view class="coruse_num">共{{ goodsTeacher.length }}门</view>
  230. <view class="menuSel">
  231. <scroll-view class="sub_sliper" scroll-x="true">
  232. <view
  233. v-for="(item, index) in subList"
  234. :key="index"
  235. style="margin-right: 50rpx; display: inline-block"
  236. >
  237. <view
  238. class="r_t1"
  239. :class="{ nactive: subIndex == index }"
  240. @click="cMenu(item, index)"
  241. >
  242. {{ item.subjectName }}
  243. </view>
  244. </view>
  245. </scroll-view>
  246. </view>
  247. </view>
  248. <view class="check_con">
  249. <scroll-view scroll-y="true" style="height: 700rpx">
  250. <view v-for="(courseItem, gTindex) in goodsTeacher" :key="gTindex">
  251. <view
  252. v-for="(item, index) in courseItem.courseList"
  253. :key="index"
  254. v-show="
  255. item.subjectId === newActiveSubjectId || !newActiveSubjectId
  256. "
  257. >
  258. <view class="course_items" v-if="item.show && item.show == 1">
  259. <view class="course_lefts">
  260. <view class="course_title">
  261. {{ item.courseName }}
  262. </view>
  263. <view
  264. v-if="courseItem.teaList && courseItem.teaList.length > 0"
  265. class="teacher_names"
  266. >
  267. <view
  268. v-for="(tea, tindex) in courseItem.teaList"
  269. :key="tindex"
  270. class="names"
  271. >{{ tea.aliasName }}</view
  272. >
  273. </view>
  274. <view class="course_pros">
  275. 学习进度
  276. <text>
  277. {{ item.stuAllNum + item.recordNum }}/{{
  278. item.secAllNum + item.examNum
  279. }}</text
  280. >
  281. </view>
  282. </view>
  283. <view
  284. class="course_rights"
  285. @click="jump(item, gTindex, 'jump')"
  286. >
  287. <view class="cicles">
  288. <u-icon
  289. name="arrow-right"
  290. color="#498AFE"
  291. size="20"
  292. ></u-icon>
  293. </view>
  294. <view class="intoStudy">进入学习</view>
  295. </view>
  296. </view>
  297. </view>
  298. </view>
  299. </scroll-view>
  300. </view>
  301. </view>
  302. </u-popup>
  303. <!-- 摄像头 -->
  304. <Popup-camera @submitPhoto="submitPhoto" ref="camera" />
  305. </view>
  306. </template>
  307. <script>
  308. import handoutsBox from "@/components/course/handoutsBox.vue";
  309. import courseTree from "@/components/course/courseTree.vue";
  310. import PopupCamera from "../../components/popup/camera.vue";
  311. import myPlayer from "@/components/myPlayer/polyvPlayer.vue";
  312. import noteBox from "@/components/course/noteBox.vue";
  313. import answerBox from "@/components/course/answerBox.vue";
  314. import { mapGetters, mapMutations } from "vuex";
  315. import { lockAction } from "../../utils/lock";
  316. export default {
  317. components: {
  318. handoutsBox,
  319. myPlayer,
  320. noteBox,
  321. answerBox,
  322. courseTree,
  323. PopupCamera,
  324. },
  325. data() {
  326. return {
  327. markContent: "http://admin.zhujianpeixun.com/",
  328. showMark: false,
  329. hasStart: false,
  330. channelItem: null,
  331. lockTimer: null,
  332. orderGoodsId: 0,
  333. noticeShow: false,
  334. enableAutoRotation: true,
  335. showSet: false,
  336. startStatus: false,
  337. courseId: 0,
  338. menuList: [],
  339. current: 0,
  340. vid: "",
  341. goodsId: 0,
  342. goodsData: {},
  343. photoPopup: false,
  344. goodsPlayConfig: null,
  345. autoplay: false,
  346. isAllowSeek: "no",
  347. playbackRate: [1.0],
  348. timer: null,
  349. goodsPhotographConfig: null,
  350. playTime: 0, // 播放时刻
  351. currentTime: 0,
  352. avatarUrl: "",
  353. ossAvatarUrl: "",
  354. studyDuration: 0, // 当前视频时长
  355. gradeId: 0,
  356. chapterId: 0,
  357. moduleId: 0,
  358. reMenuList: [],
  359. recordObj: {},
  360. photoIndex: 0,
  361. isTaking: true, //是否正在拍照
  362. needSeek: false, //第一次播放是否需要跳转
  363. photoNum: 0,
  364. photoList: [], //拍照的时间点
  365. photoConfig: false, //是否配置好拍照次数
  366. photoHistoryList: [], //已拍照历史的下标点
  367. sectionItem: {},
  368. uploadLock: false, //上传图片
  369. isPlayRebuild: false, //是否正在播放重修视频needOpen
  370. isRebuild: false, //视频是否从重修目录点击
  371. clearTimer: null,
  372. livingItem: "",
  373. option: null,
  374. toggleCourseShow: false, // 切换课程弹窗
  375. courseList: [], // 课程列表
  376. subList: [],
  377. subIndex: 0,
  378. goodsTeacher: [],
  379. teacherList: [],
  380. teacherIndex: 0,
  381. newActiveSubjectId: "", //当前选中ID
  382. compareFaceData: 0, // 拍照匹配相似度
  383. prendreAutoCarme: false, // 是否发起授权相机
  384. studyTimer: null, // 学习记录定时器
  385. CountTo: 30, // 倒计时
  386. CountTo1: 0,
  387. handoutTipLength: 0,
  388. menuAllList: [],
  389. curPlayIndex: 0, // 正在播放的节的下标
  390. faceUrl: "",
  391. erJianErZao: false,
  392. jjShiGongYuan: false,
  393. pauseTime: 0,
  394. pauseTimer: null,
  395. barTimer: null,
  396. isReach: false,
  397. noticeShow1: false,
  398. refPlv: null,
  399. isCache: true,
  400. };
  401. },
  402. computed: {
  403. ...mapGetters([
  404. "userInfo",
  405. "playSectionId",
  406. "playChannelId",
  407. "playVID",
  408. "config",
  409. ]),
  410. playSecIsLearn() {
  411. return false;
  412. return this.sectionItem.learning != 1;
  413. },
  414. orderNum() {
  415. return 0;
  416. return this.goodsData.goodsLearningOrder;
  417. },
  418. list() {
  419. let list = [
  420. {
  421. name: "目录",
  422. },
  423. {
  424. name: "讲义",
  425. },
  426. {
  427. name: "笔记",
  428. },
  429. {
  430. name: "答疑",
  431. },
  432. ];
  433. if (this.reMenuList.length > 0) {
  434. list.push({ name: "重修目录" });
  435. }
  436. return list;
  437. },
  438. params: function () {
  439. return (keys = ["orderGoodsId", "goodsId", "courseId"]) => {
  440. let params = {};
  441. for (const key of keys) {
  442. params[key] = this[key];
  443. }
  444. return params;
  445. };
  446. },
  447. detail() {
  448. if (!this.courseId || !this.courseList.length) {
  449. return {};
  450. }
  451. return this.courseList.find((e) => e.courseId == this.courseId);
  452. },
  453. },
  454. async onLoad(option) {
  455. if (option.isOther) {
  456. this.showMark = true;
  457. return;
  458. }
  459. this.option = option;
  460. let { skipPort, id, goodsId, orderGoodsId, gradeId, informId } = option;
  461. this.orderGoodsId = Number(orderGoodsId) || "";
  462. this.courseId = Number(id) || "";
  463. this.goodsId = Number(goodsId);
  464. this.gradeId = Number(gradeId);
  465. this.isCache = false;
  466. if (skipPort) {
  467. await this.$method.skipLogin(skipPort);
  468. }
  469. if (this.$method.isGoLogin()) {
  470. return;
  471. }
  472. // 公众号模板消息的数据埋点
  473. informId && this.clickOfficial(informId);
  474. await this.init();
  475. },
  476. async onShow() {
  477. if (this.isCache) {
  478. // #ifdef H5
  479. location.reload();
  480. // #endif
  481. // #ifdef MP-WEIXIN
  482. this.init();
  483. // #endif
  484. }
  485. },
  486. onUnload() {
  487. console.log("onUnloadonUnloadonUnloadonUnload");
  488. this.originUnload();
  489. clearInterval(this.lockTimer);
  490. },
  491. onHide() {
  492. setTimeout(() => {
  493. this.isCache = true;
  494. }, 2000);
  495. this.originUnload();
  496. },
  497. mounted() {},
  498. methods: {
  499. ...mapMutations(["updateChapterOpen", "updateLiveLast"]),
  500. async init() {
  501. this.isCache = false;
  502. // #ifdef MP-WEIXIN
  503. this.isAllowSeek = "no";
  504. // #endif
  505. // #ifdef H5
  506. this.isAllowSeek = "on";
  507. // #endif
  508. // 锁
  509. lockAction();
  510. this.lockTimer = setInterval(lockAction, 10000);
  511. await this.isCanLearn();
  512. !this.userInfo && this.$api.refreshUserInfo();
  513. this.courseCourseList();
  514. },
  515. // 七大员是否能进入学习
  516. async qCheckIsCanLearn() {
  517. let res = await this.$api.qCheckIsCanLearn(this.orderGoodsId);
  518. if (res.data.code !== 200) {
  519. uni.showModal({
  520. showCancel: false,
  521. title: "提示",
  522. content: res.data.msg,
  523. success: (resultst) => {
  524. uni.navigateBack();
  525. },
  526. });
  527. return Promise.reject();
  528. }
  529. let res1 = await this.$api.syncSevenPublicClass({
  530. orderGoodsId: this.orderGoodsId,
  531. });
  532. if (res1.data.code !== 200) {
  533. uni.showModal({
  534. showCancel: false,
  535. title: "提示",
  536. content: "无法进入学习!",
  537. success: (resultst) => {
  538. uni.navigateBack();
  539. },
  540. });
  541. return Promise.reject();
  542. }
  543. },
  544. // 新增微信公众号模板消息点击数据
  545. clickOfficial(informId) {
  546. this.$http({
  547. url: "/data/click",
  548. method: "post",
  549. data: { informId },
  550. });
  551. },
  552. // 点击课程目录
  553. cMenu(item, index) {
  554. this.subIndex = index;
  555. this.newActiveSubjectId = item.subjectId;
  556. },
  557. courseCourseList() {
  558. this.courseList = [];
  559. this.menuList = [];
  560. this.photoConfig = false;
  561. this.$api
  562. .courseCourseList({
  563. pageNum: 1,
  564. pageSize: 200,
  565. ...this.params(["goodsId", "orderGoodsId", "gradeId"]),
  566. })
  567. .then((res) => {
  568. if (res.data.code == 200) {
  569. this.courseList = res.data.rows;
  570. // 科目
  571. let allItem = [{ subjectId: 0, subjectName: "所有" }];
  572. let ids = [];
  573. const newArr = [];
  574. this.courseList.forEach((item) => {
  575. if (ids.indexOf(item.subjectId) == -1) {
  576. ids.push(item.subjectId);
  577. newArr.push(item);
  578. }
  579. });
  580. this.subList = [...allItem, ...newArr];
  581. if (res.data.total > 1) {
  582. this.getUserWatchLast();
  583. } else {
  584. this.originOnShow();
  585. this.originMounted();
  586. }
  587. }
  588. });
  589. },
  590. // 查询用户最后一次看的录播的信息
  591. getUserWatchLast() {
  592. this.$http({
  593. url: "/study/record/getUserWatchLast",
  594. method: "get",
  595. data: {
  596. orderGoodsId: this.orderGoodsId,
  597. },
  598. }).then((res) => {
  599. console.log("🚀 ~ file: detail.vue:859 ~ getUserWatchLast ~ res:", res);
  600. if (res.data.code == 200 && res.data.data) {
  601. this.courseId = res.data.data.courseId;
  602. }
  603. if (!this.courseId) {
  604. this.courseId = this.courseList[0].courseId;
  605. }
  606. this.originOnShow();
  607. this.originMounted();
  608. //获取商品双师资模板
  609. this.getCourseTeacher(this.courseList);
  610. });
  611. },
  612. getCourseTeacher(rows) {
  613. this.goodsTeacher = [];
  614. //获取商品双师资模板
  615. this.$api
  616. .courseTeacherList({
  617. goodsId: this.goodsId,
  618. })
  619. .then((res1) => {
  620. if (res1.data.data && res1.data.data.length > 0) {
  621. //课程老师模板
  622. let teacherTel = res1.data.data;
  623. //商品课程
  624. let courses = rows;
  625. teacherTel.forEach((tea) => {
  626. let dataList = [];
  627. let teacherList = [];
  628. courses.forEach((item) => {
  629. let data = tea.courseList.filter(
  630. (x) => x.courseId == item.courseId
  631. );
  632. if (data && data.length > 0) {
  633. dataList.push(item);
  634. teacherList = tea.courseList;
  635. }
  636. });
  637. let result = {
  638. teaList: teacherList,
  639. courseList: dataList,
  640. };
  641. this.goodsTeacher.push(result);
  642. });
  643. if (this.goodsTeacher && this.goodsTeacher.length > 0) {
  644. let courseIds = [];
  645. this.goodsTeacher.forEach((item) => {
  646. item.courseList.forEach((course) => {
  647. courseIds.push(course.courseId);
  648. });
  649. });
  650. if (courseIds.length > 0) {
  651. courses.forEach((item) => {
  652. if (!courseIds.includes(item.courseId)) {
  653. let data = {
  654. teaList: [],
  655. courseList: [],
  656. };
  657. data.courseList.push(item);
  658. this.goodsTeacher.push(data);
  659. }
  660. });
  661. }
  662. this.goodsTeacher.forEach((item) => {
  663. if (item.courseList && item.courseList.length > 0) {
  664. item.courseList[0].show = 1;
  665. }
  666. });
  667. }
  668. } else {
  669. //没有双师资模板
  670. rows.forEach((item) => {
  671. item.show = 1;
  672. let data = {
  673. teaList: [],
  674. courseList: [],
  675. };
  676. data.courseList.push(item);
  677. this.goodsTeacher.push(data);
  678. });
  679. }
  680. this.goodsTeacher.forEach((item) => {
  681. if (item.courseList.some((x) => x.courseId == this.courseId)) {
  682. this.teacherList = item.teaList;
  683. }
  684. });
  685. });
  686. },
  687. erJianErZaoPauseTip() {
  688. if (this.playSecIsLearn && this.erJianErZao) {
  689. if (this.pauseTimer) {
  690. return;
  691. }
  692. this.pauseTime = Date.now();
  693. console.log("开启定时器");
  694. this.pauseTimer = setInterval(() => {
  695. console.log("暂停时间", Date.now() - this.pauseTime, this.pauseTime);
  696. if (Date.now() - this.pauseTime > 5 * 60 * 1000) {
  697. // 5 * 60 * 1000
  698. let text = this.photoPopup ? "拍照停留" : "暂停";
  699. this.photoPopup = false;
  700. uni.showModal({
  701. title: "提示",
  702. showCancel: false,
  703. content: `检测${text}时间过长,刷新当前页面`,
  704. cancelText: "取消",
  705. confirmText: "确定",
  706. success: (res) => {
  707. if (res.confirm) {
  708. // #ifdef H5
  709. location.reload();
  710. // #endif
  711. // #ifdef MP-WEIXIN
  712. this.courseCourseList();
  713. // #endif
  714. }
  715. },
  716. });
  717. this.clearPauseTimer();
  718. }
  719. }, 5000);
  720. }
  721. },
  722. // 原来onshow里面的内容
  723. async originOnShow() {
  724. this.getReMenuList();
  725. await this.studyRecordMenuAllList();
  726. // 消息过来 定位某个节
  727. if (this.option.noteSecond) {
  728. this.jumpNote({
  729. sectionType: 1,
  730. ...this.option,
  731. });
  732. return;
  733. }
  734. this.studyRecordQueryLiveLast();
  735. },
  736. // 原来的mouted内容
  737. originMounted() {
  738. uni.$on("changeSection", (oldSectionId) => {
  739. console.log(
  740. "切换课程-originMounted->playVID:",
  741. this.playVID,
  742. oldSectionId
  743. );
  744. this.studyTimer && clearInterval(this.studyTimer); // 清除定时器
  745. this.clearPauseTimer();
  746. this.hasStart = false;
  747. this.photoConfig = false;
  748. //清除直播
  749. this.$store.commit("setPlayChannelId", { playChannelId: 0 });
  750. // 防止原先初始化错误
  751. if (!this.refPlv) {
  752. this.refPlv = this.$refs.player;
  753. }
  754. this.postStudyRecord(0, oldSectionId);
  755. });
  756. uni.$on("getSection", (item) => {
  757. //清除直播
  758. this.studyTimer && clearInterval(this.studyTimer);
  759. this.hasStart = false;
  760. this.isPlayRebuild = item.rebuild;
  761. this.photoConfig = false;
  762. this.sectionItem = item;
  763. this.moduleId = item.moduleId || null;
  764. this.chapterId = item.chapterId || null;
  765. this.$store.commit("setPlayChannelId", { playChannelId: 0 });
  766. this.playVideo(item);
  767. });
  768. uni.$on("levelId", (item) => {
  769. let arr = item.split("-");
  770. //点击节获取的各层级ID
  771. this.moduleId = arr[0];
  772. this.chapterId = arr[1];
  773. });
  774. uni.$on("getChannel", (item) => {
  775. //清除录播
  776. this.studyTimer && clearInterval(this.studyTimer);
  777. this.hasStart = false;
  778. this.$store.commit("setPlayVID", { playVID: null });
  779. this.moduleId = item.moduleId;
  780. this.chapterId = item.chapterId;
  781. this.$store.commit("setPlaySectionId", {
  782. playSectionId: item.sectionId || item.menuId,
  783. });
  784. this.playChannel(item);
  785. this.channelItem = item;
  786. });
  787. uni.$on("isRebuild", (item) => {
  788. this.isRebuild = item;
  789. });
  790. this.updateChapterOpen(true);
  791. },
  792. clearPauseTimer() {
  793. if (this.pauseTimer) {
  794. this.pauseTime = 0;
  795. clearInterval(this.pauseTimer);
  796. this.pauseTimer = null;
  797. }
  798. },
  799. clearBarTimer() {
  800. if (this.barTimer) {
  801. clearInterval(this.barTimer);
  802. this.barTimer = null;
  803. }
  804. },
  805. // 原来onUnload里面的内容
  806. originUnload() {
  807. if (this.playSectionId > 0 && this.hasStart) {
  808. //退出提交记录
  809. this.postStudyRecord();
  810. }
  811. //清除正在播放的节ID
  812. // this.$store.commit('setPlayObj',null)
  813. this.$store.commit("setPlaySectionId", { playSectionId: 0 });
  814. this.$store.commit("setPlayChannelId", { playChannelId: 0 });
  815. this.$store.commit("setPlayVID", { playVID: null });
  816. //移除所有的事件监听器
  817. uni.$off();
  818. this.clearTimer && clearTimeout(this.clearTimer);
  819. if (this.studyTimer) {
  820. clearInterval(this.studyTimer);
  821. this.hasStart = false;
  822. }
  823. this.clearPauseTimer();
  824. this.clearBarTimer();
  825. if (this.lockTimer) {
  826. clearInterval(this.lockTimer);
  827. this.$api
  828. .lockDelLock({
  829. action: "jxjy",
  830. uuid: this.$method.getUuid(),
  831. })
  832. .then((res) => {
  833. uni.hideLoading();
  834. });
  835. }
  836. },
  837. changeCourses() {
  838. this.toggleCourseShow = true;
  839. },
  840. closePop() {
  841. this.toggleCourseShow = false;
  842. },
  843. async activeFunc(item, index) {
  844. this.teacherIndex = index;
  845. let findResult = "";
  846. this.goodsTeacher.forEach((citem, index) => {
  847. citem.courseList.forEach((e, e_index) => {
  848. if (e.courseId == item.courseId) {
  849. findResult = e;
  850. }
  851. });
  852. });
  853. this.jump(findResult, 1);
  854. },
  855. // 进入学习
  856. async jump(item, index, type) {
  857. if (this.courseId === item.courseId) {
  858. this.toggleCourseShow = false;
  859. return;
  860. }
  861. if (this.orderNum == 2 && index != 0) {
  862. let prevItem = this.courseList[index - 1];
  863. if (
  864. prevItem.stuAllNum + prevItem.recordNum <
  865. prevItem.secAllNum + prevItem.examNum
  866. ) {
  867. uni.showToast({
  868. icon: "none",
  869. title: "请按顺序学完上一课再学习这一课",
  870. });
  871. return;
  872. }
  873. }
  874. // 打回 需重修
  875. if (item.rebuild === 0) {
  876. this.$navTo.togo("/pages2/learn/details", {
  877. id: item.courseId,
  878. ...this.params(["goodsId", "orderGoodsId", "gradeId"]),
  879. });
  880. return;
  881. }
  882. if (type) {
  883. this.teacherIndex = 0;
  884. this.goodsTeacher.forEach((citem) => {
  885. if (citem.courseList.some((x) => x.courseId == item.courseId)) {
  886. this.teacherList = citem.teaList;
  887. }
  888. });
  889. }
  890. this.sectionItem = {};
  891. this.toggleCourseShow = false;
  892. this.courseId = item.courseId;
  893. this.originOnShow();
  894. },
  895. async nextCourses(item, type) {
  896. this.vid = "";
  897. this.hasStart = true;
  898. await this.originUnload();
  899. this.courseId = item.courseId;
  900. this.gradeId = item.gradeId;
  901. this.toggleCourseShow = false;
  902. },
  903. clickLeft() {
  904. // uni.navigateBack()
  905. uni.switchTab({
  906. url: "/pages/learn/index",
  907. });
  908. },
  909. toBack(delta = 1) {
  910. uni.navigateBack({
  911. delta,
  912. });
  913. },
  914. markConfirm() {
  915. uni.setClipboardData({
  916. data: this.markContent,
  917. success: () => {
  918. setTimeout(this.toBack, 1000);
  919. },
  920. });
  921. },
  922. closeNotice() {
  923. this.$api
  924. .baseHandoutTip({
  925. orderGoodsId: this.orderGoodsId,
  926. })
  927. .then((res) => {});
  928. },
  929. noticeConfirm() {
  930. if (this.CountTo < 0) {
  931. this.noticeShow = false;
  932. if (this.handoutTipLength == 0 && this.goodsPlayConfig.autoPlay > 0) {
  933. this.autoplay = true;
  934. this.refPlv.resumeVideo();
  935. }
  936. }
  937. },
  938. baseHandoutTipList() {
  939. this.$api
  940. .baseHandoutTipList({
  941. orderGoodsId: this.orderGoodsId,
  942. })
  943. .then((res) => {
  944. this.handoutTipLength = res.data.rows.length;
  945. if (res.data.rows.length == 0) {
  946. this.noticeShow = true;
  947. if (this.CountTo == 30) {
  948. var timer = setInterval(() => {
  949. this.CountTo--;
  950. if (this.CountTo < 0) {
  951. clearInterval(timer);
  952. }
  953. }, 1000);
  954. }
  955. } else {
  956. this.CountTo = -1;
  957. }
  958. });
  959. },
  960. /**
  961. * 获取上次观看的直播
  962. */
  963. studyRecordGetLastLive() {
  964. this.$api
  965. .studyRecordGetLastLive({
  966. orderGoodsId: this.orderGoodsId,
  967. courseId: this.courseId,
  968. })
  969. .then((res) => {
  970. this.updateLiveLast(res.data.data);
  971. });
  972. },
  973. async initPlayVideo(sectionItem) {
  974. this.moduleId = sectionItem.moduleId;
  975. this.chapterId = sectionItem.chapterId;
  976. this.sectionItem = sectionItem
  977. if (sectionItem.sectionType == 1) {
  978. //录播
  979. this.playVideo(sectionItem);
  980. } else if (sectionItem.sectionType == 2) {
  981. //直播
  982. this.studyRecordGetLastLive();
  983. } else if (sectionItem.sectionType == 3) {
  984. //回放
  985. this.playVideo(sectionItem);
  986. } else if (sectionItem.doType == 2) {
  987. uni.showModal({
  988. title: "温馨提示",
  989. content: "当前节视频已学完,是否进入考试?",
  990. success: (res) => {
  991. if (res.confirm) {
  992. this.toQuestionBank(sectionItem);
  993. }
  994. },
  995. });
  996. return;
  997. }
  998. },
  999. async submitPhoto(url, compareFaceData, cb) {
  1000. this.ossAvatarUrl = url;
  1001. this.compareFaceData = compareFaceData;
  1002. this.postCoursePhotoRecord()
  1003. .then(async (res) => {
  1004. this.photoHistoryList[this.photoIndex] = true;
  1005. await this.postStudyRecord();
  1006. if (!this.erJianErZao && this.isReach) {
  1007. await this.postStudyRecord(1);
  1008. cb();
  1009. this.nextSection();
  1010. return;
  1011. }
  1012. cb();
  1013. this.refPlv.resumeVideo();
  1014. this.enableAutoRotation = true;
  1015. })
  1016. .catch((err) => {
  1017. uni.showToast({
  1018. title: "上传接口报错,请重新拍照上传" + err,
  1019. icon: "none",
  1020. });
  1021. cb(1);
  1022. });
  1023. },
  1024. toQuestionBank(sectionItem) {
  1025. uni.navigateTo({
  1026. url:
  1027. "/pages2/class/questionBank?courseId=" +
  1028. this.courseId +
  1029. "&gradeId=" +
  1030. this.gradeId +
  1031. "&isFromVideo=1&id=" +
  1032. sectionItem.id +
  1033. "&goodsid=" +
  1034. this.goodsId +
  1035. "&moduleId=" +
  1036. (sectionItem.moduleId || 0) +
  1037. "&chapterId=" +
  1038. (sectionItem.chapterId || 0) +
  1039. "&orderGoodsId=" +
  1040. this.orderGoodsId +
  1041. "&type=" +
  1042. (sectionItem.type == 4 ? 1 : 3) +
  1043. "&learning=" +
  1044. sectionItem.studyStatus +
  1045. "&isBackVideo=" +
  1046. 1,
  1047. });
  1048. },
  1049. studyRecordQueryLiveLast() {
  1050. // /study/record/queryLiveLast
  1051. this.$api
  1052. .studyRecordQueryLiveLast({
  1053. gradeId: this.gradeId,
  1054. orderGoodsId: this.orderGoodsId,
  1055. courseId: this.courseId,
  1056. })
  1057. .then((res) => {
  1058. console.log("🚀 ~ file: detail.vue:1071 ~ .then ~ res:", res)
  1059. let { data } = res.data;
  1060. if (!data.sectionId) {
  1061. data = this.menuAllList[0];
  1062. }
  1063. // if (data.learning == 1 && this.orderNum == 2) {
  1064. // let next = this.menuAllList.find((e) => e.studyStatus != 1);
  1065. // next && (data = next);
  1066. // }
  1067. this.initPlayVideo(data);
  1068. });
  1069. },
  1070. /**
  1071. * 模块大节播放完毕,刷新列表
  1072. */
  1073. sectionPlayEnd(isRebuild, index) {
  1074. if (this.reMenuList.length > 0) {
  1075. //有重修目录
  1076. if (isRebuild.isRebuild) {
  1077. //从重修点击
  1078. this.$api
  1079. .reMenuList({
  1080. orderGoodsId: this.orderGoodsId,
  1081. courseId: this.courseId,
  1082. rebuild: 1,
  1083. gradeId: this.gradeId,
  1084. })
  1085. .then((res) => {
  1086. if (res.data.code == 200) {
  1087. if (res.data.rows.length) {
  1088. res.data.rows[index].name = res.data.rows[index].menuName;
  1089. this.$set(this.reMenuList, index, res.data.rows[index]);
  1090. for (let i = 0; i < res.data.rows.length; i++) {
  1091. let item = res.data.rows[i];
  1092. item.down = true;
  1093. item.id = item.menuId;
  1094. item.name = item.menuName;
  1095. }
  1096. this.reMenuList = [];
  1097. this.$nextTick(() => {
  1098. this.reMenuList = res.data.rows;
  1099. // console.log(this.reMenuList,'this.reMenuList1')
  1100. });
  1101. } else {
  1102. this.reMenuList = [];
  1103. }
  1104. }
  1105. });
  1106. this.$api
  1107. .reMenuList({
  1108. courseId: this.courseId,
  1109. gradeId: this.gradeId,
  1110. orderGoodsId: this.orderGoodsId,
  1111. })
  1112. .then((res) => {
  1113. if (res.data.code == 200) {
  1114. for (let i = 0; i < res.data.rows.length; i++) {
  1115. let item = res.data.rows[i];
  1116. item.down = true;
  1117. item.id = item.menuId;
  1118. item.name = item.menuName;
  1119. item.menuType = item.type;
  1120. }
  1121. this.menuList = [];
  1122. this.$nextTick(() => {
  1123. this.menuList = res.data.rows;
  1124. });
  1125. }
  1126. });
  1127. } else {
  1128. //从普通目录点击
  1129. this.$api
  1130. .reMenuList({
  1131. courseId: this.courseId,
  1132. gradeId: this.gradeId,
  1133. orderGoodsId: this.orderGoodsId,
  1134. })
  1135. .then((res) => {
  1136. if (res.data.code == 200) {
  1137. res.data.rows[index].name = res.data.rows[index].menuName;
  1138. res.data.rows[index].id = res.data.rows[index].menuId;
  1139. this.$set(this.menuList, index, res.data.rows[index]);
  1140. }
  1141. });
  1142. this.$api
  1143. .reMenuList({
  1144. orderGoodsId: this.orderGoodsId,
  1145. courseId: this.courseId,
  1146. rebuild: 1,
  1147. gradeId: this.gradeId,
  1148. })
  1149. .then((res) => {
  1150. if (res.data.code == 200) {
  1151. if (res.data.rows.length) {
  1152. // for (let i = 0; i < res.data.rows.length; i++) {
  1153. // let item = res.data.rows[i];
  1154. // item.down = true;
  1155. // item.id = item.menuId;
  1156. // item.name = item.menuName;
  1157. // }
  1158. // this.reMenuList = res.data.rows;
  1159. } else {
  1160. this.reMenuList = [];
  1161. }
  1162. }
  1163. });
  1164. }
  1165. } else {
  1166. console.log("--模块大节播放完毕,刷新列表-");
  1167. //没有重修目录
  1168. this.$api
  1169. .reMenuList({
  1170. courseId: this.courseId,
  1171. gradeId: this.gradeId,
  1172. orderGoodsId: this.orderGoodsId,
  1173. })
  1174. .then((res) => {
  1175. if (res.data.code == 200) {
  1176. res.data.rows[index].name = res.data.rows[index].menuName;
  1177. res.data.rows[index].id = res.data.rows[index].menuId;
  1178. this.$set(this.menuList, index, res.data.rows[index]);
  1179. }
  1180. });
  1181. }
  1182. },
  1183. goLive(item) {
  1184. let moduleId = item.moduleId || 0;
  1185. let chapterId = item.chapterId || 0;
  1186. let sectionId = item.sectionId || item.menuId;
  1187. let uuid = new Date().valueOf() + "";
  1188. // buyCourse 是否购买课程:1是 0否
  1189. let encode = encodeURIComponent(
  1190. this.config.hostLive +
  1191. "/pages/live/index?token=" +
  1192. uni.getStorageSync("token") +
  1193. "&userInfo=" +
  1194. JSON.stringify(this.userInfo) +
  1195. "&channelId=" +
  1196. item.liveUrl +
  1197. "&gradeId=" +
  1198. this.gradeId +
  1199. "&courseId=" +
  1200. this.courseId +
  1201. "&goodsId=" +
  1202. this.goodsId +
  1203. "&orderGoodsId=" +
  1204. this.orderGoodsId +
  1205. "&sectionId=" +
  1206. sectionId +
  1207. "&chapterId=" +
  1208. chapterId +
  1209. "&moduleId=" +
  1210. moduleId +
  1211. "&buyCourse=1" +
  1212. "&ident=" +
  1213. uuid
  1214. );
  1215. uni.navigateTo({
  1216. url: `../../pages/webview/index?url=` + encode,
  1217. });
  1218. },
  1219. studyRecordMenuAllList() {
  1220. // study/record/menuAllList
  1221. return this.$api
  1222. .studMenuAllList({
  1223. courseId: this.courseId,
  1224. ...this.params(["goodsId", "orderGoodsId", "gradeId"]),
  1225. })
  1226. .then((res) => {
  1227. let nowTime = Number(new Date().getTime() / 1000).toFixed(0);
  1228. if (res.data.data) {
  1229. this.menuAllList = res.data.data.filter(
  1230. (e) => e.doType != 1 || (e.doType == 2 && e.studyStatus == 1)
  1231. );
  1232. this.livingItem = res.data.data.find(
  1233. (item) =>
  1234. item.liveStartTime <= nowTime && item.liveEndTime > nowTime
  1235. );
  1236. }
  1237. return Promise.resolve();
  1238. });
  1239. },
  1240. async getbaseprofiletplists() {
  1241. let {
  1242. data: { code, rows },
  1243. } = await this.$api.getbaseprofiletplists({
  1244. goodsId: this.goodsId,
  1245. orderGoodsId: this.orderGoodsId,
  1246. });
  1247. if (code === 200 && rows.length && rows[0].keyValue) {
  1248. let baseRes = await this.$api.getbaseprofiletpId(this.goodsId);
  1249. if (baseRes.data.code === 200 && baseRes.data.data) {
  1250. let {
  1251. data: { code, data },
  1252. } = await this.$api.getbaseprofiletpgetInfo({
  1253. goodsId: this.goodsId,
  1254. orderGoodsId: this.orderGoodsId,
  1255. });
  1256. if (
  1257. code === 200 &&
  1258. (!data || (data.status === 3 && data.changeStatus === 1))
  1259. ) {
  1260. uni.showModal({
  1261. content: !data
  1262. ? "请前往填写资料"
  1263. : "资料审核不通过,请前往重新填写",
  1264. cancelText: "返回",
  1265. success: (resultst) => {
  1266. if (resultst.confirm) {
  1267. this.$navTo.togo("/pages2/verify/input", {
  1268. id: this.goodsId,
  1269. orderGoodsId: this.orderGoodsId,
  1270. });
  1271. }
  1272. if (resultst.cancel) {
  1273. uni.navigateBack();
  1274. }
  1275. },
  1276. });
  1277. return Promise.reject();
  1278. } else if (data.status === 1 && JSON.parse(rows[0].keyValue2)[0]) {
  1279. let {
  1280. data: { code, data },
  1281. } = await this.$api.getbaseprofileStampgetInfo({
  1282. goodsId: this.goodsId,
  1283. orderGoodsId: this.orderGoodsId,
  1284. });
  1285. if (
  1286. code === 200 &&
  1287. (!data || (data.status === 3 && data.changeStatus === 1))
  1288. ) {
  1289. uni.showModal({
  1290. content: !data
  1291. ? "请前往填写盖章资料"
  1292. : "资料盖章审核不通过,请前往重新填写",
  1293. cancelText: "返回",
  1294. success: (resultst) => {
  1295. if (resultst.confirm) {
  1296. this.$navTo.togo("/pages2/verify/input2", {
  1297. id: this.goodsId,
  1298. orderGoodsId: this.orderGoodsId,
  1299. });
  1300. }
  1301. if (resultst.cancel) {
  1302. uni.navigateBack();
  1303. }
  1304. },
  1305. });
  1306. return Promise.reject();
  1307. }
  1308. }
  1309. }
  1310. }
  1311. return Promise.resolve();
  1312. },
  1313. async isCanLearn() {
  1314. this.option.isQ !== "" && (await this.qCheckIsCanLearn());
  1315. await this.getbaseprofiletplists();
  1316. await this.getGradeInfo();
  1317. await this.getGoodsDetail();
  1318. },
  1319. /**
  1320. * 计算tabs宽度
  1321. */
  1322. itemWidth() {
  1323. return 100 / this.list.length + "%";
  1324. },
  1325. findMenuNextSection(index) {
  1326. for (let i = index + 1; i < this.reMenuList.length; i++) {
  1327. let item = this.reMenuList[i];
  1328. if (item.type == 3) {
  1329. return item;
  1330. }
  1331. }
  1332. return {};
  1333. },
  1334. loadedmetadata(event) {
  1335. this.refPlv = this.$refs.player;
  1336. // this.openCamera()
  1337. },
  1338. getPhotoLastRecord() {
  1339. let { chapterId, sectionId, moduleId } = this.sectionItem;
  1340. let data = {
  1341. ...this.params(),
  1342. sectionId: sectionId || 0,
  1343. gradeId: this.gradeId,
  1344. chapterId: chapterId || 0,
  1345. moduleId: moduleId || 0,
  1346. };
  1347. this.$api.getPhotoLastRecord(data).then((res) => {
  1348. if (res.data.code == 200) {
  1349. //清空历史数据
  1350. this.photoHistoryList = [];
  1351. this.photoList = [];
  1352. for (let i = 0; i < res.data.data.length; i++) {
  1353. //-2存储随机拍照数组
  1354. if (res.data.data[i].photoIndex == -2) {
  1355. this.photoList =
  1356. res.data.data[i].timeInterval &&
  1357. res.data.data[i].timeInterval.split(",");
  1358. } else {
  1359. this.photoHistoryList.push(res.data.data[i].photoIndex);
  1360. }
  1361. }
  1362. }
  1363. });
  1364. },
  1365. //postTime 只提交随机时间
  1366. postCoursePhotoRecord(postTime = false) {
  1367. return new Promise((resolve, reject) => {
  1368. let data = {
  1369. ...this.params("orderGoodsId", "goodsId", "courseId", "gradeId"),
  1370. photo: this.ossAvatarUrl,
  1371. sectionId: this.playSectionId,
  1372. photoTime: this.playTime || 0,
  1373. photoIndex: postTime ? -2 : this.photoIndex, //从0算起,-2只提交随机时间
  1374. photoNum: this.photoNum,
  1375. chapterId: this.chapterId,
  1376. moduleId: this.moduleId,
  1377. timeInterval: postTime ? this.photoList.join(",") : "",
  1378. };
  1379. this.$api
  1380. .coursePhotoRecord(data)
  1381. .then((res) => {
  1382. if (res.data.code == 200) {
  1383. resolve();
  1384. } else {
  1385. reject();
  1386. }
  1387. })
  1388. .catch((err) => {
  1389. reject();
  1390. });
  1391. });
  1392. },
  1393. randomNum(minNum, maxNum) {
  1394. switch (arguments.length) {
  1395. case 1:
  1396. return parseInt(Math.random() * minNum + 1, 10);
  1397. break;
  1398. case 2:
  1399. return parseInt(Math.random() * (maxNum - minNum + 1) + minNum, 10);
  1400. break;
  1401. default:
  1402. return 0;
  1403. break;
  1404. }
  1405. },
  1406. //配置随机拍照时间
  1407. configPhoto(duration) {
  1408. if (this.photoConfig) {
  1409. return;
  1410. }
  1411. let totalVideoTime = this.refPlv.getDuration();
  1412. this.photoConfig = true;
  1413. if (this.erJianErZao) {
  1414. this.photoList = this.randomConfig(totalVideoTime, duration);
  1415. return;
  1416. }
  1417. //没有历史拍照间隔数据
  1418. if (!this.photoList || this.photoList.length == 0) {
  1419. // 46 * 60
  1420. this.photoList = this.commonConfig(
  1421. totalVideoTime,
  1422. this.jjShiGongYuan ? 10 : undefined
  1423. );
  1424. this.postCoursePhotoRecord(true); //提交随机拍照时间数组
  1425. }
  1426. console.log(this.photoList, "this.photoList");
  1427. },
  1428. // 二建随机拍摄时间
  1429. randomConfig(totalVideoTime, duration) {
  1430. this.photoHistoryList = [];
  1431. let photoList = [duration];
  1432. let pre = duration;
  1433. if (totalVideoTime > 300) {
  1434. while (pre <= totalVideoTime) {
  1435. pre += this.randomNum(780, 900);
  1436. pre <= totalVideoTime && photoList.push(pre);
  1437. }
  1438. if (totalVideoTime - 300 > photoList.slice(-1)[0]) {
  1439. photoList.push(this.randomNum(totalVideoTime - 180, totalVideoTime));
  1440. }
  1441. }
  1442. return photoList;
  1443. },
  1444. // 随机前后五分钟
  1445. commonConfig(totalVideoTime, fixS) {
  1446. console.log("🚀 ~ file: detail.vue:2407 ~ commonConfig ~ fixS:", fixS);
  1447. let photoList = [0];
  1448. // 固定间隔时间取
  1449. if (fixS) {
  1450. let num = Math.ceil(totalVideoTime / fixS);
  1451. for (let i = 1; i < num; i++) {
  1452. photoList.push(i * fixS);
  1453. }
  1454. this.photoNum = num;
  1455. } else {
  1456. if (this.photoNum == 3) {
  1457. if (totalVideoTime >= 900) {
  1458. //大于15分钟
  1459. let centerTime = Math.floor(totalVideoTime / 2); //获取中间时间
  1460. let centerMinTime = centerTime - 300; //前后5分钟
  1461. let centerMaxTime = centerTime + 300;
  1462. let centerTakeTime = this.randomNum(centerMinTime, centerMaxTime);
  1463. photoList.push(centerTakeTime); //中间拍一张
  1464. let endMaxTime = totalVideoTime - 60;
  1465. let endMinTime = totalVideoTime - 300;
  1466. let endTakeTime = this.randomNum(endMinTime, endMaxTime);
  1467. photoList.push(endTakeTime); //最后拍一张
  1468. } else {
  1469. //小于15分钟
  1470. let centerTime = this.randomNum(
  1471. (1 / 3) * totalVideoTime,
  1472. (2 / 3) * totalVideoTime
  1473. );
  1474. photoList.push(centerTime);
  1475. let endTakeTime = this.randomNum(
  1476. (2 / 3) * totalVideoTime,
  1477. totalVideoTime
  1478. );
  1479. photoList.push(endTakeTime);
  1480. }
  1481. }
  1482. }
  1483. return photoList;
  1484. },
  1485. getLiveUid(channelId) {
  1486. let self = this;
  1487. return new Promise((resolve) => {
  1488. let data = {
  1489. channelId: channelId,
  1490. orderGoodsId: this.orderGoodsId,
  1491. };
  1492. self.$api.polyvSign(data).then((res) => {
  1493. resolve(res.data.data);
  1494. });
  1495. });
  1496. },
  1497. studyNotice() {
  1498. this.noticeShow = true;
  1499. },
  1500. //正常播放视频
  1501. async playVideo(item) {
  1502. this.sectionItem = item;
  1503. let { learning, videoCurrentTime, sectionId, recordingUrl } = item;
  1504. console.log(this.sectionItem, "this.sectionItem");
  1505. if (this.timer) {
  1506. clearInterval(this.timer);
  1507. }
  1508. this.recordObj = videoCurrentTime
  1509. ? { videoCurrentTime }
  1510. : await this.getRecordLast(item);
  1511. // 查找拍照历史
  1512. if ((this.photoNum > 0 || this.jjShiGongYuan) && learning != 1) {
  1513. await this.getPhotoLastRecord();
  1514. }
  1515. this.$store.commit("setPlayVID", {
  1516. playVID: recordingUrl,
  1517. });
  1518. this.$store.commit("setPlaySectionId", {
  1519. playSectionId: sectionId,
  1520. });
  1521. this.startStatus = true;
  1522. if (this.refPlv) {
  1523. this.refPlv.changeVid({
  1524. vid: recordingUrl,
  1525. videoCurrentTime: this.recordObj.videoCurrentTime,
  1526. });
  1527. }
  1528. },
  1529. getRecordLast(sectionItem) {
  1530. let { chapterId, sectionId, courseId, moduleId } = sectionItem;
  1531. return new Promise((resolve) => {
  1532. let data = {
  1533. ...this.params(),
  1534. gradeId:
  1535. this.gradeId || this.gradeId == 0 ? Number(this.gradeId) : null,
  1536. sectionId: sectionId || 0,
  1537. chapterId: chapterId || 0,
  1538. moduleId: moduleId || 0,
  1539. };
  1540. this.$api.recordLast(data).then((res) => {
  1541. resolve(res.data.data);
  1542. });
  1543. });
  1544. },
  1545. jumpNote(item) {
  1546. this.$u.toast("即将跳到笔记位置");
  1547. if (this.playSectionId != item.sectionId) {
  1548. this.initPlayVideo({
  1549. sectionType: 1,
  1550. ...item,
  1551. videoCurrentTime: Number(item.noteSecond),
  1552. });
  1553. } else {
  1554. this.refPlv.seekVideo(item.noteSecond);
  1555. }
  1556. },
  1557. getGradeInfo() {
  1558. // 即刻 1 待定2 日期3
  1559. return this.$api.goodsGradeInfo(this.gradeId).then((res) => {
  1560. if (res.data.code == 200) {
  1561. let { data } = res.data;
  1562. if (
  1563. data.learningStatus == 2 ||
  1564. (data.learningStatus == 3 &&
  1565. Number(data.learningTimeStart) > Number(new Date() / 1000))
  1566. ) {
  1567. uni.showModal({
  1568. showCancel: false,
  1569. confirmText: "确定",
  1570. content:
  1571. "当前课程正在申请中,正式开班后方可进行学习,请耐心等候!",
  1572. success: function (resultst) {
  1573. uni.navigateBack();
  1574. },
  1575. });
  1576. return Promise.reject(123);
  1577. }
  1578. }
  1579. });
  1580. },
  1581. postStudyRecord(status = 0, sectionId = this.playSectionId) {
  1582. if (!this.refPlv) {
  1583. return;
  1584. }
  1585. let currentTime = this.refPlv.playCurrentTime();
  1586. let PlayDuration = this.refPlv.playVideoTime();
  1587. if (currentTime < 10 && !this.ossAvatarUrl) {
  1588. return;
  1589. }
  1590. if (this.playChannelId > 0) {
  1591. currentTime = 2; //直播无法获取,无论开始结束都传2秒
  1592. }
  1593. let self = this;
  1594. let data = {
  1595. ...this.params(
  1596. "orderGoodsId",
  1597. "goodsId",
  1598. "courseId",
  1599. "erJianErZao",
  1600. "gradeId"
  1601. ),
  1602. fromPlat: 1, //来源平台 1小程序 2网站
  1603. photo: self.ossAvatarUrl,
  1604. sectionId: sectionId || 0,
  1605. studyDuration: parseInt(
  1606. PlayDuration > 0 ? PlayDuration : self.studyDuration
  1607. ),
  1608. chapterId: this.chapterId || 0,
  1609. moduleId: this.moduleId || 0,
  1610. videoCurrentTime: parseInt(
  1611. currentTime > 0 ? currentTime : self.studyDuration
  1612. ),
  1613. };
  1614. if (this.ossAvatarUrl) {
  1615. data.similarity = this.compareFaceData; // 相似度
  1616. }
  1617. if (status > 0) {
  1618. data.status = status;
  1619. }
  1620. console.log(data, "记录参数");
  1621. return new Promise((resolve, reject) => {
  1622. this.$api
  1623. .studyRecord(data)
  1624. .then((res) => {
  1625. console.log(res, "记录返回");
  1626. let { code, msg } = res.data;
  1627. if (code == 200) {
  1628. if (status > 0) {
  1629. this.studyRecordMenuAllList();
  1630. let moduleId = this.moduleId || 0;
  1631. let chapterId = this.chapterId || 0;
  1632. let playNextIdisRebuild = `moduleId${moduleId}chapterId${chapterId}sectionId${sectionId}isRebuild`;
  1633. let playNextId = `moduleId${moduleId}chapterId${chapterId}sectionId${sectionId}`; //拼接对应章节唯一id
  1634. uni.$emit("playNext" + playNextIdisRebuild, {
  1635. fromRebuild: this.isRebuild,
  1636. }); //通知播放结束,不来自重修目录的点击不用弹窗学习下一节
  1637. uni.$emit("playNext" + playNextId); //通知播放结束
  1638. }
  1639. self.ossAvatarUrl = "";
  1640. } else if (code == 600) {
  1641. uni.showModal({
  1642. showCancel: false,
  1643. title: "提示",
  1644. content: msg,
  1645. success: (resultst) => {
  1646. uni.navigateBack();
  1647. },
  1648. });
  1649. } else if (code == 558) {
  1650. this.CountTo1 = msg.split(",")[1];
  1651. this.noticeShow1 = true;
  1652. var timer = setInterval(() => {
  1653. this.CountTo1--;
  1654. if (this.CountTo1 < 0) {
  1655. this.noticeShow1 = false;
  1656. clearInterval(timer);
  1657. this.postStudyRecord(1);
  1658. }
  1659. }, 1000);
  1660. reject("中断执行");
  1661. } else {
  1662. this.uploadLock = false;
  1663. uni.showToast({
  1664. icon: "none",
  1665. title: res.data.msg,
  1666. duration: 2000,
  1667. });
  1668. if (!this.erJianErZao && code == 559) {
  1669. this.isReach = true;
  1670. this.$refs["camera"].reTake();
  1671. }
  1672. if (code == 559 || code == 588) {
  1673. reject(res.data.msg);
  1674. }
  1675. }
  1676. resolve();
  1677. })
  1678. .catch((err) => {
  1679. this.studyRecordMenuAllList();
  1680. });
  1681. });
  1682. },
  1683. timeEvent(time) {
  1684. this.clearPauseTimer();
  1685. if (this.playSecIsLearn && (this.erJianErZao || this.photoNum > 0)) {
  1686. this.configPhoto(time);
  1687. this.isReach = false;
  1688. const index = this.photoList.findIndex((e) => e < time && e > time - 8);
  1689. console.log(index, time, this.photoHistoryList, 789);
  1690. if (index != -1 && !this.photoHistoryList[index]) {
  1691. this.photoIndex = index;
  1692. // 拍照
  1693. this.openCamera();
  1694. }
  1695. }
  1696. },
  1697. // 新增用户视频学习日志
  1698. studyLog() {
  1699. this.$http({
  1700. url: "/user/study/log",
  1701. method: "post",
  1702. data: {
  1703. ...this.params(),
  1704. moduleId: this.moduleId || 0,
  1705. chapterId: this.chapterId || 0,
  1706. sectionId: this.playSectionId || 0,
  1707. fromPlat: 1, //来源平台 1小程序 2PC网站
  1708. goodsType: 1, // 商品类型 1视频2题库 3补考 4前培 5虚拟赠送题库 6直播
  1709. },
  1710. }).then((res) => {});
  1711. },
  1712. timeupdate(time) {
  1713. // console.log("播放中", time);
  1714. this.playTime = time;
  1715. this.clearPauseTimer();
  1716. this.timeEvent(time);
  1717. },
  1718. playing() {
  1719. console.log("playing");
  1720. if (this.noticeShow) {
  1721. this.refPlv.playPause();
  1722. return;
  1723. }
  1724. this.studyLog();
  1725. if (!this.recordObj.videoCurrentTime) {
  1726. this.postStudyRecord(0);
  1727. }
  1728. this.studyTimer && clearInterval(this.studyTimer);
  1729. this.studyTimer = setInterval(() => {
  1730. this.postStudyRecord(0);
  1731. }, 15000);
  1732. },
  1733. openCamera() {
  1734. this.$refs["camera"].openCamera();
  1735. this.refPlv.playPause();
  1736. this.refPlv.exitFullScreen();
  1737. },
  1738. pause() {
  1739. this.erJianErZaoPauseTip();
  1740. clearInterval(this.timer);
  1741. clearInterval(this.studyTimer);
  1742. },
  1743. async ended() {
  1744. this.hasStart = false;
  1745. uni.showToast({
  1746. icon: "none",
  1747. title: "播放完毕",
  1748. });
  1749. clearInterval(this.timer);
  1750. clearInterval(this.studyTimer);
  1751. await this.postStudyRecord(1);
  1752. this.nextSection();
  1753. },
  1754. playerError() {
  1755. console.log(46546);
  1756. },
  1757. //播放下一节
  1758. nextSection() {
  1759. console.log("播放下一节");
  1760. if (!this.menuAllList.length) {
  1761. return;
  1762. }
  1763. this.curPlayIndex = this.menuAllList.findIndex((item) => {
  1764. let i_sectionId = item.sectionId || 0;
  1765. let i_chapterId = item.chapterId || 0;
  1766. let i_moduleId = item.moduleId || 0;
  1767. return (
  1768. i_sectionId == this.playSectionId &&
  1769. i_chapterId == this.chapterId &&
  1770. i_moduleId == this.moduleId
  1771. );
  1772. });
  1773. let data = this.menuAllList[this.curPlayIndex + 1];
  1774. if (!data) {
  1775. //第二个弹窗
  1776. uni.showModal({
  1777. title: "温馨提示",
  1778. content:
  1779. "恭喜您课程学习全部完成,教务会在1-3个工作日内完成学习初审,请耐心等待。",
  1780. showCancel: !this.erJianErZao,
  1781. success: (res) => {
  1782. if (res.confirm) {
  1783. uni.switchTab({
  1784. url: "/pages/learn/index",
  1785. });
  1786. }
  1787. },
  1788. });
  1789. } else {
  1790. if (data.doType == 2) {
  1791. if (data.studyStatus == 1) {
  1792. uni.showToast({
  1793. title: "试卷已合格!",
  1794. duration: 2000,
  1795. icon: "none",
  1796. });
  1797. return;
  1798. }
  1799. uni.showModal({
  1800. title: "温馨提示",
  1801. content: "当前节视频已学完,是否进入考试?",
  1802. success: (res) => {
  1803. if (res.confirm) {
  1804. this.toQuestionBank(data);
  1805. }
  1806. },
  1807. });
  1808. return;
  1809. }
  1810. uni.showModal({
  1811. title: "温馨提示",
  1812. content: "当前节视频已学完,继续学习下一节?",
  1813. success: async (res) => {
  1814. if (res.confirm) {
  1815. this.moduleId = data.moduleId;
  1816. this.chapterId = data.chapterId;
  1817. this.sectionId = data.sectionId;
  1818. if (data.sectionType == 1) {
  1819. //录播
  1820. this.$store.commit("setPlaySectionId", {
  1821. playSectionId: data.sectionId,
  1822. });
  1823. this.$store.commit("setPlayVID", {
  1824. playVID: data.recordingUrl,
  1825. });
  1826. this.hasStart = false;
  1827. this.photoConfig = false;
  1828. this.sectionItem = data;
  1829. this.playVideo(data);
  1830. } else if (data.sectionType == 2) {
  1831. //直播
  1832. this.studyRecordGetLastLive();
  1833. } else if (data.sectionType == 3) {
  1834. //回放
  1835. this.$store.commit("setPlaySectionId", {
  1836. playSectionId: data.sectionId,
  1837. });
  1838. this.$store.commit("setPlayVID", {
  1839. playVID: data.recordingUrl,
  1840. });
  1841. this.sectionItem = data;
  1842. this.playVideo(data);
  1843. }
  1844. let playNextId = `moduleId${data.moduleId}chapterId${data.chapterId}sectionId${data.sectionId}`;
  1845. this.$store.commit("updatePlayNextId", playNextId);
  1846. this.updateChapterOpen(true);
  1847. }
  1848. },
  1849. });
  1850. }
  1851. },
  1852. playError(e) {
  1853. console.log(e);
  1854. },
  1855. //拍照报错
  1856. error(e) {
  1857. console.log(e.detail);
  1858. },
  1859. //关闭相机
  1860. closePhoto() {
  1861. this.photoPopup = false;
  1862. this.enableAutoRotation = true;
  1863. },
  1864. async userConfirmInfoDetail() {
  1865. let info = await this.$api.userConfirmInfoDetail({
  1866. orderGoodsId: this.orderGoodsId,
  1867. });
  1868. if (!info.data.data || info.data.data.pushInfo !== 1) {
  1869. uni.showModal({
  1870. showCancel: false,
  1871. title: "提示",
  1872. content: "开通信息推送不成功,无法进入学习!",
  1873. success: (resultst) => {
  1874. uni.navigateBack();
  1875. },
  1876. });
  1877. return Promise.reject();
  1878. }
  1879. },
  1880. checkFinishRequiredCourse() {
  1881. return this.$api
  1882. .checkFinishRequiredCourse({
  1883. businessId: this.goodsData.businessId,
  1884. goodsId: this.goodsId,
  1885. })
  1886. .then((res) => {
  1887. if (res.data.data > 0) {
  1888. uni.showModal({
  1889. showCancel: false,
  1890. confirmText: "确定",
  1891. content: "该业务层次下有未学完的商品,无法学习新商品!",
  1892. success: function (resultst) {
  1893. uni.navigateBack();
  1894. },
  1895. });
  1896. return Promise.reject();
  1897. }
  1898. return Promise.resolve();
  1899. });
  1900. },
  1901. async getGoodsDetail() {
  1902. let { data } = await this.$api.goodsDetail(this.goodsId);
  1903. this.goodsData = data.data;
  1904. this.erJianErZao = this.goodsData.erJianErZao;
  1905. this.jjShiGongYuan = this.goodsData.jjShiGongYuan;
  1906. this.erJianErZao && (await this.userConfirmInfoDetail());
  1907. this.option.periodWaitTime && (await this.checkFinishRequiredCourse());
  1908. this.goodsData.buyNote && this.baseHandoutTipList();
  1909. this.gradeId = this.goodsData.gradeId;
  1910. if (this.goodsData.goodsPlayConfig) {
  1911. this.goodsPlayConfig = JSON.parse(this.goodsData.goodsPlayConfig);
  1912. if (this.goodsPlayConfig.autoPlay > 0) {
  1913. this.autoplay = true;
  1914. }
  1915. if (this.goodsPlayConfig.drag > 0 && !this.erJianErZao) {
  1916. // #ifdef MP-WEIXIN
  1917. this.isAllowSeek = "yes";
  1918. // #endif
  1919. // #ifdef H5
  1920. this.isAllowSeek = "off";
  1921. // #endif
  1922. }
  1923. if (this.goodsPlayConfig.speed > 0) {
  1924. this.playbackRate = [0.5, 0.8, 1.0, 1.25, 1.5, 2.0];
  1925. }
  1926. }
  1927. if (this.goodsData.goodsPhotographConfig) {
  1928. this.goodsPhotographConfig = JSON.parse(
  1929. this.goodsData.goodsPhotographConfig
  1930. );
  1931. if (this.goodsPhotographConfig.photoNum > 0) {
  1932. this.photoNum = this.goodsPhotographConfig.photoNum;
  1933. }
  1934. }
  1935. },
  1936. getReMenuList() {
  1937. let self = this;
  1938. this.$api
  1939. .reMenuList({
  1940. orderGoodsId: this.orderGoodsId,
  1941. courseId: this.courseId,
  1942. rebuild: 1,
  1943. gradeId: this.gradeId,
  1944. })
  1945. .then((res) => {
  1946. if (res.data.code == 200) {
  1947. for (let i = 0; i < res.data.rows.length; i++) {
  1948. let item = res.data.rows[i];
  1949. item.down = true;
  1950. item.id = item.menuId;
  1951. item.name = item.menuName;
  1952. }
  1953. self.reMenuList = res.data.rows;
  1954. this.current = 0;
  1955. if (self.reMenuList.length > 0) {
  1956. if (Object.keys(this.sectionItem).length) {
  1957. let playNextIdisRebuild = `moduleId${this.sectionItem.moduleId}chapterId${this.sectionItem.chapterId}sectionId${this.sectionItem.sectionId}isRebuild`;
  1958. this.$store.commit("updatePlayNextId", playNextIdisRebuild);
  1959. }
  1960. } else {
  1961. if (Object.keys(this.sectionItem).length) {
  1962. let playNextId = `moduleId${this.sectionItem.moduleId}chapterId${this.sectionItem.chapterId}sectionId${this.sectionItem.sectionId}`;
  1963. this.$store.commit("updatePlayNextId", playNextId);
  1964. }
  1965. }
  1966. }
  1967. });
  1968. },
  1969. courseDetail() {
  1970. this.$api.courseDetail(this.courseId).then((res) => {
  1971. if (res.data.code == 200) {
  1972. this.detail = res.data.data;
  1973. }
  1974. });
  1975. },
  1976. open(item) {
  1977. item.showChildren = !item.showChildren;
  1978. },
  1979. change(index) {
  1980. this.current = index;
  1981. },
  1982. /**
  1983. * 退出全屏
  1984. */
  1985. exitFullscreen() {
  1986. try {
  1987. var de = document;
  1988. if (de.exitFullscreen) {
  1989. de.exitFullscreen();
  1990. } else if (de.mozCancelFullScreen) {
  1991. de.mozCancelFullScreen();
  1992. } else if (de.webkitCancelFullScreen) {
  1993. de.webkitCancelFullScreen();
  1994. }
  1995. } catch (err) {}
  1996. },
  1997. fullele() {
  1998. return (
  1999. document.fullscreenElement ||
  2000. document.webkitFullscreenElement ||
  2001. document.msFullscreenElement ||
  2002. document.mozFullScreenElement ||
  2003. null
  2004. );
  2005. },
  2006. paramsFn(
  2007. keys = ["orderGoodsId", "goodsId", "courseId", "gradeId", "sectionItem"]
  2008. ) {
  2009. return this.params(keys);
  2010. },
  2011. },
  2012. provide() {
  2013. return {
  2014. paramsFn: this.paramsFn,
  2015. };
  2016. },
  2017. };
  2018. </script>
  2019. <style lang="scss" scope>
  2020. @import "./css/detail.scss";
  2021. .top {
  2022. &__header {
  2023. position: relative;
  2024. width: 100%;
  2025. height: 150rpx;
  2026. padding: 24rpx 150rpx 24rpx 24rpx;
  2027. .img {
  2028. position: absolute;
  2029. left: 0;
  2030. top: 0;
  2031. width: 100%;
  2032. }
  2033. .note {
  2034. position: relative;
  2035. z-index: 10;
  2036. font-size: 24rpx;
  2037. font-family: PingFang SC;
  2038. font-weight: bold;
  2039. color: #efdbff;
  2040. }
  2041. .title {
  2042. position: relative;
  2043. z-index: 10;
  2044. font-size: 26rpx;
  2045. font-family: PingFang SC;
  2046. font-weight: bold;
  2047. color: #ffffff;
  2048. }
  2049. }
  2050. }
  2051. #top {
  2052. position: relative;
  2053. z-index: 99;
  2054. }
  2055. .polyv_detail {
  2056. display: flex;
  2057. flex-direction: column;
  2058. height: 100vh;
  2059. position: relative;
  2060. top: 0;
  2061. left: 0;
  2062. .pops {
  2063. position: absolute;
  2064. top: 0;
  2065. left: 0;
  2066. background: #ccc;
  2067. opacity: 0.5;
  2068. width: 100%;
  2069. height: 300rpx;
  2070. z-index: 9999;
  2071. }
  2072. .box {
  2073. flex: 1;
  2074. overflow: hidden;
  2075. margin: 16rpx 16rpx 100rpx 16rpx;
  2076. .box_in {
  2077. height: 100%;
  2078. }
  2079. }
  2080. .first_ml {
  2081. margin: 16rpx 16rpx 16rpx 16rpx;
  2082. }
  2083. }
  2084. .btnSet {
  2085. width: 440rpx;
  2086. height: 80rpx;
  2087. background: #007aff;
  2088. border-radius: 40rpx;
  2089. color: #ffffff;
  2090. font-size: 28rpx;
  2091. line-height: 80rpx;
  2092. }
  2093. .lecture-content {
  2094. background: #fff;
  2095. margin-top: 10rpx;
  2096. padding: 10rpx;
  2097. border-radius: 16rpx;
  2098. }
  2099. .tBox {
  2100. display: flex;
  2101. align-items: center;
  2102. padding-top: 10rpx;
  2103. }
  2104. .title {
  2105. font-size: 24rpx;
  2106. color: #999999;
  2107. }
  2108. .t_content1 {
  2109. color: #007aff;
  2110. margin-left: 10rpx;
  2111. }
  2112. .tag1 {
  2113. border: 2rpx solid #007aff;
  2114. border-radius: 8rpx;
  2115. font-size: 20rpx;
  2116. color: #007aff;
  2117. padding: 5rpx;
  2118. }
  2119. .b_title {
  2120. color: #333333;
  2121. font-size: 30rpx;
  2122. font-weight: bold;
  2123. }
  2124. page {
  2125. background: #eaeef1;
  2126. }
  2127. .menuBox {
  2128. width: 100%;
  2129. background: #ffffff;
  2130. border-radius: 16rpx;
  2131. padding: 0rpx 20rpx;
  2132. margin-bottom: 20rpx;
  2133. }
  2134. .btnspric {
  2135. border-top: 1rpx solid #eee;
  2136. display: flex;
  2137. align-items: center;
  2138. justify-content: space-between;
  2139. height: 108rpx;
  2140. padding-left: 43rpx;
  2141. padding-right: 32rpx;
  2142. }
  2143. .btnspric > .lefprL {
  2144. font-size: 36rpx;
  2145. color: #0c141f;
  2146. font-weight: bold;
  2147. }
  2148. .btnspric > .lefprR {
  2149. padding: 0rpx 24rpx;
  2150. height: 60rpx;
  2151. line-height: 60rpx;
  2152. text-align: center;
  2153. color: #fff;
  2154. background: #32467b;
  2155. border-radius: 24rpx;
  2156. box-shadow: 0rpx 0rpx 16rpx 4rpx rgba(145, 156, 178, 0.1);
  2157. }
  2158. .yhj,
  2159. .hdyhj {
  2160. padding: 24rpx 29rpx 24rpx 34rpx;
  2161. }
  2162. .yhj {
  2163. border-bottom: 16rpx solid #f9f9f9;
  2164. }
  2165. .yhjtit {
  2166. font-size: 30rpx;
  2167. color: #0c141f;
  2168. font-weight: 500;
  2169. margin-bottom: 14rpx;
  2170. }
  2171. .yhjList {
  2172. display: flex;
  2173. align-items: center;
  2174. justify-content: space-between;
  2175. margin-bottom: 14rpx;
  2176. }
  2177. .yhjList > .yhjLefts {
  2178. display: flex;
  2179. align-items: center;
  2180. }
  2181. .yhjLefts > .yhl {
  2182. color: #32467b;
  2183. font-size: 30rpx;
  2184. margin-right: 31rpx;
  2185. }
  2186. .yhjLefts > .yhbq {
  2187. font-size: 24rpx;
  2188. color: #ff9500;
  2189. border-radius: 18rpx;
  2190. background-color: rgba(255, 149, 0, 0.2);
  2191. border: 2rpx solid #ff9500;
  2192. height: 38rpx;
  2193. line-height: 38rpx;
  2194. padding: 0rpx 16rpx;
  2195. }
  2196. .ts {
  2197. font-size: 24rpx;
  2198. color: #999;
  2199. margin: 14rpx 0rpx;
  2200. padding-right: 29rpx;
  2201. padding-left: 34rpx;
  2202. }
  2203. .yh {
  2204. padding-top: 20rpx;
  2205. }
  2206. .yh > .yhtitle {
  2207. display: flex;
  2208. align-items: center;
  2209. justify-content: space-between;
  2210. padding-right: 29rpx;
  2211. padding-left: 34rpx;
  2212. }
  2213. .priceBxs {
  2214. display: flex;
  2215. align-items: center;
  2216. }
  2217. .priceBxs > .pricleft {
  2218. border-radius: 24rpx;
  2219. border: 1rpx solid #e91313;
  2220. background-color: rgba(233, 19, 19, 0.1);
  2221. padding: 0rpx 18rpx;
  2222. height: 49rpx;
  2223. line-height: 49rpx;
  2224. text-align: center;
  2225. font-size: 30rpx;
  2226. font-weight: 500;
  2227. color: #e91313;
  2228. margin-right: 13rpx;
  2229. }
  2230. .topBox {
  2231. padding: 32rpx 32rpx 24rpx;
  2232. border-bottom: 1rpx solid #eeeeee;
  2233. }
  2234. .topBox > .boldFonstType {
  2235. font-weight: 500;
  2236. font-size: 30rpx;
  2237. margin: 16rpx 0rpx 23rpx;
  2238. }
  2239. .topBox > .firstTopL {
  2240. display: flex;
  2241. align-items: center;
  2242. }
  2243. .topBox > .firstTopL > .imageBs {
  2244. width: 331rpx;
  2245. height: 160rpx;
  2246. border-radius: 6rpx;
  2247. overflow: hidden;
  2248. margin-right: 8rpx;
  2249. box-shadow: 0rpx 6rpx 6rpx 0rpx rgba(47, 67, 121, 0.08);
  2250. }
  2251. .topBox > .firstTopL > .imageBs > image {
  2252. width: 100%;
  2253. height: 100%;
  2254. }
  2255. .topBox > .firstTopL > .textBs {
  2256. font-size: 30rpx;
  2257. font-weight: bold;
  2258. color: #0c141f;
  2259. }
  2260. .content {
  2261. padding: 24rpx;
  2262. text-align: left;
  2263. }
  2264. .catalogBox {
  2265. display: flex;
  2266. align-items: center;
  2267. flex-wrap: nowrap;
  2268. overflow-x: auto;
  2269. padding-left: 38rpx;
  2270. max-height: 305rpx;
  2271. overflow-y: auto;
  2272. transition: all 0.4s;
  2273. }
  2274. .catalogBox > .catalogA {
  2275. min-width: 200rpx;
  2276. height: 48rpx;
  2277. line-height: 48rpx;
  2278. // text-align: center;
  2279. border: 2rpx solid transparent;
  2280. white-space: nowrap;
  2281. text-overflow: ellipsis;
  2282. overflow: hidden;
  2283. word-break: break-all;
  2284. border-radius: 10rpx;
  2285. background: rgba(22, 119, 255, 0.05);
  2286. padding-left: 19rpx;
  2287. box-sizing: border-box;
  2288. padding-right: 15rpx;
  2289. margin-right: 16rpx;
  2290. margin-bottom: 20rpx;
  2291. margin-top: 15rpx;
  2292. font-size: 24rpx;
  2293. color: #666;
  2294. }
  2295. .catalogBox > .activesq {
  2296. border-color: #1677ff;
  2297. }
  2298. .changeCatalogBox {
  2299. display: block;
  2300. }
  2301. .catalogBox::-webkit-scrollbar {
  2302. display: none; /* Chrome Safari */
  2303. }
  2304. .price_t2 {
  2305. font-size: 18rpx;
  2306. font-family: PingFang SC;
  2307. font-weight: 500;
  2308. text-decoration: line-through;
  2309. color: #999999;
  2310. }
  2311. .price_t1 {
  2312. font-size: 33rpx;
  2313. font-family: PingFang SC;
  2314. font-weight: bold;
  2315. color: #e91313;
  2316. }
  2317. .sc_t {
  2318. font-size: 22rpx;
  2319. color: #000000;
  2320. }
  2321. .sc {
  2322. width: 29rpx;
  2323. height: 29rpx;
  2324. }
  2325. .buy {
  2326. width: 138rpx;
  2327. height: 48rpx;
  2328. line-height: 48rpx;
  2329. background: #32467b;
  2330. border-radius: 10rpx;
  2331. color: #ffffff;
  2332. font-size: 28rpx;
  2333. text-align: center;
  2334. vertical-align: middle;
  2335. position: absolute;
  2336. right: 30rpx;
  2337. }
  2338. .video_body {
  2339. padding-bottom: 96rpx;
  2340. }
  2341. .footer_tab {
  2342. position: fixed;
  2343. bottom: 0;
  2344. height: 96rpx;
  2345. width: 100%;
  2346. background-color: #ffffff;
  2347. }
  2348. .tj_box {
  2349. width: 50%;
  2350. display: inline-block;
  2351. text-align: center;
  2352. margin: 10rpx 0;
  2353. }
  2354. .teacher_t {
  2355. font-size: 24rpx;
  2356. font-family: PingFang SC;
  2357. font-weight: 400;
  2358. color: #666666;
  2359. line-height: 36rpx;
  2360. margin-left: 15rpx;
  2361. }
  2362. .teacher_img {
  2363. width: 87rpx;
  2364. height: 129rpx;
  2365. }
  2366. .t2 {
  2367. font-size: 24rpx;
  2368. font-family: PingFang SC;
  2369. color: #666666;
  2370. line-height: 36rpx;
  2371. margin: 15rpx;
  2372. }
  2373. .r_t2 {
  2374. width: 201rpx;
  2375. height: 49rpx;
  2376. background: rgba(22, 119, 255, 0.05);
  2377. border: 1rpx solid #32467b;
  2378. border-radius: 16rpx;
  2379. color: #666666;
  2380. font-size: 23rpx;
  2381. text-align: center;
  2382. display: flex;
  2383. align-items: center;
  2384. padding: 5rpx;
  2385. }
  2386. .scroll_box {
  2387. width: 100%;
  2388. height: 60rpx;
  2389. background: #ffffff;
  2390. box-shadow: 0rpx 0rpx 16rpx 4rpx rgba(145, 156, 178, 0.1);
  2391. white-space: nowrap;
  2392. overflow: hidden;
  2393. margin: 15rpx 0;
  2394. }
  2395. .r_sliper {
  2396. padding: 0 20rpx;
  2397. }
  2398. .top_line {
  2399. width: 6rpx;
  2400. height: 22rpx;
  2401. background: #32467b;
  2402. margin-right: 10rpx;
  2403. }
  2404. .video_t2 {
  2405. font-size: 24rpx;
  2406. font-family: PingFang SC;
  2407. font-weight: 500;
  2408. color: #666666;
  2409. }
  2410. .video_play {
  2411. position: absolute;
  2412. width: 95rpx;
  2413. height: 95rpx;
  2414. top: 0;
  2415. left: 0;
  2416. right: 0;
  2417. bottom: 0;
  2418. margin: auto;
  2419. }
  2420. .video_box {
  2421. position: relative;
  2422. }
  2423. .rotoct {
  2424. transform: rotate(90deg);
  2425. }
  2426. .slot-content {
  2427. padding: 0 20rpx;
  2428. }
  2429. .notice_modal {
  2430. .content {
  2431. width: 100%;
  2432. height: 100%;
  2433. padding: 56rpx 56rpx 56rpx 64rpx;
  2434. .title {
  2435. color: #222;
  2436. line-height: 40rpx;
  2437. font-size: 36rpx;
  2438. text-align: center;
  2439. font-weight: bold;
  2440. margin-bottom: 24rpx;
  2441. }
  2442. .text {
  2443. height: 340rpx;
  2444. line-height: 40rpx;
  2445. text-indent: 2em;
  2446. font-size: 32rpx;
  2447. color: #222;
  2448. }
  2449. .had_read {
  2450. width: 100%;
  2451. height: 88rpx;
  2452. line-height: 88rpx;
  2453. text-align: center;
  2454. background: #3577e8;
  2455. border-radius: 240rpx;
  2456. font-size: 32rpx;
  2457. font-weight: 500;
  2458. color: #fff;
  2459. margin-top: 20rpx;
  2460. &.gray {
  2461. background: #bbbec5;
  2462. }
  2463. }
  2464. }
  2465. }
  2466. .full_mulu {
  2467. position: absolute;
  2468. top: 100rpx;
  2469. right: 20rpx;
  2470. width: 700rpx;
  2471. height: 515rpx;
  2472. color: #333;
  2473. display: flex;
  2474. align-items: center;
  2475. justify-content: space-between;
  2476. z-index: 99999;
  2477. .mulus {
  2478. width: 623rpx;
  2479. // height: 515rpx;
  2480. height: 400rpx;
  2481. overflow-y: scroll;
  2482. // overflow: scroll;
  2483. }
  2484. .mulu_box_in {
  2485. background-color: #b7b7b7;
  2486. border-radius: 16rpx;
  2487. // transition: all 0.5s;
  2488. &::after {
  2489. content: "";
  2490. width: 0;
  2491. height: 0;
  2492. position: absolute;
  2493. top: 235rpx;
  2494. right: 27px;
  2495. border-top: 16rpx solid transparent;
  2496. border-right: 16rpx solid transparent;
  2497. border-left: 16rpx solid #b7b7b7;
  2498. border-bottom: 16rpx solid transparent;
  2499. }
  2500. }
  2501. .mulu_box_out {
  2502. // visibility: hidden;
  2503. display: none;
  2504. }
  2505. .menuBox_mulu {
  2506. // width: 100%;
  2507. background: #ffffff;
  2508. border-radius: 16rpx;
  2509. padding: 0rpx 20rpx;
  2510. margin-bottom: 20rpx;
  2511. }
  2512. .ml_img {
  2513. position: absolute;
  2514. right: 0;
  2515. top: 100rpx;
  2516. }
  2517. .items {
  2518. width: 620rpx;
  2519. height: 100rpx;
  2520. border: 1rpx solid red;
  2521. }
  2522. }
  2523. </style>