detail.vue 48 KB

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