info1.vue 44 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529
  1. <template>
  2. <!-- <page-meta :page-font-size="`${this.$store.getters.scaleFontSize}px`" :root-font-size="`${this.$store.getters.scaleFontSize}px`"></page-meta>
  3. -->
  4. <view class="es-view-w-x">
  5. <!-- #ifdef APP-PLUS -->
  6. <es-nav-title title="课程详情" mode="cover"></es-nav-title>
  7. <!-- #endif -->
  8. <view class="video es-mt-20">
  9. <video @tap="toggleBarChange" ref="myVideo" id="myVideo" :src="pickCatalog.videoUrl"
  10. @error="videoErrorCallback" :enable-progress-gesture="data.isFast==1" :enable-danmu="false" :danmu-btn="false" :danmu-list="danmuList" :initial-time="studyTimes"
  11. @play="onPlayVideo" @pause="onPauseVideo" :poster="poster" objectFit="contain" :show-progress="data.isFast==1" :title="pickCatalog.courseName" :controls="true" :show-fullscreen-btn="true" @controlstoggle="toggleBarChange"
  12. @timeupdate="onTimeUpdate" @fullscreenchange="onFullscreenChange" @waiting="onWaiting()" @progress="onProgress()" @ended="endedPlayNext()" @canplay="onVideoCanPlay" @canplaythrough="onVideoCanPlayThrough"
  13. @loadeddata="onLoadeddata" @loadedmetadata="onLoadedMetadata" >
  14. </video>
  15. <!-- #ifdef APP-PLUS -->
  16. <cover-image src="/static/images/other/yuan-1.png" class="video-1"></cover-image>
  17. <cover-image src="/static/images/other/yuan-2.png" class="video-2"></cover-image>
  18. <cover-image src="/static/images/other/yuan-3.png" class="video-3"></cover-image>
  19. <cover-image src="/static/images/other/yuan-4.png" class="video-4"></cover-image>
  20. <!-- #endif -->
  21. </view>
  22. <view class="es es-ac es-mt-20">
  23. <view class="es-icon-70 es-br">
  24. <image mode="aspectFill" :src="data.talentAvatar"></image>
  25. </view>
  26. <view class="es-f1 es-fw-600 es-fs-28 es-ml-10">
  27. {{data.courseName}}
  28. </view>
  29. <view class="es-w-111 es-h-46 es-br-10 es es-ac es-pc es-fs-24" @tap="doFollow()" :class="isFollow?'es-btn-ygz':'es-bc'">
  30. <!-- <view style="line-height: 1em;margin-bottom: 4rpx;">+</view> -->
  31. <view :class="isFollow?'':'es-icon-26 es-icon-add'" style="margin-right: -5rpx;"></view>
  32. <view>{{isFollow?"已关注":"关注"}}</view>
  33. </view>
  34. </view>
  35. <!-- 音频播放 -->
  36. <view class="es-mt-11 es-bc-f9 es-br-10 es-pl-26 es-pr-26 es-h-67 es es-ac es-mt-10 es-c-66 es-fs-24 es-fw-500">
  37. <view class="es-icon-39 es-brc es-br es es-ac es-pc" @tap="playAudioAction()">
  38. <view class="es-icon es-w-16 es-h-19 " :class="!audioPlayIng?'es-icon-course-play':'es-icon-course-pause'" ></view>
  39. </view>
  40. <view class="es-ml-16">{{playTime}}</view>
  41. <view class="slider-box es-p-r load-con es-h-40 es-ml-32 es-mr-28">
  42. <u-slider :disabled="data.isFast==0" @change="audioChange" @changing="audioChanging" @input="input" blockSize="22" activeColor="#fff" blockStyle="white-bloack" inactiveColor="#AAAAAA" v-model="video.percent" min="0" max="100"></u-slider>
  43. </view>
  44. <view class="es-mr-16">{{ $formatSeconds(pickCatalog.seconds) }}</view>
  45. <view class="es-icon es-w-30 es-h-22 es-icon-course-play-menu"></view>
  46. </view>
  47. <!-- 简介 -->
  48. <view class="es es-ac es-c-66 es-mt-22">
  49. <view class="es-icon-27 es-icon-course-play_icon"></view>
  50. <view class="es-fs-24 es-fw-500 es-ml-13">{{data.views}}</view>
  51. <view class="es-icon-27 es-icon-course-time_icon es-ml-20"></view>
  52. <view class="es-fs-24 es-fw-500 es-ml-13">{{data.totalDuration}}</view>
  53. <view class="es-f1"></view>
  54. <view class="es-fs-24 es es-ac" @tap="goToIntroduce">
  55. <text>简介</text>
  56. <view class="es-icon-ret-right"></view>
  57. </view>
  58. </view>
  59. <view class="es-mt-24 es-fw-500 es-fs-28 more-t">
  60. {{data.description}}
  61. </view>
  62. <!-- 笔记/收藏 -->
  63. <view class="es es-pt-40 es-pb-40 es-fs-26 es-fw-500 es-c-66">
  64. <view class="es es-ver es-ac es-pc es-wp-25" @tap="$navTo('./note?courseId='+courseId)">
  65. <view class="es-icon-70 es-br es-bc-e6 es es-ac es-pc">
  66. <view class="es-w-36 es-h-40 es-icon es-icon-course-note"></view>
  67. </view>
  68. <view class="es-mt-8" >笔记·{{data.noteNum}}</view>
  69. </view>
  70. <view class="es es-ver es-ac es-pc es-wp-25" @tap="doFavorite()">
  71. <view class="es-icon-70 es-br es es-ac es-pc" :class="isFavorite?'es-bc-theme':'es-bc-e6'" >
  72. <view class="es-w-40 es-h-40 es-icon es-icon-course-collect"></view>
  73. </view>
  74. <view class="es-mt-8">{{isFavorite?"已收藏":"收藏"}}</view>
  75. </view>
  76. <view class="es es-ver es-ac es-pc es-wp-25" @tap="doLike()">
  77. <view class="es-icon-70 es-br es es-ac es-pc" :class="isLike?'es-bc-theme':'es-bc-e6'" >
  78. <view class="es-w-33 es-h-32 es-icon es-icon-course-like"></view>
  79. </view>
  80. <view class="es-mt-8">{{isLike?"喜欢":"喜欢"}}</view>
  81. </view>
  82. <view class="es es-ver es-ac es-pc es-wp-25" @tap="openShare()">
  83. <view class="es-icon-70 es-br es-bc-e6 es es-ac es-pc">
  84. <view class="es-w-38 es-h-37 es-icon es-icon-course-share"></view>
  85. </view>
  86. <view class="es-mt-8">分享</view>
  87. </view>
  88. </view>
  89. <!-- 目录 -->
  90. <view class="catalogue">
  91. <view class="es es-ac" >
  92. <view class="es-f1 es-fw-600 es-fs-30">目录</view>
  93. <view class="es-c-66 es-fs-26 es es-ac" @tap="goToCatalogue()">共<text class="es-c">{{catalogueList.length}}</text>节<view class="es-icon-ret-right"></view></view>
  94. </view>
  95. <scroll-view style="display: flex;white-space: nowrap;overflow-x: scroll;" class="es es-fs-24 es-fw-600 es es-center es-pt-20 es-pb-20" scroll-x="true" :scroll-into-view="scrollIntoViewId" >
  96. <view :id="'cataLogue'+index" v-for="(item, index) in catalogueList" :key="index" @click="pickCatalogAction(index)" class="catalogue-item" :class="index==pickCatalogIdx?'ac':''" >
  97. <view class="es-ml-29 es-mr-29 es es-pc es-center es-ver">
  98. <view class="es es-ac es-mt-12">
  99. <view class="" style="max-width: 6em;">第{{index+1}}讲</view>
  100. <view class="es-ml-23 es-icon es-w-30 es-h-28"></view>
  101. </view>
  102. <view class="es-omit es-mb-12">{{item.title}}</view>
  103. <view class="vip" v-if="index>1 && canShowVip(item)">VIP</view>
  104. </view>
  105. </view>
  106. </scroll-view>
  107. </view>
  108. <!-- 评论 -->
  109. <view class="comment">
  110. <view class="es-bc-f8 es-br-10 es-mt-15 es-view-w-x es-pt-28 es-pb-10">
  111. <view class="es es-ac " >
  112. <view class="es-f1 es-fw-600 es-fs-30">评论</view>
  113. <view class="es-c-66 es-fs-26 es es-ac" @tap="doCommentAction()">共{{data.commentNum}}条 <view class="es-icon-ret-right"></view></view>
  114. </view>
  115. <swiper class="carousel" :vertical="true" circular :autoplay="true" interval="5000" duration="2000">
  116. <swiper-item v-for="(item, index) in data.commentList" :key="index" class="carousel-item">
  117. <view class="es es-ac">
  118. <!-- <view class="es-f1"></view> -->
  119. <view class="es-icon-48 es-br es-mt-20">
  120. <image :src="item.avatar?item.avatar:''"></image>
  121. </view>
  122. <view class="es-ml-21 es-mr-37 es-fs-28 es-fw-500 es-omit" style="max-width: 12em;">{{item.nickName}}</view>
  123. </view>
  124. <view class="es-fs-26 es-pt-16 es-pb-16">{{item.content}}</view>
  125. <view class="es-fs-24 es-c-99">{{ $formatDate(item.createTime) }}</view>
  126. </swiper-item>
  127. </swiper>
  128. </view>
  129. </view>
  130. <!-- 猜你喜欢 -->
  131. <view class="es es-ac es-mt-24">
  132. <view class="es-f1 es-fw-600 es-fs-30">猜你喜欢</view>
  133. <view class="es-c-66 es-fs-28 es es-ac" > <view class="es-icon-ret-right"></view></view>
  134. </view>
  135. <view class="es-mt-4 con es-center" :style="{ marginBottom:(isH5?145:20)+'px'}">
  136. <block v-for="(item, index) in dataList" :key="index">
  137. <es-course-item @tap.native="goToInfo(item)" :data="item"></es-course-item>
  138. </block>
  139. </view>
  140. <!-- h5下载 -->
  141. <view class="es-c es-share-bg-box" v-if="false">
  142. <image class="image x-c" src="/static/images/other/bg_bar.png"></image>
  143. <view class="es-bc-white es-h-100" style="width: 100%;line-height: 100rpx;">下载中康未来App,查看更多内容↓</view>
  144. <view class="line flex es-h-1 es-bc-fa"></view>
  145. <view class="es-h-120 es-bc-white x-bc es-pl-20 es-pr-20 es-pb-20">
  146. <view class="left x-f">
  147. <image class="es-w-100 es-h-100 es-mr-20" src="../../static/logo.png"></image>
  148. <view class="y-b">
  149. <view class="es-fs-30 es-fw-bold es-c-33 es-mb-10 x-f">中康未来</view>
  150. <view class="es-fs-26 es-fw-n es-c-33">古籍·中药·方剂大全</view>
  151. </view>
  152. </view>
  153. <view class="es-br-20 es-h-80 es-w-250 es-bc es es-pc es-ac es-fw-bold es-fs-30" @tap="openApp()">
  154. <view class="es-ml-30 es-mr-30 es-h-50">App内打开</view>
  155. </view>
  156. </view>
  157. </view>
  158. <!-- 分享弹窗 -->
  159. <u-popup :show="showShare" @close="showShare = false" >
  160. <share-box :shareItem="shareItem" @closeShare='showShare = false' ></share-box>
  161. </u-popup>
  162. <!-- VIP特权弹窗 -->
  163. <uni-popup ref="popPrivilege" type="bottom" borderRadius="10rpx 10rpx 0px 0px">
  164. <view class="privilegeBox es es-ver es-br-38 es-pt-30 es-pb-30 ">
  165. <view class="es es-fx es-pc es-h-56 es-ml-48 es-mr-48">
  166. <image class="es-w-74 es-h-40" style="position: absolute;left:60rpx;top:0" src="../../static/image/course/xiangyun.png"></image>
  167. <view class="es-fs-40 es-h-56 es-fw-500" style="color: #FFDAA3;">开通VIP专享以下特权</view>
  168. <image class="es-w-74 es-h-40" style="position: absolute;right:60rpx;top:0" src="../../static/image/course/xiangyun2.png"></image>
  169. <image class="es-w-40 es-h-40" style="position: absolute;right:-20rpx;top:-10rpx" @tap="closePrivilege" src="/static/images/close40.png"></image>
  170. </view>
  171. <view class="sec1 es-mt-20 es-ml-48 es-mr-48">
  172. <view class="es x-bc es-pl-28 es-pt-12">
  173. <view class="l1">
  174. <view class="x-f">
  175. <image class="es-w-44 es-h-44" src="../../static/image/course/privilege/fozhu.png"></image>
  176. <view class="es-ml-8 es-c-white es-fs-32 es-fw-600">名家讲堂</view>
  177. </view>
  178. <view class="es-fs-30 es-mt-10 es-c-99">畅享10000+VIP视频</view>
  179. </view>
  180. <view class="es">
  181. <image src="../../static/image/course/zyx.png" class="es-w-183 es-h-98 es-br-15"></image>
  182. <!-- <view class="es-fs-20 es-br-8 es-w-80 es-h-30 es-fw-bold x-c" style="position:absolute; right: 0;top:10rpx;background: #000;opacity: 0.7;color: #FFDAA3;">10000+</view> -->
  183. </view>
  184. </view>
  185. </view>
  186. <view class="sec2 es es-fx es-pc es-h-56 es-mt-40 es-ml-48 es-mr-48">
  187. <!-- <image class="es-w-148 es-h-3" style="position: absolute;left:0;top:16rpx" src="../../static/image/course/privilege/line1.png"></image> -->
  188. <view class="es-fs-30 es-h-56 es-fw-bold" style="color: #FFDAA3;">超多权益待你开启</view>
  189. <!-- <image class="es-w-148 es-h-3" style="position: absolute;right:0;top:16rpx" src="../../static/image/course/privilege/line2.png"></image> -->
  190. </view>
  191. <view class="primenu-box es es-fx es-pc es-mt-20 es-ml-48 es-mr-48">
  192. <view class="content-inner">
  193. <view class="item">
  194. <image class="img" src="/static/image/course/privilege/she.png" mode="heightFix"></image>
  195. <text class="label">AI舌诊</text>
  196. </view>
  197. <view class="item">
  198. <image class="img jlxw" src="/static/image/course/privilege/tizhi.png" mode="heightFix"></image>
  199. <text class="label">体质检测</text>
  200. </view>
  201. <view class="item" >
  202. <image class="img" src="/static/image/course/privilege/baike.png" mode="heightFix"></image>
  203. <text class="label">养生百科</text>
  204. </view>
  205. <view class="item">
  206. <image class="img" src="/static/image/course/privilege/yishu.png" mode="heightFix"></image>
  207. <text class="label">经典医书</text>
  208. </view>
  209. <view class="item">
  210. <image class="img" src="/static/image/course/privilege/more.png" mode="heightFix"></image>
  211. <text class="label">多设备登陆</text>
  212. </view>
  213. <view class="item">
  214. <image class="img" src="/static/image/course/privilege/ad.png" mode="heightFix"></image>
  215. <text class="label">去除广告</text>
  216. </view>
  217. </view>
  218. </view>
  219. <view class="es-ml-48 es-mr-48 es-mt-10 es-pt-10 es-pb-10 es-br-5" style="background:#2a2f32">
  220. <view v-for="(item, index) in vipMethods" :key="index" @tap="changeVipMethod(index)" class="vipMethodItem es x-bc">
  221. <view class="x-bc es-ml-14">
  222. <view class="es-fs-32 es-fw-500 es-ml-14">{{item}}</view>
  223. </view>
  224. <image v-if="vipMethodIdx==index" class="es-w-40 es-h-40 es-br-ban es-mr-14 es-mr-26" src="../../static/image/course/vipBuy/check.png"></image>
  225. <view v-else class="es-w-40 es-h-40 es-br-ban es-mr-14 es-mr-26 circle"></view>
  226. </view>
  227. </view>
  228. <view v-if="isShowPayType" class="es-ml-48 es-mr-48 es-mt-40 x-bc" style="background:#2a2f32">
  229. <view v-for="(item, index) in payTypes" :key="index" @tap="changePayType(index)" class="payTypeItem es x-bc " :class="payType==index+1?'pt_ac':''">
  230. <view class="x-bc es-ml-14">
  231. <image class="es-w-59 es-h-52" :src="index==0?'../../static/image/course/vipBuy/wx.png':'../../static/image/course/vipBuy/zfb.png'"></image>
  232. <view class="es-fs-33 es-c-white es-fw-500 es-ml-14">{{item}}</view>
  233. </view>
  234. <image v-if="payType==index+1" src="../../static/image/course/vipBuy/check.png" class="es-w-40 es-h-40 es-br-ban es-mr-14"></image>
  235. <view v-else class="es-w-40 es-h-40 es-br-ban es-mr-14 circle"></view>
  236. </view>
  237. </view>
  238. <view class="es es-mt-40 es-ml-48 es-mr-48 x-c">
  239. <view @tap="doBuy()" class="es-h-94 x-c es-fw-700 es-fs-34 vipCourseBtn vipAc es-br-46" style="width: 310rpx;">
  240. 立即购买
  241. </view>
  242. </view>
  243. </view>
  244. </uni-popup>
  245. <uni-popup ref="popTip" type="dialog">
  246. <uni-popup-dialog cancelText="支付失败" confirmText="支付成功" mode="base" content="是否已支付成功?" title="提示" :duration="2000" :before-close="true" @close="closeTip" @confirm="confirmTip"></uni-popup-dialog>
  247. </uni-popup>
  248. <!-- 评论弹窗 -->
  249. <popupBottom ref="mescrollItem" :visible.sync="specVisible" @close="closePop" :cmdId="courseId" :smsNum="data.commentNum" :title="data.commentNum+'条评论'" :type="1" radius="32" maxHeight="1200"></popupBottom>
  250. </view>
  251. </template>
  252. <script>
  253. import {getUserInfo} from '@/api/user'
  254. // import { formatSeconds,formatDate } from '@/utils/tools.js'
  255. import { getCourseById,getCourseList,getCourseVideoList,checkFavorite,checkFollow,checkLike,doFavorite,doFollow,doLike,addDuration,
  256. createCourseOrder,createIntegralOrder,createVipOrder,aliPayment,wxPayment } from '@/api/course'
  257. import popupBottom from '@/components/popupBottom/popupBottom.vue'
  258. import MescrollCompMixin from "@/uni_modules/mescroll-uni/components/mescroll-uni/mixins/mescroll-comp.js";
  259. export default {
  260. mixins: [MescrollCompMixin],
  261. components: {
  262. popupBottom
  263. },
  264. data() {
  265. return {
  266. videoContext: null,
  267. video: {
  268. percent: 10, //进度百分比
  269. },
  270. courseId:null,
  271. talentId:null,
  272. videoId:null,
  273. showShare:false,
  274. shareItem:{ imageUrl:"",title:"",path:""},
  275. scrollIntoViewId:"cataLogue0",
  276. isShare:false,
  277. user:null,
  278. data:{
  279. courseId:null,
  280. imgUrl:"",
  281. talentAvatar:"",
  282. price:"",
  283. remark:"",
  284. noteNum:0,
  285. courseName:"",
  286. description:"",
  287. cataIndex:0,
  288. isFast:false,
  289. isAutoPlay:false,
  290. commentList:[
  291. {avatar:"",content:"",createTime:"",nickName:""}
  292. ]
  293. },
  294. dataList:[],
  295. notes:[],
  296. catalogueList:[],
  297. pickCatalog:{videoUrl:"",thumbnail:"",duration:0,videoId:0,seconds:0},
  298. pickCatalogIdx:0,
  299. danmuList:[],
  300. isFavorite:0,
  301. isFollow:0,
  302. isLike:0,
  303. courseDuration:0,
  304. audioDuration:0,
  305. totalDuration:0,
  306. tempAudioDuration:0, //用于记录视频/音频播放切换时 播放的时间,达到无缝续播
  307. countdowning: false, // 是否正在倒计时
  308. isAudioChanging:false,//音频滑块是否在拖动,audioTimer倒计时是否暂停
  309. timer: null, // 定时器
  310. audioTimer:null,
  311. playTime:"00:00",
  312. scaleFontSize:18,
  313. studyTimes:0,
  314. audioContext: null,
  315. audioPlayIng:false,
  316. showFullScreenBtn:true,
  317. currentTime:null,
  318. isLearning:false,
  319. myVideo:null,
  320. showProgress:true,
  321. videoUrl:"https://1319721001.vod-qcloud.com/3525603bvodcq1319721001/2b3e76ac1253642698811158287/Hmod7JMfAowA.mp4",
  322. poster: "",
  323. studyLog:null,
  324. isPostBack:false,//页面是否已初次加载
  325. isWaiting:false, //视频出现缓冲
  326. specVisible: false,
  327. esComment:null,
  328. isH5:false,
  329. vipSelIndex:0,
  330. vipMethods:["开通会员"],
  331. vipMethodIdx:0,
  332. isShowPayType:false,
  333. payTypes:["微信支付","支付宝支付"],
  334. payType:1,//微信支付1 支付宝支付2
  335. createType:3,//1直接购买,2福币兑换 3开通会员
  336. orderId:null,
  337. order:null,
  338. showPayTips:false,
  339. }
  340. },
  341. onLoad(options) {
  342. this.courseId=options.courseId;
  343. if(options.isShare!=undefined){
  344. this.isShare=options.isShare;
  345. }
  346. if(options.videoId!=undefined){
  347. this.videoId=options.videoId;
  348. }
  349. if(options.isLearning!=undefined){
  350. this.isLearning=options.isLearning;
  351. }
  352. this.esComment=this.$refs["esComment"];
  353. let that=this;
  354. uni.$on('refreshTitle', (pingCount) => {
  355. that.data.commentNum=pingCount;
  356. });
  357. setTimeout(()=>{
  358. this.getCourseInfo();
  359. },200);
  360. if(this.$isLogin()){
  361. this.getUserInfo();
  362. this.checkFavorite();
  363. this.checkLike();
  364. }
  365. },
  366. onShow(){
  367. if(this.data.courseId!=null && !this.countdowning){
  368. console.log("qxj onShow startCountsTime");
  369. }
  370. //#ifdef H5
  371. this.isH5=true;
  372. //#endif
  373. //#ifdef APP-PLUS
  374. //plus.navigator.setFullscreen(false)
  375. //plus.screen.lockOrientation('portrait-primary');
  376. //#endif
  377. if(this.showPayTips){
  378. this.$refs.popTip.open();
  379. this.showPayTips=false;
  380. }
  381. },
  382. onHide() {
  383. this.pauseVideo();
  384. //this.$store.commit('setScaleFontSize',16);
  385. },
  386. onReady() {
  387. this.videoContext = uni.createVideoContext("myVideo", this);
  388. this.audioContext = uni.createInnerAudioContext();
  389. },
  390. methods: {
  391. getCourseInfo(){
  392. getCourseById(this.courseId).then(res => {
  393. if(res.code==200){
  394. this.data=res.data;
  395. this.dataList=res.data.courseList;
  396. this.talentId=res.data.talentId;
  397. this.studyLog=res.data.studyLog;
  398. if(this.studyLog!=null){
  399. this.videoId=this.studyLog.videoId;
  400. }
  401. this.vipMethods=["开通会员"];
  402. if(this.data.isIntegral==1){
  403. this.vipMethods.push("福币兑换")
  404. }
  405. if(this.data.sellPrice>0){
  406. this.vipMethods.push(this.data.sellPrice+"元购买");
  407. }
  408. this.getCourseVideoList();
  409. if(this.$isLogin()){
  410. this.checkFollow();
  411. }
  412. }
  413. },
  414. rej => {}
  415. );
  416. },
  417. getCourseList(){
  418. let that=this;
  419. const params={"cateId":this.data.cateId,"isTui":1};
  420. getCourseList(params).then(res => {
  421. if(res.code==200){
  422. this.dataList=res.data.list;
  423. }
  424. },
  425. rej => {}
  426. );
  427. },
  428. //课程目录
  429. getCourseVideoList(){
  430. let that=this;
  431. const params={"courseId":this.courseId};
  432. getCourseVideoList(params,1,30).then(res => {
  433. if(res.code==200){
  434. this.catalogueList=res.data.list;
  435. if(this.catalogueList.length>0){
  436. if(this.videoId!=null){
  437. this.pickCatalogIdx=this.getCatalogIdx();
  438. this.scrollIntoViewId="cataLogue"+this.pickCatalogIdx;
  439. this.pickCatalog=this.catalogueList[this.pickCatalogIdx];
  440. }else{
  441. this.pickCatalog=this.catalogueList[0];
  442. }
  443. if(this.pickCatalog.studyTime!=null){
  444. this.initStudyTime(this.pickCatalog.studyTime);
  445. }
  446. //开始播放计时
  447. if(this.data.isAutoPlay==1){
  448. this.pickCatalogMethod(this.pickCatalogIdx);
  449. this.startCountsTime();
  450. }
  451. this.poster=this.pickCatalog.thumbnail;
  452. this.audioContext.src = this.pickCatalog.videoUrl;
  453. this.video.percent=(this.audioDuration/this.pickCatalog.seconds*1.0).toFixed(2)*100;
  454. }
  455. }
  456. },
  457. rej => {}
  458. );
  459. },
  460. getUserInfo(){
  461. let that=this;
  462. getUserInfo().then(res => {
  463. if(res.code==200){
  464. if(res.user!=null){
  465. uni.setStorageSync('userInfo',JSON.stringify(res.user));
  466. this.user=res.user;
  467. }
  468. else{
  469. uni.showToast({
  470. icon:'none',
  471. title: res.msg,
  472. });
  473. }
  474. }
  475. },
  476. rej => {}
  477. );
  478. },
  479. checkFavorite(){
  480. checkFavorite(this.courseId).then(res => {
  481. if(res.code==200){
  482. this.isFavorite=res.isFavorite;
  483. }
  484. },
  485. rej => {}
  486. );
  487. },
  488. checkFollow(){
  489. checkFollow(this.talentId).then(res => {
  490. if(res.code==200){
  491. this.isFollow=res.isFollow;
  492. }
  493. },
  494. rej => {}
  495. );
  496. },
  497. checkLike(){
  498. checkLike(this.courseId).then(res => {
  499. if(res.code==200){
  500. this.isLike=res.isLike;
  501. }
  502. },
  503. rej => {}
  504. );
  505. },
  506. doFavorite(){
  507. if(!this.$isLogin()){
  508. this.$showLoginPage();
  509. return;
  510. }
  511. uni.showLoading({title:""});
  512. doFavorite(this.courseId).then(res => {
  513. uni.hideLoading();
  514. if(res.code==200){
  515. uni.showToast({title: '操作成功',icon: 'none'});
  516. }else{
  517. uni.showToast({title: res.msg,icon: 'none'});
  518. }
  519. this.isFavorite=!this.isFavorite;
  520. },
  521. rej => {}
  522. );
  523. },
  524. doLike(){
  525. if(!this.$isLogin()){
  526. this.$showLoginPage();
  527. return;
  528. }
  529. uni.showLoading({title:""});
  530. doLike(this.courseId).then(res => {
  531. uni.hideLoading();
  532. if(res.code==200){
  533. uni.showToast({title: '操作成功',icon: 'none'});
  534. }else{
  535. uni.showToast({title: res.msg,icon: 'none'});
  536. }
  537. this.isLike=!this.isLike;
  538. },
  539. rej => {}
  540. );
  541. },
  542. doFollow(){
  543. if(!this.$isLogin()){
  544. this.$showLoginPage();
  545. return;
  546. }
  547. uni.showLoading({title:""});
  548. doFollow(this.talentId).then(res => {
  549. uni.hideLoading();
  550. if(res.code==200){
  551. uni.showToast({title: '操作成功',icon: 'none'});
  552. }else{
  553. uni.showToast({title: res.msg,icon: 'none'});
  554. }
  555. this.isFollow=!this.isFollow;
  556. },
  557. rej => {}
  558. );
  559. },
  560. pickCatalogAction(index){
  561. //添加切换之前课程目录学习记录
  562. this.addStudyCourse();
  563. this.pickCatalogMethod(index);
  564. },
  565. pickCatalogMethod(index){
  566. //console.log("qxj pickCatalogMethod--------");
  567. let tempCatalogue=this.catalogueList[index];
  568. if(tempCatalogue.isVip==1){ //需要Vip才能观看
  569. if(!this.$isLogin()){
  570. this.$showLoginPage();
  571. return;
  572. }
  573. if(this.user==null){
  574. this.user=this.$getUserInfo()
  575. }
  576. if(this.user.isVip==0 && tempCatalogue.isBuy==0){
  577. this.openVipCourse();
  578. return;
  579. }
  580. }
  581. this.pickCatalogIdx=index;
  582. this.pickCatalog=this.catalogueList[index];
  583. this.studyTimes=0;//当pickCatalog.studyTime=null 或者等于视频总时长时默认切为零
  584. if(this.pickCatalog.studyTime!=this.pickCatalog.seconds){
  585. this.studyTimes=this.pickCatalog.studyTime;
  586. }
  587. this.initStudyTime(this.studyTimes);
  588. this.poster=this.pickCatalog.thumbnail;
  589. if (this.audioContext==null) {
  590. this.audioContext = uni.createInnerAudioContext();
  591. }
  592. this.audioContext.src = this.pickCatalog.videoUrl;
  593. let that=this;
  594. setTimeout(function(){
  595. that.playVideo();
  596. },300);
  597. },
  598. addStudyCourse(){
  599. if(this.catalogueList.length==0 || this.courseDuration==0){
  600. return;
  601. }
  602. this.pickCatalog=this.catalogueList[this.pickCatalogIdx];
  603. if(this.pickCatalog.isBuy==0){
  604. return;
  605. }
  606. const parmas={"courseId":parseInt(this.courseId),"duration":this.courseDuration,"videoId":this.pickCatalog.videoId};
  607. console.log("qxj courseDuration:"+this.courseDuration);
  608. addDuration(parmas).then(res => {
  609. if(res.code==200){
  610. this.courseDuration=0;
  611. }
  612. },
  613. rej => {}
  614. );
  615. },
  616. playVideo() {
  617. this.videoContext.play();
  618. },
  619. pauseVideo() {
  620. console.log("pauseVideo");
  621. this.videoContext.pause();
  622. },
  623. onPlayVideo(){ //视频播放器事件
  624. console.log("qxj onPlayVideo tempAudioDuration:"+this.tempAudioDuration);
  625. if(this.tempAudioDuration==0){
  626. return;
  627. }
  628. this.playVideoAction();
  629. },
  630. playVideoAction(){
  631. this.courseDuration=(this.tempAudioDuration*1.0).toFixed(0);
  632. this.studyTimes=this.tempAudioDuration;
  633. console.log("qxj courseDuration:"+this.courseDuration);
  634. if(this.audioPlayIng){
  635. this.pauseAudio();
  636. this.audioPlayIng=false;
  637. }
  638. this.videoContext.seek(this.courseDuration);
  639. },
  640. onPauseVideo(){
  641. },
  642. playAudioAction(){
  643. //if(this.isLearning){ //若从在学课程跳转过来则续播
  644. this.playTime=this.$formatSeconds(this.courseDuration);
  645. this.audioContext.seek(this.audioDuration+0.8);
  646. this.isLearning=false;
  647. //}
  648. if(!this.audioPlayIng){
  649. this.pauseVideo();
  650. this.playAudio();
  651. }
  652. else{
  653. this.pauseAudio();
  654. }
  655. this.audioPlayIng=!this.audioPlayIng;
  656. },
  657. playAudio() {
  658. let that=this;
  659. this.audioTimer = setInterval(() => {
  660. if(that.isAudioChanging){
  661. return;
  662. }
  663. if(that.audioDuration>that.pickCatalog.seconds){
  664. clearInterval(that.audioTimer);
  665. return;
  666. }
  667. that.audioDuration++;
  668. that.tempAudioDuration=that.audioDuration;
  669. let tempAudioDuration=(that.audioDuration*1.0).toFixed(0);
  670. that.video.percent=(tempAudioDuration/that.pickCatalog.seconds*1.0).toFixed(2)*100;
  671. that.playTime=this.$formatSeconds(tempAudioDuration);
  672. }, 1000);
  673. this.audioContext.play();
  674. this.pauseCountsTime();
  675. },
  676. pauseAudio() {
  677. if(this.audioContext) {
  678. this.audioContext.pause();
  679. clearInterval(this.audioTimer);
  680. this.audioTimer=null;
  681. }
  682. },
  683. destoryAudio() {
  684. console.log("qxj destoryAudio");
  685. if (this.audioContext) {
  686. this.audioContext.destroy();
  687. }
  688. },
  689. input(){
  690. this.isAudioChanging=true;
  691. },
  692. audioChanging(){
  693. this.isAudioChanging=true; //正在拖动时屏蔽掉audio倒计时
  694. },
  695. audioChange(value){
  696. console.log("audioChange value:"+value+" audioPlayIng:"+this.audioPlayIng);
  697. this.isAudioChanging=false;
  698. this.tempAudioDuration=parseInt(value/100.0*this.pickCatalog.seconds);
  699. this.playTime=this.$formatSeconds(this.tempAudioDuration);
  700. if(this.audioPlayIng){
  701. console.log("qxj audioDuration:"+this.tempAudioDuration);
  702. this.audioDuration=this.tempAudioDuration;
  703. this.audioContext.seek(this.tempAudioDuration);
  704. }else{
  705. this.playVideoAction();
  706. }
  707. },
  708. startCountsTime(){
  709. // if (this.countdowning) return;
  710. // this.countdowning = true;
  711. // this.timer = setInterval(() => {
  712. // if(this.courseDuration>this.pickCatalog.seconds){
  713. // clearInterval(this.timer);
  714. // return;
  715. // }
  716. // this.courseDuration++;
  717. // console.log("qxj courseDuration:"+this.courseDuration);
  718. // }, 1000);
  719. },
  720. pauseCountsTime(){ //暂停
  721. // if (this.countdowning){
  722. // clearInterval(this.timer);
  723. // this.countdowning=false;
  724. // }
  725. },
  726. resumeCountsTime(){ //恢复
  727. // if (!this.countdowning){
  728. // this.startCountsTime();
  729. // }
  730. },
  731. endCountsTime(){
  732. if (this.timer) {
  733. clearInterval(this.timer);
  734. this.timer = null;
  735. }
  736. },
  737. onFullscreenChange(event){
  738. // 检查是否全屏
  739. if (event.fullscreen) {
  740. // 如果是全屏,则退出全屏
  741. //this.videoContext.exitFullScreen();
  742. }
  743. },
  744. toggleBarChange(event){
  745. console.log("qxj toggleBarChange");
  746. this.showFullScreenBtn=!this.showFullScreenBtn;
  747. },
  748. onWaiting(){
  749. this.isWaiting=true;
  750. console.log("qxj onWaiting:");
  751. },
  752. onProgress() {
  753. console.log("qxj onProgress");
  754. },
  755. onLoadeddata() {
  756. console.log('视频缓冲完成');
  757. },
  758. onVideoCanPlay() {
  759. console.log('视频可以开始播放,但可能需要缓冲');
  760. },
  761. onVideoCanPlayThrough() {
  762. console.log('视频可以无暂停地播放');
  763. },
  764. onLoadedMetadata(e) {
  765. console.log("qxj onLoadedMetadata");
  766. },
  767. endedPlayNext(){
  768. let nextCatalog=this.catalogueList[this.pickCatalogIdx+1];
  769. if(nextCatalog.isBuy==0){
  770. return;
  771. }
  772. if(this.pickCatalogIdx<this.catalogueList.length-1){ //未播放到最后一节自动续播
  773. this.pickCatalogAction(this.pickCatalogIdx+1)
  774. }
  775. },
  776. onTimeUpdate(res){
  777. this.audioDuration=res.detail.currentTime;
  778. this.courseDuration = (res.detail.currentTime*1.0).toFixed(0);
  779. this.totalDuration=res.detail.currentTime;
  780. if(this.totalDuration>=120){ //未登录状态播放两分钟就跳出登录页面
  781. if(!this.$isLogin()){
  782. this.$showLoginPage();
  783. }
  784. this.totalDuration=0;
  785. }
  786. let detail=res.detail;
  787. let currentDuration=parseInt(detail.duration);
  788. if(this.pickCatalog.duration==null && !!currentDuration){
  789. this.pickCatalog.duration=currentDuration;
  790. this.pickCatalog.seconds=currentDuration;
  791. this.catalogueList[this.pickCatalogIdx]=this.pickCatalog;
  792. this.$forceUpdate();
  793. console.log("qxj currentDuration:"+this.pickCatalog.duration);
  794. }
  795. if(!this.isWaiting){
  796. this.video.percent=(this.courseDuration/this.pickCatalog.seconds*1.0).toFixed(2)*100;
  797. this.playTime=this.$formatSeconds(this.courseDuration);
  798. }else{
  799. setTimeout(()=>{
  800. this.isWaiting=false;
  801. },2000);
  802. }
  803. },
  804. initStudyTime(times){
  805. this.studyTimes=times;
  806. this.courseDuration=times;
  807. this.audioDuration=times;
  808. this.playTime=this.$formatSeconds(this.studyTimes);
  809. },
  810. getCatalogIdx(){
  811. let index=0;
  812. for (var i = 0; i < this.catalogueList.length; i++) {
  813. let item=this.catalogueList[i];
  814. if(this.videoId==item.videoId){
  815. break;
  816. }
  817. index++;
  818. }
  819. return index;
  820. },
  821. goToPlay(){
  822. this.navTo("./videoUni");
  823. //this.navTo("/pages/course/video/play?videoUrl="+this.pickCatalog.videoUrl+"&currentTime="+this.currentTime+"&catalogIdx="+this.pickCatalogIdx);
  824. },
  825. goToInfo(item){
  826. this.$navTo('./info?courseId='+item.courseId);
  827. },
  828. goToIntroduce(){
  829. //this.pickCatalog=this.catalogueList[this.pickCatalogIdx];
  830. let url='./introduce?courseId='+this.courseId+'&videoId='+this.pickCatalog.videoId+'&studyTimes='+this.courseDuration;
  831. this.$navTo(url);
  832. },
  833. doCommentAction(){
  834. if(this.isH5){
  835. this.specVisible=true;
  836. }
  837. else{
  838. // this.$navTo('./comment?courseId='+this.courseId);
  839. // return;
  840. const subNVue = uni.getSubNVueById('commentN');
  841. subNVue.show('slide-in-bottom', 250);
  842. uni.$emit('comment', {
  843. videoId: this.pickCatalog.videoId,
  844. courseId: this.courseId
  845. });
  846. }
  847. },
  848. goToCatalogue(){
  849. if(this.isH5){
  850. let url='./catalogue?courseId='+this.courseId+'&videoId='+this.pickCatalog.videoId+'&isAutoPlay='+this.data.isAutoPlay+'&studyTimes='+this.courseDuration;
  851. this.$navTo(url);
  852. }
  853. else{
  854. const subNVue = uni.getSubNVueById('catalogueN');
  855. subNVue.show('slide-in-bottom', 250);
  856. uni.$emit('catalogue', {
  857. videoId: this.pickCatalog.videoId,
  858. courseId: this.courseId
  859. });
  860. }
  861. },
  862. closePop(){
  863. console.log("qxj closePop");
  864. this.specVisible=false;
  865. },
  866. navTo(url) {
  867. console.log("qxj url:"+url);
  868. uni.navigateTo({
  869. url: url
  870. })
  871. },
  872. openShare(){
  873. if(this.isH5){
  874. return;
  875. }
  876. this.shareItem.title=this.data.courseName+"-"+this.pickCatalog.title;
  877. this.shareItem.imageUrl=this.data.imgUrl;
  878. this.shareItem.compressImage = 1;
  879. this.shareItem.summary=!this.$isEmpty(this.data.description)?this.data.description:"";
  880. let cdn=uni.getStorageSync('requestPath');
  881. this.shareItem.url=cdn+"/h5/pages/course/info?courseId="+this.courseId;
  882. this.showShare=true;
  883. },
  884. openVipCourse() {
  885. if(!this.isPostBack){
  886. this.isPostBack=true;
  887. return;
  888. }
  889. this.showPopPrivilege();
  890. },
  891. showPopPrivilege(){
  892. if(this.isH5){
  893. this.$refs.popPrivilege.open("bottom");
  894. }
  895. else{
  896. const subNVue = uni.getSubNVueById('privilege');
  897. subNVue.show('slide-in-bottom', 250);
  898. uni.$emit('privilege', {
  899. videoId: this.pickCatalog.videoId,
  900. courseId: this.courseId
  901. });
  902. }
  903. },
  904. changeVip(index){
  905. this.vipSelIndex=index;
  906. if(index==2){
  907. this.showPopPrivilege();
  908. }
  909. },
  910. changeVipMethod(index){
  911. this.vipMethodIdx=index;
  912. const vipMethod=this.vipMethods[index];
  913. this.isShowPayType=false;
  914. if(vipMethod.indexOf('元购买')!=-1){ //直接购买
  915. this.isShowPayType=true;
  916. this.createType=1;
  917. }
  918. if(vipMethod.indexOf('福币兑换')!=-1){ //福币兑换
  919. this.createType=2;
  920. }
  921. if(vipMethod.indexOf('开通会员')!=-1){ //开通会员
  922. this.createType=3;
  923. }
  924. },
  925. changePayType(index){
  926. this.payType=index+1;
  927. },
  928. doBuy(){
  929. if(this.createType==1){ //直接购买
  930. this.createCourseOrder();
  931. }
  932. else if(this.createType==2){ //福币兑换
  933. this.createIntegralOrder();
  934. }
  935. else{ //开通会员
  936. this.$navTo('./vipBuy');
  937. }
  938. },
  939. createCourseOrder(){
  940. if(!this.$isLogin()){
  941. this.$showLoginPage();
  942. return;
  943. }
  944. uni.showLoading({title:""});
  945. let params={"courseId":this.courseId,"createType":this.createType,"videoId":this.pickCatalog.videoId,"payType":this.payType};
  946. createCourseOrder(params).then(res => {
  947. uni.hideLoading();
  948. if(res.code==200){
  949. this.order=res.order;
  950. if(this.payType==1){ //微信支付
  951. this.doWxPay();
  952. }else{ //支付宝
  953. this.doAlipay();
  954. }
  955. }else{
  956. uni.showToast({title: res.msg,icon: 'none'});
  957. }
  958. },
  959. rej => {}
  960. );
  961. },
  962. createIntegralOrder(){
  963. if(!this.$isLogin()){
  964. this.$showLoginPage();
  965. return;
  966. }
  967. uni.showLoading({title:""});
  968. let params={"courseId":this.courseId,"videoId":this.pickCatalog.videoId};
  969. createIntegralOrder(params).then(res => {
  970. uni.hideLoading();
  971. if(res.code==200){
  972. uni.showToast({title: res.msg,icon: 'success'});
  973. }else{
  974. uni.showToast({title: res.msg,icon: 'error'});
  975. }
  976. },
  977. rej => {}
  978. );
  979. },
  980. doAlipay(){
  981. var data = {orderId:this.order.orderId};
  982. uni.showLoading();
  983. aliPayment(data).then(res => {
  984. console.log(res.data)
  985. uni.hideLoading()
  986. this.$refs.popPrivilege.close();
  987. if(res.code==200){
  988. this.$refs.popTip.open();
  989. if (uni.getSystemInfoSync().platform == 'android') {
  990. var alipayScheme ='alipays://platformapi/startApp?&saId=10000007&qrcode=' + res.data.qr_code;
  991. }else{
  992. var alipayScheme ='alipay://platformapi/startApp?&saId=10000007&qrcode=' + res.data.qr_code;
  993. }
  994. console.log(alipayScheme)
  995. // 在uni-app中使用plus.runtime.openURL打开URL
  996. plus.runtime.openURL(alipayScheme, function(error) {
  997. // console.error('打开支付宝失败: ' + error.message);
  998. // 处理打开支付宝失败的情况,比如提示用户或者跳转到其他支付方式
  999. });
  1000. }
  1001. else{
  1002. uni.showToast({
  1003. title:res.msg,
  1004. icon:'none'
  1005. })
  1006. }
  1007. },
  1008. rej => {}
  1009. );
  1010. },
  1011. doWxPay(){
  1012. var that=this;
  1013. plus.share.getServices(function(res){
  1014. var sweixin = null;
  1015. for(var i=0;i<res.length;i++){
  1016. var t = res[i];
  1017. if(t.id == 'weixin'){
  1018. sweixin = t;
  1019. }
  1020. }
  1021. if(sweixin){
  1022. console.log('调起小程序')
  1023. that.$refs.popPrivilege.close();
  1024. that.$refs.popTip.open()
  1025. //唤起微信跳转小程序
  1026. sweixin.launchMiniProgram({
  1027. id:getApp().globalData.miniprogamId,
  1028. path:'pages_order/coursePayment?orderId='+that.orderId+"&payMethod=app",
  1029. type:0
  1030. },function(){
  1031. console.log("微信唤起成功");
  1032. return true;
  1033. },function(e){
  1034. console.log("微信唤起失败",e);
  1035. uni.showToast({
  1036. title:'微信唤起失败,请检查是否有微信应用',
  1037. icon:'none'
  1038. })
  1039. return false;
  1040. })
  1041. }else{
  1042. uni.showToast({
  1043. title:'微信唤起失败,请检查是否有微信应用',
  1044. icon:'none',
  1045. duration:3000
  1046. })
  1047. return false;
  1048. }
  1049. },function(res){
  1050. console.log(JSON.stringify(res));
  1051. });
  1052. },
  1053. closePrivilege(){
  1054. this.$refs.popPrivilege.close();
  1055. },
  1056. closeTip(){
  1057. this.$refs.popTip.close()
  1058. },
  1059. confirmTip() {
  1060. this.$refs.popTip.close();
  1061. this.getCourseInfo();
  1062. this.getUserInfo();
  1063. uni.showToast({
  1064. title:"操作成功",
  1065. icon:'success'
  1066. })
  1067. },
  1068. canShowVip(item){
  1069. return true;
  1070. if(this.user.isVip){
  1071. return false;
  1072. }
  1073. return item.isVip==1 && item.isBuy==0;
  1074. },
  1075. openApp(){
  1076. window.location.href="zklive://course?courseId="+this.courseId;
  1077. },
  1078. videoErrorCallback(){
  1079. },
  1080. },
  1081. onUnload() {
  1082. console.log("qxj onUnload");
  1083. // 页面卸载时清除计时器
  1084. this.endCountsTime();
  1085. this.addStudyCourse();
  1086. this.destoryAudio();
  1087. uni.$emit('refreshStudyTime', {});
  1088. },
  1089. created(){
  1090. let that = this;
  1091. uni.$on('backStudyTime', function(data) {
  1092. //console.log("qxj backStudyTime:"+JSON.stringify(data));
  1093. that.videoId=data.videoId;
  1094. that.pickCatalogIdx=that.getCatalogIdx();
  1095. that.pickCatalog=that.catalogueList[that.pickCatalogIdx];
  1096. that.pickCatalog.studyTime=data.studyTimes;
  1097. that.catalogueList[that.pickCatalogIdx]=that.pickCatalog;
  1098. that.tempAudioDuration=data.studyTimes;
  1099. that.pickCatalogMethod(that.pickCatalogIdx);
  1100. });
  1101. uni.$on('showPayTips', function(data) {
  1102. that.showPayTips=true;
  1103. });
  1104. uni.$on('refreshUser', function(data) {
  1105. that.getUserInfo();
  1106. that.getCourseInfo();
  1107. });
  1108. uni.$on('pickCatalogAction', function(index) {
  1109. console.log("qxj index:"+index);
  1110. that.pickCatalogAction(index);
  1111. });
  1112. },
  1113. destroyed() {
  1114. // 注销全局配置监听
  1115. uni.$off("backStudyTime");
  1116. uni.$off("refreshUser");
  1117. uni.$off("showPayTips");
  1118. uni.$off("pickCatalogAction");
  1119. uni.$off("refreshTitle");
  1120. }
  1121. }
  1122. </script>
  1123. <style>
  1124. page {
  1125. background-color: white;
  1126. }
  1127. .video {
  1128. height: 380rpx;
  1129. position: relative;
  1130. display: flex;
  1131. .cover{
  1132. position: absolute;
  1133. left: 0;
  1134. top: 0;
  1135. width: 100%;
  1136. height: 100%;
  1137. border-radius: 20rpx;
  1138. }
  1139. .playIcon{
  1140. position: absolute;
  1141. width:44rpx ;
  1142. height: 44rpx;
  1143. z-index: 10;
  1144. right: 26rpx;
  1145. bottom: 50rpx;
  1146. }
  1147. }
  1148. .bottom {
  1149. position: absolute;
  1150. left: 0;
  1151. top:0px;
  1152. width: 100%;
  1153. z-index: 100;
  1154. /* background-color: red; */
  1155. }
  1156. .video video {
  1157. width: 100%;
  1158. height: 100%;
  1159. border-radius: 20rpx;
  1160. }
  1161. .video .video-1,.video .video-2,.video .video-3,.video .video-4{
  1162. position: absolute;
  1163. width: 20rpx;
  1164. height: 20rpx;
  1165. z-index: 1;
  1166. }
  1167. .video .video-1{
  1168. left:0;top:0;
  1169. }
  1170. .video .video-2{
  1171. right:0;top:0;
  1172. }
  1173. .video .video-3{
  1174. left:0;bottom:0;
  1175. }
  1176. .video .video-4{
  1177. right:0;bottom:0;
  1178. }
  1179. .es-icon-add{
  1180. background-image: url(../../static/images/other/add.png);
  1181. }
  1182. .es-icon-course-collect {
  1183. background-image: url(../../static/images/other/course/collect.png);
  1184. }
  1185. .es-icon-course-like {
  1186. background-image: url(../../static/images/other/course/like.png);
  1187. }
  1188. .es-icon-course-note {
  1189. background-image: url(../../static/images/other/course/note.png);
  1190. }
  1191. .es-icon-course-play {
  1192. background-image: url(../../static/images/other/course/play.png);
  1193. }
  1194. .es-icon-course-pause {
  1195. background-image: url(../../static/images/other/course/pause.png);
  1196. }
  1197. .es-icon-course-play_icon {
  1198. background-image: url(../../static/image/course/play_small.png);
  1199. }
  1200. .es-icon-course-time_icon {
  1201. background-image: url(../../static/image/course/time_small.png);
  1202. }
  1203. .catalogue-item{
  1204. display: inline-block; /* 将子元素设置为行内块级元素 */
  1205. }
  1206. .es-icon-course-play1,
  1207. .catalogue-item .es-icon {
  1208. background-image: url(../../static/images/other/course/play1.png);
  1209. }
  1210. .es-icon-course-play2,
  1211. .catalogue-item.ac .es-icon {
  1212. background-image: url(../../static/images/other/course/play2.png);
  1213. }
  1214. .es-icon-course-play-menu {
  1215. background-image: url(../../static/images/other/course/play-menu.png);
  1216. }
  1217. .es-icon-course-share {
  1218. background-image: url(../../static/images/other/course/share.png);
  1219. }
  1220. .load-con>view {
  1221. position: absolute;
  1222. left: 0;
  1223. top: 0;
  1224. height: 30rpx;
  1225. width: 100%;
  1226. }
  1227. .load-con>view:nth-child(1)>view {
  1228. background-color: #AAAAAA;
  1229. }
  1230. .load-con>view:nth-child(2)>view {
  1231. background-color: #ffffff;
  1232. }
  1233. .white-bloack {
  1234. background-color: white;
  1235. width: 36rpx;
  1236. height: 10rpx;
  1237. margin-left: -12rpx;
  1238. border-radius: 100rpx;
  1239. box-shadow: 2px 6px 10px 0px rgba(153, 153, 153, 0.22);
  1240. }
  1241. /* .load-con .white-block {
  1242. position: absolute;
  1243. width: 24rpx;
  1244. margin-left: -12rpx;
  1245. top: 5rpx;
  1246. background-color: red;
  1247. box-shadow: 2px 6px 10px 10px rgba(153,153,153,0.52);
  1248. } */
  1249. .catalogue-item {
  1250. border: 3rpx solid #E6E4E5;
  1251. height: 111rpx;
  1252. border-radius: 10rpx;
  1253. color: #999;
  1254. margin-right: 20rpx;
  1255. width: calc(50% - 40rpx);
  1256. /* margin-top: 4rpx; */
  1257. }
  1258. .catalogue-item:last-child {
  1259. margin-right: 0;
  1260. }
  1261. .catalogue-item>view {
  1262. height: 100%;
  1263. }
  1264. .catalogue-item.ac {
  1265. border: 3rpx solid #EA581B;
  1266. color: #EA581B;
  1267. /* margin-top: 0rpx; */
  1268. }
  1269. .vip{
  1270. position: absolute;
  1271. width: 44rpx;
  1272. height: 19rpx;
  1273. line-height: 15rpx;
  1274. background: linear-gradient(94deg, #FFE9D0 0%, #E9BD97 100%);
  1275. border-radius: 5rpx;
  1276. top: 0rpx;
  1277. right: -29rpx;
  1278. color:#333;
  1279. font-size:18rpx ;
  1280. text-align: center;
  1281. font-weight: 500;
  1282. font-style: italic;
  1283. }
  1284. .con{
  1285. display: flex;
  1286. justify-content: space-between;
  1287. flex-wrap: wrap;
  1288. }
  1289. .es-f1, .es-f2, .es-f3, .es-f4 {
  1290. flex-shrink: 0 !important;
  1291. }
  1292. .es-btn-ygz{
  1293. background: #e5e5e5;
  1294. color: #333;
  1295. }
  1296. .swiper-box,
  1297. .carousel {
  1298. width: 100%;
  1299. height: 190rpx;
  1300. position: relative;
  1301. border-radius: 20rpx;
  1302. margin-top: 10rpx;
  1303. .carousel-item {
  1304. width: 100%;
  1305. height: 100%;
  1306. /* padding: 0 28upx; */
  1307. overflow: hidden;
  1308. }
  1309. .swiper-image {
  1310. width: 100%;
  1311. height: 100%;
  1312. /* border-radius: 10upx; */
  1313. background: #ccc;
  1314. }
  1315. }
  1316. /deep/uni-slider{
  1317. margin: 0;
  1318. }
  1319. .es-icon-play-1 {
  1320. background-image: url(../../static/images/other/video/1.png);
  1321. }
  1322. .es-icon-play-2 {
  1323. background-image: url(../../static/images/other/video/2.png);
  1324. }
  1325. .es-icon-play-3 {
  1326. background-image: url(../../static/images/other/video/3.png);
  1327. }
  1328. .es-icon-play-last {
  1329. background-image: url(../../static/images/other/video/play-last.png);
  1330. }
  1331. .es-icon-play-stop {
  1332. background-image: url(../../static/images/other/video/play-stop.png);
  1333. }
  1334. .es-icon-play-next {
  1335. background-image: url(../../static/images/other/video/play-next.png);
  1336. }
  1337. .es-icon-play-dan {
  1338. background-image: url(../../static/images/other/video/dan.png);
  1339. }
  1340. .es-share-bg-box {
  1341. position: fixed;
  1342. z-index: 9999;
  1343. bottom: 0;
  1344. left:0;
  1345. width: 100%;
  1346. text-align: center;
  1347. .image{
  1348. width: 100%;
  1349. height:100rpx ;
  1350. }
  1351. }
  1352. .vipCourseBtn{
  1353. background: #1B1F22;
  1354. border-radius: 46rpx;
  1355. border: 1px solid #FFDAA3;
  1356. color: #FFDAA3;
  1357. width: calc(33.33333% - 46.6666rpx);
  1358. }
  1359. .vipAc{
  1360. background: linear-gradient(90deg, #FFE0B2, #F8BA8B);
  1361. border-radius: 46rpx;
  1362. border: 1px solid #FFDAA3;
  1363. color: #1B1F22;
  1364. }
  1365. .privilegeBox{
  1366. background-color:#171a1d;
  1367. box-sizing: border-box;
  1368. }
  1369. .primenu-box{
  1370. border-radius: 16rpx;
  1371. margin-top: 0rpx;
  1372. padding: 10rpx 20rpx;
  1373. }
  1374. .content-inner {
  1375. display: flex;
  1376. flex-wrap: wrap;
  1377. min-height:310rpx ;
  1378. }
  1379. .content-inner .item{
  1380. width: calc(33.3333333%);
  1381. height: 150rpx;
  1382. display: flex;
  1383. flex-direction: column;
  1384. align-items: center;
  1385. justify-content: center;
  1386. margin-top: 0rpx;
  1387. }
  1388. .content-inner .item .img{
  1389. width: 84rpx;
  1390. height: 84rpx;
  1391. margin-bottom: 8rpx;
  1392. }
  1393. .content-inner .item .label{
  1394. font-size: 32rpx;
  1395. color: #83878A;
  1396. }
  1397. .vipMethodItem{
  1398. border-radius: 10rpx;
  1399. width: calc(100%);
  1400. height: 70rpx;
  1401. color: #FDD8A1;
  1402. }
  1403. .payTypeItem{
  1404. background-color:#1B1F22;
  1405. border:1px solid #fff;
  1406. border-radius: 10rpx;
  1407. width: calc(50% - 15rpx);
  1408. height: 94rpx;
  1409. }
  1410. .circle{
  1411. border:1px solid #FDD8A1;
  1412. }
  1413. .pt_ac{
  1414. border:1px solid #FDD8A1;
  1415. }
  1416. .slider-box{
  1417. flex:1
  1418. }
  1419. </style>