detail.vue 46 KB

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