personalPage.vue 8.3 KB

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