detail.vue 48 KB

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