info1.vue 44 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530
  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="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. //this.poster="https://fs-1319721001.cos.ap-chongqing.myqcloud.com/fs/20240515/23b10c32d51a4bebb6f76f5543430359.jpg";
  354. let that=this;
  355. uni.$on('refreshTitle', (pingCount) => {
  356. that.data.commentNum=pingCount;
  357. });
  358. setTimeout(()=>{
  359. this.getCourseInfo();
  360. },200);
  361. if(this.$isLogin()){
  362. this.getUserInfo();
  363. this.checkFavorite();
  364. this.checkLike();
  365. }
  366. },
  367. onShow(){
  368. if(this.data.courseId!=null && !this.countdowning){
  369. console.log("qxj onShow startCountsTime");
  370. }
  371. //#ifdef H5
  372. this.isH5=true;
  373. //#endif
  374. //#ifdef APP-PLUS
  375. //plus.navigator.setFullscreen(false)
  376. //plus.screen.lockOrientation('portrait-primary');
  377. //#endif
  378. if(this.showPayTips){
  379. this.$refs.popTip.open();
  380. this.showPayTips=false;
  381. }
  382. },
  383. onHide() {
  384. this.pauseVideo();
  385. //this.$store.commit('setScaleFontSize',16);
  386. },
  387. onReady() {
  388. this.videoContext = uni.createVideoContext("myVideo", this);
  389. this.audioContext = uni.createInnerAudioContext();
  390. },
  391. methods: {
  392. getCourseInfo(){
  393. getCourseById(this.courseId).then(res => {
  394. if(res.code==200){
  395. this.data=res.data;
  396. this.dataList=res.data.courseList;
  397. this.talentId=res.data.talentId;
  398. this.studyLog=res.data.studyLog;
  399. if(this.studyLog!=null){
  400. this.videoId=this.studyLog.videoId;
  401. }
  402. this.vipMethods=["开通会员"];
  403. if(this.data.isIntegral==1){
  404. this.vipMethods.push("芳华币兑换")
  405. }
  406. if(this.data.sellPrice>0){
  407. this.vipMethods.push(this.data.sellPrice+"元购买");
  408. }
  409. this.getCourseVideoList();
  410. if(this.$isLogin()){
  411. this.checkFollow();
  412. }
  413. }
  414. },
  415. rej => {}
  416. );
  417. },
  418. getCourseList(){
  419. let that=this;
  420. const params={"cateId":this.data.cateId,"isTui":1};
  421. getCourseList(params).then(res => {
  422. if(res.code==200){
  423. this.dataList=res.data.list;
  424. }
  425. },
  426. rej => {}
  427. );
  428. },
  429. //课程目录
  430. getCourseVideoList(){
  431. let that=this;
  432. const params={"courseId":this.courseId};
  433. getCourseVideoList(params,1,30).then(res => {
  434. if(res.code==200){
  435. this.catalogueList=res.data.list;
  436. if(this.catalogueList.length>0){
  437. if(this.videoId!=null){
  438. this.pickCatalogIdx=this.getCatalogIdx();
  439. this.scrollIntoViewId="cataLogue"+this.pickCatalogIdx;
  440. this.pickCatalog=this.catalogueList[this.pickCatalogIdx];
  441. }else{
  442. this.pickCatalog=this.catalogueList[0];
  443. }
  444. if(this.pickCatalog.studyTime!=null){
  445. this.initStudyTime(this.pickCatalog.studyTime);
  446. }
  447. //开始播放计时
  448. if(this.data.isAutoPlay==1){
  449. this.pickCatalogMethod(this.pickCatalogIdx);
  450. this.startCountsTime();
  451. }
  452. this.poster=this.pickCatalog.thumbnail;
  453. this.audioContext.src = this.pickCatalog.videoUrl;
  454. this.video.percent=(this.audioDuration/this.pickCatalog.seconds*1.0).toFixed(2)*100;
  455. }
  456. }
  457. },
  458. rej => {}
  459. );
  460. },
  461. getUserInfo(){
  462. let that=this;
  463. getUserInfo().then(res => {
  464. if(res.code==200){
  465. if(res.user!=null){
  466. uni.setStorageSync('userInfo',JSON.stringify(res.user));
  467. this.user=res.user;
  468. }
  469. else{
  470. uni.showToast({
  471. icon:'none',
  472. title: res.msg,
  473. });
  474. }
  475. }
  476. },
  477. rej => {}
  478. );
  479. },
  480. checkFavorite(){
  481. checkFavorite(this.courseId).then(res => {
  482. if(res.code==200){
  483. this.isFavorite=res.isFavorite;
  484. }
  485. },
  486. rej => {}
  487. );
  488. },
  489. checkFollow(){
  490. checkFollow(this.talentId).then(res => {
  491. if(res.code==200){
  492. this.isFollow=res.isFollow;
  493. }
  494. },
  495. rej => {}
  496. );
  497. },
  498. checkLike(){
  499. checkLike(this.courseId).then(res => {
  500. if(res.code==200){
  501. this.isLike=res.isLike;
  502. }
  503. },
  504. rej => {}
  505. );
  506. },
  507. doFavorite(){
  508. if(!this.$isLogin()){
  509. this.$showLoginPage();
  510. return;
  511. }
  512. uni.showLoading({title:""});
  513. doFavorite(this.courseId).then(res => {
  514. uni.hideLoading();
  515. if(res.code==200){
  516. uni.showToast({title: '操作成功',icon: 'none'});
  517. }else{
  518. uni.showToast({title: res.msg,icon: 'none'});
  519. }
  520. this.isFavorite=!this.isFavorite;
  521. },
  522. rej => {}
  523. );
  524. },
  525. doLike(){
  526. if(!this.$isLogin()){
  527. this.$showLoginPage();
  528. return;
  529. }
  530. uni.showLoading({title:""});
  531. doLike(this.courseId).then(res => {
  532. uni.hideLoading();
  533. if(res.code==200){
  534. uni.showToast({title: '操作成功',icon: 'none'});
  535. }else{
  536. uni.showToast({title: res.msg,icon: 'none'});
  537. }
  538. this.isLike=!this.isLike;
  539. },
  540. rej => {}
  541. );
  542. },
  543. doFollow(){
  544. if(!this.$isLogin()){
  545. this.$showLoginPage();
  546. return;
  547. }
  548. uni.showLoading({title:""});
  549. doFollow(this.talentId).then(res => {
  550. uni.hideLoading();
  551. if(res.code==200){
  552. uni.showToast({title: '操作成功',icon: 'none'});
  553. }else{
  554. uni.showToast({title: res.msg,icon: 'none'});
  555. }
  556. this.isFollow=!this.isFollow;
  557. },
  558. rej => {}
  559. );
  560. },
  561. pickCatalogAction(index){
  562. //添加切换之前课程目录学习记录
  563. this.addStudyCourse();
  564. this.pickCatalogMethod(index);
  565. },
  566. pickCatalogMethod(index){
  567. //console.log("qxj pickCatalogMethod--------");
  568. let tempCatalogue=this.catalogueList[index];
  569. if(tempCatalogue.isVip==1){ //需要Vip才能观看
  570. if(!this.$isLogin()){
  571. this.$showLoginPage();
  572. return;
  573. }
  574. if(this.user==null){
  575. this.user=this.$getUserInfo()
  576. }
  577. if(this.user.isVip==0 && tempCatalogue.isBuy==0){
  578. this.openVipCourse();
  579. return;
  580. }
  581. }
  582. this.pickCatalogIdx=index;
  583. this.pickCatalog=this.catalogueList[index];
  584. this.studyTimes=0;//当pickCatalog.studyTime=null 或者等于视频总时长时默认切为零
  585. if(this.pickCatalog.studyTime!=this.pickCatalog.seconds){
  586. this.studyTimes=this.pickCatalog.studyTime;
  587. }
  588. this.initStudyTime(this.studyTimes);
  589. this.poster=this.pickCatalog.thumbnail;
  590. if (this.audioContext==null) {
  591. this.audioContext = uni.createInnerAudioContext();
  592. }
  593. this.audioContext.src = this.pickCatalog.videoUrl;
  594. let that=this;
  595. setTimeout(function(){
  596. that.playVideo();
  597. },300);
  598. },
  599. addStudyCourse(){
  600. if(this.catalogueList.length==0 || this.courseDuration==0){
  601. return;
  602. }
  603. this.pickCatalog=this.catalogueList[this.pickCatalogIdx];
  604. if(this.pickCatalog.isBuy==0){
  605. return;
  606. }
  607. const parmas={"courseId":parseInt(this.courseId),"duration":this.courseDuration,"videoId":this.pickCatalog.videoId};
  608. console.log("qxj courseDuration:"+this.courseDuration);
  609. addDuration(parmas).then(res => {
  610. if(res.code==200){
  611. this.courseDuration=0;
  612. }
  613. },
  614. rej => {}
  615. );
  616. },
  617. playVideo() {
  618. this.videoContext.play();
  619. },
  620. pauseVideo() {
  621. console.log("pauseVideo");
  622. this.videoContext.pause();
  623. },
  624. onPlayVideo(){ //视频播放器事件
  625. console.log("qxj onPlayVideo tempAudioDuration:"+this.tempAudioDuration);
  626. if(this.tempAudioDuration==0){
  627. return;
  628. }
  629. this.playVideoAction();
  630. },
  631. playVideoAction(){
  632. this.courseDuration=(this.tempAudioDuration*1.0).toFixed(0);
  633. this.studyTimes=this.tempAudioDuration;
  634. console.log("qxj courseDuration:"+this.courseDuration);
  635. if(this.audioPlayIng){
  636. this.pauseAudio();
  637. this.audioPlayIng=false;
  638. }
  639. this.videoContext.seek(this.courseDuration);
  640. },
  641. onPauseVideo(){
  642. },
  643. playAudioAction(){
  644. //if(this.isLearning){ //若从在学课程跳转过来则续播
  645. this.playTime=this.$formatSeconds(this.courseDuration);
  646. this.audioContext.seek(this.audioDuration+0.8);
  647. this.isLearning=false;
  648. //}
  649. if(!this.audioPlayIng){
  650. this.pauseVideo();
  651. this.playAudio();
  652. }
  653. else{
  654. this.pauseAudio();
  655. }
  656. this.audioPlayIng=!this.audioPlayIng;
  657. },
  658. playAudio() {
  659. let that=this;
  660. this.audioTimer = setInterval(() => {
  661. if(that.isAudioChanging){
  662. return;
  663. }
  664. if(that.audioDuration>that.pickCatalog.seconds){
  665. clearInterval(that.audioTimer);
  666. return;
  667. }
  668. that.audioDuration++;
  669. that.tempAudioDuration=that.audioDuration;
  670. let tempAudioDuration=(that.audioDuration*1.0).toFixed(0);
  671. that.video.percent=(tempAudioDuration/that.pickCatalog.seconds*1.0).toFixed(2)*100;
  672. that.playTime=this.$formatSeconds(tempAudioDuration);
  673. }, 1000);
  674. this.audioContext.play();
  675. this.pauseCountsTime();
  676. },
  677. pauseAudio() {
  678. if(this.audioContext) {
  679. this.audioContext.pause();
  680. clearInterval(this.audioTimer);
  681. this.audioTimer=null;
  682. }
  683. },
  684. destoryAudio() {
  685. console.log("qxj destoryAudio");
  686. if (this.audioContext) {
  687. this.audioContext.destroy();
  688. }
  689. },
  690. input(){
  691. this.isAudioChanging=true;
  692. },
  693. audioChanging(){
  694. this.isAudioChanging=true; //正在拖动时屏蔽掉audio倒计时
  695. },
  696. audioChange(value){
  697. console.log("audioChange value:"+value+" audioPlayIng:"+this.audioPlayIng);
  698. this.isAudioChanging=false;
  699. this.tempAudioDuration=parseInt(value/100.0*this.pickCatalog.seconds);
  700. this.playTime=this.$formatSeconds(this.tempAudioDuration);
  701. if(this.audioPlayIng){
  702. console.log("qxj audioDuration:"+this.tempAudioDuration);
  703. this.audioDuration=this.tempAudioDuration;
  704. this.audioContext.seek(this.tempAudioDuration);
  705. }else{
  706. this.playVideoAction();
  707. }
  708. },
  709. startCountsTime(){
  710. // if (this.countdowning) return;
  711. // this.countdowning = true;
  712. // this.timer = setInterval(() => {
  713. // if(this.courseDuration>this.pickCatalog.seconds){
  714. // clearInterval(this.timer);
  715. // return;
  716. // }
  717. // this.courseDuration++;
  718. // console.log("qxj courseDuration:"+this.courseDuration);
  719. // }, 1000);
  720. },
  721. pauseCountsTime(){ //暂停
  722. // if (this.countdowning){
  723. // clearInterval(this.timer);
  724. // this.countdowning=false;
  725. // }
  726. },
  727. resumeCountsTime(){ //恢复
  728. // if (!this.countdowning){
  729. // this.startCountsTime();
  730. // }
  731. },
  732. endCountsTime(){
  733. if (this.timer) {
  734. clearInterval(this.timer);
  735. this.timer = null;
  736. }
  737. },
  738. onFullscreenChange(event){
  739. // 检查是否全屏
  740. if (event.fullscreen) {
  741. // 如果是全屏,则退出全屏
  742. //this.videoContext.exitFullScreen();
  743. }
  744. },
  745. toggleBarChange(event){
  746. console.log("qxj toggleBarChange");
  747. this.showFullScreenBtn=!this.showFullScreenBtn;
  748. },
  749. onWaiting(){
  750. this.isWaiting=true;
  751. console.log("qxj onWaiting:");
  752. },
  753. onProgress() {
  754. console.log("qxj onProgress");
  755. },
  756. onLoadeddata() {
  757. console.log('视频缓冲完成');
  758. },
  759. onVideoCanPlay() {
  760. console.log('视频可以开始播放,但可能需要缓冲');
  761. },
  762. onVideoCanPlayThrough() {
  763. console.log('视频可以无暂停地播放');
  764. },
  765. onLoadedMetadata(e) {
  766. console.log("qxj onLoadedMetadata");
  767. },
  768. endedPlayNext(){
  769. let nextCatalog=this.catalogueList[this.pickCatalogIdx+1];
  770. if(nextCatalog.isBuy==0){
  771. return;
  772. }
  773. if(this.pickCatalogIdx<this.catalogueList.length-1){ //未播放到最后一节自动续播
  774. this.pickCatalogAction(this.pickCatalogIdx+1)
  775. }
  776. },
  777. onTimeUpdate(res){
  778. this.audioDuration=res.detail.currentTime;
  779. this.courseDuration = (res.detail.currentTime*1.0).toFixed(0);
  780. this.totalDuration=res.detail.currentTime;
  781. if(this.totalDuration>=120){ //未登录状态播放两分钟就跳出登录页面
  782. if(!this.$isLogin()){
  783. this.$showLoginPage();
  784. }
  785. this.totalDuration=0;
  786. }
  787. let detail=res.detail;
  788. let currentDuration=parseInt(detail.duration);
  789. if(this.pickCatalog.duration==null && !!currentDuration){
  790. this.pickCatalog.duration=currentDuration;
  791. this.pickCatalog.seconds=currentDuration;
  792. this.catalogueList[this.pickCatalogIdx]=this.pickCatalog;
  793. this.$forceUpdate();
  794. console.log("qxj currentDuration:"+this.pickCatalog.duration);
  795. }
  796. if(!this.isWaiting){
  797. this.video.percent=(this.courseDuration/this.pickCatalog.seconds*1.0).toFixed(2)*100;
  798. this.playTime=this.$formatSeconds(this.courseDuration);
  799. }else{
  800. setTimeout(()=>{
  801. this.isWaiting=false;
  802. },2000);
  803. }
  804. },
  805. initStudyTime(times){
  806. this.studyTimes=times;
  807. this.courseDuration=times;
  808. this.audioDuration=times;
  809. this.playTime=this.$formatSeconds(this.studyTimes);
  810. },
  811. getCatalogIdx(){
  812. let index=0;
  813. for (var i = 0; i < this.catalogueList.length; i++) {
  814. let item=this.catalogueList[i];
  815. if(this.videoId==item.videoId){
  816. break;
  817. }
  818. index++;
  819. }
  820. return index;
  821. },
  822. goToPlay(){
  823. this.navTo("./videoUni");
  824. //this.navTo("/pages/course/video/play?videoUrl="+this.pickCatalog.videoUrl+"&currentTime="+this.currentTime+"&catalogIdx="+this.pickCatalogIdx);
  825. },
  826. goToInfo(item){
  827. this.$navTo('./info?courseId='+item.courseId);
  828. },
  829. goToIntroduce(){
  830. //this.pickCatalog=this.catalogueList[this.pickCatalogIdx];
  831. let url='./introduce?courseId='+this.courseId+'&videoId='+this.pickCatalog.videoId+'&studyTimes='+this.courseDuration;
  832. this.$navTo(url);
  833. },
  834. doCommentAction(){
  835. if(this.isH5){
  836. this.specVisible=true;
  837. }
  838. else{
  839. // this.$navTo('./comment?courseId='+this.courseId);
  840. // return;
  841. const subNVue = uni.getSubNVueById('commentN');
  842. subNVue.show('slide-in-bottom', 250);
  843. uni.$emit('comment', {
  844. videoId: this.pickCatalog.videoId,
  845. courseId: this.courseId
  846. });
  847. }
  848. },
  849. goToCatalogue(){
  850. if(this.isH5){
  851. let url='./catalogue?courseId='+this.courseId+'&videoId='+this.pickCatalog.videoId+'&isAutoPlay='+this.data.isAutoPlay+'&studyTimes='+this.courseDuration;
  852. this.$navTo(url);
  853. }
  854. else{
  855. const subNVue = uni.getSubNVueById('catalogueN');
  856. subNVue.show('slide-in-bottom', 250);
  857. uni.$emit('catalogue', {
  858. videoId: this.pickCatalog.videoId,
  859. courseId: this.courseId
  860. });
  861. }
  862. },
  863. closePop(){
  864. console.log("qxj closePop");
  865. this.specVisible=false;
  866. },
  867. navTo(url) {
  868. console.log("qxj url:"+url);
  869. uni.navigateTo({
  870. url: url
  871. })
  872. },
  873. openShare(){
  874. if(this.isH5){
  875. return;
  876. }
  877. this.shareItem.title=this.data.courseName+"-"+this.pickCatalog.title;
  878. this.shareItem.imageUrl=this.data.imgUrl;
  879. this.shareItem.compressImage = 1
  880. this.shareItem.summary=!this.$isEmpty(this.data.description)?this.data.description:"";
  881. let cdn=uni.getStorageSync('requestPath');
  882. this.shareItem.url=cdn+"/h5/pages/course/info?courseId="+this.courseId;
  883. this.showShare=true;
  884. },
  885. openVipCourse() {
  886. if(!this.isPostBack){
  887. this.isPostBack=true;
  888. return;
  889. }
  890. this.showPopPrivilege();
  891. },
  892. showPopPrivilege(){
  893. if(this.isH5){
  894. this.$refs.popPrivilege.open("bottom");
  895. }
  896. else{
  897. const subNVue = uni.getSubNVueById('privilege');
  898. subNVue.show('slide-in-bottom', 250);
  899. uni.$emit('privilege', {
  900. videoId: this.pickCatalog.videoId,
  901. courseId: this.courseId
  902. });
  903. }
  904. },
  905. changeVip(index){
  906. this.vipSelIndex=index;
  907. if(index==2){
  908. this.showPopPrivilege();
  909. }
  910. },
  911. changeVipMethod(index){
  912. this.vipMethodIdx=index;
  913. const vipMethod=this.vipMethods[index];
  914. this.isShowPayType=false;
  915. if(vipMethod.indexOf('元购买')!=-1){ //直接购买
  916. this.isShowPayType=true;
  917. this.createType=1;
  918. }
  919. if(vipMethod.indexOf('芳华币兑换')!=-1){ //芳华币兑换
  920. this.createType=2;
  921. }
  922. if(vipMethod.indexOf('开通会员')!=-1){ //开通会员
  923. this.createType=3;
  924. }
  925. },
  926. changePayType(index){
  927. this.payType=index+1;
  928. },
  929. doBuy(){
  930. if(this.createType==1){ //直接购买
  931. this.createCourseOrder();
  932. }
  933. else if(this.createType==2){ //芳华币兑换
  934. this.createIntegralOrder();
  935. }
  936. else{ //开通会员
  937. this.$navTo('./vipBuy');
  938. }
  939. },
  940. createCourseOrder(){
  941. if(!this.$isLogin()){
  942. this.$showLoginPage();
  943. return;
  944. }
  945. uni.showLoading({title:""});
  946. let params={"courseId":this.courseId,"createType":this.createType,"videoId":this.pickCatalog.videoId,"payType":this.payType};
  947. createCourseOrder(params).then(res => {
  948. uni.hideLoading();
  949. if(res.code==200){
  950. this.order=res.order;
  951. if(this.payType==1){ //微信支付
  952. this.doWxPay();
  953. }else{ //支付宝
  954. this.doAlipay();
  955. }
  956. }else{
  957. uni.showToast({title: res.msg,icon: 'none'});
  958. }
  959. },
  960. rej => {}
  961. );
  962. },
  963. createIntegralOrder(){
  964. if(!this.$isLogin()){
  965. this.$showLoginPage();
  966. return;
  967. }
  968. uni.showLoading({title:""});
  969. let params={"courseId":this.courseId,"videoId":this.pickCatalog.videoId};
  970. createIntegralOrder(params).then(res => {
  971. uni.hideLoading();
  972. if(res.code==200){
  973. uni.showToast({title: res.msg,icon: 'success'});
  974. }else{
  975. uni.showToast({title: res.msg,icon: 'error'});
  976. }
  977. },
  978. rej => {}
  979. );
  980. },
  981. doAlipay(){
  982. var data = {orderId:this.order.orderId};
  983. uni.showLoading();
  984. aliPayment(data).then(res => {
  985. console.log(res.data)
  986. uni.hideLoading()
  987. this.$refs.popPrivilege.close();
  988. if(res.code==200){
  989. this.$refs.popTip.open();
  990. if (uni.getSystemInfoSync().platform == 'android') {
  991. var alipayScheme ='alipays://platformapi/startApp?&saId=10000007&qrcode=' + res.data.qr_code;
  992. }else{
  993. var alipayScheme ='alipay://platformapi/startApp?&saId=10000007&qrcode=' + res.data.qr_code;
  994. }
  995. console.log(alipayScheme)
  996. // 在uni-app中使用plus.runtime.openURL打开URL
  997. plus.runtime.openURL(alipayScheme, function(error) {
  998. // console.error('打开支付宝失败: ' + error.message);
  999. // 处理打开支付宝失败的情况,比如提示用户或者跳转到其他支付方式
  1000. });
  1001. }
  1002. else{
  1003. uni.showToast({
  1004. title:res.msg,
  1005. icon:'none'
  1006. })
  1007. }
  1008. },
  1009. rej => {}
  1010. );
  1011. },
  1012. doWxPay(){
  1013. var that=this;
  1014. plus.share.getServices(function(res){
  1015. var sweixin = null;
  1016. for(var i=0;i<res.length;i++){
  1017. var t = res[i];
  1018. if(t.id == 'weixin'){
  1019. sweixin = t;
  1020. }
  1021. }
  1022. if(sweixin){
  1023. console.log('调起小程序')
  1024. that.$refs.popPrivilege.close();
  1025. that.$refs.popTip.open()
  1026. //唤起微信跳转小程序
  1027. sweixin.launchMiniProgram({
  1028. id:"gh_7a6a32e5ef61",
  1029. path:'pages_order/coursePayment?orderId='+that.orderId+"&payMethod=app",
  1030. type:0
  1031. },function(){
  1032. console.log("微信唤起成功");
  1033. return true;
  1034. },function(e){
  1035. console.log("微信唤起失败",e);
  1036. uni.showToast({
  1037. title:'微信唤起失败,请检查是否有微信应用',
  1038. icon:'none'
  1039. })
  1040. return false;
  1041. })
  1042. }else{
  1043. uni.showToast({
  1044. title:'微信唤起失败,请检查是否有微信应用',
  1045. icon:'none',
  1046. duration:3000
  1047. })
  1048. return false;
  1049. }
  1050. },function(res){
  1051. console.log(JSON.stringify(res));
  1052. });
  1053. },
  1054. closePrivilege(){
  1055. this.$refs.popPrivilege.close();
  1056. },
  1057. closeTip(){
  1058. this.$refs.popTip.close()
  1059. },
  1060. confirmTip() {
  1061. this.$refs.popTip.close();
  1062. this.getCourseInfo();
  1063. this.getUserInfo();
  1064. uni.showToast({
  1065. title:"操作成功",
  1066. icon:'success'
  1067. })
  1068. },
  1069. canShowVip(item){
  1070. return true;
  1071. if(this.user.isVip){
  1072. return false;
  1073. }
  1074. return item.isVip==1 && item.isBuy==0;
  1075. },
  1076. openApp(){
  1077. window.location.href="rtlive://course?courseId="+this.courseId;
  1078. },
  1079. videoErrorCallback(){
  1080. },
  1081. },
  1082. onUnload() {
  1083. console.log("qxj onUnload");
  1084. // 页面卸载时清除计时器
  1085. this.endCountsTime();
  1086. this.addStudyCourse();
  1087. this.destoryAudio();
  1088. uni.$emit('refreshStudyTime', {});
  1089. },
  1090. created(){
  1091. let that = this;
  1092. uni.$on('backStudyTime', function(data) {
  1093. //console.log("qxj backStudyTime:"+JSON.stringify(data));
  1094. that.videoId=data.videoId;
  1095. that.pickCatalogIdx=that.getCatalogIdx();
  1096. that.pickCatalog=that.catalogueList[that.pickCatalogIdx];
  1097. that.pickCatalog.studyTime=data.studyTimes;
  1098. that.catalogueList[that.pickCatalogIdx]=that.pickCatalog;
  1099. that.tempAudioDuration=data.studyTimes;
  1100. that.pickCatalogMethod(that.pickCatalogIdx);
  1101. });
  1102. uni.$on('showPayTips', function(data) {
  1103. that.showPayTips=true;
  1104. });
  1105. uni.$on('refreshUser', function(data) {
  1106. that.getUserInfo();
  1107. that.getCourseInfo();
  1108. });
  1109. uni.$on('pickCatalogAction', function(index) {
  1110. console.log("qxj index:"+index);
  1111. that.pickCatalogAction(index);
  1112. });
  1113. },
  1114. destroyed() {
  1115. // 注销全局配置监听
  1116. uni.$off("backStudyTime");
  1117. uni.$off("refreshUser");
  1118. uni.$off("showPayTips");
  1119. uni.$off("pickCatalogAction");
  1120. uni.$off("refreshTitle");
  1121. }
  1122. }
  1123. </script>
  1124. <style>
  1125. page {
  1126. background-color: white;
  1127. }
  1128. .video {
  1129. height: 380rpx;
  1130. position: relative;
  1131. display: flex;
  1132. .cover{
  1133. position: absolute;
  1134. left: 0;
  1135. top: 0;
  1136. width: 100%;
  1137. height: 100%;
  1138. border-radius: 20rpx;
  1139. }
  1140. .playIcon{
  1141. position: absolute;
  1142. width:44rpx ;
  1143. height: 44rpx;
  1144. z-index: 10;
  1145. right: 26rpx;
  1146. bottom: 50rpx;
  1147. }
  1148. }
  1149. .bottom {
  1150. position: absolute;
  1151. left: 0;
  1152. top:0px;
  1153. width: 100%;
  1154. z-index: 100;
  1155. /* background-color: red; */
  1156. }
  1157. .video video {
  1158. width: 100%;
  1159. height: 100%;
  1160. border-radius: 20rpx;
  1161. }
  1162. .video .video-1,.video .video-2,.video .video-3,.video .video-4{
  1163. position: absolute;
  1164. width: 20rpx;
  1165. height: 20rpx;
  1166. z-index: 1;
  1167. }
  1168. .video .video-1{
  1169. left:0;top:0;
  1170. }
  1171. .video .video-2{
  1172. right:0;top:0;
  1173. }
  1174. .video .video-3{
  1175. left:0;bottom:0;
  1176. }
  1177. .video .video-4{
  1178. right:0;bottom:0;
  1179. }
  1180. .es-icon-add{
  1181. background-image: url(../../static/images/other/add.png);
  1182. }
  1183. .es-icon-course-collect {
  1184. background-image: url(../../static/images/other/course/collect.png);
  1185. }
  1186. .es-icon-course-like {
  1187. background-image: url(../../static/images/other/course/like.png);
  1188. }
  1189. .es-icon-course-note {
  1190. background-image: url(../../static/images/other/course/note.png);
  1191. }
  1192. .es-icon-course-play {
  1193. background-image: url(../../static/images/other/course/play.png);
  1194. }
  1195. .es-icon-course-pause {
  1196. background-image: url(../../static/images/other/course/pause.png);
  1197. }
  1198. .es-icon-course-play_icon {
  1199. background-image: url(../../static/image/course/play_small.png);
  1200. }
  1201. .es-icon-course-time_icon {
  1202. background-image: url(../../static/image/course/time_small.png);
  1203. }
  1204. .catalogue-item{
  1205. display: inline-block; /* 将子元素设置为行内块级元素 */
  1206. }
  1207. .es-icon-course-play1,
  1208. .catalogue-item .es-icon {
  1209. background-image: url(../../static/images/other/course/play1.png);
  1210. }
  1211. .es-icon-course-play2,
  1212. .catalogue-item.ac .es-icon {
  1213. background-image: url(../../static/images/other/course/play2.png);
  1214. }
  1215. .es-icon-course-play-menu {
  1216. background-image: url(../../static/images/other/course/play-menu.png);
  1217. }
  1218. .es-icon-course-share {
  1219. background-image: url(../../static/images/other/course/share.png);
  1220. }
  1221. .load-con>view {
  1222. position: absolute;
  1223. left: 0;
  1224. top: 0;
  1225. height: 30rpx;
  1226. width: 100%;
  1227. }
  1228. .load-con>view:nth-child(1)>view {
  1229. background-color: #AAAAAA;
  1230. }
  1231. .load-con>view:nth-child(2)>view {
  1232. background-color: #ffffff;
  1233. }
  1234. .white-bloack {
  1235. background-color: white;
  1236. width: 36rpx;
  1237. height: 10rpx;
  1238. margin-left: -12rpx;
  1239. border-radius: 100rpx;
  1240. box-shadow: 2px 6px 10px 0px rgba(153, 153, 153, 0.22);
  1241. }
  1242. /* .load-con .white-block {
  1243. position: absolute;
  1244. width: 24rpx;
  1245. margin-left: -12rpx;
  1246. top: 5rpx;
  1247. background-color: red;
  1248. box-shadow: 2px 6px 10px 10px rgba(153,153,153,0.52);
  1249. } */
  1250. .catalogue-item {
  1251. border: 3rpx solid #E6E4E5;
  1252. height: 111rpx;
  1253. border-radius: 10rpx;
  1254. color: #999;
  1255. margin-right: 20rpx;
  1256. width: calc(50% - 40rpx);
  1257. /* margin-top: 4rpx; */
  1258. }
  1259. .catalogue-item:last-child {
  1260. margin-right: 0;
  1261. }
  1262. .catalogue-item>view {
  1263. height: 100%;
  1264. }
  1265. .catalogue-item.ac {
  1266. border: 3rpx solid #EA581B;
  1267. color: #EA581B;
  1268. /* margin-top: 0rpx; */
  1269. }
  1270. .vip{
  1271. position: absolute;
  1272. width: 44rpx;
  1273. height: 19rpx;
  1274. line-height: 15rpx;
  1275. background: linear-gradient(94deg, #FFE9D0 0%, #E9BD97 100%);
  1276. border-radius: 5rpx;
  1277. top: 0rpx;
  1278. right: -29rpx;
  1279. color:#333;
  1280. font-size:18rpx ;
  1281. text-align: center;
  1282. font-weight: 500;
  1283. font-style: italic;
  1284. }
  1285. .con{
  1286. display: flex;
  1287. justify-content: space-between;
  1288. flex-wrap: wrap;
  1289. }
  1290. .es-f1, .es-f2, .es-f3, .es-f4 {
  1291. flex-shrink: 0 !important;
  1292. }
  1293. .es-btn-ygz{
  1294. background: #e5e5e5;
  1295. color: #333;
  1296. }
  1297. .swiper-box,
  1298. .carousel {
  1299. width: 100%;
  1300. height: 190rpx;
  1301. position: relative;
  1302. border-radius: 20rpx;
  1303. margin-top: 10rpx;
  1304. .carousel-item {
  1305. width: 100%;
  1306. height: 100%;
  1307. /* padding: 0 28upx; */
  1308. overflow: hidden;
  1309. }
  1310. .swiper-image {
  1311. width: 100%;
  1312. height: 100%;
  1313. /* border-radius: 10upx; */
  1314. background: #ccc;
  1315. }
  1316. }
  1317. /deep/uni-slider{
  1318. margin: 0;
  1319. }
  1320. .es-icon-play-1 {
  1321. background-image: url(../../static/images/other/video/1.png);
  1322. }
  1323. .es-icon-play-2 {
  1324. background-image: url(../../static/images/other/video/2.png);
  1325. }
  1326. .es-icon-play-3 {
  1327. background-image: url(../../static/images/other/video/3.png);
  1328. }
  1329. .es-icon-play-last {
  1330. background-image: url(../../static/images/other/video/play-last.png);
  1331. }
  1332. .es-icon-play-stop {
  1333. background-image: url(../../static/images/other/video/play-stop.png);
  1334. }
  1335. .es-icon-play-next {
  1336. background-image: url(../../static/images/other/video/play-next.png);
  1337. }
  1338. .es-icon-play-dan {
  1339. background-image: url(../../static/images/other/video/dan.png);
  1340. }
  1341. .es-share-bg-box {
  1342. position: fixed;
  1343. z-index: 9999;
  1344. bottom: 0;
  1345. left:0;
  1346. width: 100%;
  1347. text-align: center;
  1348. .image{
  1349. width: 100%;
  1350. height:100rpx ;
  1351. }
  1352. }
  1353. .vipCourseBtn{
  1354. background: #1B1F22;
  1355. border-radius: 46rpx;
  1356. border: 1px solid #FFDAA3;
  1357. color: #FFDAA3;
  1358. width: calc(33.33333% - 46.6666rpx);
  1359. }
  1360. .vipAc{
  1361. background: linear-gradient(90deg, #FFE0B2, #F8BA8B);
  1362. border-radius: 46rpx;
  1363. border: 1px solid #FFDAA3;
  1364. color: #1B1F22;
  1365. }
  1366. .privilegeBox{
  1367. background-color:#171a1d;
  1368. box-sizing: border-box;
  1369. }
  1370. .primenu-box{
  1371. border-radius: 16rpx;
  1372. margin-top: 0rpx;
  1373. padding: 10rpx 20rpx;
  1374. }
  1375. .content-inner {
  1376. display: flex;
  1377. flex-wrap: wrap;
  1378. min-height:310rpx ;
  1379. }
  1380. .content-inner .item{
  1381. width: calc(33.3333333%);
  1382. height: 150rpx;
  1383. display: flex;
  1384. flex-direction: column;
  1385. align-items: center;
  1386. justify-content: center;
  1387. margin-top: 0rpx;
  1388. }
  1389. .content-inner .item .img{
  1390. width: 84rpx;
  1391. height: 84rpx;
  1392. margin-bottom: 8rpx;
  1393. }
  1394. .content-inner .item .label{
  1395. font-size: 32rpx;
  1396. color: #83878A;
  1397. }
  1398. .vipMethodItem{
  1399. border-radius: 10rpx;
  1400. width: calc(100%);
  1401. height: 70rpx;
  1402. color: #FDD8A1;
  1403. }
  1404. .payTypeItem{
  1405. background-color:#1B1F22;
  1406. border:1px solid #fff;
  1407. border-radius: 10rpx;
  1408. width: calc(50% - 15rpx);
  1409. height: 94rpx;
  1410. }
  1411. .circle{
  1412. border:1px solid #FDD8A1;
  1413. }
  1414. .pt_ac{
  1415. border:1px solid #FDD8A1;
  1416. }
  1417. .slider-box{
  1418. flex:1
  1419. }
  1420. </style>