personalPage.vue 8.8 KB

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