personalPage.vue 9.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506
  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="content">
  93. <view class="title">
  94. <textarea placeholder="记录点滴生活..." :auto-height="true"
  95. v-model="item.synopsis" maxlength="200" readonly
  96. name="" id="" ></textarea>
  97. </view>
  98. <view class="photos">
  99. <template v-for="(pic,i2) in item.listShareFiles" v-if="pic.url">
  100. <img v-if="pic.isPic" :key="i2"
  101. @click="previewImage(item.listShareFiles,i2)"
  102. :src="pic.url" alt="">
  103. <video v-else :key="i2" :src="pic.url" :class="{videoplay:playurl==pic.url}" @play="playurl=pic.url"
  104. enable-danmu danmu-btn controls></video>
  105. </template>
  106. </view>
  107. </view>
  108. </view>
  109. </view>
  110. <u-divider :isnone="list.length==0" nonetext="没有找到相关内容" border-color="#CFD2D5">已经到底了</u-divider>
  111. </view>
  112. </template>
  113. <script>
  114. import * as API from '@/apis/pagejs/user.js'
  115. import * as API_share from '@/apis/pagejs/share.js'
  116. export default {
  117. data() {
  118. return {
  119. flag: false,
  120. scrollTop: "",
  121. playurl:"",
  122. plusInfo:{},
  123. userInfo:{},
  124. listForm:{
  125. pageIndex:1,
  126. pageSize:20,
  127. queryStatus:1
  128. },
  129. list:[],
  130. recordsTotal:0,
  131. }
  132. },
  133. onLoad() {
  134. this.carhelp.set("addShare",0);
  135. this.init()
  136. this.getList()
  137. },
  138. onShow(){
  139. this.findByOpenId()
  140. if( this.carhelp.get("addShare")){
  141. this.listForm.pageIndex=1;
  142. this.getList()
  143. }
  144. },
  145. onReachBottom() {
  146. if (this.list.length < this.recordsTotal) {
  147. this.myLoadmore();
  148. }
  149. },
  150. methods: {
  151. delShare(id){
  152. uni.showModal({
  153. title: '提示',
  154. content: '是否删除分享?',
  155. success: res=>{
  156. if (res.confirm) {
  157. this.delShareApi(id)
  158. } else if (res.cancel) {
  159. //('用户点击取消');
  160. }
  161. }
  162. });
  163. },
  164. delShareApi(id){
  165. uni.showLoading({
  166. title: "加载中",
  167. mask: true,
  168. })
  169. API_share.delShare({
  170. shareId:id
  171. }).then((res) => {
  172. uni.showToast({
  173. title: "删除成功",
  174. icon: "none"
  175. })
  176. this.listForm.pageIndex=1;
  177. this.getList()
  178. }).catch(error => {
  179. uni.showToast({
  180. title: error,
  181. icon: "none"
  182. })
  183. this.listForm.pageIndex=1;
  184. this.getList()
  185. })
  186. },
  187. day(time){
  188. if(time){
  189. return time.substring(8,10)
  190. }else
  191. return''
  192. },
  193. yearmonth(time){
  194. if(time){
  195. return time.substring(0,7).replace('-','.')
  196. }else
  197. return''
  198. },
  199. issueMethod(id){
  200. this.gotoUrl('pages/mine/issue?nic=1')
  201. },
  202. init(){
  203. this.plusInfo=this.carhelp.getPersonInfoPlus();
  204. this.userInfo=this.carhelp.getPersonInfo();
  205. },
  206. findByOpenId(){
  207. API.findByOpenId({
  208. noerror:true,
  209. openId: this.carhelp.getOpenId(),
  210. }).then((response) => {
  211. this.carhelp.setPersonInfo(response.data.regUser);
  212. this.carhelp.setPersonInfoPlus(response.data)
  213. this.init();
  214. }).catch(error => {
  215. uni.hideLoading();
  216. })
  217. },
  218. back(){
  219. this.$refs.refNavbar.goBack()
  220. },
  221. onPageScroll(e) {
  222. this.scrollTop = e.scrollTop;
  223. console.log(this.scrollTop);
  224. if (this.scrollTop >=44) {
  225. this.flag = true;
  226. } else {
  227. this.flag = false;
  228. }
  229. },previewImage(img,j) {
  230. let imgs = [];
  231. img.forEach(it=>{
  232. if(it.isPic){
  233. imgs.push(it.url)
  234. }
  235. })
  236. uni.previewImage({
  237. indicator:"number",
  238. indicatorDots:true,
  239. loop:true,
  240. urls: imgs,
  241. current: j,
  242. success:(e)=>{
  243. }
  244. })
  245. },getList(){
  246. uni.showLoading({
  247. title: "加载中",
  248. mask: true,
  249. })
  250. API_share.pageList(this.listForm).then((res) => {
  251. this.carhelp.set("addShare",0);
  252. uni.hideLoading();
  253. //this.list=response.data.data
  254. if(this.listForm.pageIndex==1){
  255. this.list = res.data.data;
  256. }else{
  257. this.list = [
  258. ...this.list,
  259. ...res.data.data
  260. ];
  261. }
  262. this.recordsTotal = res.data.recordsTotal;
  263. }).catch(error => {
  264. uni.showToast({
  265. title: error,
  266. icon: "none"
  267. })
  268. })
  269. },
  270. myLoadmore(){
  271. this.listForm.pageIndex += 1;
  272. this.getList();
  273. },
  274. }
  275. }
  276. </script>
  277. <style scoped lang="scss">
  278. uni-textarea{
  279. width: 500rpx;
  280. text-indent: 28rpx;
  281. padding-top:28rpx;
  282. font-family: Microsoft Yahei;
  283. }
  284. page{
  285. background-color: #fff;
  286. padding-bottom: 50px;
  287. font-family: 'Regular';
  288. }
  289. .header{
  290. padding: 0 0 48rpx 0;
  291. background: linear-gradient(180deg, rgba(183,208,255,1) 0%,rgba(244,244,246,1) 100%);
  292. .navbar{
  293. display: flex;
  294. justify-content: space-between;
  295. align-items: center;
  296. height: 44px;
  297. padding: 0 32rpx;
  298. .title{
  299. font-size: 16px;
  300. color: rgba(16, 16, 16, 1);
  301. }
  302. }
  303. .sticky{
  304. background-color: #fff;
  305. display: flex;
  306. justify-content: space-between;
  307. align-items: center;
  308. height: 44px;
  309. padding: 0 32rpx;
  310. position: fixed;
  311. top: 0;
  312. left: 0;
  313. right: 0;
  314. .title{
  315. font-size: 16px;
  316. color: rgba(16, 16, 16, 1);
  317. }
  318. }
  319. // 个人信息
  320. .person-infos{
  321. margin-top: 32rpx;
  322. padding: 0 48rpx;
  323. display: flex;
  324. align-items: center;
  325. margin-bottom: 48rpx;
  326. .photo {
  327. box-shadow: 0px 2px 8px 0px rgba(35, 72, 75, 15);
  328. border: 2px solid rgba(255, 255, 255, 1);
  329. border-radius: 50px;
  330. width: 120rpx;
  331. height: 120rpx;
  332. overflow: hidden;
  333. img {
  334. vertical-align: middle;
  335. border-radius: 50px;
  336. width: 120rpx;
  337. height: 120rpx;
  338. }
  339. }
  340. .infos {
  341. margin-left:32rpx;
  342. .name {
  343. line-height: 28px;
  344. font-size: 20px;
  345. font-family: 'Medium';
  346. }
  347. .department-position {
  348. display: flex;
  349. margin-top: 16rpx;
  350. color: rgba(119, 119, 119, 1);
  351. .icon {
  352. margin-right: 8rpx;
  353. img {
  354. width: 28rpx;
  355. height: 28rpx;
  356. }
  357. }
  358. .department {
  359. display: flex;
  360. .text{
  361. line-height: 16px;
  362. }
  363. }
  364. .position {
  365. display: flex;
  366. margin-left: 24rpx;
  367. .text{
  368. line-height: 16px;
  369. }
  370. }
  371. }
  372. }
  373. }
  374. .grid {
  375. width: 100%;
  376. display: flex;
  377. flex-direction: row;
  378. flex-wrap: wrap;
  379. align-items: center;
  380. margin-top: 24rpx;
  381. justify-content: space-between;
  382. .item {
  383. width: 33.3%;
  384. text-align: center;
  385. .amout {
  386. font-size: 48rpx;
  387. line-height: 64rpx;
  388. }
  389. .text {
  390. font-size: 32rpx;
  391. line-height: 44rpx;
  392. }
  393. }
  394. }
  395. }
  396. .share{
  397. padding: 32rpx;
  398. .item{
  399. margin-bottom: 48rpx;
  400. display: flex;
  401. .date{
  402. width: 120rpx;
  403. .day{
  404. color: rgba(51, 51, 51, 1);
  405. font-size: 18px;
  406. font-weight:bold;
  407. line-height: 25px;
  408. font-family: 'Medium';
  409. }
  410. .year-month{
  411. color: rgba(51, 51, 51, 1);
  412. }
  413. }
  414. .content{
  415. margin-left: 52rpx;
  416. border-bottom: 1px solid rgba(232, 232, 232, 1);
  417. padding-bottom: 32rpx;
  418. .title{
  419. color: rgba(51, 51, 51, 1);
  420. font-size: 16px;
  421. margin-bottom: 16rpx;
  422. line-height: 22px;
  423. }
  424. .photos{
  425. img{
  426. width: 168rpx;
  427. height: 168rpx;
  428. border-radius: 16rpx;
  429. margin-right: 4rpx;
  430. }
  431. .videoplay{
  432. height: 400rpx;
  433. }
  434. video {
  435. width: 100%;
  436. height: 200rpx;
  437. border-radius: 16rpx;
  438. margin-bottom: 16rpx;
  439. //margin-left: 16rpx;
  440. }
  441. }
  442. }
  443. }
  444. .item:last-of-type{
  445. .content{
  446. border: none;
  447. }
  448. }
  449. }
  450. </style>