expert.vue 13 KB

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