list.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638
  1. <template>
  2. <view class="content">
  3. <view class="info">
  4. <image class="info-bg" src="https://cdn.his.cdwjyyh.com/images/live_broadcast_bg.png"></image>
  5. <view class="status_bar" :style="{height: statusBarHeight}"></view>
  6. <view class="shop-block">
  7. <view class="shop">
  8. <image class="w40 h40" src="https://cdn.his.cdwjyyh.com/images/shopping_car.png"></image>
  9. </view>
  10. </view>
  11. <view class="vedio-block">
  12. <view class="top">
  13. <view class="tab-wrapper">
  14. <!-- 直播 -->
  15. <view class="tab-item" :class="{ active: activeTab === 0 }" @click="switchTab(0)">
  16. <text class="tab-text">直播中</text>
  17. <image class="line" v-if="activeTab === 0" src="https://cdn.his.cdwjyyh.com/images/header_tabs_icon.png"
  18. alt="" />
  19. </view>
  20. <!-- 直播预告-->
  21. <view class="tab-item" :class="{ active: activeTab === 1 }" @click="switchTab(1)">
  22. <text class="tab-text">直播预告</text>
  23. <image class="line" v-if="activeTab === 1" src="https://cdn.his.cdwjyyh.com/images/header_tabs_icon.png"
  24. alt="" />
  25. </view>
  26. </view>
  27. </view>
  28. <!-- 视频文章列表 -->
  29. <mescroll-body bottom="0" ref="mescrollRef" @init="mescrollInit" @down="downCallback" @up="upCallback"
  30. :down="downOption" :up="upOption">
  31. <view class="list" v-if="activeTab === 0">
  32. <view class="list-item" @click="goLive(item)" v-for="(item,index) in list" :key="index">
  33. <image class="img" v-if="item.liveImgUrl" :src="item.liveImgUrl" mode="widthFix"></image>
  34. <!-- 重庆 · 优选标签 -->
  35. <view class="lable">
  36. <view class="play-lable">
  37. <image class="icon" src="https://cdn.his.cdwjyyh.com/images/play.gif"></image>
  38. </view>
  39. <view class="place-label">
  40. 重庆 · 优选
  41. </view>
  42. </view>
  43. <!-- 直播中标签 -->
  44. <view class="live-lable" v-if="false">
  45. <image class="icon" src="https://cdn.his.cdwjyyh.com/images/play.gif"></image>
  46. <text>直播中</text>
  47. </view>
  48. <view class="info-block">
  49. <view class="title ellipsis2">冰乳绿豆糕 冰冰凉凉谁吃谁迷糊! 谁懂,...冰乳绿豆糕 冰冰凉凉谁吃谁迷糊!</view>
  50. <view class="item">
  51. <view class="flex">
  52. <image class="head" src="https://cdn.his.cdwjyyh.com/images/img.png"></image>
  53. <text class="name">崔医生</text>
  54. </view>
  55. <view class="flex">
  56. <image class="icon" src="https://cdn.his.cdwjyyh.com/images/watch_number_icon.png"></image>
  57. <text>141</text>
  58. </view>
  59. </view>
  60. </view>
  61. </view>
  62. </view>
  63. <view class="list" v-if="activeTab === 1">
  64. <view class="list-item2" @click="goLive(item)" v-for="(item,index) in list" :key="index">
  65. <view class="img-box">
  66. <view class="time-block">
  67. <view class="date">9/11</view>
  68. <view class="time">20:00开播</view>
  69. </view>
  70. <image class="img" v-if="item.liveImgUrl" :src="item.liveImgUrl">
  71. </image>
  72. </view>
  73. <!-- <image class="video-icon" src="https://cdn.his.cdwjyyh.com/images/video_icon.png"></image> -->
  74. <view class="info-block">
  75. <view class="title ellipsis2">冰乳绿豆糕 冰冰凉凉谁吃谁迷糊! 谁懂,...冰乳绿豆糕 冰冰凉凉谁吃谁迷糊!冰乳绿豆糕 冰冰凉凉谁吃谁迷糊!
  76. </view>
  77. <view class="shop-item">
  78. <image class="head" src="https://cdn.his.cdwjyyh.com/images/img.png"></image>
  79. <text class="name">芳华悦选旗舰店</text>
  80. </view>
  81. <view class="item">
  82. <view class="flex">
  83. <image class="icon" src="https://cdn.his.cdwjyyh.com/images/reservation_icon.png"></image>
  84. <text class="name">245人已预约</text>
  85. </view>
  86. <view class="button">预约</view>
  87. </view>
  88. </view>
  89. </view>
  90. </view>
  91. </mescroll-body>
  92. </view>
  93. </view>
  94. </view>
  95. </template>
  96. <script>
  97. import {
  98. liveList
  99. } from '@/api/living.js'
  100. import MescrollMixin from "@/uni_modules/mescroll-uni/components/mescroll-uni/mescroll-mixins.js";
  101. export default {
  102. mixins: [MescrollMixin],
  103. data() {
  104. return {
  105. activeTab: 0,
  106. // 状态栏的高度
  107. statusBarHeight: uni.getStorageSync('menuInfo').statusBarHeight,
  108. list: [],
  109. downOption: {
  110. offset: 80,
  111. use: true,
  112. auto: false
  113. },
  114. upOption: {
  115. use: true,
  116. auto: true,
  117. page: {
  118. num: 0,
  119. size: 10
  120. }
  121. },
  122. mescroll: null,
  123. }
  124. },
  125. onLoad() {
  126. },
  127. onUnload() {
  128. },
  129. methods: {
  130. switchTab(tab) {
  131. if (this.activeTab === tab) return;
  132. this.activeTab = tab;
  133. this.$emit('change', tab);
  134. },
  135. mescrollInit(mescroll) {
  136. this.mescroll = mescroll;
  137. },
  138. // 下拉刷新回调
  139. downCallback(mescroll) {
  140. this.list = [];
  141. mescroll.resetUpScroll();
  142. },
  143. // 上拉加载回调
  144. upCallback(mescroll) {
  145. const pageNum = mescroll.num;
  146. const pageSize = mescroll.size;
  147. let data = {
  148. pageSize: pageSize,
  149. pageNum: pageNum,
  150. }
  151. liveList(data).then(res => {
  152. if (!res) {
  153. mescroll.endErr();
  154. return;
  155. }
  156. if (res.code == 200) {
  157. let curPageData = Array.isArray(res.data.list) ? res.data.list : [];
  158. let totalSize = Number(res.data.total) || 0;
  159. if (pageNum === 1) {
  160. this.list = [];
  161. }
  162. this.list = this.list.concat(curPageData);
  163. mescroll.endBySize(curPageData.length, totalSize);
  164. } else {
  165. mescroll.endErr();
  166. uni.showToast({
  167. title: res.msg,
  168. icon: 'none'
  169. });
  170. }
  171. }).catch(err => {
  172. mescroll.endErr();
  173. });
  174. },
  175. goLive(item) {
  176. uni.navigateTo({
  177. url: `./living?liveId=${item.liveId}`
  178. });
  179. }
  180. }
  181. }
  182. </script>
  183. <style lang="scss" scoped>
  184. .ellipsis2 {
  185. display: -webkit-box;
  186. -webkit-box-orient: vertical;
  187. -webkit-line-clamp: 2;
  188. overflow: hidden;
  189. word-break: break-all;
  190. }
  191. .content {
  192. background: #F5F7FA;
  193. min-height: 100vh;
  194. .info {
  195. width: 100%;
  196. height: 600rpx;
  197. position: relative;
  198. z-index: 0;
  199. .shop-block {
  200. display: flex;
  201. justify-content: flex-end;
  202. .shop {
  203. width: 64rpx;
  204. height: 64rpx;
  205. padding: 12rpx;
  206. margin-right: 210rpx;
  207. border-radius: 32rpx 32rpx 32rpx 32rpx;
  208. border: 1rpx solid #E9E9E9;
  209. box-sizing: border-box;
  210. background: #FFFFFF;
  211. }
  212. }
  213. .info-bg {
  214. position: absolute;
  215. z-index: -1;
  216. width: 100%;
  217. height: 100%;
  218. }
  219. .data-block {
  220. padding: 0 20rpx;
  221. margin-top: 30rpx;
  222. display: flex;
  223. justify-content: space-between;
  224. align-items: center;
  225. .number-block {
  226. display: flex;
  227. .item {
  228. margin-right: 32rpx;
  229. display: flex;
  230. flex-direction: column;
  231. align-items: center;
  232. .number-item {
  233. font-family: Roboto, Roboto;
  234. font-weight: 600;
  235. font-size: 36rpx;
  236. color: #FFFFFF;
  237. }
  238. .txt-item {
  239. margin-top: 6rpx;
  240. font-size: 26rpx;
  241. color: rgba(255, 255, 255, 0.7);
  242. }
  243. }
  244. }
  245. .button {
  246. width: 144rpx;
  247. height: 56rpx;
  248. background: #FFFFFF;
  249. border-radius: 28rpx 28rpx 28rpx 28rpx;
  250. display: flex;
  251. align-items: center;
  252. justify-content: center;
  253. font-size: 24rpx;
  254. color: #02B176;
  255. .icon {
  256. width: 24rpx;
  257. height: 24rpx;
  258. margin-right: 4rpx;
  259. }
  260. }
  261. }
  262. .shop-icon {
  263. display: flex;
  264. justify-content: flex-end;
  265. margin: 12rpx 210rpx 0 0;
  266. }
  267. //视频
  268. .vedio-block {
  269. position: relative;
  270. z-index: 1;
  271. padding: 26rpx 0;
  272. .top {
  273. display: flex;
  274. }
  275. .tab-wrapper {
  276. display: flex;
  277. height: 88rpx;
  278. padding: 0 40rpx;
  279. position: relative;
  280. .tab-item {
  281. display: flex;
  282. flex-direction: column;
  283. align-items: center;
  284. justify-content: center;
  285. position: relative;
  286. font-size: 32rpx;
  287. color: #333333;
  288. margin-right: 44rpx;
  289. &.active {
  290. font-weight: 600;
  291. font-size: 40rpx;
  292. }
  293. .tab-text {
  294. font-size: 32rpx;
  295. transition: all 0.3s ease;
  296. }
  297. .line {
  298. width: 68rpx;
  299. height: 28rpx;
  300. position: absolute;
  301. top: 44rpx;
  302. z-index: -1;
  303. }
  304. }
  305. }
  306. .icon {
  307. display: flex;
  308. justify-content: flex-end;
  309. }
  310. @keyframes slideIn {
  311. from {
  312. opacity: 0;
  313. transform: translateX(-50%) scaleX(0.5);
  314. }
  315. to {
  316. opacity: 1;
  317. transform: translateX(-50%) scaleX(1);
  318. }
  319. }
  320. .list {
  321. padding: 24rpx 24rpx;
  322. display: flex;
  323. justify-content: space-between;
  324. flex-wrap: wrap;
  325. .list-item {
  326. width: 342rpx;
  327. margin-bottom: 18rpx;
  328. position: relative;
  329. display: flex;
  330. flex-direction: column;
  331. border-radius: 16rpx 16rpx 16rpx 16rpx;
  332. .lable {
  333. position: absolute;
  334. left: 16rpx;
  335. top: 16rpx;
  336. display: flex;
  337. text-align: center;
  338. border-radius: 6rpx 6rpx 6rpx 6rpx;
  339. overflow: hidden;
  340. .play-lable {
  341. width: 40rpx;
  342. height: 40rpx;
  343. line-height: 40rpx;
  344. font-size: 20rpx;
  345. color: #FFFFFF;
  346. background: linear-gradient(136deg, #38D97D 0%, #02B176 100%);
  347. display: flex;
  348. justify-content: center;
  349. align-items: center;
  350. .icon {
  351. width: 24rpx;
  352. height: 24rpx;
  353. }
  354. }
  355. .place-label {
  356. width: 106rpx;
  357. height: 40rpx;
  358. background: rgba(0, 0, 0, 0.6);
  359. line-height: 40rpx;
  360. font-size: 20rpx;
  361. color: #FFFFFF;
  362. }
  363. }
  364. .live-lable {
  365. position: absolute;
  366. left: 16rpx;
  367. top: 16rpx;
  368. display: flex;
  369. width: 104rpx;
  370. height: 40rpx;
  371. background: #FA341E;
  372. align-items: center;
  373. justify-content: center;
  374. border-radius: 6rpx 6rpx 6rpx 6rpx;
  375. font-size: 20rpx;
  376. color: #FFFFFF;
  377. .icon {
  378. width: 24rpx;
  379. height: 24rpx;
  380. margin-right: 4rpx;
  381. }
  382. }
  383. .img {
  384. width: 100%;
  385. border-radius: 16rpx 16rpx 0rpx 0rpx;
  386. }
  387. .info-block {
  388. border-radius: 0rpx 0rpx 16rpx 16rpx;
  389. padding: 12rpx 20rpx 20rpx;
  390. box-sizing: border-box;
  391. width: 100%;
  392. background: #FFFFFF;
  393. display: flex;
  394. flex-direction: column;
  395. .title {
  396. font-weight: 500;
  397. font-size: 28rpx;
  398. color: #333333;
  399. margin-bottom: 20rpx;
  400. }
  401. .item {
  402. display: flex;
  403. justify-content: space-between;
  404. align-items: center;
  405. margin-bottom: 20rpx;
  406. .flex {
  407. display: flex;
  408. align-items: center;
  409. font-size: 22rpx;
  410. color: #999999;
  411. }
  412. .icon {
  413. width: 32rpx;
  414. height: 32rpx;
  415. margin-right: 4rpx;
  416. }
  417. .head {
  418. width: 32rpx;
  419. height: 32rpx;
  420. border-radius: 50%;
  421. margin-right: 8rpx;
  422. }
  423. .name {
  424. color: #757575;
  425. }
  426. }
  427. text {
  428. white-space: nowrap;
  429. overflow: hidden;
  430. text-overflow: ellipsis;
  431. }
  432. }
  433. }
  434. .list-item2 {
  435. width: 100%;
  436. margin-bottom: 18rpx;
  437. position: relative;
  438. display: flex;
  439. align-items: center;
  440. justify-content: space-between;
  441. margin-bottom: 20rpx;
  442. border-radius: 16rpx 16rpx 16rpx 16rpx;
  443. background: #ffffff;
  444. padding: 24rpx;
  445. .img-box {
  446. position: relative;
  447. width: 280rpx;
  448. height: 220rpx;
  449. overflow: hidden;
  450. flex-shrink: 0;
  451. border-radius: 16rpx 16rpx 16rpx 16rpx;
  452. margin-right: 24rpx;
  453. .time-block {
  454. position: absolute;
  455. left: 16rpx;
  456. top: 16rpx;
  457. display: flex;
  458. text-align: center;
  459. border-radius: 6rpx 6rpx 6rpx 6rpx;
  460. overflow: hidden;
  461. .date {
  462. width: 56rpx;
  463. height: 40rpx;
  464. line-height: 40rpx;
  465. font-size: 20rpx;
  466. color: #FFFFFF;
  467. background: #F4A007;
  468. }
  469. .time {
  470. width: 110rpx;
  471. height: 40rpx;
  472. background: rgba(0, 0, 0, 0.6);
  473. line-height: 40rpx;
  474. font-size: 20rpx;
  475. color: #FFFFFF;
  476. }
  477. }
  478. .img {
  479. width: 100%;
  480. height: 100%;
  481. }
  482. }
  483. .info-block {
  484. padding: 12rpx 20rpx 20rpx;
  485. box-sizing: border-box;
  486. width: 100%;
  487. display: flex;
  488. flex-direction: column;
  489. .title {
  490. font-weight: 500;
  491. font-size: 32rpx;
  492. color: #333333;
  493. margin-bottom: 12rpx;
  494. }
  495. .shop-item {
  496. display: flex;
  497. font-size: 24rpx;
  498. color: #666666;
  499. align-items: center;
  500. margin-bottom: 34rpx;
  501. .icon {
  502. width: 32rpx;
  503. height: 32rpx;
  504. margin-right: 12rpx;
  505. }
  506. .head {
  507. width: 32rpx;
  508. height: 32rpx;
  509. border-radius: 50%;
  510. margin-right: 8rpx;
  511. }
  512. .name {
  513. color: #757575;
  514. }
  515. }
  516. .item {
  517. display: flex;
  518. justify-content: space-between;
  519. align-items: center;
  520. font-size: 22rpx;
  521. color: #999999;
  522. .flex {
  523. display: flex;
  524. align-items: center;
  525. }
  526. .icon {
  527. width: 24rpx;
  528. height: 24rpx;
  529. margin-right: 8rpx;
  530. }
  531. .button {
  532. width: 136rpx;
  533. height: 64rpx;
  534. background: linear-gradient(136deg, #38D97D 0%, #02B176 100%);
  535. border-radius: 32rpx 32rpx 32rpx 32rpx;
  536. font-weight: 500;
  537. font-size: 28rpx;
  538. color: #FFFFFF;
  539. text-align: center;
  540. line-height: 64rpx;
  541. }
  542. .name {
  543. color: #757575;
  544. }
  545. }
  546. text {
  547. white-space: nowrap;
  548. overflow: hidden;
  549. text-overflow: ellipsis;
  550. }
  551. }
  552. }
  553. .list-item:nth-child(2n) {
  554. margin-right: 0;
  555. }
  556. }
  557. }
  558. }
  559. }
  560. </style>