detail.vue 48 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846
  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>
  47. <view><u-tabs gutter="0" :item-width="itemWidth()" :list="list" font-size="32" 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. * 计算tabs宽度
  435. */
  436. itemWidth() {
  437. return 100/this.list.length + '%'
  438. },
  439. /**
  440. * 获取讲义权限
  441. */
  442. courseHandouts() {
  443. this.$api.courseHandouts(this.goodsData.handoutsId).then(res => {
  444. this.courseHandoutsData = res.data.data
  445. })
  446. },
  447. getPhotoLastRecord() {
  448. let self = this;
  449. let data = {
  450. sectionId: parseInt(self.playSectionId),
  451. goodsId: parseInt(self.goodsId),
  452. courseId: parseInt(self.courseId),
  453. gradeId: parseInt(self.gradeId)}
  454. this.$api.getPhotoLastRecord(data).then(res => {
  455. if(res.data.code==200){
  456. //清空历史数据
  457. self.photoHistoryList = []
  458. this.photoIndex = 0
  459. for(let i=0;i<res.data.data.length;i++){
  460. self.photoHistoryList.push(res.data.data[i].photoIndex)
  461. }
  462. }
  463. });
  464. },
  465. postCoursePhotoRecord() {
  466. let currentTime = 0;
  467. var polyvPlayerContext = this.selectComponent('#playerVideo');
  468. if (polyvPlayerContext) {
  469. currentTime = polyvPlayerContext.getCurrentTime();
  470. }
  471. let self = this;
  472. let photoIndex = self.photoIndex-1
  473. let data = {
  474. photo: self.ossAvatarUrl,
  475. sectionId: parseInt(self.playSectionId),
  476. goodsId: parseInt(self.goodsId),
  477. courseId: parseInt(self.courseId),
  478. photoTime: parseInt(currentTime > 0 ? currentTime : 0),
  479. gradeId: parseInt(self.gradeId),
  480. photoIndex: parseInt(photoIndex),//从0算起
  481. photoNum:parseInt(self.photoNum)
  482. };
  483. console.log('提交接口', data);
  484. this.$api.coursePhotoRecord(data).then(res => {
  485. console.log(res);
  486. });
  487. },
  488. randomNum(minNum,maxNum){
  489. switch(arguments.length){
  490. case 1:
  491. return parseInt(Math.random()*minNum+1,10);
  492. break;
  493. case 2:
  494. return parseInt(Math.random()*(maxNum-minNum+1)+minNum,10);
  495. break;
  496. default:
  497. return 0;
  498. break;
  499. }
  500. },
  501. //配置随机拍照时间
  502. configPhoto(){
  503. var polyvPlayerContext = this.selectComponent('#playerVideo');
  504. let totalVideoTime = polyvPlayerContext.getDuration()
  505. let duration = polyvPlayerContext.getCurrentTime()
  506. if(!this.photoConfig){
  507. this.photoConfig = true
  508. let spaceTime = Math.floor(totalVideoTime/this.photoNum) //拍照时间区间
  509. if(spaceTime<5){//区间小于5秒
  510. this.photoNum = Math.floor(totalVideoTime/5)
  511. spaceTime = 5
  512. }
  513. if(this.photoNum<1){
  514. this.photoNum = 1 //只要设置,至少拍一次
  515. spaceTime = totalVideoTime
  516. }
  517. let initSpace = 0
  518. this.photoList = []
  519. for(let i=0;i<this.photoNum;i++){
  520. let s = this.randomNum(initSpace,initSpace+spaceTime)
  521. if(s>totalVideoTime){
  522. s = totalVideoTime-1
  523. }
  524. if(s<2){
  525. s =1
  526. }
  527. this.photoList.push(s)
  528. initSpace+=spaceTime
  529. }
  530. console.log(this.photoList,"随机拍时间数组",this.photoNum)
  531. //兼容已有观看历史
  532. for(let i=0;i<this.photoList.length-1;i++){
  533. if(this.photoList[i]<duration&&this.photoList[i+1]>duration){
  534. this.photoIndex = i+1
  535. console.log("我的修改了photoIndex")
  536. break
  537. }
  538. if(duration>this.photoList[this.photoList.length-1]){
  539. this.photoIndex = this.photoList.length-1 //取最后一个下标
  540. console.log("1我的修改了photoIndex")
  541. break
  542. }
  543. }
  544. }
  545. },
  546. getLiveUid(channelId) {
  547. let self = this;
  548. return new Promise(resolve => {
  549. let data = {
  550. channelId: channelId
  551. };
  552. self.$api.polyvSign(data).then(res => {
  553. resolve(res.data.data);
  554. });
  555. });
  556. },
  557. timeEventLiving() {
  558. if (plv != null) {
  559. if(this.livePlay){
  560. this.liveDuration = this.liveDuration +1 //每隔1秒
  561. if(this.liveDuration==2){ //直播第2秒拍照
  562. if(this.goodsPhotographConfig){
  563. if(this.goodsPhotographConfig.livephotograph==1){
  564. //开启直播拍照
  565. this.openPhoto();
  566. }
  567. }
  568. }
  569. }
  570. }
  571. },
  572. playerLiveStatusChange(e) {
  573. const status = e.detail.status;
  574. console.log('直播状态',status);
  575. if (status === 'live') {
  576. console.log('开始直播');
  577. //开始播放
  578. if (this.timer) {
  579. clearInterval(this.timer);
  580. }
  581. this.livePlay = true
  582. this.timer = setInterval(this.timeEventLiving, 1000); //定时器
  583. }
  584. if (status === 'end') {
  585. if(this.livePlay){
  586. //只有播放过的结束才提交,避免未开播触发结束
  587. this.postStudyRecord(1);
  588. }
  589. console.log('结束直播');
  590. this.livePlay = false
  591. // 未开始
  592. }
  593. },
  594. closePlv(){
  595. if(plv){
  596. plv.destroy();
  597. }
  598. },
  599. playChannel(item){
  600. if (this.timer) {
  601. clearInterval(this.timer);
  602. }
  603. this.startStatus = true
  604. this.initLive()
  605. },
  606. setLiveOption(status) {
  607. const { userId, channelId, recordFileSimpleModel, playbackEnabled } = this.detail;
  608. const playRecordFile = playbackEnabled && recordFileSimpleModel && status === 'end';
  609. this.videoOption = {
  610. mode: 'live',
  611. uid: this.liveObj.uid, //this.playChannelId egsxlptzdq
  612. cid: this.playChannelId,
  613. openId: this.userInfo.userAccount,
  614. isAutoChange: false,
  615. forceVideo: false,
  616. }
  617. },
  618. async initLive(){
  619. console.log(this.playChannelId,7111)
  620. this.liveObj = await this.getLiveUid(this.playChannelId);
  621. this.initLiveOk = true
  622. let optionsData = {}
  623. optionsData.mode = 'live';
  624. optionsData.forceVideo = false;
  625. optionsData.channelId = this.playChannelId; // 频道ID '2553128'
  626. optionsData.openId = this.userInfo.userAccount; // 用户openId this.userInfo.userAccount 'oQ5eX5BCtSjkE1ct8CzvxGWgh0hQ'
  627. optionsData.userId = this.liveObj.uid // 2.0.0及以上版本的demo需要使用 userId 设置学员唯一id 'egsxlptzdq'
  628. let self = this
  629. this.closePlv()
  630. plv.init(optionsData)
  631. .then(({ detail, chat }) => {
  632. self.liveDetail = detail
  633. // 设置mode为live的videoOption
  634. this.setLiveOption();
  635. if (detail.isPPT) {
  636. chat.on(chat.events.SLICESTART, () => {
  637. // 开始直播
  638. });
  639. } else {
  640. plv.api.getOrdinaryLiveStatus(detail.stream);
  641. }
  642. });
  643. },
  644. openSetting(res){
  645. console.log(res,98)
  646. },
  647. getCameraSetting () {
  648. const self = this
  649. wx.getSetting({
  650. success: res => {
  651. if (res.authSetting['scope.camera']) {
  652. // 用户已经授权
  653. self.showSet = false
  654. } else {
  655. // 用户还没有授权,向用户发起授权请求
  656. wx.authorize({
  657. scope: 'scope.camera',
  658. success() { // 用户同意授权
  659. self.showSet = false
  660. },
  661. fail() { // 用户不同意授权
  662. self.showSet = true
  663. /* wx.showToast({
  664. title: '摄像头授权失败',
  665. icon: 'none',
  666. duration: 3000
  667. }) */
  668. }
  669. })
  670. }
  671. },
  672. fail: res => {
  673. }
  674. })
  675. },
  676. openJY(){
  677. this.$u.toast('此功能正在开发中');
  678. },
  679. //播放笔记视频
  680. async playNoteVideo(item) {
  681. if (this.timer) {
  682. clearInterval(this.timer);
  683. }
  684. if (this.vid) {
  685. //切换视频
  686. var polyvPlayerContext = this.selectComponent('#playerVideo');
  687. polyvPlayerContext.changeVid(item.recordingUrl);
  688. } else {
  689. this.vid = item.recordingUrl;
  690. }
  691. this.recordObj = {studyDuration:item.noteSecond}
  692. if (this.recordObj.studyDuration) {
  693. this.needSeek = true; //需要跳转到播放记录
  694. }
  695. this.startStatus = true;
  696. //获取节笔记
  697. this.getNoteList();
  698. },
  699. //正常播放视频
  700. async playVideo(item) {
  701. if (this.timer) {
  702. clearInterval(this.timer);
  703. }
  704. if (this.vid) {
  705. //切换视频
  706. var polyvPlayerContext = this.selectComponent('#playerVideo');
  707. polyvPlayerContext.changeVid(item.recordingUrl);
  708. } else {
  709. this.vid = item.recordingUrl;
  710. }
  711. this.recordObj = await this.getRecordLast();
  712. if (this.recordObj.studyDuration) {
  713. this.needSeek = true; //需要跳转到播放记录
  714. }
  715. this.startStatus = true;
  716. //获取节笔记
  717. this.getNoteList();
  718. },
  719. getRecordLast() {
  720. let self = this;
  721. return new Promise(resolve => {
  722. let data = {
  723. gradeId: Number(self.gradeId),
  724. goodsId: Number(self.goodsId),
  725. sectionId: Number(self.playSectionId),
  726. courseId: Number(self.courseId)
  727. };
  728. self.$api.recordLast(data).then(res => {
  729. resolve(res.data.data);
  730. });
  731. });
  732. },
  733. jumpNote(item) {
  734. this.noteId = item.noteId;
  735. //没视频播放
  736. if(this.playSectionId==0){
  737. this.$u.toast('即将跳到笔记位置');
  738. this.$store.commit('setPlaySectionId', {playSectionId :item.sectionId});
  739. this.playNoteVideo(item);
  740. }else{
  741. //正在看当前笔记视频
  742. this.$u.toast('即将跳到笔记位置');
  743. //跳到笔记时刻
  744. var polyvPlayerContext = this.selectComponent('#playerVideo');
  745. polyvPlayerContext.seek(item.noteSecond);
  746. polyvPlayerContext.play();
  747. }
  748. },
  749. postNote() {
  750. let self = this;
  751. if (!(this.playSectionId > 0)) {
  752. this.$u.toast('目前无播放视频');
  753. return;
  754. }
  755. if (!this.noteValue) {
  756. this.$u.toast('请输入内容');
  757. return;
  758. }
  759. if(!this.gradeId){
  760. this.$u.toast('暂无班级数据');
  761. return;
  762. }
  763. var polyvPlayerContext = this.selectComponent('#playerVideo');
  764. let noteDate = this.$method.getZeroTime();
  765. let noteSecond = polyvPlayerContext.getCurrentTime();
  766. console.log(noteSecond,698)
  767. if (!noteSecond) {
  768. if(noteSecond==0){
  769. //播放结束
  770. noteSecond = polyvPlayerContext.getDuration();
  771. console.log(noteSecond,63398)
  772. }
  773. if(!noteSecond){
  774. this.$u.toast('视频暂未开始');
  775. return;
  776. }
  777. }
  778. let data = {
  779. gradeId: this.gradeId,
  780. goodsId: this.goodsId,
  781. sectionId: this.playSectionId,
  782. courseId: this.courseId,
  783. noteText: this.noteValue,
  784. noteDate: noteDate,
  785. noteSecond: noteSecond
  786. };
  787. this.$api.postNote(data).then(res => {
  788. if (res.data.code == 200) {
  789. this.$u.toast('发布成功');
  790. self.getNoteList();
  791. this.noteValue = '';
  792. }
  793. });
  794. },
  795. getGradeInfo() {
  796. let self = this;
  797. this.$store.state.allowLoading = false;
  798. this.$api.goodsGradeInfo(this.gradeId).then(res => {
  799. if (res.data.code == 200) {
  800. self.gradeDetail = res.data.data;
  801. if(self.needProfileModal){
  802. return
  803. }
  804. if(self.gradeDetail.learningStatus==2){
  805. uni.showModal({
  806. showCancel:false,
  807. cancelText: '返回',
  808. content: '当前课程正在申请中,请耐心等待',
  809. success: function(resultst) {
  810. uni.navigateBack();
  811. }
  812. });
  813. }
  814. if(self.gradeDetail.learningStatus==3&&(Number(self.gradeDetail.learningTimeStart)>Number((new Date())/1000))){
  815. uni.showModal({
  816. showCancel:false,
  817. cancelText: '返回',
  818. content: '当前课程正在申请中,请耐心等待',
  819. success: function(resultst) {
  820. uni.navigateBack();
  821. }
  822. });
  823. }
  824. }
  825. });
  826. this.$store.state.allowLoading = true;
  827. },
  828. getNoteList() {
  829. let self = this;
  830. self.noteList = [];
  831. let data = { courseId: this.courseId, gradeId: this.gradeId, goodsId: this.goodsId }
  832. if(this.playSectionId>0){
  833. data.sectionId = this.playSectionId
  834. }
  835. this.$api.noteList(data).then(res => {
  836. if (res.data.code == 200) {
  837. self.noteList = res.data.rows;
  838. }
  839. });
  840. },
  841. delAnswer(answerId) {
  842. let self = this;
  843. let data = { answerId: answerId, status: -1 };
  844. this.$api.delAnswer(data).then(res => {
  845. if (res.data.code == 200) {
  846. self.getAnswerList();
  847. }
  848. });
  849. },
  850. clearCtx() {
  851. console.log(4234);
  852. this.placeholder = '您可以在这里输入答疑内容';
  853. this.ctxValue = '';
  854. this.assignUserId = 0;
  855. },
  856. replyContent(item) {
  857. this.assignUserId = item.userId;
  858. this.placeholder = '@' + item.realname;
  859. },
  860. delContent(item) {
  861. this.delAnswer(item.answerId);
  862. },
  863. postAnswer() {
  864. let self = this;
  865. let data = { courseId: this.courseId, answerText: this.ctxValue, goodsId: this.goodsId };
  866. if (this.assignUserId > 0) {
  867. data.assignUserId = this.assignUserId;
  868. }
  869. this.$api.postAnswer(data).then(res => {
  870. if (res.data.code == 200) {
  871. this.$u.toast('发布成功');
  872. self.getAnswerList();
  873. this.placeholder = '您可以在这里输入答疑内容';
  874. this.ctxValue = '';
  875. this.assignUserId = 0;
  876. }
  877. });
  878. },
  879. postContent() {
  880. if (!this.ctxValue||this.ctxValue=='') {
  881. this.$u.toast('请输入内容');
  882. return
  883. }
  884. this.postAnswer();
  885. },
  886. postStudyRecord(status = 0, sectionId = this.playSectionId) {
  887. let currentTime = 0;
  888. var polyvPlayerContext = this.selectComponent('#playerVideo');
  889. if (polyvPlayerContext) {
  890. currentTime = polyvPlayerContext.getCurrentTime(); //录播回放
  891. }
  892. if(this.playChannelId>0){
  893. currentTime = 2;//直播无法获取,无论开始结束都传2秒
  894. }
  895. let self = this;
  896. let data = {
  897. photo: self.ossAvatarUrl,
  898. sectionId: parseInt(sectionId),
  899. goodsId: parseInt(self.goodsId),
  900. courseId: parseInt(self.courseId),
  901. studyDuration: parseInt(currentTime > 0 ? currentTime : self.studyDuration),
  902. gradeId: parseInt(self.gradeId),
  903. chapterId: parseInt(self.chapterId),
  904. moduleId: parseInt(self.moduleId)
  905. };
  906. if (status > 0) {
  907. data.status = status;
  908. }
  909. console.log('提交接口', data);
  910. this.$api.studyRecord(data).then(res => {
  911. self.ossAvatarUrl = ''
  912. console.log(res);
  913. });
  914. },
  915. uploadFile(options, int) {
  916. var self = this;
  917. return new Promise((resolve, reject) => {
  918. var data = {
  919. imageStatus: int
  920. };
  921. self.$api.aliyunpolicy(data).then(res => {
  922. if (res.data.code != 200) {
  923. self.$method.showToast('签名错误' + JSON.stringify(res.data));
  924. return;
  925. }
  926. var ossToken = res.data.data.resultContent;
  927. if (ossToken.host == null || ossToken.host == undefined) {
  928. self.$method.showToast('上传路径报错' + JSON.stringify(res.data));
  929. return;
  930. }
  931. uni.uploadFile({
  932. url: ossToken.host,
  933. name: 'file',
  934. filePath: options,
  935. fileType: 'image',
  936. header: {
  937. AuthorizationToken: 'WX ' + uni.getStorageSync('token')
  938. },
  939. formData: {
  940. key: ossToken.dir,
  941. OSSAccessKeyId: ossToken.accessid,
  942. policy: ossToken.policy,
  943. Signature: ossToken.signature,
  944. callback: ossToken.callback,
  945. success_action_status: 200
  946. },
  947. success: result => {
  948. if (result.statusCode === 200) {
  949. self.ossAvatarUrl = ossToken.dir;
  950. resolve();
  951. } else {
  952. uni.showToast({
  953. title: '上传失败',
  954. icon: 'none'
  955. });
  956. return;
  957. }
  958. },
  959. fail: error => {
  960. uni.showToast({
  961. title: '上传接口报错' + error,
  962. icon: 'none'
  963. });
  964. return;
  965. }
  966. });
  967. });
  968. });
  969. },
  970. imageInfos() {
  971. var self = this;
  972. return new Promise((resolve, reject) => {
  973. uni.getImageInfo({
  974. src: self.avatarUrl,
  975. success: async res => {
  976. let canvasWidth = res.width; //图片原始长宽
  977. let canvasHeight = res.height;
  978. if (canvasWidth > 1000 || canvasHeight > 1000) {
  979. uni.compressImage({
  980. src: self.avatarUrl,
  981. quality: 75,
  982. width: '50%',
  983. height: '50%',
  984. success: async rest => {
  985. const waitUpload = await self.uploadFile(rest.tempFilePath, 0);
  986. resolve();
  987. }
  988. });
  989. } else {
  990. console.log('无需压缩');
  991. const waitUpload = await self.uploadFile(self.avatarUrl, 0);
  992. resolve();
  993. }
  994. }
  995. });
  996. });
  997. },
  998. timeEvent() {
  999. let self = this;
  1000. var polyvPlayerContext = this.selectComponent('#playerVideo');
  1001. if (polyvPlayerContext != null) {
  1002. this.playTime = polyvPlayerContext.getCurrentTime() //播放时刻
  1003. //判断是否需要拍照
  1004. if (this.photoNum > 0) {
  1005. this.configPhoto()
  1006. if(this.photoIndex<this.photoList.length){
  1007. let photoTime = Number(this.photoList[this.photoIndex]); //获取拍照秒数
  1008. let nextIndex = this.photoIndex+1
  1009. let nextTime = 0
  1010. if(nextIndex<this.photoList.length){
  1011. nextTime = Number(this.photoList[nextIndex]); //获取下次拍照秒数
  1012. }
  1013. if (photoTime < this.playTime) {
  1014. if(this.photoHistoryList.indexOf(this.photoIndex)<0){ //不存在拍照历史则拍照
  1015. //启动拍照
  1016. //暂停
  1017. polyvPlayerContext.exitFullScreen();
  1018. polyvPlayerContext.pause();
  1019. this.photoIndex++;
  1020. this.openPhoto();
  1021. }
  1022. }
  1023. }
  1024. }
  1025. }
  1026. },
  1027. onStateChange(newstate, oldstate) {
  1028. if (newstate.detail.newstate == 'playing') {
  1029. if (this.needSeek) {
  1030. var polyvPlayerContext = this.selectComponent('#playerVideo');
  1031. polyvPlayerContext.seek(this.recordObj.studyDuration);
  1032. polyvPlayerContext.play();
  1033. this.needSeek = false;
  1034. }
  1035. //开始播放
  1036. if (this.timer) {
  1037. clearInterval(this.timer);
  1038. }
  1039. this.timer = setInterval(this.timeEvent, 1000); //定时器
  1040. }
  1041. if (newstate.detail.newstate == 'pause') {
  1042. //暂停提交记录
  1043. /* this.ossAvatarUrl = ""
  1044. this.postStudyRecord() */
  1045. }
  1046. if (newstate.detail.newstate == 'ended') {
  1047. this.postStudyRecord(1);
  1048. }
  1049. },
  1050. //拍照
  1051. openPhoto() {
  1052. this.photoPopup = true;
  1053. uni.authorize({
  1054. scope: 'scope.camera',
  1055. success() {
  1056. }
  1057. })
  1058. },
  1059. async submit() {
  1060. const waitYS = await this.imageInfos();
  1061. this.postCoursePhotoRecord()
  1062. this.postStudyRecord(); //提交记录
  1063. //恢复播放
  1064. var polyvPlayerContext = this.selectComponent('#playerVideo');
  1065. if (polyvPlayerContext != null) {
  1066. polyvPlayerContext.play();
  1067. }
  1068. },
  1069. //确认拍照
  1070. takePhoto() {
  1071. var self = this;
  1072. const ctx = uni.createCameraContext();
  1073. ctx.takePhoto({
  1074. quality: 'high',
  1075. success: res => {
  1076. console.log(res.tempImagePath);
  1077. self.avatarUrl = res.tempImagePath;
  1078. self.submit();
  1079. self.photoPopup = false;
  1080. },
  1081. fail: err => {
  1082. console.log(err);
  1083. }
  1084. });
  1085. },
  1086. //拍照报错
  1087. error(e) {
  1088. console.log(e.detail);
  1089. },
  1090. //关闭相机
  1091. closePhoto() {
  1092. this.photoPopup = false;
  1093. },
  1094. getGoodsDetail() {
  1095. let self = this;
  1096. this.$api.goodsDetail(this.goodsId).then(res => {
  1097. self.goodsData = res.data.data;
  1098. self.gradeId = self.goodsData.gradeId;
  1099. console.log(self.gradeId, "班级ID");
  1100. this.courseHandouts();
  1101. self.getMenuList();
  1102. self.getReMenuList(); //获取重修目录
  1103. setTimeout(function(){
  1104. if(!self.needProfileModal){
  1105. self.getGradeInfo()
  1106. }
  1107. },500)
  1108. //获取节笔记
  1109. this.getNoteList();
  1110. if (self.goodsData.goodsPlayConfig) {
  1111. self.goodsPlayConfig = JSON.parse(self.goodsData.goodsPlayConfig);
  1112. if (self.goodsPlayConfig.autoPlay > 0) {
  1113. self.autoplay = true;
  1114. }
  1115. if (self.goodsPlayConfig.drag > 0) {
  1116. self.isAllowSeek = 'yes';
  1117. }
  1118. if (self.goodsPlayConfig.speed > 0) {
  1119. self.playbackRate = [0.5, 0.8, 1.0, 1.25, 1.5, 2.0];
  1120. }
  1121. }
  1122. if (self.goodsData.goodsPhotographConfig) {
  1123. self.goodsPhotographConfig = JSON.parse(self.goodsData.goodsPhotographConfig);
  1124. if (self.goodsPhotographConfig.photoNum>0) {
  1125. self.photoNum = self.goodsPhotographConfig.photoNum
  1126. console.log(self.photoNum,777777)
  1127. }
  1128. }
  1129. });
  1130. },
  1131. startVideo() {
  1132. this.startStatus = true;
  1133. },
  1134. getAnswerList() {
  1135. let self = this;
  1136. this.$api.answerList({ courseId: this.courseId,goodsId: this.goodsId }).then(res => {
  1137. if (res.data.code == 200) {
  1138. self.answerList = res.data.rows;
  1139. }
  1140. });
  1141. },
  1142. getReMenuList() {
  1143. let self = this;
  1144. this.$api.reMenuList({ courseId: this.courseId, rebuild: 1, gradeId: this.gradeId }).then(res => {
  1145. if (res.data.code == 200) {
  1146. for (let i = 0; i < res.data.rows.length; i++) {
  1147. let item = res.data.rows[i];
  1148. item.down = true;
  1149. item.id = item.menuId;
  1150. item.name = item.menuName;
  1151. }
  1152. self.reMenuList = res.data.rows;
  1153. if(self.reMenuList.length>0){
  1154. self.list = [
  1155. {
  1156. name: '目录'
  1157. },
  1158. {
  1159. name: '讲义'
  1160. },
  1161. {
  1162. name: '笔记'
  1163. },
  1164. {
  1165. name: '答疑'
  1166. },
  1167. {name:'重修目录'}
  1168. ];
  1169. this.current = 0;
  1170. } else {
  1171. self.list = [
  1172. {
  1173. name: '目录'
  1174. },
  1175. {
  1176. name: '讲义'
  1177. },
  1178. {
  1179. name: '笔记'
  1180. },
  1181. {
  1182. name: '答疑'
  1183. }
  1184. ];
  1185. this.current = 0;
  1186. }
  1187. }
  1188. });
  1189. },
  1190. getMenuList() {
  1191. let self = this;
  1192. this.$api.reMenuList({ courseId: this.courseId, gradeId: this.gradeId }).then(res => {
  1193. if (res.data.code == 200) {
  1194. for (let i = 0; i < res.data.rows.length; i++) {
  1195. let item = res.data.rows[i];
  1196. item.down = true;
  1197. item.id = item.menuId;
  1198. item.name = item.menuName;
  1199. }
  1200. self.menuList = res.data.rows;
  1201. }
  1202. });
  1203. },
  1204. courseDetail() {
  1205. let self = this;
  1206. this.$api.courseDetail(this.courseId).then(res => {
  1207. if (res.data.code == 200) {
  1208. self.detail = res.data.data;
  1209. uni.setNavigationBarTitle({
  1210. title:self.detail.courseName
  1211. })
  1212. }
  1213. });
  1214. },
  1215. open(item) {
  1216. item.showChildren = !item.showChildren;
  1217. },
  1218. change(index) {
  1219. this.current = index;
  1220. },
  1221. openDocument() {
  1222. let self = this;
  1223. // console.log(this.$method.splitImgHost(this.courseHandoutsData.handoutsUrl))
  1224. uni.downloadFile({
  1225. url: this.$method.splitImgHost(this.courseHandoutsData.handoutsUrl),
  1226. success: function (res) {
  1227. console.log(999)
  1228. var filePath = res.tempFilePath;
  1229. uni.openDocument({
  1230. filePath: filePath,
  1231. showMenu: self.courseHandoutsData.canDownload == 1 ? true : false,
  1232. success: function (res) {
  1233. console.log(res,'打开文档成功');
  1234. },
  1235. fail:function(err) {
  1236. uni.showToast({
  1237. icon:'none',
  1238. title:'文档地址错误'
  1239. })
  1240. }
  1241. });
  1242. }
  1243. });
  1244. }
  1245. }
  1246. };
  1247. </script>
  1248. <style lang="scss" scope>
  1249. .btnSet{
  1250. width: 440rpx;
  1251. height: 80rpx;
  1252. background: #007AFF;
  1253. border-radius: 40rpx;
  1254. color: #FFFFFF;
  1255. font-size: 28rpx;
  1256. line-height: 80rpx;
  1257. }
  1258. .btnReply {
  1259. width: 80rpx;
  1260. height: 40rpx;
  1261. background: #e3f0ff;
  1262. border-radius: 16rpx;
  1263. text-align: center;
  1264. color: #007aff;
  1265. }
  1266. .btnDel {
  1267. width: 80rpx;
  1268. height: 40rpx;
  1269. background: #ffedf0;
  1270. border-radius: 16rpx;
  1271. text-align: center;
  1272. color: #ff2d55;
  1273. }
  1274. .btnReply {
  1275. width: 80rpx;
  1276. height: 40rpx;
  1277. background: #e3f0ff;
  1278. border-radius: 16rpx;
  1279. font-size: 24rpx;
  1280. }
  1281. .lecture-box {
  1282. display: flex;
  1283. align-items: center;
  1284. height: 80rpx;
  1285. background: #FFFFFF;
  1286. border-radius: 16rpx 16rpx 16rpx 16rpx;
  1287. .title {
  1288. padding:10rpx;
  1289. flex:1;
  1290. overflow: hidden;
  1291. text-overflow: ellipsis;
  1292. white-space: nowrap;
  1293. color:#333;
  1294. font-weight: bold;
  1295. font-size: 32rpx;
  1296. }
  1297. .btn {
  1298. display: flex;
  1299. align-items: center;
  1300. justify-content: center;
  1301. width:80rpx;
  1302. height:80rpx;
  1303. background: #FFFFFF;
  1304. box-shadow: -4rpx 0rpx 4rpx 0rpx rgba(0,0,0,0.1);
  1305. border-radius: 16rpx 16rpx 16rpx 16rpx;
  1306. }
  1307. }
  1308. .lecture-content {
  1309. background:#fff;
  1310. margin-top:10rpx;
  1311. padding:10rpx;
  1312. border-radius:16rpx;
  1313. }
  1314. .photoBox {
  1315. background-color: #FFFFFF;
  1316. border-radius: 32px 32px 0px 0px;
  1317. .photoTop {
  1318. height: 74upx;
  1319. display: flex;
  1320. align-items: center;
  1321. justify-content: space-between;
  1322. padding: 0upx 38upx;
  1323. .sqzz {
  1324. width: 28upx;
  1325. height: 28upx;
  1326. display: flex;
  1327. align-items: center;
  1328. justify-content: center;
  1329. }
  1330. .centersq {
  1331. color: #333;
  1332. font-size: 30upx;
  1333. font-weight: 500;
  1334. }
  1335. }
  1336. .photoCenter {
  1337. width: 750upx;
  1338. height: 979upx;
  1339. position: relative;
  1340. .custom {
  1341. width: 750upx;
  1342. height: 979upx;
  1343. position: absolute;
  1344. z-index: 1000;
  1345. top: 0;
  1346. left: 0;
  1347. image {
  1348. width: 100%;
  1349. height: 100%;
  1350. }
  1351. }
  1352. }
  1353. .btnResult {
  1354. height: 100rpx;
  1355. width: 100%;
  1356. background-color: #07c160;
  1357. text-align: center;
  1358. line-height: 100upx;
  1359. color: #fff;
  1360. font-size: 32upx;
  1361. font-weight: bold;
  1362. }
  1363. }
  1364. .chat_box {
  1365. display: flex;
  1366. padding: 20rpx;
  1367. justify-content: space-between;
  1368. }
  1369. .chat3 {
  1370. font-size: 30rpx;
  1371. font-family: PingFang SC;
  1372. font-weight: 500;
  1373. color: #666666;
  1374. margin-top: 10rpx;
  1375. }
  1376. .chat2 {
  1377. font-size: 20rpx;
  1378. font-family: PingFang SC;
  1379. font-weight: 500;
  1380. color: #999999;
  1381. margin-top: 10rpx;
  1382. }
  1383. .chat1 {
  1384. font-size: 24rpx;
  1385. font-family: PingFang SC;
  1386. font-weight: 500;
  1387. color: #333333;
  1388. }
  1389. .leftPadding {
  1390. margin-left: 8rpx;
  1391. }
  1392. .t2Content {
  1393. font-size: 28rpx;
  1394. font-family: PingFang SC;
  1395. font-weight: bold;
  1396. color: #999999;
  1397. line-height: 48rpx;
  1398. }
  1399. .tBox2 {
  1400. display: flex;
  1401. padding-top: 10rpx;
  1402. color: #333333;
  1403. font-size: 30rpx;
  1404. }
  1405. .tBox {
  1406. display: flex;
  1407. align-items: center;
  1408. padding-top: 10rpx;
  1409. }
  1410. .title {
  1411. font-size: 24rpx;
  1412. color: #999999;
  1413. }
  1414. page {
  1415. padding-top: 10px;
  1416. padding-top: constant(safe-area-inset-top);
  1417. padding-top: env(safe-area-inset-top);
  1418. }
  1419. .inputBottom {
  1420. position: fixed;
  1421. left: 0;
  1422. bottom: 0;
  1423. background: #ffffff;
  1424. height: 98rpx;
  1425. display: flex;
  1426. align-items: center;
  1427. width: 100%;
  1428. .flex_auto {
  1429. flex:1;
  1430. margin-left: 10% ;
  1431. .input {
  1432. height:60rpx;
  1433. }
  1434. }
  1435. .btn {
  1436. color: #007AFF;font-size: 30rpx;font-weight: bold;width: 15%;text-align: center;
  1437. }
  1438. }
  1439. .noteBox {
  1440. width: 100%;
  1441. background: #ffffff;
  1442. padding: 10rpx;
  1443. border-radius: 16rpx;
  1444. }
  1445. .dateBox {
  1446. width: 216rpx;
  1447. height: 48rpx;
  1448. background: #ffffff;
  1449. border-radius: 24rpx;
  1450. font-size: 24rpx;
  1451. color: #666666;
  1452. text-align: center;
  1453. line-height: 48rpx;
  1454. margin: 20rpx 0;
  1455. }
  1456. .t_content1 {
  1457. color: #007aff;
  1458. margin-left: 10rpx;
  1459. }
  1460. .tag1 {
  1461. border: 2rpx solid #007aff;
  1462. border-radius: 8rpx;
  1463. font-size: 20rpx;
  1464. color: #007aff;
  1465. padding: 5rpx;
  1466. }
  1467. .b_title {
  1468. color: #333333;
  1469. font-size: 30rpx;
  1470. font-weight: bold;
  1471. }
  1472. page {
  1473. background: #eaeef1;
  1474. }
  1475. .menuBox {
  1476. width: 100%;
  1477. background: #ffffff;
  1478. border-radius: 16rpx;
  1479. padding: 20rpx;
  1480. margin-bottom: 20rpx;
  1481. }
  1482. .btnspric {
  1483. border-top: 1rpx solid #eee;
  1484. display: flex;
  1485. align-items: center;
  1486. justify-content: space-between;
  1487. height: 108rpx;
  1488. padding-left: 43rpx;
  1489. padding-right: 32rpx;
  1490. }
  1491. .btnspric > .lefprL {
  1492. font-size: 36rpx;
  1493. color: #0c141f;
  1494. font-weight: bold;
  1495. }
  1496. .btnspric > .lefprR {
  1497. padding: 0rpx 24rpx;
  1498. height: 60rpx;
  1499. line-height: 60rpx;
  1500. text-align: center;
  1501. color: #fff;
  1502. background: #32467b;
  1503. border-radius: 24rpx;
  1504. box-shadow: 0rpx 0rpx 16rpx 4rpx rgba(145, 156, 178, 0.1);
  1505. }
  1506. .yhj,
  1507. .hdyhj {
  1508. padding: 24rpx 29rpx 24rpx 34rpx;
  1509. }
  1510. .yhj {
  1511. border-bottom: 16rpx solid #f9f9f9;
  1512. }
  1513. .yhjtit {
  1514. font-size: 30rpx;
  1515. color: #0c141f;
  1516. font-weight: 500;
  1517. margin-bottom: 14rpx;
  1518. }
  1519. .yhjList {
  1520. display: flex;
  1521. align-items: center;
  1522. justify-content: space-between;
  1523. margin-bottom: 14rpx;
  1524. }
  1525. .yhjList > .yhjLefts {
  1526. display: flex;
  1527. align-items: center;
  1528. }
  1529. .yhjLefts > .yhl {
  1530. color: #32467b;
  1531. font-size: 30rpx;
  1532. margin-right: 31rpx;
  1533. }
  1534. .yhjLefts > .yhbq {
  1535. font-size: 24rpx;
  1536. color: #ff9500;
  1537. border-radius: 18rpx;
  1538. background-color: rgba(255, 149, 0, 0.2);
  1539. border: 2rpx solid #ff9500;
  1540. height: 38rpx;
  1541. line-height: 38rpx;
  1542. padding: 0rpx 16rpx;
  1543. }
  1544. .ts {
  1545. font-size: 24rpx;
  1546. color: #999;
  1547. margin: 14rpx 0rpx;
  1548. padding-right: 29rpx;
  1549. padding-left: 34rpx;
  1550. }
  1551. .yh {
  1552. padding-top: 20rpx;
  1553. }
  1554. .yh > .yhtitle {
  1555. display: flex;
  1556. align-items: center;
  1557. justify-content: space-between;
  1558. padding-right: 29rpx;
  1559. padding-left: 34rpx;
  1560. }
  1561. .priceBxs {
  1562. display: flex;
  1563. align-items: center;
  1564. }
  1565. .priceBxs > .pricleft {
  1566. border-radius: 24rpx;
  1567. border: 1rpx solid #e91313;
  1568. background-color: rgba(233, 19, 19, 0.1);
  1569. padding: 0rpx 18rpx;
  1570. height: 49rpx;
  1571. line-height: 49rpx;
  1572. text-align: center;
  1573. font-size: 30rpx;
  1574. font-weight: 500;
  1575. color: #e91313;
  1576. margin-right: 13rpx;
  1577. }
  1578. .topBox {
  1579. padding: 32rpx 32rpx 24rpx;
  1580. border-bottom: 1rpx solid #eeeeee;
  1581. }
  1582. .topBox > .boldFonstType {
  1583. font-weight: 500;
  1584. font-size: 30rpx;
  1585. margin: 16rpx 0rpx 23rpx;
  1586. }
  1587. .topBox > .firstTopL {
  1588. display: flex;
  1589. align-items: center;
  1590. }
  1591. .topBox > .firstTopL > .imageBs {
  1592. width: 331rpx;
  1593. height: 160rpx;
  1594. border-radius: 6rpx;
  1595. overflow: hidden;
  1596. margin-right: 8rpx;
  1597. box-shadow: 0rpx 6rpx 6rpx 0rpx rgba(47, 67, 121, 0.08);
  1598. }
  1599. .topBox > .firstTopL > .imageBs > image {
  1600. width: 100%;
  1601. height: 100%;
  1602. }
  1603. .topBox > .firstTopL > .textBs {
  1604. font-size: 30rpx;
  1605. font-weight: bold;
  1606. color: #0c141f;
  1607. }
  1608. .content {
  1609. padding: 24rpx;
  1610. text-align: left;
  1611. }
  1612. .catalogBox {
  1613. display: flex;
  1614. align-items: center;
  1615. flex-wrap: nowrap;
  1616. overflow-x: auto;
  1617. padding-left: 38rpx;
  1618. max-height: 305rpx;
  1619. overflow-y: auto;
  1620. transition: all 0.4s;
  1621. }
  1622. .catalogBox > .catalogA {
  1623. min-width: 200rpx;
  1624. height: 48rpx;
  1625. line-height: 48rpx;
  1626. // text-align: center;
  1627. border: 2rpx solid transparent;
  1628. white-space: nowrap;
  1629. text-overflow: ellipsis;
  1630. overflow: hidden;
  1631. word-break: break-all;
  1632. border-radius: 10rpx;
  1633. background: rgba(22, 119, 255, 0.05);
  1634. padding-left: 19rpx;
  1635. box-sizing: border-box;
  1636. padding-right: 15rpx;
  1637. margin-right: 16rpx;
  1638. margin-bottom: 20rpx;
  1639. margin-top: 15rpx;
  1640. font-size: 24rpx;
  1641. color: #666;
  1642. }
  1643. .catalogBox > .activesq {
  1644. border-color: #1677ff;
  1645. }
  1646. .changeCatalogBox {
  1647. display: block;
  1648. }
  1649. .catalogBox::-webkit-scrollbar {
  1650. display: none; /* Chrome Safari */
  1651. }
  1652. .box {
  1653. position: relative;
  1654. top: 650rpx;
  1655. padding-bottom: 88rpx;
  1656. margin: 20rpx;
  1657. }
  1658. .price_t2 {
  1659. font-size: 18rpx;
  1660. font-family: PingFang SC;
  1661. font-weight: 500;
  1662. text-decoration: line-through;
  1663. color: #999999;
  1664. }
  1665. .price_t1 {
  1666. font-size: 33rpx;
  1667. font-family: PingFang SC;
  1668. font-weight: bold;
  1669. color: #e91313;
  1670. }
  1671. .sc_t {
  1672. font-size: 22rpx;
  1673. color: #000000;
  1674. }
  1675. .sc {
  1676. width: 29rpx;
  1677. height: 29rpx;
  1678. }
  1679. .buy {
  1680. width: 138rpx;
  1681. height: 48rpx;
  1682. line-height: 48rpx;
  1683. background: #32467b;
  1684. border-radius: 10rpx;
  1685. color: #ffffff;
  1686. font-size: 28rpx;
  1687. text-align: center;
  1688. vertical-align: middle;
  1689. position: absolute;
  1690. right: 30rpx;
  1691. }
  1692. .video_body {
  1693. padding-bottom: 96rpx;
  1694. }
  1695. .footer_tab {
  1696. position: fixed;
  1697. bottom: 0;
  1698. height: 96rpx;
  1699. width: 100%;
  1700. background-color: #ffffff;
  1701. }
  1702. .tj_box {
  1703. width: 50%;
  1704. display: inline-block;
  1705. text-align: center;
  1706. margin: 10rpx 0;
  1707. }
  1708. .teacher_t {
  1709. font-size: 24rpx;
  1710. font-family: PingFang SC;
  1711. font-weight: 400;
  1712. color: #666666;
  1713. line-height: 36rpx;
  1714. margin-left: 15rpx;
  1715. }
  1716. .teacher_img {
  1717. width: 87rpx;
  1718. height: 129rpx;
  1719. }
  1720. .t2 {
  1721. font-size: 24rpx;
  1722. font-family: PingFang SC;
  1723. color: #666666;
  1724. line-height: 36rpx;
  1725. margin: 15rpx;
  1726. }
  1727. .r_t2 {
  1728. width: 201rpx;
  1729. height: 49rpx;
  1730. background: rgba(22, 119, 255, 0.05);
  1731. border: 1rpx solid #32467b;
  1732. border-radius: 16rpx;
  1733. color: #666666;
  1734. font-size: 23rpx;
  1735. text-align: center;
  1736. display: flex;
  1737. align-items: center;
  1738. padding: 5rpx;
  1739. }
  1740. .scroll_box {
  1741. width: 100%;
  1742. height: 60rpx;
  1743. background: #ffffff;
  1744. box-shadow: 0rpx 0rpx 16rpx 4rpx rgba(145, 156, 178, 0.1);
  1745. white-space: nowrap;
  1746. overflow: hidden;
  1747. margin: 15rpx 0;
  1748. }
  1749. .r_sliper {
  1750. padding: 0 20rpx;
  1751. }
  1752. .top_line {
  1753. width: 6rpx;
  1754. height: 22rpx;
  1755. background: #32467b;
  1756. margin-right: 10rpx;
  1757. }
  1758. .video_t2 {
  1759. font-size: 24rpx;
  1760. font-family: PingFang SC;
  1761. font-weight: 500;
  1762. color: #666666;
  1763. }
  1764. .video_t1 {
  1765. height: 80rpx;
  1766. color: #333333;
  1767. line-height: 80rpx;
  1768. font-size: 30rpx;
  1769. font-family: PingFang SC;
  1770. font-weight: bold;
  1771. color: #333333;
  1772. overflow: hidden;
  1773. text-overflow: ellipsis;
  1774. white-space: nowrap;
  1775. }
  1776. .video_t1_t {
  1777. display: flex;
  1778. flex-direction: column;
  1779. height: 80rpx;
  1780. color: #333333;
  1781. text-align: center;
  1782. align-items: center;
  1783. border-left: solid 1px #d6d6db;
  1784. }
  1785. .video_play {
  1786. position: absolute;
  1787. width: 95rpx;
  1788. height: 95rpx;
  1789. top: 0;
  1790. left: 0;
  1791. right: 0;
  1792. bottom: 0;
  1793. margin: auto;
  1794. }
  1795. .video_box {
  1796. position: relative;
  1797. }
  1798. .rotoct {
  1799. transform: rotate(90deg);
  1800. }
  1801. </style>