index.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525
  1. <template>
  2. <view style="position: relative;">
  3. <image class="page_bg" :src="info.backGround||defaultBg" mode="widthFix"></image>
  4. <view class="content-header">
  5. <image class="backicon" src="/static/image/liveStream/back_white_icon.png" mode="aspectFill" @click="$navBack()"></image>
  6. <view class="editinfo" v-if="info.userId&&info.userId == userId" @click="$navTo('/pages/expert/info')">编辑资料</view>
  7. </view>
  8. <u-sticky offsetTop="0" customNavHeight="0" zIndex="999">
  9. <view class="content-header-sticky" :style="{height:`calc(${statusBarHeight}px + 44px)`,opacity:opacity,display:showNav? 'flex':'none'}" @click.stop="">
  10. <image src="/static/image/black_back.png" mode="aspectFill" @click="$navBack()"></image>
  11. <text class="textOne" style="width: 50%;text-align: center;">{{info.nickName}}</text>
  12. </view>
  13. </u-sticky>
  14. <view class="content-body">
  15. <mescroll-body ref="mescrollRef" @init="mescrollInit" @down="downCallback" @up="upCallback" :down="downOption" :up="upOption">
  16. <view class="user">
  17. <u-avatar :src="info.avatar||'/static/logo.png'" size="88"></u-avatar>
  18. <view class="user-left">
  19. <view class="textOne">{{info.nickName}}</view>
  20. <view class="levelbox">
  21. <image class="levelbox-icon" src="/static/image/my/intelligent_icon.png" mode="aspectFill"></image>
  22. <text>LV.{{info.level}}</text>
  23. </view>
  24. </view>
  25. </view>
  26. <view class="content-box">
  27. <view class="rowbox es-pr-24">
  28. <view class="x-f flex">
  29. <view class="rowbox-item">
  30. <view>{{formatNum(fansCount)}}</view>
  31. <text>粉丝</text>
  32. </view>
  33. <view class="rowbox-item">
  34. <view>{{formatNum(idolCount)}}</view>
  35. <text>关注</text>
  36. </view>
  37. <view class="rowbox-item">
  38. <view>{{formatNum(favoriteNum)}}</view>
  39. <text>收藏</text>
  40. </view>
  41. <view class="rowbox-item">
  42. <view>{{formatNum(likeNum)}}</view>
  43. <text>获赞</text>
  44. </view>
  45. </view>
  46. <view class="es-ml-24">
  47. <image class="es-icon-80 es-mr-24" src="/static/images/other/user/dy.png" mode="aspectFill"></image>
  48. <image class="es-icon-80" src="/static/images/other/user/ks.png" mode="aspectFill"></image>
  49. </view>
  50. </view>
  51. <view class="es-pl-24 es-pr-24 es-mt-32 es-fs-26">{{info.title}}</view>
  52. <view class="taglist es-pl-24 es-mt-26 x-f es-fs-22">
  53. <view class="x-c" style="min-width: 60px;">
  54. <u-icon v-show="info.sex==1" class="sexicon" name="woman" color="#FF8394" size="16"></u-icon>
  55. <u-icon v-show="info.sex==0" class="sexicon" name="man" color="#2979ff" size="16"></u-icon>
  56. <text v-show="info.sex!=1&&info.sex!=0" style="margin-right: 6rpx;">未知</text>
  57. <text>{{info.birthDay&&$getAge(info.birthDay)|| '--'}}岁</text>
  58. <!-- 0男,1女,2未知 -->
  59. </view>
  60. <view class="textOne" style="max-width: 320rpx;" v-if="info.address">{{info.province}}</view>
  61. <view class="textOne" v-for="(tag,index) in tags" :key="index">{{tag}}</view>
  62. </view>
  63. <view class="x-f es-mt-16 es-pr-24 es-pl-24" v-if="info.userId&&info.userId != userId">
  64. <view class="item_btn x-c es-mr-24" @click="handleFollow">
  65. <template v-if="isFollow==1">
  66. 取消关注
  67. </template>
  68. <template v-else>
  69. <u-icon name="plus" color="#fff" size="16" class="es-pr-14"></u-icon>关注
  70. </template>
  71. </view>
  72. <!-- <view class="item_btn x-c">私信</view> -->
  73. </view>
  74. <!-- <view class="x-f es-mt-24 es-pl-24 es-pr-24">
  75. <view class="user-item es-pt-14 es-pb-14 es-pl-22 es-pr-22">
  76. <view class="x-f">
  77. <image class="icon" src="/static/image/liveStream/recommend_icon.png" mode="aspectFill"></image>
  78. <view class="es-ml-17 es-fs-26 es-fw-500">达人推荐</view>
  79. </view>
  80. <view class="es-fs-22 es-mt-4 es-c-99">超多性价比好物</view>
  81. </view>
  82. <view class="user-item es-pt-14 es-pb-14 es-pl-22 es-pr-22">
  83. <view class="x-f">
  84. <image class="icon" src="/static/image/liveStream/my_wallet_icon.png" mode="aspectFill"></image>
  85. <view class="es-ml-17 es-fs-26 es-fw-500">我的钱包</view>
  86. </view>
  87. <view class="es-fs-22 es-mt-4 es-c-99">查看可提现佣金</view>
  88. </view>
  89. <view class="user-item es-pt-14 es-pb-14 es-pl-22 es-pr-22">
  90. <view class="x-f">
  91. <image class="icon" src="/static/image/liveStream/browsing_history_icon.png" mode="aspectFill"></image>
  92. <view class="es-ml-17 es-fs-26 es-fw-500">浏览记录</view>
  93. </view>
  94. <view class="es-fs-22 es-mt-4 es-c-99">我的访问记录</view>
  95. </view>
  96. </view> -->
  97. <u-sticky :offsetTop="0" :customNavHeight="customNavHeight" zIndex="999">
  98. <view class="tab-bar x-c es-mt-8">
  99. <view :class="current == 0 ? 'tab-bar-item active':'tab-bar-item'">主页</view>
  100. <view :class="current == 1 ? 'tab-bar-item active':'tab-bar-item'">收藏</view>
  101. </view>
  102. </u-sticky>
  103. <view class="es-pl-24 es-pr-24 es-pt-20 es-pb-20">
  104. <!-- <view class="x-bc es-pt-20 es-pb-32">
  105. <view class="x-f es-fs-32 es-fw-500">短视频<text class="x-f es-fs-28 es-ml-22">(6)</text></view>
  106. <view class="x-f es-fs-24 es-c-99">
  107. 查看全部
  108. <image class="es-w-48 es-h-48" src="/static/image/hall/my_right_arrow_right_icon.png" mode="aspectFill"></image>
  109. </view>
  110. </view> -->
  111. <!-- <mescroll-body ref="mescrollRef" @init="mescrollInit" @down="downCallback" @up="upCallback" :down="downOption" :up="upOption"> -->
  112. <view class="x-f video-list">
  113. <view class="video-item es-br-16" v-for="(item,i) in dataList" :key="i">
  114. <image class="video-item-img" :src="item.cover" mode="aspectFill"></image>
  115. <view class="textOne es-pl-20 es-pr-20 es-pt-22 es-pb-22">{{item.title}}</view>
  116. </view>
  117. </view>
  118. <!-- </mescroll-body> -->
  119. </view>
  120. </view>
  121. </mescroll-body>
  122. </view>
  123. <view class="footer x-c" v-if="info.userId&&info.userId == userId">
  124. <view class="x-c footer-fb" @click="$navTo('/pages/expert/releaseVideo')"><image src="/static/image/liveStream/publish_video_icon.png"></image>发布视频</view>
  125. <!-- <view class="x-c footer-zb"><image src="/static/image/liveStream/live_broadcast_icon2.png"></image>开直播</view> -->
  126. </view>
  127. </view>
  128. </template>
  129. <script>
  130. import { getTalentByToken,getVideoList,doFollow,checkFollow,getTalentByUserId } from "@/api/expert.js"
  131. import MescrollMixin from "@/uni_modules/mescroll-uni/components/mescroll-uni/mescroll-mixins.js";
  132. export default {
  133. // components: {
  134. // videoItem
  135. // },
  136. mixins: [MescrollMixin],
  137. data(){
  138. return {
  139. userId: '',
  140. statusBarHeight:uni.getSystemInfoSync().statusBarHeight,
  141. defaultBg: "https://cos.his.cdwjyyh.com/fs/20250509/e5fb40b2b6e640b48e5f055c786dd289.png",
  142. avatar:'',
  143. current: 0,
  144. customNavHeight: 22,
  145. showNav: false,
  146. opacity: 1,
  147. info: {},
  148. fansCount: 0,
  149. favoriteNum: 0,
  150. idolCount: 0,
  151. likeNum: 0,
  152. mescroll:null,
  153. downOption: { //下拉刷新
  154. use:true,
  155. auto: false // 不自动加载 (mixin已处理第一个tab触发downCallback)
  156. },
  157. upOption: {
  158. onScroll:false,
  159. use: true, // 是否启用上拉加载; 默认true
  160. page: {
  161. pae: 0, // 当前页码,默认0,回调之前会加1,即callback(page)会从1开始
  162. size: 10 // 每页数据的数量,默认10
  163. },
  164. noMoreSize: 10, // 配置列表的总数量要大于等于5条才显示'-- END --'的提示
  165. textNoMore:"已经到底了",
  166. empty: {
  167. icon:'/static/image/liveStream/video_default_img.png',
  168. tip: '暂无视频'
  169. }
  170. },
  171. dataList: [],
  172. user: {},
  173. isFollow: 0, // /是否已关注1:已关注,0:未关注
  174. talentUserId: '',
  175. }
  176. },
  177. computed:{
  178. formatNum(){
  179. return (num)=>{
  180. if(num>10000){
  181. return (num/10000.0).toFixed(1)+"万";
  182. }
  183. return num;
  184. }
  185. }
  186. },
  187. onLoad(option) {
  188. this.customNavHeight = this.statusBarHeight/2 + 44;
  189. this.user=this.$getUserInfo()
  190. this.userId = this.user.userId || ''
  191. this.talentUserId = option.userId || ''
  192. },
  193. onShow() {
  194. if(this.talentUserId) {
  195. this.getTalentInfo()
  196. } else {
  197. this.getInfo()
  198. }
  199. },
  200. methods: {
  201. getInfo() {
  202. getTalentByToken().then(res=>{
  203. if(res.code == 200) {
  204. this.info = res.data.fsUserTalent
  205. this.fansCount = res.data.fansCount
  206. this.favoriteNum = res.data.favoriteNum
  207. this.idolCount = res.data.idolCount
  208. this.likeNum = res.data.likeNum
  209. }
  210. })
  211. },
  212. getTalentInfo() {
  213. getTalentByUserId({userId: this.talentUserId}).then(res=>{
  214. if(res.code == 200) {
  215. this.info = res.data.fsUserTalent
  216. this.fansCount = res.data.fansCount
  217. this.favoriteNum = res.data.favoriteNum
  218. this.idolCount = res.data.idolCount
  219. this.likeNum = res.data.likeNum
  220. this.checkFollow()
  221. }
  222. })
  223. },
  224. handleFollow() {
  225. doFollow({talentId:this.info.talentId}).then(res=>{
  226. if(res.code==200) {
  227. if(this.isFollow == 1) {
  228. this.fansCount--
  229. } else {
  230. this.fansCount++
  231. }
  232. this.isFollow = this.isFollow==1?0:1
  233. }
  234. uni.showToast({
  235. title: res.msg
  236. })
  237. })
  238. },
  239. checkFollow() {
  240. checkFollow({talentId:this.info.talentId}).then(res=>{
  241. if(res.code == 200) {
  242. this.isFollow = res.isFollow || 0
  243. }
  244. })
  245. },
  246. mescrollInit(mescroll) {
  247. this.mescroll = mescroll;
  248. },
  249. /*下拉刷新的回调 */
  250. downCallback(mescroll) {
  251. mescroll.resetUpScroll()
  252. },
  253. upCallback(page) {
  254. //联网加载数据
  255. var that = this;
  256. var data = {
  257. userId:this.talentUserId||0,
  258. pageNum: page.num,
  259. pageSize: page.size
  260. };
  261. getVideoList(data).then(res => {
  262. if(res.code==200){
  263. //设置列表数据
  264. if (page.num == 1) {
  265. that.dataList = res.data.list;
  266. } else {
  267. that.dataList = that.dataList.concat(res.data.list);
  268. }
  269. that.mescroll.endBySize(res.data.list.length, res.data.total);
  270. }else{
  271. uni.showToast({
  272. icon:'none',
  273. title: "请求失败",
  274. });
  275. that.dataList = null;
  276. that.mescroll.endErr();
  277. }
  278. });
  279. }
  280. },
  281. onPageScroll(e) {
  282. if (e.scrollTop <= 136) {
  283. this.showNav = false
  284. this.opacity = 0
  285. } else if (e.scrollTop > 136) {
  286. this.opacity = e.scrollTop / 216 * 1 > 1 ? 1 :e.scrollTop / 216 * 1
  287. this.showNav = true
  288. }
  289. }
  290. }
  291. </script>
  292. <style>
  293. page {
  294. background-color: #fff;
  295. }
  296. </style>
  297. <style lang="scss" scoped>
  298. @mixin u-flex($flexD, $alignI, $justifyC) {
  299. display: flex;
  300. flex-direction: $flexD;
  301. align-items: $alignI;
  302. justify-content: $justifyC;
  303. }
  304. .page_bg {
  305. width: 100%;
  306. height: auto;
  307. position: absolute;
  308. top: 0;
  309. left: 0;
  310. }
  311. .content-header {
  312. position: relative;
  313. width: 100%;
  314. height: 44px;
  315. padding: 12rpx 24rpx;
  316. padding-top: calc(var(--status-bar-height) + 12rpx);
  317. @include u-flex(row-reverse, center, space-between);
  318. &-sticky {
  319. background-color: #fff;
  320. @include u-flex(row, center, center);
  321. position: absolute;
  322. width: 100%;
  323. image {
  324. width: 64rpx;
  325. height: 64rpx;
  326. position: absolute;
  327. top: calc(var(--status-bar-height) + 12rpx);
  328. left: 24rpx;
  329. }
  330. }
  331. }
  332. .backicon {
  333. width: 64rpx;
  334. height: 64rpx;
  335. position: fixed;
  336. left: 24rpx;
  337. top: calc(var(--status-bar-height) + 12rpx);
  338. z-index: 998;
  339. }
  340. .editinfo {
  341. background: rgba(0,0,0,0.5);
  342. border-radius: 32rpx 32rpx 32rpx 32rpx;
  343. padding: 15rpx 28rpx;
  344. font-family: PingFang SC;
  345. font-weight: 400;
  346. font-size: 24rpx;
  347. color: #FFFFFF;
  348. }
  349. .content-body {
  350. font-family: PingFang SC;
  351. font-weight: 400;
  352. position: relative;
  353. color: #222222;
  354. .user {
  355. @include u-flex(row, flex-start, flex-start);
  356. padding: 40rpx 24rpx;
  357. &-left {
  358. overflow: hidden;
  359. padding-top: 24rpx;
  360. margin-left: 32rpx;
  361. font-weight: 500;
  362. font-size: 44rpx;
  363. color: #FFFFFF;
  364. }
  365. .levelbox {
  366. display: inline-flex;
  367. padding: 4rpx 12rpx;
  368. margin-top: 14rpx;
  369. background: linear-gradient( 90deg, #F5CE3C 0%, #E39414 100%);
  370. border-radius: 20rpx 20rpx 20rpx 20rpx;
  371. font-weight: 500;
  372. font-size: 22rpx;
  373. color: #FEF5EA;
  374. &-icon {
  375. width: 32rpx;
  376. height: 32rpx;
  377. margin-right: 8rpx;
  378. }
  379. }
  380. }
  381. .content-box {
  382. background: #FFFFFF;
  383. border-radius: 32rpx 32rpx 0rpx 0rpx;
  384. padding: 24rpx 0;
  385. }
  386. .rowbox {
  387. text-align: center;
  388. @include u-flex(row, center, space-between);
  389. &-item {
  390. flex: 1;
  391. font-weight: 400;
  392. font-size: 26rpx;
  393. color: #757575;
  394. view {
  395. margin-bottom: 4rpx;
  396. font-family: DIN, DIN;
  397. font-weight: bold;
  398. font-size: 36rpx;
  399. color: #222222;
  400. }
  401. }
  402. }
  403. .taglist {
  404. color: #757575;
  405. flex-wrap: wrap;
  406. view {
  407. max-width: 220rpx;
  408. overflow: hidden;
  409. padding: 8rpx 16rpx;
  410. background: #F3F3F4;
  411. border-radius: 24rpx 24rpx 24rpx 24rpx;
  412. box-sizing: border-box;
  413. margin-right: 16rpx;
  414. margin-bottom: 16rpx;
  415. }
  416. .sexicon {
  417. margin: 0;
  418. padding: 0;
  419. }
  420. }
  421. .user-item {
  422. min-width: 220rpx;
  423. flex-shrink: 0;
  424. border-radius: 16rpx 16rpx 16rpx 16rpx;
  425. border: 2rpx solid #ECECEC;
  426. box-sizing: border-box;
  427. margin-right: 22rpx;
  428. .icon {
  429. height: 32rpx;
  430. width: 32rpx;
  431. }
  432. }
  433. .tab-bar {
  434. background-color: #fff;
  435. border-bottom: 2rpx solid #ECECEC;
  436. font-weight: 400;
  437. font-size: 32rpx;
  438. color: #757575;
  439. &-item {
  440. padding: 32rpx 40rpx;
  441. }
  442. }
  443. .active {
  444. font-weight: 600;
  445. font-size: 32rpx;
  446. color: #222222;
  447. position: relative;
  448. &::after {
  449. position: absolute;
  450. bottom: 0;
  451. left: 50%;
  452. transform: translateX(-50%);
  453. content: "";
  454. width: 70rpx;
  455. height: 6rpx;
  456. background: #222222;
  457. border-radius: 3rpx 3rpx 3rpx 3rpx;
  458. }
  459. }
  460. .video-list {
  461. flex-wrap: wrap;
  462. margin-right: -18rpx;
  463. }
  464. .video-item {
  465. width: 342rpx;
  466. margin-right: 18rpx;
  467. margin-bottom: 18rpx;
  468. background: #F5F7FA;
  469. overflow: hidden;
  470. position: relative;
  471. &-img {
  472. width: 100%;
  473. height: 280rpx;
  474. border-radius: 16rpx 16rpx 0rpx 0rpx;
  475. }
  476. }
  477. }
  478. .item_btn {
  479. flex: 1;
  480. height: 70rpx;
  481. background: #FF5C03;
  482. border-radius: 16rpx;
  483. font-family: PingFang SC, PingFang SC;
  484. font-weight: 500;
  485. font-size: 30rpx;
  486. color: #FFFFFF;
  487. }
  488. .footer {
  489. position: fixed;
  490. bottom: 0;
  491. left: 0;
  492. z-index: 999;
  493. width: 100%;
  494. background-color: #fff;
  495. padding: 20rpx 24rpx;
  496. padding-bottom: calc(var(--window-bottom) + 20rpx);
  497. font-family: PingFang SC, PingFang SC;
  498. font-weight: 600;
  499. font-size: 34rpx;
  500. color: #FFFFFF;
  501. &-fb {
  502. flex: 1;
  503. height: 112rpx;
  504. background: linear-gradient( 90deg, #FF5C03 0%, #F0964C 100%);
  505. border-radius: 16rpx 16rpx 16rpx 16rpx;
  506. }
  507. &-zb {
  508. flex: 1;
  509. margin-left: 18rpx;
  510. height: 112rpx;
  511. background: linear-gradient( 90deg, #4DC68D 0%, #7CD8A8 100%);
  512. border-radius: 16rpx 16rpx 16rpx 16rpx;
  513. }
  514. image {
  515. height: 48rpx;
  516. width: 48rpx;
  517. margin-right: 16rpx;
  518. }
  519. }
  520. </style>