detail.vue 47 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834
  1. <template>
  2. <view>
  3. <view style="position: fixed;width: 100%;z-index: 999;background: #FFFFFF;top: 0;" id="top">
  4. <view class="video_box" v-if="!startStatus">
  5. <image :src="$method.splitImgHost(detail.coverUrl)" style="width: 100%;height: 460rpx;"></image>
  6. <image v-if="false" class="video_play" src="/static/play.png" @click="startVideo"></image>
  7. </view>
  8. <view v-else>
  9. <view class="video_box" style="width: 100%;height: 460rpx;" v-if="playVID">
  10. <polyv-player
  11. id="playerVideo"
  12. playerId="playerVideo"
  13. height="460rpx"
  14. :vid="vid"
  15. :showSettingBtn="true"
  16. :enablePlayGesture="true"
  17. @statechange="onStateChange"
  18. :autoplay="autoplay"
  19. :isAllowSeek="isAllowSeek"
  20. :playbackRate="playbackRate"
  21. :startTime="startTime"
  22. ></polyv-player>
  23. </view>
  24. <view class="video_box" style="width: 100%;height: 460rpx;" v-if="playChannelId>0">
  25. <player
  26. class="plv-mp-demo-player"
  27. :videoOption="videoOption"
  28. @onLiveStatusChange="playerLiveStatusChange"
  29. />
  30. </view>
  31. </view>
  32. <view>
  33. <u-row>
  34. <u-col span="10">
  35. <view class="video_t1">{{ detail.courseName }}</view>
  36. </u-col>
  37. <u-col span="2" v-if="false">
  38. <view class="video_t1_t" @click="openJY">
  39. <image src="/static/icon/jy_icon.png" style="width: 40rpx;height: 40rpx;"></image>
  40. 讲义
  41. </view>
  42. </u-col>
  43. </u-row>
  44. </view>
  45. <u-line color="#D6D6DB" />
  46. <view style="display: flex;justify-content: center;">
  47. <view><u-tabs :list="list" font-size="24" bar-width="24" :current="current" @change="change" active-color="#007AFF"></u-tabs></view>
  48. </view>
  49. <u-line color="#D6D6DB" />
  50. </view>
  51. <view class="box">
  52. <!--目录 -->
  53. <view v-show="current == 0">
  54. <view class="menuBox" v-for="(item, index) in menuList" :key="index">
  55. <!--模块 -->
  56. <view v-if="item.type == 1"><courseModule :courseId="courseId" :goodsId="goodsId" :gradeId="gradeId" :isBuy="true" :menuItem="item" :levelId="item.menuId"></courseModule></view>
  57. <!--章 -->
  58. <view v-if="item.type == 2"><courseChapter :courseId="courseId" :goodsId="goodsId" :gradeId="gradeId" :isBuy="true" :menuItem="item" :levelId="'0-' + item.menuId"></courseChapter></view>
  59. <!--节 -->
  60. <view v-if="item.type == 3"><courseSection :courseId="courseId" :goodsId="goodsId" :gradeId="gradeId" :isBuy="true" :menuItem="item" :levelId="'0-0-' + item.menuId"></courseSection></view>
  61. </view>
  62. </view>
  63. <!--讲义 -->
  64. <view v-show="current == 1">
  65. <view class="lecture-box">
  66. <view class="title">
  67. {{courseHandoutsData.handoutsName}}
  68. <!-- 这是后台配置的讲义标题过长省略这是后台配置的讲义标题过长省略 -->
  69. </view>
  70. <view class="btn" @click="openDocument">
  71. <u-icon name="download" color="#007AFF" size="40"></u-icon>
  72. </view>
  73. </view>
  74. <!-- <view class="lecture-content">
  75. <rich-text :nodes="'讲义内容讲义内容讲义内容讲义内容讲义内容讲义内容讲义内容讲义内容讲义内容讲义内容讲义内容讲义内容讲义内容讲义内容讲义内容讲义内容讲义内容讲义内容讲义内容讲义内容讲义内容讲义内容讲义内容讲义内容讲义内容讲义内容讲义内容讲义内容讲义内容讲义内容讲义内容讲义内容讲义内容讲义内容讲义内容讲义内容讲义内容讲义内容讲义内容讲义内容讲义内容讲义内容讲义内容讲义内容讲义内容讲义内容讲义内容讲义内容讲义内容讲义内容讲义内容讲义内容讲义内容讲义内容讲义内容讲义内容讲义内容讲义内容讲义内容讲义内容讲义内容讲义内容讲义内容讲义内容讲义内容讲义内容讲义内容讲义内容讲义内容讲义内容讲义内容讲义内容讲义内容讲义内容讲义内容讲义内容讲义内容'"></rich-text>
  76. </view> -->
  77. <!-- <view class="inputBottom">
  78. <view style="width: 10%;"><image src="/static/icon/note3.png" style="width: 39rpx;height: 39rpx;margin:0 29rpx;"></image></view>
  79. <view style="width: 73%;height: 100%;padding: 10rpx 0;">
  80. <u-input class="input" height="60" fixed="true" placeholder="您可以在这里输入笔记内容" type="textarea" :custom-style="inputStyle" v-model="noteValue" />
  81. </view>
  82. <view style="color: #007AFF;font-size: 30rpx;font-weight: bold;width: 15%;text-align: center;" @click="postNote">提交</view>
  83. </view> -->
  84. </view>
  85. <!--笔记 -->
  86. <view v-show="current == 2">
  87. <view v-if="noteList.length == 0" style="text-align: center;">暂无笔记</view>
  88. <view class="inputBottom">
  89. <view style="width: 10%;"><image src="/static/icon/note3.png" style="width: 39rpx;height: 39rpx;margin:0 29rpx;"></image></view>
  90. <view style="width: 73%;height: 100%;padding: 10rpx 0;">
  91. <u-input class="input" height="60" fixed="true" placeholder="您可以在这里输入笔记内容" type="textarea" :custom-style="inputStyle" v-model="noteValue" />
  92. </view>
  93. <view style="color: #007AFF;font-size: 30rpx;font-weight: bold;width: 15%;text-align: center;" @click="postNote">提交</view>
  94. </view>
  95. <view v-for="(item, index) in noteList" :key="index">
  96. <view class="dateBox">{{ $method.timestampToTime(item.dateNote) }}</view>
  97. <view class="noteBox">
  98. <view v-for="(item1, index1) in item.userNotes" :key="index1" style="margin-top: 30rpx;" @click="jumpNote(item1)">
  99. <view style="display: flex;">
  100. <view>
  101. <view>
  102. <image src="/static/icon/note2.png" v-if="noteId != item1.noteId" style="width: 39rpx;height: 39rpx;margin:0 29rpx;"></image>
  103. <image src="/static/icon/note1.png" v-if="noteId == item1.noteId" style="width: 39rpx;height: 39rpx;margin:0 29rpx;"></image>
  104. </view>
  105. <view class="title" style="width: 39rpx;height: 39rpx;margin:0 29rpx;">{{ $method.secondToDate(item1.noteSecond) }}</view>
  106. </view>
  107. <view style="margin-left: 10rpx;">
  108. <view class="t2Content leftPadding">{{ item1.sectionName }}</view>
  109. <view class="tBox2">{{ item1.noteText }}</view>
  110. </view>
  111. </view>
  112. </view>
  113. </view>
  114. </view>
  115. </view>
  116. <!--答疑 -->
  117. <view v-show="current == 3">
  118. <view class="inputBottom">
  119. <view class="flex_auto">
  120. <u-input height="60" fixed="true" :placeholder="placeholder" type="textarea" :custom-style="inputStyle" v-model="ctxValue" />
  121. </view>
  122. <view class="btn" @click="postContent">提交</view>
  123. </view>
  124. <view v-for="(item, index) in answerList" :key="index" style="background-color: #FFFFFF;margin-bottom: 20rpx;">
  125. <view class="chat_box" @click.stop="clearCtx">
  126. <view style="display: flex;">
  127. <view><image :src="$method.splitImgHost(item.avatar)" style="width: 64rpx;height: 64rpx;"></image></view>
  128. <view style="margin-left: 15rpx;">
  129. <view class="chat1">{{ item.realname }}</view>
  130. <view class="chat2">{{ $method.timestampToTime(item.createTime) }}</view>
  131. <view class="chat3">
  132. <text v-if="item.assignUserId > 0">回复</text>
  133. <text v-if="item.assignUserId > 0" style="color: #007AFF;">@{{ item.assignRealname }}</text>
  134. {{ item.answerText }}
  135. </view>
  136. </view>
  137. </view>
  138. <view class="btnReply" @click.stop="replyContent(item)" v-if="item.userId != userInfo.userId">回复</view>
  139. <view v-else class="btnDel" @click.stop="delContent(item)">删除</view>
  140. </view>
  141. <u-line color="#D6D6DB" />
  142. </view>
  143. <view v-if="answerList.length == 0" style="text-align: center;">暂无记录</view>
  144. </view>
  145. <!--目录 -->
  146. <view v-show="current == 4" >
  147. <view class="menuBox" v-for="(item, index) in reMenuList" :key="index">
  148. <!--模块 -->
  149. <view v-if="item.type == 1"><courseModule :courseId="courseId" :goodsId="goodsId" :gradeId="gradeId" :isRebuild="true" :isBuy="true" :menuItem="item" :levelId="item.menuId"></courseModule></view>
  150. <!--章 -->
  151. <view v-if="item.type == 2">
  152. <courseChapter :courseId="courseId" :gradeId="gradeId" :goodsId="goodsId" :isRebuild="true" :isBuy="true" :menuItem="item" :levelId="'0-' + item.menuId"></courseChapter>
  153. </view>
  154. <!--节 -->
  155. <view v-if="item.type == 3">
  156. <courseSection :courseId="courseId" :gradeId="gradeId" :goodsId="goodsId" :isRebuild="true" :isBuy="true" :menuItem="item" :levelId="'0-0-' + item.menuId"></courseSection>
  157. </view>
  158. </view>
  159. </view>
  160. </view>
  161. <!-- 播放前拍照end -->
  162. <u-popup v-model="showSet" :mask-close-able="false" mode="center" border-radius="24">
  163. <view style="align-items:center;padding: 0 40rpx;display: flex;flex-direction: column;justify-content:center;">
  164. <view style="font-weight: bold;color: #333333;font-size: 30rpx;margin-top: 30rpx;">温馨提示</view>
  165. <view style="width: 457rpx;color: #666666;font-size: 30rpx;margin-top: 30rpx;">学习过程中需要拍照验证学员身份,
  166. 拍照功能需要使用您的相机。
  167. 是否授权使用?</view>
  168. <view style="margin: 40rpx 0;">
  169. <button open-type="openSetting" @bindopensetting="openSetting" class="btnSet">去授权</button>
  170. </view>
  171. </view>
  172. </u-popup>
  173. <u-mask :show="photoPopup" >
  174. <!-- 播放前拍照start -->
  175. <view v-if="photoPopup" :mask-close-able="false" style="bottom: 0;position: fixed;width: 100%;z-index: 999;">
  176. <view class="photoBox">
  177. <view class="photoTop">
  178. <view class="sqzz" v-if="false"><u-icon name="close" color="#333333" size="30" @click="closePhoto"></u-icon></view>
  179. <view class="centersq">请正视手机屏幕</view>
  180. <view class="sqzz"></view>
  181. </view>
  182. <view class="photoCenter">
  183. <view style="width: 100%; height: 979rpx;position: fixed;" v-if="photoPopup">
  184. <camera device-position="front" flash="off" @error="error" style="width: 100%; height: 100%;" ></camera>
  185. </view>
  186. <view class="custom"><image src="/static/zhezhao.png" mode=""></image></view>
  187. </view>
  188. <view class="btnResult" @click="takePhoto">拍照</view>
  189. </view>
  190. </view>
  191. </u-mask>
  192. </view>
  193. </template>
  194. <script>
  195. import plv from '../static/polyv-sdk/index';
  196. import courseModule from '@/components/course/courseModule.vue';
  197. import courseChapter from '@/components/course/courseChapter.vue';
  198. import courseSection from '@/components/course/courseSection.vue';
  199. import { mapGetters } from 'vuex';
  200. export default {
  201. components: {
  202. courseModule,
  203. courseChapter,
  204. courseSection
  205. },
  206. data() {
  207. return {
  208. initLiveOk:false,
  209. livePlay:false, //是否正在播放直播,不含暂停
  210. liveDuration:0, //直播观看时长
  211. videoOption:{
  212. mode: 'live',
  213. uid: '',
  214. cid: '',
  215. openId: '',
  216. isAutoChange: false,
  217. forceVideo: false,
  218. },
  219. courseHandoutsData:{},
  220. liveDetail:{},
  221. showSet:false,
  222. startStatus: false,
  223. detail: {},
  224. courseId: 0,
  225. placeholder: '您可以在这里输入笔记内容\n还可以点击左侧图标为笔记加上时间标记',
  226. inputStyle: {
  227. background: 'rgba(244, 244, 244, 0.98)',
  228. borderRadius: '24rpx',
  229. padding: '8rpx',
  230. marginBottom: '10rpx'
  231. },
  232. list: [],
  233. menuList: [],
  234. current: 0,
  235. vid: '',
  236. goodsId: 0,
  237. goodsData: {},
  238. photoPopup: false,
  239. goodsPlayConfig: null,
  240. autoplay: false,
  241. isAllowSeek: 'no',
  242. playbackRate: [1.0],
  243. timer: null,
  244. goodsPhotographConfig: null,
  245. intervalTimeList: [], // 间隔拍照时长
  246. intervalTimeIndex: 0, //当前处于哪个时间段拍照
  247. playTime: 0, //页面播放时长,不含暂停
  248. currentTime: 0,
  249. avatarUrl: '',
  250. ossAvatarUrl: '',
  251. studyDuration: 0, // 当前视频时长
  252. gradeId: 0,
  253. chapterId: 0,
  254. moduleId: 0,
  255. reMenuList: [],
  256. answerList: [],
  257. assignUserId: 0,
  258. placeholder: '您可以在这里输入答疑内容',
  259. ctxValue: '',
  260. noteList: [],
  261. noteValue: '',
  262. noteId: 0,
  263. recordObj: 0,
  264. gradeDetail:{},
  265. needSeek: false, //第一次播放是否需要跳转
  266. needProfileModal:false, //是否需要资料审核弹框
  267. liveObj:{},
  268. photoNum:0,
  269. photoList:[], //拍照的时间点
  270. photoConfig:false, //是否配置好拍照次数
  271. photoIndex:0, //当前位于拍照的区间下标 从0开始
  272. photoHistoryList:[], //已拍照历史的下标点
  273. };
  274. },
  275. computed: { ...mapGetters(['userInfo', 'playSectionId','playChannelId','playVID']) },
  276. onLoad(option) {
  277. console.log(this.userInfo,789)
  278. this.courseId = Number(option.id);
  279. this.goodsId = Number(option.goodsId);
  280. this.courseDetail();
  281. this.getGoodsDetail();
  282. this.getAnswerList();
  283. let noteSecond = Number(option.noteSecond);
  284. if(noteSecond>0){
  285. //我的消息跳过来,播放节
  286. let item = {
  287. sectionId:Number(option.sectionId),
  288. recordingUrl:option.recordingUrl,
  289. noteSecond:noteSecond
  290. }
  291. this.$store.commit('setPlaySectionId', {playSectionId :item.sectionId});
  292. this.playNoteVideo(item);
  293. }
  294. },
  295. onShow() {
  296. var self = this;
  297. //相机授权
  298. this.getCameraSetting()
  299. this.$api.getbaseprofiletplists({ goodsId: self.goodsId }).then(res => {
  300. if (res.data.code === 200 && res.data.rows.length) {
  301. if (res.data.rows[0].keyValue) {
  302. self.$api.getbaseprofiletpgetInfo({ goodsId: self.goodsId }).then(result => {
  303. if (result.data.code === 200) {
  304. if (!result.data.data || (result.data.data.status === 3 && result.data.data.changeStatus === 1)) {
  305. if (!result.data.data) {
  306. self.needProfileModal = true
  307. uni.showModal({
  308. content: '请前往填写资料',
  309. cancelText: '返回',
  310. success: function(resultst) {
  311. if (resultst.confirm) {
  312. self.$navTo.togo('/pages2/verify/input', {
  313. id: self.goodsId
  314. });
  315. }
  316. if (resultst.cancel) {
  317. uni.navigateBack();
  318. }
  319. }
  320. });
  321. } else {
  322. self.needProfileModal = true
  323. uni.showModal({
  324. content: '资料审核不通过,请前往重新填写',
  325. cancelText: '返回',
  326. success: function(resultst) {
  327. if (resultst.confirm) {
  328. self.$navTo.togo('/pages2/verify/input', {
  329. id: self.goodsId
  330. });
  331. }
  332. if (resultst.cancel) {
  333. uni.navigateBack();
  334. }
  335. }
  336. });
  337. }
  338. } else if (result.data.data.status === 1 && res.data.rows[0].keyValue2) {
  339. self.$api.getbaseprofileStampgetInfo({ goodsId: self.goodsId }).then(k => {
  340. if (k.data.code === 200) {
  341. if (!k.data.data || (k.data.data.status === 3 && k.data.data.changeStatus === 1)) {
  342. if (!k.data.data) {
  343. self.needProfileModal = true
  344. uni.showModal({
  345. cancelText: '返回',
  346. content: '请前往填写盖章资料',
  347. success: function(resultst) {
  348. if (resultst.confirm) {
  349. self.$navTo.togo('/pages2/verify/input2', {
  350. id: self.goodsId
  351. });
  352. }
  353. if (resultst.cancel) {
  354. uni.navigateBack();
  355. }
  356. }
  357. });
  358. } else {
  359. self.needProfileModal = true
  360. uni.showModal({
  361. cancelText: '返回',
  362. content: '资料盖章审核不通过,请前往重新填写',
  363. success: function(resultst) {
  364. if (resultst.confirm) {
  365. self.$navTo.togo('/pages2/verify/input2', {
  366. id: self.goodsId
  367. });
  368. }
  369. if (resultst.cancel) {
  370. uni.navigateBack();
  371. }
  372. }
  373. });
  374. }
  375. }
  376. }
  377. });
  378. }
  379. }
  380. });
  381. }
  382. }
  383. });
  384. console.log(this.gradeId,7512)
  385. if(this.gradeId>0){
  386. //提交完资料返回判断是否已开班
  387. this.getGradeInfo()
  388. }
  389. },
  390. onUnload() {
  391. if (this.playSectionId > 0) {
  392. //退出提交记录
  393. this.postStudyRecord();
  394. }
  395. //清除正在播放的节ID
  396. this.$store.commit('setPlaySectionId', { playSectionId: 0 });
  397. this.$store.commit('setPlayChannelId', { playChannelId: 0 });
  398. this.$store.commit('setPlayVID', { playVID: null });
  399. this.closePlv()
  400. //移除所有的事件监听器
  401. uni.$off();
  402. if (this.timer) {
  403. clearInterval(this.timer);
  404. }
  405. },
  406. mounted() {
  407. uni.$on('changeSection', oldSectionId => {
  408. console.log(this.playVID)
  409. //清除直播
  410. this.$store.commit('setPlayChannelId', { playChannelId: 0 });
  411. this.postStudyRecord(0, oldSectionId);
  412. });
  413. uni.$on('getSection', item => {
  414. //清除直播
  415. this.$store.commit('setPlayChannelId', { playChannelId: 0 });
  416. //获取拍照历史
  417. this.getPhotoLastRecord()
  418. this.playVideo(item);
  419. });
  420. uni.$on('levelId', item => {
  421. let arr = item.split('-');
  422. //点击节获取的各层级ID
  423. this.moduleId = arr[0];
  424. this.chapterId = arr[1];
  425. });
  426. uni.$on('getChannel', item => {
  427. //清除录播
  428. this.$store.commit('setPlayVID', {playVID :null});
  429. this.playChannel(item);
  430. });
  431. },
  432. methods: {
  433. /**
  434. * 获取讲义权限
  435. */
  436. courseHandouts() {
  437. this.$api.courseHandouts(this.goodsData.handoutsId).then(res => {
  438. this.courseHandoutsData = res.data.data
  439. })
  440. },
  441. getPhotoLastRecord() {
  442. let self = this;
  443. let data = {
  444. sectionId: parseInt(self.playSectionId),
  445. goodsId: parseInt(self.goodsId),
  446. courseId: parseInt(self.courseId),
  447. gradeId: parseInt(self.gradeId)}
  448. this.$api.getPhotoLastRecord(data).then(res => {
  449. if(res.data.code==200){
  450. //清空历史数据
  451. self.photoHistoryList = []
  452. this.photoIndex = 0
  453. for(let i=0;i<res.data.data.length;i++){
  454. self.photoHistoryList.push(res.data.data[i].photoIndex)
  455. }
  456. }
  457. });
  458. },
  459. postCoursePhotoRecord() {
  460. let currentTime = 0;
  461. var polyvPlayerContext = this.selectComponent('#playerVideo');
  462. if (polyvPlayerContext) {
  463. currentTime = polyvPlayerContext.getCurrentTime();
  464. }
  465. let self = this;
  466. let photoIndex = self.photoIndex-1
  467. let data = {
  468. photo: self.ossAvatarUrl,
  469. sectionId: parseInt(self.playSectionId),
  470. goodsId: parseInt(self.goodsId),
  471. courseId: parseInt(self.courseId),
  472. photoTime: parseInt(currentTime > 0 ? currentTime : 0),
  473. gradeId: parseInt(self.gradeId),
  474. photoIndex: parseInt(photoIndex),//从0算起
  475. photoNum:parseInt(self.photoNum)
  476. };
  477. console.log('提交接口', data);
  478. this.$api.coursePhotoRecord(data).then(res => {
  479. console.log(res);
  480. });
  481. },
  482. randomNum(minNum,maxNum){
  483. switch(arguments.length){
  484. case 1:
  485. return parseInt(Math.random()*minNum+1,10);
  486. break;
  487. case 2:
  488. return parseInt(Math.random()*(maxNum-minNum+1)+minNum,10);
  489. break;
  490. default:
  491. return 0;
  492. break;
  493. }
  494. },
  495. //配置随机拍照时间
  496. configPhoto(){
  497. var polyvPlayerContext = this.selectComponent('#playerVideo');
  498. let totalVideoTime = polyvPlayerContext.getDuration()
  499. let duration = polyvPlayerContext.getCurrentTime()
  500. if(!this.photoConfig){
  501. this.photoConfig = true
  502. let spaceTime = Math.floor(totalVideoTime/this.photoNum) //拍照时间区间
  503. if(spaceTime<5){//区间小于5秒
  504. this.photoNum = Math.floor(totalVideoTime/5)
  505. spaceTime = 5
  506. }
  507. if(this.photoNum<1){
  508. this.photoNum = 1 //只要设置,至少拍一次
  509. spaceTime = totalVideoTime
  510. }
  511. let initSpace = 0
  512. this.photoList = []
  513. for(let i=0;i<this.photoNum;i++){
  514. let s = this.randomNum(initSpace,initSpace+spaceTime)
  515. if(s>totalVideoTime){
  516. s = totalVideoTime-1
  517. }
  518. if(s<2){
  519. s =1
  520. }
  521. this.photoList.push(s)
  522. initSpace+=spaceTime
  523. }
  524. console.log(this.photoList,"随机拍时间数组",this.photoNum)
  525. //兼容已有观看历史
  526. for(let i=0;i<this.photoList.length-1;i++){
  527. if(this.photoList[i]<duration&&this.photoList[i+1]>duration){
  528. this.photoIndex = i+1
  529. console.log("我的修改了photoIndex")
  530. break
  531. }
  532. if(duration>this.photoList[this.photoList.length-1]){
  533. this.photoIndex = this.photoList.length-1 //取最后一个下标
  534. console.log("1我的修改了photoIndex")
  535. break
  536. }
  537. }
  538. }
  539. },
  540. getLiveUid(channelId) {
  541. let self = this;
  542. return new Promise(resolve => {
  543. let data = {
  544. channelId: channelId
  545. };
  546. self.$api.polyvSign(data).then(res => {
  547. resolve(res.data.data);
  548. });
  549. });
  550. },
  551. timeEventLiving() {
  552. if (plv != null) {
  553. if(this.livePlay){
  554. this.liveDuration = this.liveDuration +1 //每隔1秒
  555. if(this.liveDuration==2){ //直播第2秒拍照
  556. if(this.goodsPhotographConfig){
  557. if(this.goodsPhotographConfig.livephotograph==1){
  558. //开启直播拍照
  559. this.openPhoto();
  560. }
  561. }
  562. }
  563. }
  564. }
  565. },
  566. playerLiveStatusChange(e) {
  567. const status = e.detail.status;
  568. console.log('直播状态',status);
  569. if (status === 'live') {
  570. console.log('开始直播');
  571. //开始播放
  572. if (this.timer) {
  573. clearInterval(this.timer);
  574. }
  575. this.livePlay = true
  576. this.timer = setInterval(this.timeEventLiving, 1000); //定时器
  577. }
  578. if (status === 'end') {
  579. if(this.livePlay){
  580. //只有播放过的结束才提交,避免未开播触发结束
  581. this.postStudyRecord(1);
  582. }
  583. console.log('结束直播');
  584. this.livePlay = false
  585. // 未开始
  586. }
  587. },
  588. closePlv(){
  589. if(plv){
  590. plv.destroy();
  591. }
  592. },
  593. playChannel(item){
  594. if (this.timer) {
  595. clearInterval(this.timer);
  596. }
  597. this.startStatus = true
  598. this.initLive()
  599. },
  600. setLiveOption(status) {
  601. const { userId, channelId, recordFileSimpleModel, playbackEnabled } = this.detail;
  602. const playRecordFile = playbackEnabled && recordFileSimpleModel && status === 'end';
  603. this.videoOption = {
  604. mode: 'live',
  605. uid: this.liveObj.uid, //this.playChannelId egsxlptzdq
  606. cid: this.playChannelId,
  607. openId: this.userInfo.userAccount,
  608. isAutoChange: false,
  609. forceVideo: false,
  610. }
  611. },
  612. async initLive(){
  613. console.log(this.playChannelId,7111)
  614. this.liveObj = await this.getLiveUid(this.playChannelId);
  615. this.initLiveOk = true
  616. let optionsData = {}
  617. optionsData.mode = 'live';
  618. optionsData.forceVideo = false;
  619. optionsData.channelId = this.playChannelId; // 频道ID '2553128'
  620. optionsData.openId = this.userInfo.userAccount; // 用户openId this.userInfo.userAccount 'oQ5eX5BCtSjkE1ct8CzvxGWgh0hQ'
  621. optionsData.userId = this.liveObj.uid // 2.0.0及以上版本的demo需要使用 userId 设置学员唯一id 'egsxlptzdq'
  622. let self = this
  623. this.closePlv()
  624. plv.init(optionsData)
  625. .then(({ detail, chat }) => {
  626. self.liveDetail = detail
  627. // 设置mode为live的videoOption
  628. this.setLiveOption();
  629. if (detail.isPPT) {
  630. chat.on(chat.events.SLICESTART, () => {
  631. // 开始直播
  632. });
  633. } else {
  634. plv.api.getOrdinaryLiveStatus(detail.stream);
  635. }
  636. });
  637. },
  638. openSetting(res){
  639. console.log(res,98)
  640. },
  641. getCameraSetting () {
  642. const self = this
  643. wx.getSetting({
  644. success: res => {
  645. if (res.authSetting['scope.camera']) {
  646. // 用户已经授权
  647. self.showSet = false
  648. } else {
  649. // 用户还没有授权,向用户发起授权请求
  650. wx.authorize({
  651. scope: 'scope.camera',
  652. success() { // 用户同意授权
  653. self.showSet = false
  654. },
  655. fail() { // 用户不同意授权
  656. self.showSet = true
  657. /* wx.showToast({
  658. title: '摄像头授权失败',
  659. icon: 'none',
  660. duration: 3000
  661. }) */
  662. }
  663. })
  664. }
  665. },
  666. fail: res => {
  667. }
  668. })
  669. },
  670. openJY(){
  671. this.$u.toast('此功能正在开发中');
  672. },
  673. //播放笔记视频
  674. async playNoteVideo(item) {
  675. if (this.timer) {
  676. clearInterval(this.timer);
  677. }
  678. if (this.vid) {
  679. //切换视频
  680. var polyvPlayerContext = this.selectComponent('#playerVideo');
  681. polyvPlayerContext.changeVid(item.recordingUrl);
  682. } else {
  683. this.vid = item.recordingUrl;
  684. }
  685. this.recordObj = {studyDuration:item.noteSecond}
  686. if (this.recordObj.studyDuration) {
  687. this.needSeek = true; //需要跳转到播放记录
  688. }
  689. this.startStatus = true;
  690. //获取节笔记
  691. this.getNoteList();
  692. },
  693. //正常播放视频
  694. async playVideo(item) {
  695. if (this.timer) {
  696. clearInterval(this.timer);
  697. }
  698. if (this.vid) {
  699. //切换视频
  700. var polyvPlayerContext = this.selectComponent('#playerVideo');
  701. polyvPlayerContext.changeVid(item.recordingUrl);
  702. } else {
  703. this.vid = item.recordingUrl;
  704. }
  705. this.recordObj = await this.getRecordLast();
  706. if (this.recordObj.studyDuration) {
  707. this.needSeek = true; //需要跳转到播放记录
  708. }
  709. this.startStatus = true;
  710. //获取节笔记
  711. this.getNoteList();
  712. },
  713. getRecordLast() {
  714. let self = this;
  715. return new Promise(resolve => {
  716. let data = {
  717. gradeId: Number(self.gradeId),
  718. goodsId: Number(self.goodsId),
  719. sectionId: Number(self.playSectionId),
  720. courseId: Number(self.courseId)
  721. };
  722. self.$api.recordLast(data).then(res => {
  723. resolve(res.data.data);
  724. });
  725. });
  726. },
  727. jumpNote(item) {
  728. this.noteId = item.noteId;
  729. //没视频播放
  730. if(this.playSectionId==0){
  731. this.$u.toast('即将跳到笔记位置');
  732. this.$store.commit('setPlaySectionId', {playSectionId :item.sectionId});
  733. this.playNoteVideo(item);
  734. }else{
  735. //正在看当前笔记视频
  736. this.$u.toast('即将跳到笔记位置');
  737. //跳到笔记时刻
  738. var polyvPlayerContext = this.selectComponent('#playerVideo');
  739. polyvPlayerContext.seek(item.noteSecond);
  740. polyvPlayerContext.play();
  741. }
  742. },
  743. postNote() {
  744. let self = this;
  745. if (!(this.playSectionId > 0)) {
  746. this.$u.toast('目前无播放视频');
  747. return;
  748. }
  749. if (!this.noteValue) {
  750. this.$u.toast('请输入内容');
  751. return;
  752. }
  753. if(!this.gradeId){
  754. this.$u.toast('暂无班级数据');
  755. return;
  756. }
  757. var polyvPlayerContext = this.selectComponent('#playerVideo');
  758. let noteDate = this.$method.getZeroTime();
  759. let noteSecond = polyvPlayerContext.getCurrentTime();
  760. console.log(noteSecond,698)
  761. if (!noteSecond) {
  762. if(noteSecond==0){
  763. //播放结束
  764. noteSecond = polyvPlayerContext.getDuration();
  765. console.log(noteSecond,63398)
  766. }
  767. if(!noteSecond){
  768. this.$u.toast('视频暂未开始');
  769. return;
  770. }
  771. }
  772. let data = {
  773. gradeId: this.gradeId,
  774. goodsId: this.goodsId,
  775. sectionId: this.playSectionId,
  776. courseId: this.courseId,
  777. noteText: this.noteValue,
  778. noteDate: noteDate,
  779. noteSecond: noteSecond
  780. };
  781. this.$api.postNote(data).then(res => {
  782. if (res.data.code == 200) {
  783. this.$u.toast('发布成功');
  784. self.getNoteList();
  785. this.noteValue = '';
  786. }
  787. });
  788. },
  789. getGradeInfo() {
  790. let self = this;
  791. this.$store.state.allowLoading = false;
  792. this.$api.goodsGradeInfo(this.gradeId).then(res => {
  793. if (res.data.code == 200) {
  794. self.gradeDetail = res.data.data;
  795. if(self.gradeDetail.learningStatus==2){
  796. uni.showModal({
  797. showCancel:false,
  798. cancelText: '返回',
  799. content: '当前课程正在申请中,请耐心等待',
  800. success: function(resultst) {
  801. uni.navigateBack();
  802. }
  803. });
  804. }
  805. if(self.gradeDetail.learningStatus==3&&(Number(self.gradeDetail.learningTimeStart)>Number((new Date())/1000))){
  806. uni.showModal({
  807. showCancel:false,
  808. cancelText: '返回',
  809. content: '当前课程正在申请中,请耐心等待',
  810. success: function(resultst) {
  811. uni.navigateBack();
  812. }
  813. });
  814. }
  815. }
  816. });
  817. this.$store.state.allowLoading = true;
  818. },
  819. getNoteList() {
  820. let self = this;
  821. self.noteList = [];
  822. let data = { courseId: this.courseId, gradeId: this.gradeId, goodsId: this.goodsId }
  823. if(this.playSectionId>0){
  824. data.sectionId = this.playSectionId
  825. }
  826. this.$api.noteList(data).then(res => {
  827. if (res.data.code == 200) {
  828. self.noteList = res.data.rows;
  829. }
  830. });
  831. },
  832. delAnswer(answerId) {
  833. let self = this;
  834. let data = { answerId: answerId, status: -1 };
  835. this.$api.delAnswer(data).then(res => {
  836. if (res.data.code == 200) {
  837. self.getAnswerList();
  838. }
  839. });
  840. },
  841. clearCtx() {
  842. console.log(4234);
  843. this.placeholder = '您可以在这里输入答疑内容';
  844. this.ctxValue = '';
  845. this.assignUserId = 0;
  846. },
  847. replyContent(item) {
  848. this.assignUserId = item.userId;
  849. this.placeholder = '@' + item.realname;
  850. },
  851. delContent(item) {
  852. this.delAnswer(item.answerId);
  853. },
  854. postAnswer() {
  855. let self = this;
  856. let data = { courseId: this.courseId, answerText: this.ctxValue, goodsId: this.goodsId };
  857. if (this.assignUserId > 0) {
  858. data.assignUserId = this.assignUserId;
  859. }
  860. this.$api.postAnswer(data).then(res => {
  861. if (res.data.code == 200) {
  862. this.$u.toast('发布成功');
  863. self.getAnswerList();
  864. this.placeholder = '您可以在这里输入答疑内容';
  865. this.ctxValue = '';
  866. this.assignUserId = 0;
  867. }
  868. });
  869. },
  870. postContent() {
  871. if (!this.ctxValue||this.ctxValue=='') {
  872. this.$u.toast('请输入内容');
  873. return
  874. }
  875. this.postAnswer();
  876. },
  877. postStudyRecord(status = 0, sectionId = this.playSectionId) {
  878. let currentTime = 0;
  879. var polyvPlayerContext = this.selectComponent('#playerVideo');
  880. if (polyvPlayerContext) {
  881. currentTime = polyvPlayerContext.getCurrentTime(); //录播回放
  882. }
  883. if(this.playChannelId>0){
  884. currentTime = 2;//直播无法获取,无论开始结束都传2秒
  885. }
  886. let self = this;
  887. let data = {
  888. photo: self.ossAvatarUrl,
  889. sectionId: parseInt(sectionId),
  890. goodsId: parseInt(self.goodsId),
  891. courseId: parseInt(self.courseId),
  892. studyDuration: parseInt(currentTime > 0 ? currentTime : self.studyDuration),
  893. gradeId: parseInt(self.gradeId),
  894. chapterId: parseInt(self.chapterId),
  895. moduleId: parseInt(self.moduleId)
  896. };
  897. if (status > 0) {
  898. data.status = status;
  899. }
  900. console.log('提交接口', data);
  901. this.$api.studyRecord(data).then(res => {
  902. self.ossAvatarUrl = ''
  903. console.log(res);
  904. });
  905. },
  906. uploadFile(options, int) {
  907. var self = this;
  908. return new Promise((resolve, reject) => {
  909. var data = {
  910. imageStatus: int
  911. };
  912. self.$api.aliyunpolicy(data).then(res => {
  913. if (res.data.code != 200) {
  914. self.$method.showToast('签名错误' + JSON.stringify(res.data));
  915. return;
  916. }
  917. var ossToken = res.data.data.resultContent;
  918. if (ossToken.host == null || ossToken.host == undefined) {
  919. self.$method.showToast('上传路径报错' + JSON.stringify(res.data));
  920. return;
  921. }
  922. uni.uploadFile({
  923. url: ossToken.host,
  924. name: 'file',
  925. filePath: options,
  926. fileType: 'image',
  927. header: {
  928. AuthorizationToken: 'WX ' + uni.getStorageSync('token')
  929. },
  930. formData: {
  931. key: ossToken.dir,
  932. OSSAccessKeyId: ossToken.accessid,
  933. policy: ossToken.policy,
  934. Signature: ossToken.signature,
  935. callback: ossToken.callback,
  936. success_action_status: 200
  937. },
  938. success: result => {
  939. if (result.statusCode === 200) {
  940. self.ossAvatarUrl = ossToken.dir;
  941. resolve();
  942. } else {
  943. uni.showToast({
  944. title: '上传失败',
  945. icon: 'none'
  946. });
  947. return;
  948. }
  949. },
  950. fail: error => {
  951. uni.showToast({
  952. title: '上传接口报错' + error,
  953. icon: 'none'
  954. });
  955. return;
  956. }
  957. });
  958. });
  959. });
  960. },
  961. imageInfos() {
  962. var self = this;
  963. return new Promise((resolve, reject) => {
  964. uni.getImageInfo({
  965. src: self.avatarUrl,
  966. success: async res => {
  967. let canvasWidth = res.width; //图片原始长宽
  968. let canvasHeight = res.height;
  969. if (canvasWidth > 1000 || canvasHeight > 1000) {
  970. uni.compressImage({
  971. src: self.avatarUrl,
  972. quality: 75,
  973. width: '50%',
  974. height: '50%',
  975. success: async rest => {
  976. const waitUpload = await self.uploadFile(rest.tempFilePath, 0);
  977. resolve();
  978. }
  979. });
  980. } else {
  981. console.log('无需压缩');
  982. const waitUpload = await self.uploadFile(self.avatarUrl, 0);
  983. resolve();
  984. }
  985. }
  986. });
  987. });
  988. },
  989. timeEvent() {
  990. let self = this;
  991. var polyvPlayerContext = this.selectComponent('#playerVideo');
  992. if (polyvPlayerContext != null) {
  993. this.playTime = polyvPlayerContext.getCurrentTime() //播放时刻
  994. //判断是否需要拍照
  995. if (this.photoNum > 0) {
  996. this.configPhoto()
  997. if(this.photoIndex<this.photoList.length){
  998. let photoTime = Number(this.photoList[this.photoIndex]); //获取拍照秒数
  999. let nextIndex = this.photoIndex+1
  1000. let nextTime = 0
  1001. if(nextIndex<this.photoList.length){
  1002. nextTime = Number(this.photoList[nextIndex]); //获取下次拍照秒数
  1003. }
  1004. if (photoTime < this.playTime) {
  1005. if(this.photoHistoryList.indexOf(this.photoIndex)<0){ //不存在拍照历史则拍照
  1006. //启动拍照
  1007. //暂停
  1008. polyvPlayerContext.exitFullScreen();
  1009. polyvPlayerContext.pause();
  1010. this.photoIndex++;
  1011. this.openPhoto();
  1012. }
  1013. }
  1014. }
  1015. }
  1016. }
  1017. },
  1018. onStateChange(newstate, oldstate) {
  1019. if (newstate.detail.newstate == 'playing') {
  1020. if (this.needSeek) {
  1021. var polyvPlayerContext = this.selectComponent('#playerVideo');
  1022. polyvPlayerContext.seek(this.recordObj.studyDuration);
  1023. polyvPlayerContext.play();
  1024. this.needSeek = false;
  1025. }
  1026. //开始播放
  1027. if (this.timer) {
  1028. clearInterval(this.timer);
  1029. }
  1030. this.timer = setInterval(this.timeEvent, 1000); //定时器
  1031. }
  1032. if (newstate.detail.newstate == 'pause') {
  1033. //暂停提交记录
  1034. /* this.ossAvatarUrl = ""
  1035. this.postStudyRecord() */
  1036. }
  1037. if (newstate.detail.newstate == 'ended') {
  1038. this.postStudyRecord(1);
  1039. }
  1040. },
  1041. //拍照
  1042. openPhoto() {
  1043. this.photoPopup = true;
  1044. uni.authorize({
  1045. scope: 'scope.camera',
  1046. success() {
  1047. }
  1048. })
  1049. },
  1050. async submit() {
  1051. const waitYS = await this.imageInfos();
  1052. this.postCoursePhotoRecord()
  1053. this.postStudyRecord(); //提交记录
  1054. //恢复播放
  1055. var polyvPlayerContext = this.selectComponent('#playerVideo');
  1056. if (polyvPlayerContext != null) {
  1057. polyvPlayerContext.play();
  1058. }
  1059. },
  1060. //确认拍照
  1061. takePhoto() {
  1062. var self = this;
  1063. const ctx = uni.createCameraContext();
  1064. ctx.takePhoto({
  1065. quality: 'high',
  1066. success: res => {
  1067. console.log(res.tempImagePath);
  1068. self.avatarUrl = res.tempImagePath;
  1069. self.submit();
  1070. self.photoPopup = false;
  1071. },
  1072. fail: err => {
  1073. console.log(err);
  1074. }
  1075. });
  1076. },
  1077. //拍照报错
  1078. error(e) {
  1079. console.log(e.detail);
  1080. },
  1081. //关闭相机
  1082. closePhoto() {
  1083. this.photoPopup = false;
  1084. },
  1085. getGoodsDetail() {
  1086. let self = this;
  1087. this.$api.goodsDetail(this.goodsId).then(res => {
  1088. self.goodsData = res.data.data;
  1089. self.gradeId = self.goodsData.gradeId;
  1090. console.log(self.gradeId, "班级ID");
  1091. this.courseHandouts();
  1092. self.getMenuList();
  1093. self.getReMenuList(); //获取重修目录
  1094. setTimeout(function(){
  1095. if(!self.needProfileModal){
  1096. self.getGradeInfo()
  1097. }
  1098. },500)
  1099. //获取节笔记
  1100. this.getNoteList();
  1101. if (self.goodsData.goodsPlayConfig) {
  1102. self.goodsPlayConfig = JSON.parse(self.goodsData.goodsPlayConfig);
  1103. if (self.goodsPlayConfig.autoPlay > 0) {
  1104. self.autoplay = true;
  1105. }
  1106. if (self.goodsPlayConfig.drag > 0) {
  1107. self.isAllowSeek = 'yes';
  1108. }
  1109. if (self.goodsPlayConfig.speed > 0) {
  1110. self.playbackRate = [0.5, 0.8, 1.0, 1.25, 1.5, 2.0];
  1111. }
  1112. }
  1113. if (self.goodsData.goodsPhotographConfig) {
  1114. self.goodsPhotographConfig = JSON.parse(self.goodsData.goodsPhotographConfig);
  1115. if (self.goodsPhotographConfig.photoNum>0) {
  1116. self.photoNum = self.goodsPhotographConfig.photoNum
  1117. console.log(self.photoNum,777777)
  1118. }
  1119. }
  1120. });
  1121. },
  1122. startVideo() {
  1123. this.startStatus = true;
  1124. },
  1125. getAnswerList() {
  1126. let self = this;
  1127. this.$api.answerList({ courseId: this.courseId,goodsId: this.goodsId }).then(res => {
  1128. if (res.data.code == 200) {
  1129. self.answerList = res.data.rows;
  1130. }
  1131. });
  1132. },
  1133. getReMenuList() {
  1134. let self = this;
  1135. this.$api.reMenuList({ courseId: this.courseId, rebuild: 1, gradeId: this.gradeId }).then(res => {
  1136. if (res.data.code == 200) {
  1137. for (let i = 0; i < res.data.rows.length; i++) {
  1138. let item = res.data.rows[i];
  1139. item.down = true;
  1140. item.id = item.menuId;
  1141. item.name = item.menuName;
  1142. }
  1143. self.reMenuList = res.data.rows;
  1144. if(self.reMenuList.length>0){
  1145. self.list = [
  1146. {
  1147. name: '目录'
  1148. },
  1149. {
  1150. name: '讲义'
  1151. },
  1152. {
  1153. name: '笔记'
  1154. },
  1155. {
  1156. name: '答疑'
  1157. },
  1158. {name:'重修目录'}
  1159. ];
  1160. this.current = 0;
  1161. } else {
  1162. self.list = [
  1163. {
  1164. name: '目录'
  1165. },
  1166. {
  1167. name: '讲义'
  1168. },
  1169. {
  1170. name: '笔记'
  1171. },
  1172. {
  1173. name: '答疑'
  1174. }
  1175. ];
  1176. this.current = 0;
  1177. }
  1178. }
  1179. });
  1180. },
  1181. getMenuList() {
  1182. let self = this;
  1183. this.$api.reMenuList({ courseId: this.courseId, gradeId: this.gradeId }).then(res => {
  1184. if (res.data.code == 200) {
  1185. for (let i = 0; i < res.data.rows.length; i++) {
  1186. let item = res.data.rows[i];
  1187. item.down = true;
  1188. item.id = item.menuId;
  1189. item.name = item.menuName;
  1190. }
  1191. self.menuList = res.data.rows;
  1192. }
  1193. });
  1194. },
  1195. courseDetail() {
  1196. let self = this;
  1197. this.$api.courseDetail(this.courseId).then(res => {
  1198. if (res.data.code == 200) {
  1199. self.detail = res.data.data;
  1200. }
  1201. });
  1202. },
  1203. open(item) {
  1204. item.showChildren = !item.showChildren;
  1205. },
  1206. change(index) {
  1207. this.current = index;
  1208. },
  1209. openDocument() {
  1210. let self = this;
  1211. // console.log(this.$method.splitImgHost(this.courseHandoutsData.handoutsUrl))
  1212. uni.downloadFile({
  1213. url: this.$method.splitImgHost(this.courseHandoutsData.handoutsUrl),
  1214. success: function (res) {
  1215. console.log(999)
  1216. var filePath = res.tempFilePath;
  1217. uni.openDocument({
  1218. filePath: filePath,
  1219. showMenu: self.courseHandoutsData.canDownload == 1 ? true : false,
  1220. success: function (res) {
  1221. console.log(res,'打开文档成功');
  1222. },
  1223. fail:function(err) {
  1224. uni.showToast({
  1225. icon:'none',
  1226. title:'文档地址错误'
  1227. })
  1228. }
  1229. });
  1230. }
  1231. });
  1232. }
  1233. }
  1234. };
  1235. </script>
  1236. <style lang="scss" scope>
  1237. .btnSet{
  1238. width: 440rpx;
  1239. height: 80rpx;
  1240. background: #007AFF;
  1241. border-radius: 40rpx;
  1242. color: #FFFFFF;
  1243. font-size: 28rpx;
  1244. line-height: 80rpx;
  1245. }
  1246. .btnReply {
  1247. width: 80rpx;
  1248. height: 40rpx;
  1249. background: #e3f0ff;
  1250. border-radius: 16rpx;
  1251. text-align: center;
  1252. color: #007aff;
  1253. }
  1254. .btnDel {
  1255. width: 80rpx;
  1256. height: 40rpx;
  1257. background: #ffedf0;
  1258. border-radius: 16rpx;
  1259. text-align: center;
  1260. color: #ff2d55;
  1261. }
  1262. .btnReply {
  1263. width: 80rpx;
  1264. height: 40rpx;
  1265. background: #e3f0ff;
  1266. border-radius: 16rpx;
  1267. font-size: 24rpx;
  1268. }
  1269. .lecture-box {
  1270. display: flex;
  1271. align-items: center;
  1272. height: 80rpx;
  1273. background: #FFFFFF;
  1274. border-radius: 16rpx 16rpx 16rpx 16rpx;
  1275. .title {
  1276. padding:10rpx;
  1277. flex:1;
  1278. overflow: hidden;
  1279. text-overflow: ellipsis;
  1280. white-space: nowrap;
  1281. color:#333;
  1282. font-weight: bold;
  1283. font-size: 32rpx;
  1284. }
  1285. .btn {
  1286. display: flex;
  1287. align-items: center;
  1288. justify-content: center;
  1289. width:80rpx;
  1290. height:80rpx;
  1291. background: #FFFFFF;
  1292. box-shadow: -4rpx 0rpx 4rpx 0rpx rgba(0,0,0,0.1);
  1293. border-radius: 16rpx 16rpx 16rpx 16rpx;
  1294. }
  1295. }
  1296. .lecture-content {
  1297. background:#fff;
  1298. margin-top:10rpx;
  1299. padding:10rpx;
  1300. border-radius:16rpx;
  1301. }
  1302. .photoBox {
  1303. background-color: #FFFFFF;
  1304. border-radius: 32px 32px 0px 0px;
  1305. .photoTop {
  1306. height: 74upx;
  1307. display: flex;
  1308. align-items: center;
  1309. justify-content: space-between;
  1310. padding: 0upx 38upx;
  1311. .sqzz {
  1312. width: 28upx;
  1313. height: 28upx;
  1314. display: flex;
  1315. align-items: center;
  1316. justify-content: center;
  1317. }
  1318. .centersq {
  1319. color: #333;
  1320. font-size: 30upx;
  1321. font-weight: 500;
  1322. }
  1323. }
  1324. .photoCenter {
  1325. width: 750upx;
  1326. height: 979upx;
  1327. position: relative;
  1328. .custom {
  1329. width: 750upx;
  1330. height: 979upx;
  1331. position: absolute;
  1332. z-index: 1000;
  1333. top: 0;
  1334. left: 0;
  1335. image {
  1336. width: 100%;
  1337. height: 100%;
  1338. }
  1339. }
  1340. }
  1341. .btnResult {
  1342. height: 100rpx;
  1343. width: 100%;
  1344. background-color: #07c160;
  1345. text-align: center;
  1346. line-height: 100upx;
  1347. color: #fff;
  1348. font-size: 32upx;
  1349. font-weight: bold;
  1350. }
  1351. }
  1352. .chat_box {
  1353. display: flex;
  1354. padding: 20rpx;
  1355. justify-content: space-between;
  1356. }
  1357. .chat3 {
  1358. font-size: 30rpx;
  1359. font-family: PingFang SC;
  1360. font-weight: 500;
  1361. color: #666666;
  1362. margin-top: 10rpx;
  1363. }
  1364. .chat2 {
  1365. font-size: 20rpx;
  1366. font-family: PingFang SC;
  1367. font-weight: 500;
  1368. color: #999999;
  1369. margin-top: 10rpx;
  1370. }
  1371. .chat1 {
  1372. font-size: 24rpx;
  1373. font-family: PingFang SC;
  1374. font-weight: 500;
  1375. color: #333333;
  1376. }
  1377. .leftPadding {
  1378. margin-left: 8rpx;
  1379. }
  1380. .t2Content {
  1381. font-size: 28rpx;
  1382. font-family: PingFang SC;
  1383. font-weight: bold;
  1384. color: #999999;
  1385. line-height: 48rpx;
  1386. }
  1387. .tBox2 {
  1388. display: flex;
  1389. padding-top: 10rpx;
  1390. color: #333333;
  1391. font-size: 30rpx;
  1392. }
  1393. .tBox {
  1394. display: flex;
  1395. align-items: center;
  1396. padding-top: 10rpx;
  1397. }
  1398. .title {
  1399. font-size: 24rpx;
  1400. color: #999999;
  1401. }
  1402. page {
  1403. padding-top: 10px;
  1404. padding-top: constant(safe-area-inset-top);
  1405. padding-top: env(safe-area-inset-top);
  1406. }
  1407. .inputBottom {
  1408. position: fixed;
  1409. left: 0;
  1410. bottom: 0;
  1411. background: #ffffff;
  1412. height: 98rpx;
  1413. display: flex;
  1414. align-items: center;
  1415. width: 100%;
  1416. .flex_auto {
  1417. flex:1;
  1418. margin-left: 10% ;
  1419. .input {
  1420. height:60rpx;
  1421. }
  1422. }
  1423. .btn {
  1424. color: #007AFF;font-size: 30rpx;font-weight: bold;width: 15%;text-align: center;
  1425. }
  1426. }
  1427. .noteBox {
  1428. width: 100%;
  1429. background: #ffffff;
  1430. padding: 10rpx;
  1431. border-radius: 16rpx;
  1432. }
  1433. .dateBox {
  1434. width: 216rpx;
  1435. height: 48rpx;
  1436. background: #ffffff;
  1437. border-radius: 24rpx;
  1438. font-size: 24rpx;
  1439. color: #666666;
  1440. text-align: center;
  1441. line-height: 48rpx;
  1442. margin: 20rpx 0;
  1443. }
  1444. .t_content1 {
  1445. color: #007aff;
  1446. margin-left: 10rpx;
  1447. }
  1448. .tag1 {
  1449. border: 2rpx solid #007aff;
  1450. border-radius: 8rpx;
  1451. font-size: 20rpx;
  1452. color: #007aff;
  1453. padding: 5rpx;
  1454. }
  1455. .b_title {
  1456. color: #333333;
  1457. font-size: 30rpx;
  1458. font-weight: bold;
  1459. }
  1460. page {
  1461. background: #eaeef1;
  1462. }
  1463. .menuBox {
  1464. width: 100%;
  1465. background: #ffffff;
  1466. border-radius: 16rpx;
  1467. padding: 20rpx;
  1468. margin-bottom: 20rpx;
  1469. }
  1470. .btnspric {
  1471. border-top: 1rpx solid #eee;
  1472. display: flex;
  1473. align-items: center;
  1474. justify-content: space-between;
  1475. height: 108rpx;
  1476. padding-left: 43rpx;
  1477. padding-right: 32rpx;
  1478. }
  1479. .btnspric > .lefprL {
  1480. font-size: 36rpx;
  1481. color: #0c141f;
  1482. font-weight: bold;
  1483. }
  1484. .btnspric > .lefprR {
  1485. padding: 0rpx 24rpx;
  1486. height: 60rpx;
  1487. line-height: 60rpx;
  1488. text-align: center;
  1489. color: #fff;
  1490. background: #32467b;
  1491. border-radius: 24rpx;
  1492. box-shadow: 0rpx 0rpx 16rpx 4rpx rgba(145, 156, 178, 0.1);
  1493. }
  1494. .yhj,
  1495. .hdyhj {
  1496. padding: 24rpx 29rpx 24rpx 34rpx;
  1497. }
  1498. .yhj {
  1499. border-bottom: 16rpx solid #f9f9f9;
  1500. }
  1501. .yhjtit {
  1502. font-size: 30rpx;
  1503. color: #0c141f;
  1504. font-weight: 500;
  1505. margin-bottom: 14rpx;
  1506. }
  1507. .yhjList {
  1508. display: flex;
  1509. align-items: center;
  1510. justify-content: space-between;
  1511. margin-bottom: 14rpx;
  1512. }
  1513. .yhjList > .yhjLefts {
  1514. display: flex;
  1515. align-items: center;
  1516. }
  1517. .yhjLefts > .yhl {
  1518. color: #32467b;
  1519. font-size: 30rpx;
  1520. margin-right: 31rpx;
  1521. }
  1522. .yhjLefts > .yhbq {
  1523. font-size: 24rpx;
  1524. color: #ff9500;
  1525. border-radius: 18rpx;
  1526. background-color: rgba(255, 149, 0, 0.2);
  1527. border: 2rpx solid #ff9500;
  1528. height: 38rpx;
  1529. line-height: 38rpx;
  1530. padding: 0rpx 16rpx;
  1531. }
  1532. .ts {
  1533. font-size: 24rpx;
  1534. color: #999;
  1535. margin: 14rpx 0rpx;
  1536. padding-right: 29rpx;
  1537. padding-left: 34rpx;
  1538. }
  1539. .yh {
  1540. padding-top: 20rpx;
  1541. }
  1542. .yh > .yhtitle {
  1543. display: flex;
  1544. align-items: center;
  1545. justify-content: space-between;
  1546. padding-right: 29rpx;
  1547. padding-left: 34rpx;
  1548. }
  1549. .priceBxs {
  1550. display: flex;
  1551. align-items: center;
  1552. }
  1553. .priceBxs > .pricleft {
  1554. border-radius: 24rpx;
  1555. border: 1rpx solid #e91313;
  1556. background-color: rgba(233, 19, 19, 0.1);
  1557. padding: 0rpx 18rpx;
  1558. height: 49rpx;
  1559. line-height: 49rpx;
  1560. text-align: center;
  1561. font-size: 30rpx;
  1562. font-weight: 500;
  1563. color: #e91313;
  1564. margin-right: 13rpx;
  1565. }
  1566. .topBox {
  1567. padding: 32rpx 32rpx 24rpx;
  1568. border-bottom: 1rpx solid #eeeeee;
  1569. }
  1570. .topBox > .boldFonstType {
  1571. font-weight: 500;
  1572. font-size: 30rpx;
  1573. margin: 16rpx 0rpx 23rpx;
  1574. }
  1575. .topBox > .firstTopL {
  1576. display: flex;
  1577. align-items: center;
  1578. }
  1579. .topBox > .firstTopL > .imageBs {
  1580. width: 331rpx;
  1581. height: 160rpx;
  1582. border-radius: 6rpx;
  1583. overflow: hidden;
  1584. margin-right: 8rpx;
  1585. box-shadow: 0rpx 6rpx 6rpx 0rpx rgba(47, 67, 121, 0.08);
  1586. }
  1587. .topBox > .firstTopL > .imageBs > image {
  1588. width: 100%;
  1589. height: 100%;
  1590. }
  1591. .topBox > .firstTopL > .textBs {
  1592. font-size: 30rpx;
  1593. font-weight: bold;
  1594. color: #0c141f;
  1595. }
  1596. .content {
  1597. padding: 24rpx;
  1598. text-align: left;
  1599. }
  1600. .catalogBox {
  1601. display: flex;
  1602. align-items: center;
  1603. flex-wrap: nowrap;
  1604. overflow-x: auto;
  1605. padding-left: 38rpx;
  1606. max-height: 305rpx;
  1607. overflow-y: auto;
  1608. transition: all 0.4s;
  1609. }
  1610. .catalogBox > .catalogA {
  1611. min-width: 200rpx;
  1612. height: 48rpx;
  1613. line-height: 48rpx;
  1614. // text-align: center;
  1615. border: 2rpx solid transparent;
  1616. white-space: nowrap;
  1617. text-overflow: ellipsis;
  1618. overflow: hidden;
  1619. word-break: break-all;
  1620. border-radius: 10rpx;
  1621. background: rgba(22, 119, 255, 0.05);
  1622. padding-left: 19rpx;
  1623. box-sizing: border-box;
  1624. padding-right: 15rpx;
  1625. margin-right: 16rpx;
  1626. margin-bottom: 20rpx;
  1627. margin-top: 15rpx;
  1628. font-size: 24rpx;
  1629. color: #666;
  1630. }
  1631. .catalogBox > .activesq {
  1632. border-color: #1677ff;
  1633. }
  1634. .changeCatalogBox {
  1635. display: block;
  1636. }
  1637. .catalogBox::-webkit-scrollbar {
  1638. display: none; /* Chrome Safari */
  1639. }
  1640. .box {
  1641. position: relative;
  1642. top: 650rpx;
  1643. padding-bottom: 88rpx;
  1644. margin: 20rpx;
  1645. }
  1646. .price_t2 {
  1647. font-size: 18rpx;
  1648. font-family: PingFang SC;
  1649. font-weight: 500;
  1650. text-decoration: line-through;
  1651. color: #999999;
  1652. }
  1653. .price_t1 {
  1654. font-size: 33rpx;
  1655. font-family: PingFang SC;
  1656. font-weight: bold;
  1657. color: #e91313;
  1658. }
  1659. .sc_t {
  1660. font-size: 22rpx;
  1661. color: #000000;
  1662. }
  1663. .sc {
  1664. width: 29rpx;
  1665. height: 29rpx;
  1666. }
  1667. .buy {
  1668. width: 138rpx;
  1669. height: 48rpx;
  1670. line-height: 48rpx;
  1671. background: #32467b;
  1672. border-radius: 10rpx;
  1673. color: #ffffff;
  1674. font-size: 28rpx;
  1675. text-align: center;
  1676. vertical-align: middle;
  1677. position: absolute;
  1678. right: 30rpx;
  1679. }
  1680. .video_body {
  1681. padding-bottom: 96rpx;
  1682. }
  1683. .footer_tab {
  1684. position: fixed;
  1685. bottom: 0;
  1686. height: 96rpx;
  1687. width: 100%;
  1688. background-color: #ffffff;
  1689. }
  1690. .tj_box {
  1691. width: 50%;
  1692. display: inline-block;
  1693. text-align: center;
  1694. margin: 10rpx 0;
  1695. }
  1696. .teacher_t {
  1697. font-size: 24rpx;
  1698. font-family: PingFang SC;
  1699. font-weight: 400;
  1700. color: #666666;
  1701. line-height: 36rpx;
  1702. margin-left: 15rpx;
  1703. }
  1704. .teacher_img {
  1705. width: 87rpx;
  1706. height: 129rpx;
  1707. }
  1708. .t2 {
  1709. font-size: 24rpx;
  1710. font-family: PingFang SC;
  1711. color: #666666;
  1712. line-height: 36rpx;
  1713. margin: 15rpx;
  1714. }
  1715. .r_t2 {
  1716. width: 201rpx;
  1717. height: 49rpx;
  1718. background: rgba(22, 119, 255, 0.05);
  1719. border: 1rpx solid #32467b;
  1720. border-radius: 16rpx;
  1721. color: #666666;
  1722. font-size: 23rpx;
  1723. text-align: center;
  1724. display: flex;
  1725. align-items: center;
  1726. padding: 5rpx;
  1727. }
  1728. .scroll_box {
  1729. width: 100%;
  1730. height: 60rpx;
  1731. background: #ffffff;
  1732. box-shadow: 0rpx 0rpx 16rpx 4rpx rgba(145, 156, 178, 0.1);
  1733. white-space: nowrap;
  1734. overflow: hidden;
  1735. margin: 15rpx 0;
  1736. }
  1737. .r_sliper {
  1738. padding: 0 20rpx;
  1739. }
  1740. .top_line {
  1741. width: 6rpx;
  1742. height: 22rpx;
  1743. background: #32467b;
  1744. margin-right: 10rpx;
  1745. }
  1746. .video_t2 {
  1747. font-size: 24rpx;
  1748. font-family: PingFang SC;
  1749. font-weight: 500;
  1750. color: #666666;
  1751. }
  1752. .video_t1 {
  1753. height: 80rpx;
  1754. color: #333333;
  1755. line-height: 80rpx;
  1756. font-size: 30rpx;
  1757. font-family: PingFang SC;
  1758. font-weight: bold;
  1759. color: #333333;
  1760. overflow: hidden;
  1761. text-overflow: ellipsis;
  1762. white-space: nowrap;
  1763. }
  1764. .video_t1_t {
  1765. display: flex;
  1766. flex-direction: column;
  1767. height: 80rpx;
  1768. color: #333333;
  1769. text-align: center;
  1770. align-items: center;
  1771. border-left: solid 1px #d6d6db;
  1772. }
  1773. .video_play {
  1774. position: absolute;
  1775. width: 95rpx;
  1776. height: 95rpx;
  1777. top: 0;
  1778. left: 0;
  1779. right: 0;
  1780. bottom: 0;
  1781. margin: auto;
  1782. }
  1783. .video_box {
  1784. position: relative;
  1785. }
  1786. .rotoct {
  1787. transform: rotate(90deg);
  1788. }
  1789. </style>