personalPage.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614
  1. <template>
  2. <view>
  3. <u-navbar v-show="false" ref="refNavbar" >
  4. </u-navbar>
  5. <view class="header">
  6. <!-- 导航 -->
  7. <view :class="flag?'sticky':'navbar'">
  8. <view class="back" style="font-size: 32rpx;" @click="back()">
  9. <u-icon name="arrow-left" size="40"></u-icon>返回
  10. </view>
  11. <view class="title">
  12. 个人主页
  13. </view>
  14. <view class="camera" @click="issueMethod()" >
  15. <u-icon name="camera-fill" size="48"></u-icon>
  16. </view>
  17. </view>
  18. <!-- 个人信息 -->
  19. <view class="person-infos">
  20. <view class="photo">
  21. <img v-if="userInfo.headImg" :src="userInfo.headImg" alt="">
  22. <u-avatar v-else size="120" ></u-avatar>
  23. </view>
  24. <view class="infos">
  25. <view class="name">
  26. {{userInfo.name}}
  27. </view>
  28. <view class="department-position">
  29. <view class="department" v-if="userInfo.orgName">
  30. <view class="icon">
  31. <img src="../../assets/img/department2.png" alt="">
  32. </view>
  33. <view class="text">
  34. {{userInfo.orgName}}
  35. </view>
  36. </view>
  37. <view class="position">
  38. <text class="icon">
  39. <img src="../../assets/img/position2.png" alt="">
  40. </text>
  41. <text class="text">
  42. 员工
  43. </text>
  44. </view>
  45. </view>
  46. </view>
  47. </view>
  48. <view class="grid">
  49. <view class="item">
  50. <view class="amout">
  51. {{plusInfo.userShare}}
  52. </view>
  53. <view class="text">
  54. 发布
  55. </view>
  56. </view>
  57. <view class="item">
  58. <view class="amout">
  59. {{plusInfo.userNewsLike}}
  60. </view>
  61. <view class="text">
  62. 点赞
  63. </view>
  64. </view>
  65. <view class="item">
  66. <view class="amout">
  67. {{plusInfo.userNewsComment}}
  68. </view>
  69. <view class="text">
  70. 评论
  71. </view>
  72. </view>
  73. </view>
  74. </view>
  75. <!-- 分享 -->
  76. <view class="share">
  77. <view class="item" v-for="(item,i) in list" :key="i" >
  78. <view class="date">
  79. <view class="day">
  80. {{day(item.createTime)}}
  81. </view>
  82. <view class="year-month">
  83. {{yearmonth(item.createTime)}}
  84. </view>
  85. <view class="status" style="color: red;" v-if="item.status!=1">
  86. [{{item.status==0?'审核中':''}}{{item.status==2?'审核不通过':''}}]
  87. </view>
  88. <view class="status" style="color: #19be6b;" @click="delShare(item.id)" v-if="item.status!=1">
  89. <u>点击删除</u>
  90. </view>
  91. </view>
  92. <view class="tagMain">
  93. <view class="content">
  94. <view class="title">
  95. <textarea placeholder="记录点滴生活..." :auto-height="true"
  96. v-model="item.synopsis" maxlength="200" readonly
  97. name="" id="" ></textarea>
  98. </view>
  99. <view class="photos">
  100. <template v-for="(pic,i2) in item.listShareFiles" v-if="pic.url">
  101. <img v-if="pic.isPic" :key="i2"
  102. @click="previewImage(item.listShareFiles,i2)"
  103. :src="pic.url" alt="">
  104. <video v-else :key="i2" :src="pic.url" :class="{videoplay:playurl==pic.url}" @play="playurl=pic.url"
  105. enable-danmu danmu-btn controls></video>
  106. </template>
  107. </view>
  108. </view>
  109. <view class="likeMain" v-if="item.status==1" >
  110. <view class="like" >
  111. <view class="icon">
  112. <u-icon name="thumb-up" size="38"></u-icon>
  113. </view>
  114. <view class="number">
  115. {{item.likesNum}}
  116. </view>
  117. </view>
  118. <view class="like" style="margin-left: 18rpx;">
  119. <view class="icon">
  120. <img style="width: 40rpx; height: 48rpx;"
  121. src="../../assets/img/riLine-chat-4-line.svg"></img>
  122. </view>
  123. <view class="number"> {{item.commentNum}}</view>
  124. </view>
  125. <view class="like" style="margin-left: 18rpx;"
  126. @click="gotoUrl('pages/staffHome/filesonicInfo?id='+item.id)" >
  127. <view class="icon">
  128. <u-icon name="photo" size="38"></u-icon>
  129. </view>
  130. <view class="number"> 查看</view>
  131. </view>
  132. </view>
  133. <view class="messageListMain" v-show="item.listShareLikes.length||item.listShareComment.length" >
  134. <view class="mLikeList" v-show="item.listShareLikes.length">
  135. <u-icon name="thumb-up" size="38"></u-icon>
  136. <span v-for="(itemlike,ilike) in item.listShareLikes" :key="ilike">
  137. {{ilike==0?' ':', '}}{{itemlike.userName}}
  138. </span>
  139. <span v-show="item.likesNum>item.listShareLikes.length">...</span>
  140. </view>
  141. <view class="messageList" v-show="item.listShareComment.length">
  142. <view class="messageItem" v-for="(itemcom,ico) in item.listShareComment" :key="ico" >
  143. <span class="mItemTitle">{{itemcom.userName}}:</span>
  144. <span class="mItemBody">{{itemcom.content}}</span>
  145. </view>
  146. <view class="messageItemEnd" v-show="item.commentNum>item.listShareComment.length" >最多显示20条评论</view>
  147. </view>
  148. </view>
  149. </view>
  150. </view>
  151. </view>
  152. <u-divider :isnone="list.length==0" nonetext="没有找到相关内容" border-color="#CFD2D5">已经到底了</u-divider>
  153. </view>
  154. </template>
  155. <script>
  156. import * as API from '@/apis/pagejs/user.js'
  157. import * as API_share from '@/apis/pagejs/share.js'
  158. export default {
  159. data() {
  160. return {
  161. flag: false,
  162. scrollTop: "",
  163. playurl:"",
  164. plusInfo:{},
  165. userInfo:{},
  166. listForm:{
  167. pageIndex:1,
  168. pageSize:20,
  169. queryStatus:1
  170. },
  171. list:[],
  172. recordsTotal:0,
  173. }
  174. },
  175. onLoad() {
  176. this.carhelp.set("addShare",0);
  177. this.init()
  178. this.getList()
  179. },
  180. onShow(){
  181. this.findByOpenId()
  182. if( this.carhelp.get("addShare")){
  183. this.listForm.pageIndex=1;
  184. this.getList()
  185. }
  186. },
  187. onReachBottom() {
  188. if (this.list.length < this.recordsTotal) {
  189. this.myLoadmore();
  190. }
  191. },
  192. methods: {
  193. delShare(id){
  194. uni.showModal({
  195. title: '提示',
  196. content: '是否删除分享?',
  197. success: res=>{
  198. if (res.confirm) {
  199. this.delShareApi(id)
  200. } else if (res.cancel) {
  201. //('用户点击取消');
  202. }
  203. }
  204. });
  205. },
  206. delShareApi(id){
  207. uni.showLoading({
  208. title: "加载中",
  209. mask: true,
  210. })
  211. API_share.delShare({
  212. shareId:id
  213. }).then((res) => {
  214. uni.showToast({
  215. title: "删除成功",
  216. icon: "none"
  217. })
  218. this.listForm.pageIndex=1;
  219. this.getList()
  220. }).catch(error => {
  221. uni.showToast({
  222. title: error,
  223. icon: "none"
  224. })
  225. this.listForm.pageIndex=1;
  226. this.getList()
  227. })
  228. },
  229. day(time){
  230. if(time){
  231. return time.substring(8,10)
  232. }else
  233. return''
  234. },
  235. yearmonth(time){
  236. if(time){
  237. return time.substring(0,7).replace('-','.')
  238. }else
  239. return''
  240. },
  241. issueMethod(id){
  242. this.gotoUrl('pages/mine/issue?nic=1')
  243. },
  244. init(){
  245. this.plusInfo=this.carhelp.getPersonInfoPlus();
  246. this.userInfo=this.carhelp.getPersonInfo();
  247. },
  248. findByOpenId(){
  249. API.findByOpenId({
  250. noerror:true,
  251. openId: this.carhelp.getOpenId(),
  252. }).then((response) => {
  253. this.carhelp.setToken(response.data.token);
  254. this.carhelp.setPersonInfo(response.data.regUser);
  255. this.carhelp.setPersonInfoPlus(response.data)
  256. this.init();
  257. }).catch(error => {
  258. uni.hideLoading();
  259. })
  260. },
  261. back(){
  262. this.$refs.refNavbar.goBack()
  263. },
  264. onPageScroll(e) {
  265. this.scrollTop = e.scrollTop;
  266. console.log(this.scrollTop);
  267. if (this.scrollTop >=44) {
  268. this.flag = true;
  269. } else {
  270. this.flag = false;
  271. }
  272. },previewImage(img,j) {
  273. let imgs = [];
  274. img.forEach(it=>{
  275. if(it.isPic){
  276. imgs.push(it.url)
  277. }
  278. })
  279. uni.previewImage({
  280. indicator:"number",
  281. indicatorDots:true,
  282. loop:true,
  283. urls: imgs,
  284. current: j,
  285. success:(e)=>{
  286. }
  287. })
  288. },getList(){
  289. uni.showLoading({
  290. title: "加载中",
  291. mask: true,
  292. })
  293. API_share.pageList(this.listForm).then((res) => {
  294. this.carhelp.set("addShare",0);
  295. uni.hideLoading();
  296. //this.list=response.data.data
  297. if(this.listForm.pageIndex==1){
  298. this.list = res.data.data;
  299. }else{
  300. this.list = [
  301. ...this.list,
  302. ...res.data.data
  303. ];
  304. }
  305. this.recordsTotal = res.data.recordsTotal;
  306. }).catch(error => {
  307. uni.showToast({
  308. title: error,
  309. icon: "none"
  310. })
  311. })
  312. },
  313. myLoadmore(){
  314. this.listForm.pageIndex += 1;
  315. this.getList();
  316. },
  317. }
  318. }
  319. </script>
  320. <style scoped lang="scss">
  321. .tagMain {
  322. // display: flex;
  323. // justify-content: space-between;
  324. .messageListMain{
  325. border-radius: 4px;
  326. background-color: rgba(240, 240, 240, 1);
  327. color: #224466 ;
  328. .mLikeList{
  329. padding:16rpx;
  330. border-bottom: 1px solid rgba(222, 222, 222, 1);
  331. }
  332. .messageList{
  333. padding:16rpx;
  334. .messageItem{
  335. // display: flex;
  336. // flex-wrap: wrap;
  337. .mItemBody{
  338. color: #101010;
  339. }
  340. }
  341. .messageItemEnd{
  342. text-align: center;
  343. color: #9E9E9E;
  344. }
  345. }
  346. }
  347. .likeMain{
  348. display: flex;
  349. justify-content: flex-end;
  350. .like {
  351. margin-top: 16rpx;
  352. line-height: 24px;
  353. display: flex;
  354. color:#224466 ;
  355. .number {
  356. margin-left: 16rpx;
  357. }
  358. }
  359. }
  360. .tag {
  361. margin-top: 16rpx;
  362. line-height: 24px;
  363. .symbol {
  364. color: rgba(31, 74, 153, 100);
  365. font-size: 16px
  366. }
  367. .text {
  368. color: rgba(31, 74, 153, 1);
  369. margin-left: 14rpx;
  370. }
  371. }
  372. }
  373. uni-textarea{
  374. width: 500rpx;
  375. text-indent: 28rpx;
  376. padding-top:28rpx;
  377. font-family: Microsoft Yahei;
  378. }
  379. page{
  380. background-color: #fff;
  381. padding-bottom: 50px;
  382. font-family: 'Regular';
  383. }
  384. .header{
  385. padding: 0 0 48rpx 0;
  386. background: linear-gradient(180deg, rgba(183,208,255,1) 0%,rgba(244,244,246,1) 100%);
  387. .navbar{
  388. display: flex;
  389. justify-content: space-between;
  390. align-items: center;
  391. height: 44px;
  392. padding: 0 32rpx;
  393. .title{
  394. font-size: 16px;
  395. color: rgba(16, 16, 16, 1);
  396. }
  397. }
  398. .sticky{
  399. background-color: #fff;
  400. display: flex;
  401. justify-content: space-between;
  402. align-items: center;
  403. height: 44px;
  404. padding: 0 32rpx;
  405. position: fixed;
  406. top: 0;
  407. left: 0;
  408. right: 0;
  409. .title{
  410. font-size: 16px;
  411. color: rgba(16, 16, 16, 1);
  412. }
  413. }
  414. // 个人信息
  415. .person-infos{
  416. margin-top: 32rpx;
  417. padding: 0 48rpx;
  418. display: flex;
  419. align-items: center;
  420. margin-bottom: 48rpx;
  421. .photo {
  422. box-shadow: 0px 2px 8px 0px rgba(35, 72, 75, 15);
  423. border: 2px solid rgba(255, 255, 255, 1);
  424. border-radius: 50px;
  425. width: 120rpx;
  426. height: 120rpx;
  427. overflow: hidden;
  428. img {
  429. vertical-align: middle;
  430. border-radius: 50px;
  431. width: 120rpx;
  432. height: 120rpx;
  433. }
  434. }
  435. .infos {
  436. margin-left:32rpx;
  437. .name {
  438. line-height: 28px;
  439. font-size: 20px;
  440. font-family: 'Medium';
  441. }
  442. .department-position {
  443. display: flex;
  444. margin-top: 16rpx;
  445. color: rgba(119, 119, 119, 1);
  446. .icon {
  447. margin-right: 8rpx;
  448. img {
  449. width: 28rpx;
  450. height: 28rpx;
  451. }
  452. }
  453. .department {
  454. display: flex;
  455. .text{
  456. line-height: 16px;
  457. }
  458. }
  459. .position {
  460. display: flex;
  461. margin-left: 24rpx;
  462. .text{
  463. line-height: 16px;
  464. }
  465. }
  466. }
  467. }
  468. }
  469. .grid {
  470. width: 100%;
  471. display: flex;
  472. flex-direction: row;
  473. flex-wrap: wrap;
  474. align-items: center;
  475. margin-top: 24rpx;
  476. justify-content: space-between;
  477. .item {
  478. width: 33.3%;
  479. text-align: center;
  480. .amout {
  481. font-size: 48rpx;
  482. line-height: 64rpx;
  483. }
  484. .text {
  485. font-size: 32rpx;
  486. line-height: 44rpx;
  487. }
  488. }
  489. }
  490. }
  491. .share{
  492. padding: 32rpx;
  493. .item{
  494. margin-bottom: 48rpx;
  495. display: flex;
  496. .date{
  497. width: 120rpx;
  498. .day{
  499. color: rgba(51, 51, 51, 1);
  500. font-size: 18px;
  501. font-weight:bold;
  502. line-height: 25px;
  503. font-family: 'Medium';
  504. }
  505. .year-month{
  506. color: rgba(51, 51, 51, 1);
  507. }
  508. }
  509. .content{
  510. margin-left: 52rpx;
  511. border-bottom: 1px solid rgba(232, 232, 232, 1);
  512. padding-bottom: 32rpx;
  513. .title{
  514. color: rgba(51, 51, 51, 1);
  515. font-size: 16px;
  516. margin-bottom: 16rpx;
  517. line-height: 22px;
  518. }
  519. .photos{
  520. img{
  521. width: 168rpx;
  522. height: 168rpx;
  523. border-radius: 16rpx;
  524. margin-right: 4rpx;
  525. }
  526. .videoplay{
  527. height: 400rpx;
  528. }
  529. video {
  530. width: 100%;
  531. height: 200rpx;
  532. border-radius: 16rpx;
  533. margin-bottom: 16rpx;
  534. //margin-left: 16rpx;
  535. }
  536. }
  537. }
  538. }
  539. .item:last-of-type{
  540. .content{
  541. border: none;
  542. }
  543. }
  544. }
  545. </style>