detail.vue 47 KB

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