detail.vue 48 KB

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