personalPage.vue 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443
  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,i) {
  190. let imgs = [];
  191. img.forEach(it=>{
  192. imgs.push(it.url)
  193. })
  194. uni.previewImage({
  195. indicator:"default",
  196. loop:true,
  197. urls: imgs,
  198. current: i
  199. })
  200. },getList(){
  201. uni.showLoading({
  202. title: "加载中",
  203. mask: true,
  204. })
  205. API_share.pageList(this.listForm).then((res) => {
  206. this.carhelp.set("addShare",0);
  207. uni.hideLoading();
  208. //this.list=response.data.data
  209. if(this.listForm.pageIndex==1){
  210. this.list = res.data.data;
  211. }else{
  212. this.list = [
  213. ...this.list,
  214. ...res.data.data
  215. ];
  216. }
  217. this.recordsTotal = res.data.recordsTotal;
  218. }).catch(error => {
  219. uni.showToast({
  220. title: error,
  221. icon: "none"
  222. })
  223. })
  224. },
  225. myLoadmore(){
  226. this.listForm.pageIndex += 1;
  227. this.getList();
  228. },
  229. }
  230. }
  231. </script>
  232. <style scoped lang="scss">
  233. uni-textarea{
  234. width: 500rpx;
  235. text-indent: 28rpx;
  236. padding-top:28rpx;
  237. font-family: Microsoft Yahei;
  238. }
  239. page{
  240. background-color: #fff;
  241. padding-bottom: 50px;
  242. font-family: 'Regular';
  243. }
  244. .header{
  245. padding: 0 0 48rpx 0;
  246. background: linear-gradient(180deg, rgba(183,208,255,1) 0%,rgba(244,244,246,1) 100%);
  247. .navbar{
  248. display: flex;
  249. justify-content: space-between;
  250. align-items: center;
  251. height: 44px;
  252. padding: 0 32rpx;
  253. .title{
  254. font-size: 16px;
  255. color: rgba(16, 16, 16, 1);
  256. }
  257. }
  258. .sticky{
  259. background-color: #fff;
  260. display: flex;
  261. justify-content: space-between;
  262. align-items: center;
  263. height: 44px;
  264. padding: 0 32rpx;
  265. position: fixed;
  266. top: 0;
  267. left: 0;
  268. right: 0;
  269. .title{
  270. font-size: 16px;
  271. color: rgba(16, 16, 16, 1);
  272. }
  273. }
  274. // 个人信息
  275. .person-infos{
  276. margin-top: 32rpx;
  277. padding: 0 48rpx;
  278. display: flex;
  279. align-items: center;
  280. margin-bottom: 48rpx;
  281. .photo {
  282. box-shadow: 0px 2px 8px 0px rgba(35, 72, 75, 15);
  283. border: 2px solid rgba(255, 255, 255, 1);
  284. border-radius: 50px;
  285. width: 120rpx;
  286. height: 120rpx;
  287. overflow: hidden;
  288. img {
  289. vertical-align: middle;
  290. border-radius: 50px;
  291. width: 120rpx;
  292. height: 120rpx;
  293. }
  294. }
  295. .infos {
  296. margin-left:32rpx;
  297. .name {
  298. line-height: 28px;
  299. font-size: 20px;
  300. font-family: 'Medium';
  301. }
  302. .department-position {
  303. display: flex;
  304. margin-top: 16rpx;
  305. color: rgba(119, 119, 119, 1);
  306. .icon {
  307. margin-right: 8rpx;
  308. img {
  309. width: 28rpx;
  310. height: 28rpx;
  311. }
  312. }
  313. .department {
  314. display: flex;
  315. .text{
  316. line-height: 16px;
  317. }
  318. }
  319. .position {
  320. display: flex;
  321. margin-left: 24rpx;
  322. .text{
  323. line-height: 16px;
  324. }
  325. }
  326. }
  327. }
  328. }
  329. .grid {
  330. width: 100%;
  331. display: flex;
  332. flex-direction: row;
  333. flex-wrap: wrap;
  334. align-items: center;
  335. margin-top: 24rpx;
  336. justify-content: space-between;
  337. .item {
  338. width: 33.3%;
  339. text-align: center;
  340. .amout {
  341. font-size: 48rpx;
  342. line-height: 64rpx;
  343. }
  344. .text {
  345. font-size: 32rpx;
  346. line-height: 44rpx;
  347. }
  348. }
  349. }
  350. }
  351. .share{
  352. padding: 32rpx;
  353. .item{
  354. margin-bottom: 48rpx;
  355. display: flex;
  356. .date{
  357. .day{
  358. color: rgba(51, 51, 51, 1);
  359. font-size: 18px;
  360. font-weight:bold;
  361. line-height: 25px;
  362. font-family: 'Medium';
  363. }
  364. .year-month{
  365. color: rgba(51, 51, 51, 1);
  366. }
  367. }
  368. .content{
  369. margin-left: 52rpx;
  370. border-bottom: 1px solid rgba(232, 232, 232, 1);
  371. padding-bottom: 32rpx;
  372. .title{
  373. color: rgba(51, 51, 51, 1);
  374. font-size: 16px;
  375. margin-bottom: 16rpx;
  376. line-height: 22px;
  377. }
  378. .photos{
  379. img{
  380. width: 248rpx;
  381. height: 248rpx;
  382. border-radius: 16rpx;
  383. margin-right: 16rpx;
  384. }
  385. }
  386. }
  387. }
  388. .item:last-of-type{
  389. .content{
  390. border: none;
  391. }
  392. }
  393. }
  394. </style>