detail.vue 48 KB

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