detail.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463
  1. <template>
  2. <view>
  3. <view style="position: fixed;width: 100%;z-index: 999;background: #FFFFFF;" id="top">
  4. <view class="video_box">
  5. <image v-if="!startStatus" src="https://cdn.uviewui.com/uview/swiper/3.jpg" style="width: 100%;height: 460rpx;"></image>
  6. <image v-if="!startStatus" class="video_play" src="/static/play.png" @click="startVideo"></image>
  7. <polyv-player
  8. v-else
  9. id="playerVideo"
  10. playerId="playerVideo"
  11. height="460rpx"
  12. :vid="vid"
  13. :showSettingBtn="true"
  14. isAllowSeek="ifViewed"
  15. :showPlaybackRateBtn="false"
  16. :enablePlayGesture="true"
  17. ></polyv-player>
  18. </view>
  19. <view>
  20. <u-row>
  21. <u-col span="8" offset="1"><view class="video_t1">2020年二级建造师教育选修</view></u-col>
  22. <u-col span="3"><view class="video_t1">共60课时</view></u-col>
  23. </u-row>
  24. </view>
  25. <view><u-tabs :list="list" font-size="24" bar-width="90" :current="current" @change="change" active-color="#32467B"></u-tabs></view>
  26. <u-line color="#D6D6DB" />
  27. </view>
  28. <view class="box" @touchmove="touchMove">
  29. <view id="modules1">
  30. <!-- 课程目录-->
  31. <view style="padding-top: 15rpx;">
  32. <u-row>
  33. <u-col span="9">
  34. <view class="video_t2" style="display: flex;align-items: center;">
  35. <view class="top_line"></view>
  36. 课程目录
  37. </view>
  38. </u-col>
  39. <u-col span="3" text-align="right">
  40. <view class="video_t2">
  41. 共60节课
  42. <u-icon name="arrow-right" size="28"></u-icon>
  43. </view>
  44. </u-col>
  45. </u-row>
  46. <view class="scroll_box">
  47. <scroll-view class="r_sliper" scroll-x="true">
  48. <view v-for="(item, index) in list" :key="index" style="margin-right: 20rpx;display:inline-block"><view class="r_t2">二级建造师市政..</view></view>
  49. </scroll-view>
  50. </view>
  51. </view>
  52. <u-line color="#D6D6DB" />
  53. </view>
  54. <view id="modules2">
  55. <!-- 课程介绍-->
  56. <view style="padding-top: 15rpx;">
  57. <u-row>
  58. <u-col span="8">
  59. <view class="video_t2" style="display: flex;align-items: center;">
  60. <view class="top_line"></view>
  61. 课程介绍
  62. </view>
  63. </u-col>
  64. </u-row>
  65. </view>
  66. <view class="t2">这是一段课程介绍文本,课程介绍内容可在后台设置编辑,以富 文本形式呈现,常见的由图片和文本组成。</view>
  67. <u-line color="#D6D6DB" />
  68. </view>
  69. <!-- 出题名师-->
  70. <view id="modules3">
  71. <view style="padding: 15rpx 0;">
  72. <u-row>
  73. <u-col span="8">
  74. <view class="video_t2" style="display: flex;align-items: center;">
  75. <view class="top_line"></view>
  76. 出题名师
  77. </view>
  78. </u-col>
  79. </u-row>
  80. <u-row>
  81. <view style="margin: 25rpx;display: flex;">
  82. <view><image src="/static/avatar1.png" class="teacher_img"></image></view>
  83. <view class="teacher_t">
  84. 建工学院名誉院长,建造师建筑资深导师,北京工业大学教授,建造师考试大纲编委会编委。参与过国家一级注册建造师考试大纲、考试辅导书、习题集等书的编写。
  85. </view>
  86. </view>
  87. </u-row>
  88. </view>
  89. <u-line color="#D6D6DB" />
  90. </view>
  91. <!-- 相关推荐-->
  92. <view style="padding-top: 15rpx;" id="modules4" :style="'padding-bottom:' + modules4Bottom + 'px'">
  93. <u-row>
  94. <u-col span="8">
  95. <view class="video_t2" style="display: flex;align-items: center;">
  96. <view class="top_line"></view>
  97. 相关推荐
  98. </view>
  99. </u-col>
  100. </u-row>
  101. <view style="margin: 10rpx;">
  102. <view class="tj_box" v-for="(item, index) in list" :key="index">
  103. <image src="http://192.168.0.222:8080/img/banner1.png" style="width: 320rpx;height: 160rpx;"></image>
  104. <view style="font-size: 24rpx;color: #666666;d">2020年二级建造师继续教...</view>
  105. <view>
  106. <u-row>
  107. <u-col span="6">
  108. <view style="margin-left: 20rpx;">
  109. <image src="/static/people.png" style="width: 20rpx;height: 20rpx;"></image>
  110. <text style="color: #999999;font-size: 20rpx;margin-left: 10rpx;">2023</text>
  111. </view>
  112. </u-col>
  113. <u-col span="6" text-align="right">
  114. <text style="color: #E91313;font-size: 16rpx;margin-left: 8rpx;">活动价</text>
  115. <text style="color: #E91313;font-size: 24rpx;font-weight: bold;">¥499</text>
  116. </u-col>
  117. </u-row>
  118. </view>
  119. </view>
  120. </view>
  121. </view>
  122. </view>
  123. <view class="footer_tab" id="foot">
  124. <u-line color="#D6D6DB" />
  125. <view style="height: 100%;display: flex;align-items: center;position: relative;">
  126. <view style="text-align: center;margin-left: 30rpx;">
  127. <image src="/static/sc.png" class="sc"></image>
  128. <view class="sc_t">收藏</view>
  129. </view>
  130. <view style="text-align: center;margin-left: 30rpx;">
  131. <view class="price_t1">¥699</view>
  132. <view class="price_t2">¥699</view>
  133. </view>
  134. <view class="buy" @click="jumpBuy">立即购买</view>
  135. </view>
  136. </view>
  137. </view>
  138. </template>
  139. <script>
  140. export default {
  141. data() {
  142. return {
  143. list: [
  144. {
  145. name: '课程目录'
  146. },
  147. {
  148. name: '课程介绍'
  149. },
  150. {
  151. name: '出题名师'
  152. },
  153. {
  154. name: '相关推荐'
  155. }
  156. ],
  157. current: 0,
  158. h1: 0,
  159. h2: 0,
  160. h3: 0,
  161. h4: 0,
  162. hh1: 0,
  163. hh2: 0,
  164. hh3: 0,
  165. hh4: 0,
  166. foot_h: 0,
  167. top_h: 0,
  168. windowHeight: 0,
  169. modules4Bottom: 0,
  170. isClick: false,
  171. vid: 'd5f6d309fe0b016d3844b194a8b32249_d', // 视频ID
  172. sign: '',
  173. ts: '',
  174. startStatus: false
  175. };
  176. },
  177. onShow() {
  178. let that = this;
  179. const query = uni.createSelectorQuery().in(this);
  180. query
  181. .select('#modules1')
  182. .boundingClientRect(data => {
  183. that.h1 = data.height;
  184. that.countHeight(that);
  185. })
  186. .exec();
  187. query
  188. .select('#modules2')
  189. .boundingClientRect(data => {
  190. that.h2 = data.height;
  191. that.countHeight(that);
  192. })
  193. .exec();
  194. query
  195. .select('#modules3')
  196. .boundingClientRect(data => {
  197. that.h3 = data.height;
  198. that.countHeight(that);
  199. })
  200. .exec();
  201. query
  202. .select('#modules4')
  203. .boundingClientRect(data => {
  204. that.h4 = data.height;
  205. that.countHeight(that);
  206. })
  207. .exec();
  208. query
  209. .select('#foot')
  210. .boundingClientRect(data => {
  211. that.foot_h = data.height;
  212. that.countModelusPadding();
  213. })
  214. .exec();
  215. query
  216. .select('#top')
  217. .boundingClientRect(data => {
  218. that.top_h = data.height;
  219. that.countModelusPadding();
  220. })
  221. .exec();
  222. this.windowHeight = uni.getSystemInfoSync().windowHeight;
  223. },
  224. onPageScroll: function(e) {
  225. //防止触发两次跳动
  226. if (this.isClick) {
  227. return;
  228. }
  229. if (e.scrollTop <= this.hh1) {
  230. this.current = 0;
  231. }
  232. if (e.scrollTop <= this.hh2 && e.scrollTop > this.hh1) {
  233. this.current = 1;
  234. }
  235. if (e.scrollTop <= this.hh3 && e.scrollTop > this.hh2) {
  236. this.current = 2;
  237. }
  238. if (e.scrollTop > this.hh3) {
  239. this.current = 3;
  240. }
  241. },
  242. methods: {
  243. startVideo() {
  244. uni.getStorageSync('union_id');
  245. if (!uni.getStorageSync('union_id')) {
  246. uni.navigateTo({
  247. url: '/pages/login/login'
  248. });
  249. } else {
  250. this.$api
  251. .polyvVideoSign(this.vid)
  252. .then(res => {
  253. console.log(res);
  254. this.startStatus = true;
  255. // this.sign = res.data.data.sign;
  256. // this.ts = res.data.data.ts;
  257. })
  258. .catch(err => {
  259. console.log('报错');
  260. });
  261. }
  262. },
  263. touchMove(e) {
  264. this.isClick = false;
  265. },
  266. countModelusPadding() {
  267. let offsetHeight = this.windowHeight - this.foot_h - this.top_h;
  268. this.modules4Bottom = offsetHeight > this.h4 ? offsetHeight - this.h4 : 7;
  269. },
  270. countHeight(that) {
  271. this.hh1 = this.h1;
  272. this.hh2 = this.h1 + this.h2;
  273. this.hh3 = this.h1 + this.h2 + this.h3;
  274. this.hh4 = this.h1 + this.h2 + this.h3 + this.h4;
  275. },
  276. change(index) {
  277. this.current = index;
  278. let that = this;
  279. this.isClick = true;
  280. if (index == 0) {
  281. uni.pageScrollTo({
  282. scrollTop: 0
  283. });
  284. }
  285. if (index == 1) {
  286. uni.pageScrollTo({
  287. scrollTop: that.h1 + 4
  288. });
  289. }
  290. if (index == 2) {
  291. uni.pageScrollTo({
  292. scrollTop: that.h1 + that.h2 + 4
  293. });
  294. }
  295. if (index == 3) {
  296. uni.pageScrollTo({
  297. scrollTop: that.h1 + that.h2 + that.h3 + 4
  298. });
  299. }
  300. },
  301. jumpBuy() {
  302. var self = this;
  303. uni.getStorage({
  304. key: 'union_id',
  305. success: function(res) {
  306. // 继续操作
  307. self.$api.getInfo().then(result => {
  308. console.log(result);
  309. });
  310. },
  311. fail: function(err) {
  312. //重新登入
  313. self.$navTo.togo('/pages/login/login', {});
  314. }
  315. });
  316. }
  317. }
  318. };
  319. </script>
  320. <style>
  321. ::-webkit-scrollbar {
  322. width: 0;
  323. height: 0;
  324. color: transparent;
  325. }
  326. </style>
  327. <style scope>
  328. .box {
  329. position: relative;
  330. top: 600rpx;
  331. padding-bottom: 88rpx;
  332. }
  333. .price_t2 {
  334. font-size: 18rpx;
  335. font-family: PingFang SC;
  336. font-weight: 500;
  337. text-decoration: line-through;
  338. color: #999999;
  339. }
  340. .price_t1 {
  341. font-size: 33rpx;
  342. font-family: PingFang SC;
  343. font-weight: bold;
  344. color: #e91313;
  345. }
  346. .sc_t {
  347. font-size: 22rpx;
  348. color: #000000;
  349. }
  350. .sc {
  351. width: 29rpx;
  352. height: 29rpx;
  353. }
  354. .buy {
  355. width: 138rpx;
  356. height: 48rpx;
  357. line-height: 48rpx;
  358. background: #32467b;
  359. border-radius: 10rpx;
  360. color: #ffffff;
  361. font-size: 28rpx;
  362. text-align: center;
  363. vertical-align: middle;
  364. position: absolute;
  365. right: 30rpx;
  366. }
  367. .video_body {
  368. padding-bottom: 96rpx;
  369. }
  370. .footer_tab {
  371. position: fixed;
  372. bottom: 0;
  373. height: 96rpx;
  374. width: 100%;
  375. background-color: #ffffff;
  376. }
  377. .tj_box {
  378. width: 50%;
  379. display: inline-block;
  380. text-align: center;
  381. margin: 10rpx 0;
  382. }
  383. .teacher_t {
  384. font-size: 24rpx;
  385. font-family: PingFang SC;
  386. font-weight: 400;
  387. color: #666666;
  388. line-height: 36rpx;
  389. margin-left: 15rpx;
  390. }
  391. .teacher_img {
  392. width: 87rpx;
  393. height: 129rpx;
  394. }
  395. .t2 {
  396. font-size: 24rpx;
  397. font-family: PingFang SC;
  398. color: #666666;
  399. line-height: 36rpx;
  400. margin: 15rpx;
  401. }
  402. .r_t2 {
  403. width: 201rpx;
  404. height: 49rpx;
  405. background: rgba(22, 119, 255, 0.05);
  406. border: 1rpx solid #32467b;
  407. border-radius: 16rpx;
  408. color: #666666;
  409. font-size: 23rpx;
  410. text-align: center;
  411. display: flex;
  412. align-items: center;
  413. padding: 5rpx;
  414. }
  415. .scroll_box {
  416. width: 100%;
  417. height: 60rpx;
  418. background: #ffffff;
  419. box-shadow: 0rpx 0rpx 16rpx 4rpx rgba(145, 156, 178, 0.1);
  420. white-space: nowrap;
  421. overflow: hidden;
  422. margin: 15rpx 0;
  423. }
  424. .r_sliper {
  425. padding: 0 20rpx;
  426. }
  427. .top_line {
  428. width: 6rpx;
  429. height: 22rpx;
  430. background: #32467b;
  431. margin-right: 10rpx;
  432. }
  433. .video_t2 {
  434. font-size: 24rpx;
  435. font-family: PingFang SC;
  436. font-weight: 500;
  437. color: #666666;
  438. }
  439. .video_t1 {
  440. font-size: 28rpx;
  441. font-family: PingFang SC;
  442. font-weight: bold;
  443. color: #333333;
  444. }
  445. .video_play {
  446. position: absolute;
  447. width: 95rpx;
  448. height: 95rpx;
  449. top: 0;
  450. left: 0;
  451. right: 0;
  452. bottom: 0;
  453. margin: auto;
  454. }
  455. .video_box {
  456. position: relative;
  457. }
  458. page {
  459. background: #ffffff;
  460. }
  461. </style>