detail.vue 49 KB

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