detail.vue 46 KB

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