life.vue 13 KB

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