life.vue 15 KB

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