homepage.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553
  1. <template>
  2. <view class="container" style="background-color: #F5F5F5;">
  3. <view class="navbar">
  4. <navbar ref="navbar" :config="config"></navbar>
  5. </view>
  6. <!-- <顶部> -->
  7. <view class="top">
  8. <!-- <背景图> -->
  9. <!-- <image :src="imgUrl+'/my-top-bgImg.png'"></image> -->
  10. <div class="bg"></div>
  11. <view class="head-login u-FFF">
  12. <!-- <view class="u-text-center u-font36 top-title">个人中心</view> -->
  13. <view class="item" style="margin-top: 50rpx;">
  14. <image v-if="myMsg.head_photo" class="image" :src="myMsg.head_photo" mode=""></image>
  15. <image v-else class="image" :src="imgUrl+'/head-on.png'" mode=""></image>
  16. <view class="name-box">
  17. <view style="display: flex;align-items: center;">
  18. <view class="name" align-items="center">
  19. {{myMsg.nickname}}
  20. </view>
  21. <view v-if="myMsg.is_celebrity==true">
  22. <image :src="imgUrl+'/delImg/celebrity.png'" style="width: 40rpx;height: 40rpx;margin-left: 14rpx;" mode=""></image>
  23. </view>
  24. </view>
  25. <view class="simple" style="display: flex;" >简介:{{myMsg.resume}}
  26. <image v-if="isme==true" @click="modifyItem" :src="imgUrl+'/pen.png'" style="width: 34rpx;margin-top: 6rpx;display: block; height: 28rpx; margin-left: 20rpx;" mode=""></image>
  27. </view>
  28. </view>
  29. </view>
  30. <uni-popup ref="popup" type="center">
  31. <view class="popup-msg">
  32. <view class="msg-top">
  33. 请修改你的简介
  34. </view>
  35. <textarea class="introduce-item"maxlength="30" :value="myMsg.resume" @input="getTextMsg" placeholder="" />
  36. <button class="introduce-button" type="default" @click="submit">确定</button>
  37. <text class="iconfont" @click="cancel">&#xe623;</text>
  38. </view>
  39. </uni-popup>
  40. </view>
  41. <view class="bgImg">
  42. <image :src="imgUrl+'/my-list-bgImg.png'"></image>
  43. <view class="position-ab">
  44. <view class="middle" >
  45. <view class="block" @click="goTodetail('/pages/research/community/myfollow?user_id='+params.userId)">
  46. <view v-if="isme==true">
  47. <view class="number">
  48. {{myCommunityMsg.concern_num}}
  49. </view>
  50. <view class="content">
  51. 我的关注
  52. </view>
  53. </view>
  54. <view v-if="isme==false">
  55. <view class="number">
  56. {{myCommunityMsg.concern_num}}
  57. </view>
  58. <view class="content">
  59. 关注
  60. </view>
  61. </view>
  62. </view>
  63. <view class="block">
  64. <view v-if="isme==true">
  65. <view class="number" @click="goTodetail('/pages/research/community/myfans?user_id='+params.userId)">
  66. {{myCommunityMsg.fans_num}}
  67. </view>
  68. <view class="content">
  69. 我的粉丝
  70. </view>
  71. </view>
  72. <view v-if="isme==false">
  73. <view class="number" @click="goTodetail('/pages/research/community/myfans?user_id='+params.userId)">
  74. {{myCommunityMsg.fans_num}}
  75. </view>
  76. <view class="content">
  77. 粉丝
  78. </view>
  79. </view>
  80. </view>
  81. <view class="block">
  82. <view v-if="isme==true">
  83. <view class="number" @click="goTodetail('/pages/research/community/myfabulous?user_id='+params.userId)">
  84. {{myCommunityMsg.like_sum}}
  85. </view>
  86. <view class="content">
  87. 我的点赞
  88. </view>
  89. </view>
  90. <view v-if="isme==false">
  91. <view class="number" @click="goTodetail('/pages/research/community/myfabulous?user_id='+params.userId)">
  92. {{myCommunityMsg.like_sum}}
  93. </view>
  94. <view class="content">
  95. 点赞
  96. </view>
  97. </view>
  98. </view>
  99. <view class="block">
  100. <view v-if="isme==true">
  101. <view class="number" @click="goTodetail('/pages/research/community/mycomment?user_id='+params.userId)">
  102. {{myCommunityMsg.comment_sum}}
  103. </view>
  104. <view class="content">
  105. 我的评论
  106. </view>
  107. </view>
  108. <view v-if="isme==false">
  109. <view class="number" @click="goTodetail('/pages/research/community/mycomment?user_id='+params.userId)">
  110. {{myCommunityMsg.comment_sum}}
  111. </view>
  112. <view class="content">
  113. 评论
  114. </view>
  115. </view>
  116. </view>
  117. <!-- <view class="block">
  118. <view class="number" @click="goTodetail('/pages/research/community/collection')">
  119. {{myCommunityMsg.collect_sum}}
  120. </view>
  121. <view class="content">
  122. 我的收藏
  123. </view>
  124. </view> -->
  125. </view>
  126. <waterfall
  127. ref="wfp"
  128. v-if="flowList.length>0"
  129. :colunmNumber="colunmNumber"
  130. :flowList="flowList"
  131. :columnGap="10"
  132. :status="status"></waterfall>
  133. <loadMore v-if="flowList.length>0" :status="status"></loadMore>
  134. <nodata v-else :config="{ top: 15, content: '暂无数据~' }"></nodata>
  135. </view>
  136. </view>
  137. </view>
  138. </view>
  139. </template>
  140. <script>
  141. import waterfall from "../../../components/waterfall/shwaterfall.vue"
  142. import {myStatistics} from "@/api/userInfo.js"
  143. import {myInfo,getAccountInfo,updateResume} from "@/api/login.js"
  144. import loadMore from "../../../components/uni-load-more/uni-load-more.vue"
  145. export default {
  146. data() {
  147. return {
  148. config: {
  149. back: true, //false是tolbar页面 是则不写
  150. title: '个人主页',
  151. color: '#ffffff',
  152. //背景颜色;参数一:透明度(0-1);参数二:背景颜色(array则为线性渐变,string为单色背景)
  153. backgroundColor: [0, '#ffffff'],
  154. statusBarFontColor: '#ffffff',
  155. fixed:false,
  156. },
  157. colunmNumber: 2,
  158. index: 19,
  159. flowList: [],
  160. //微信小程序用户信息
  161. hiddenLink:true,
  162. loginNo:false,//判断显示邀请码
  163. //微信小程序用户信息
  164. userInfo:{
  165. head_photo:"",
  166. nickname:"登录/注册"
  167. },
  168. hiddenLink:true,
  169. loginNo:false,//判断显示邀请码
  170. myMsg:{}, //个人信息
  171. myCommunityMsg:{} ,//社区信息
  172. introduceItem:'',
  173. newIntroduceItem:'',
  174. status:"more",
  175. id:null,
  176. isme:false,
  177. params:{
  178. userId:null,
  179. page:1,
  180. limit:10,
  181. },
  182. imgUrl: this.$mConfig.staticUrl,
  183. }
  184. },
  185. onLoad(options){
  186. let shop = uni.getStorageSync("personal")
  187. this.params.userId = options.user_id
  188. if(this.params.userId ==shop.id){
  189. this.isme=true
  190. }else{
  191. this.isme=false
  192. }
  193. // this.getMsg()
  194. // this.getMyMsg()
  195. // this.getList()
  196. console.log('px:'+240/(uni.upx2px(100)/100))
  197. },
  198. onShow() {
  199. this.flowList = []
  200. this.getList()
  201. this.getMsg()
  202. this.getMyMsg()
  203. },
  204. //下拉加载
  205. onPullDownRefresh() {
  206. this.params.page=1;
  207. this.flowList=[],
  208. this.getList()
  209. this.getMyMsg()
  210. this.getMsg()
  211. },
  212. onReachBottom() {
  213. if(this.status=="more"){
  214. this.params.page++
  215. this.getList()
  216. }
  217. },
  218. methods:{
  219. //跳转修改信息
  220. goToEdit(){
  221. uni.navigateTo({
  222. url:"../setup/edit"
  223. })
  224. },
  225. getList(){
  226. this.$http.get("/opus/my-release",this.params).then(res=>{
  227. if(res&&res.code==200){
  228. uni.stopPullDownRefresh()
  229. this.flowList = this.flowList.concat(res.page.list)
  230. if(res.page.totalPage<=res.page.currPage){
  231. this.status="noMore"
  232. }else{
  233. this.status="more"
  234. }
  235. }
  236. })
  237. },
  238. //获取内容
  239. getTextMsg(e){
  240. this.newIntroduceItem=e.detail.value
  241. },
  242. //取消
  243. cancel(){
  244. this.$refs.popup.close()
  245. },
  246. //修改简介
  247. modifyItem(){
  248. this.$refs.popup.open()
  249. // console.log(666)
  250. },
  251. //跳转页面
  252. goTodetail(url){
  253. uni.navigateTo({
  254. url:url
  255. })
  256. },
  257. //获取个人信息
  258. getMsg(){
  259. this.$http.get(myInfo,this.params).then(res=>{
  260. if(res&&res.code==200){
  261. // console.log(res)
  262. this.myMsg=res.data
  263. }
  264. })
  265. },
  266. //获取社区信息
  267. getMyMsg(){
  268. this.$http.get(myStatistics,this.params).then(res=>{
  269. if(res&&res.code==200){
  270. this.myCommunityMsg=res.data
  271. // console.log(this.myCommunityMsg,"123123")
  272. }
  273. })
  274. },
  275. //提交信息
  276. submit(){
  277. if(this.newIntroduceItem==""){
  278. this.$mUtil.toast("请输入您想修改的内容")
  279. return false
  280. }
  281. let params={
  282. resume:this.newIntroduceItem
  283. }
  284. this.$http.put(updateResume,params).then(res=>{
  285. if(res&&res.code==200){
  286. this.myMsg.resume=this.newIntroduceItem
  287. this.$refs.popup.close()
  288. this.$mUtil.toast("修改成功")
  289. }
  290. })
  291. },
  292. },
  293. components:{
  294. waterfall
  295. }
  296. }
  297. </script>
  298. <style>
  299. page{
  300. background-color: #F5F5F5;
  301. }
  302. </style>
  303. <style lang="scss" scoped>
  304. .popup-msg{
  305. width: 600rpx;
  306. border-radius: 20rpx;
  307. background-color: #FFFFFF;
  308. overflow: hidden;
  309. position: relative;
  310. .iconfont{
  311. position: absolute;
  312. right: 20rpx;
  313. top: 20rpx;
  314. font-size: 40rpx;
  315. color: #000000;
  316. }
  317. .msg-top{
  318. color: #000000;
  319. text-align: center;
  320. font-size: 40rpx;
  321. font-weight: bold;
  322. margin-top: 20rpx;
  323. }
  324. .introduce-item{
  325. width: 95%;
  326. margin: 0 auto;
  327. background-color: #f3f3f3;
  328. margin-top: 20rpx;
  329. color: black;
  330. }
  331. .introduce-button{
  332. padding: 0 30rpx;
  333. margin: 20rpx;
  334. background-color: #0B844A;
  335. color: #FFFFFF;
  336. }
  337. }
  338. .navbar {
  339. position: absolute;
  340. top: 0;
  341. left: 0;
  342. }
  343. .top {
  344. position: relative;
  345. min-height: 100vh;
  346. background-color: #F5F5F5;
  347. // overflow: hidden;
  348. .bg {
  349. width: 100%;
  350. height: 436rpx;
  351. background-color: #0B844A;
  352. }
  353. .head-login {
  354. position: absolute;
  355. width: 100%;
  356. top: 128rpx;
  357. left: 0;
  358. .item{
  359. z-index: 10;
  360. padding: 0 30rpx;
  361. display: flex;
  362. // flex-wrap: wrap;
  363. .name-box{
  364. margin-left: 22rpx;
  365. flex: 1;
  366. .simple{
  367. height: 100rpx;
  368. text-overflow: -o-ellipsis-lastline;
  369. overflow: hidden;
  370. text-overflow: ellipsis;
  371. display: -webkit-box;
  372. -webkit-line-clamp: 2;
  373. -webkit-box-orient: vertical;
  374. color: rgba(173,188,182,1);
  375. font-size: 28rpx;
  376. font-weight: 400;
  377. width: 100%;
  378. opacity: 1;
  379. }
  380. .name{
  381. color: rgba(255,255,255,1);
  382. font-size: 40rpx;
  383. // margin-left: 22rpx;
  384. line-height: 57rpx;
  385. font-size: 40rpx;
  386. color: #FFFFFF;
  387. font-weight: 400;
  388. width: 400rpx;
  389. overflow: hidden;
  390. white-space: nowrap;
  391. text-overflow: ellipsis;
  392. }
  393. }
  394. .image{
  395. width: 114rpx;
  396. height: 114rpx;
  397. border-radius: 999rpx;
  398. // margin-left: 30rpx;
  399. }
  400. }
  401. .top-title {
  402. height: 88rpx;
  403. line-height: 88rpx;
  404. }
  405. .head image {
  406. width: 106rpx;
  407. height: 106rpx;
  408. }
  409. .login{
  410. line-height: 106rpx;
  411. }
  412. }
  413. }
  414. .order {
  415. position: absolute;
  416. top: 320rpx;
  417. width: 84%;
  418. margin-left: 30rpx;
  419. margin-right: 30rpx;
  420. padding: 18rpx 30rpx 40rpx;
  421. border-radius: 20rpx;
  422. background-color: #FFFFFF;
  423. z-index: 99999;
  424. .pd-bt18 {
  425. padding-bottom: 18rpx;
  426. }
  427. .u-icon-bg {
  428. font-size: 52rpx;
  429. background: linear-gradient(180deg, #78df6a, #11d688);
  430. -webkit-background-clip: text;
  431. color: transparent;
  432. }
  433. .u-icon-bg2 {
  434. font-size: 50rpx;
  435. background: linear-gradient(180deg, #dc9c56, #ff7303);
  436. -webkit-background-clip: text;
  437. color: transparent;
  438. }
  439. .u-icon-bg3 {
  440. font-size: 52rpx;
  441. background: linear-gradient(180deg, #05d3a9, #06b806);
  442. -webkit-background-clip: text;
  443. color: transparent;
  444. }
  445. .u-icon-bg4 {
  446. font-size: 52rpx;
  447. background: linear-gradient(180deg, #ff5475, #fd4303);
  448. -webkit-background-clip: text;
  449. color: transparent;
  450. }
  451. .u-icon-bg5 {
  452. font-size: 48rpx;
  453. background: linear-gradient(180deg, #b175f0, #3db3fd);
  454. -webkit-background-clip: text;
  455. color: transparent;
  456. }
  457. }
  458. .bgImg {
  459. position: absolute;
  460. top: 400rpx;
  461. width: 100%;
  462. }
  463. .bgImg image {
  464. width: 100%;
  465. height: 75vh;
  466. position: relative;
  467. }
  468. .position-ab {
  469. position: absolute;
  470. top: -90rpx;
  471. width: 100%;
  472. .middle{
  473. padding: 42rpx 30rpx;
  474. background-color: white;
  475. margin: 20rpx 30rpx 0 30rpx;
  476. border-radius: 20rpx;
  477. display: flex;
  478. justify-content: space-around;
  479. align-items: center;
  480. text-align: center;
  481. .block{
  482. .content{
  483. font-size: 26rpx;
  484. font-family: PingFang SC, PingFang SC-Regular;
  485. font-weight: 400;
  486. color: #1a1a1a;
  487. }
  488. .number{
  489. color: rgba(255,0,0,1);
  490. font-size: 36rpx;
  491. font-family: PingFang SC, PingFang SC-Bold;
  492. font-weight: 700;
  493. margin-bottom: 18rpx;
  494. }
  495. }
  496. }
  497. .wallet-bg {
  498. position: relative;
  499. height: 138rpx;
  500. }
  501. .wallet-bg .bigBg {
  502. position: absolute;
  503. z-index: 0;
  504. padding: 0 15rpx;
  505. box-sizing: border-box;
  506. width: 100%;
  507. height: 138rpx;
  508. }
  509. .wallet image {
  510. width: 32rpx;
  511. height: 34rpx;
  512. }
  513. .my-wallet {
  514. position: relative;
  515. z-index: 1;
  516. height: 138rpx;
  517. }
  518. }
  519. </style>