peopleHome.vue 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257
  1. <template>
  2. <view class="page">
  3. <view class="topBody">
  4. <view class="header">
  5. <view class="infoBg">
  6. <view class="top_row">
  7. <view class="left" @click="goPage('/pages/my/editInfo')">
  8. <image class="img" mode="aspectFill" :src="myinfo.avator"></image>
  9. </view>
  10. <view class="right" @click="goPage('/pages/my/editInfo')">
  11. <view class="nickname">
  12. <text>{{myinfo.nickname}}</text>
  13. <image src="../../static/icon/man.png" mode="widthFix" v-if="myinfo.sex_id == 1" />
  14. <image src="../../static/icon/woman.png" mode="widthFix"
  15. v-else-if="myinfo.sex_id == 2" />
  16. <view class="level">Lv{{myinfo.my_level}}</view>
  17. </view>
  18. <view class="tags_list">
  19. <block v-for="(item,index) in aihao_tags">
  20. <uni-tag class="tag" type="primary" :inverted="false" :text="item" size="mini" />
  21. </block>
  22. </view>
  23. </view>
  24. </view>
  25. <view class="bottom_row">
  26. <view class="intro_row">
  27. <text class="intro_text">{{myinfo.content}}</text>
  28. </view>
  29. <view class="follow_info">
  30. <text class="num">{{myinfo.num_attention}}</text>
  31. <text class="label">关注</text>
  32. <text class="separator"></text>
  33. <text class="num">{{myinfo.num_fans}}</text>
  34. <text class="label">粉丝</text>
  35. <text class="separator"></text>
  36. <text class="num">{{myinfo.num_like}}</text>
  37. <text class="label">获赞</text>
  38. </view>
  39. </view>
  40. </view>
  41. </view>
  42. </view>
  43. <view class="myinfo">
  44. <view class="line"></view>
  45. <view class="tips">3作品</view>
  46. <view class="numlist2" style="margin-top: 60rpx;">
  47. <view class="item" v-for="(item,index) in worksList" :key="index">
  48. <view class="num">
  49. <image class="icon" :src="item.images" mode="widthFix" />
  50. <view class="name">
  51. <text class="title-text">{{item.title || '作品'+index}}</text>
  52. <view class="like-count">
  53. <image class="heart-icon" src="../../static/icon/icon-7.png" mode="widthFix"></image>
  54. <text>{{item.like_count || 0}}</text>
  55. </view>
  56. </view>
  57. </view>
  58. </view>
  59. </view>
  60. <!-- 加载更多提示 -->
  61. <view class="loading-more" v-if="isLoading">加载中...</view>
  62. </view>
  63. <!-- <view class="btn_submit" @click="chatTA()">
  64. <image class="icon" src="../../static/icon/icon_chat_white.png" mode="widthFix"></image>
  65. 私聊
  66. </view> -->
  67. <view class="thread2"></view>
  68. <view class="thread2"></view>
  69. </view>
  70. </template>
  71. <script>
  72. export default {
  73. components: {},
  74. data() {
  75. return {
  76. title: '',
  77. userID: 0,
  78. selImg: 0,
  79. home_image: '',
  80. myinfo: {},
  81. tag_list: [],
  82. image_list: [],
  83. imgs: [],
  84. descs: [],
  85. aihao_tags: [],
  86. worksList: [],
  87. activeTab: 0,
  88. offset: 0,
  89. hasMore: true,
  90. isLoading: false,
  91. myInfo: {
  92. user_id: 1,
  93. user_name: "cc",
  94. user_avatar: "https://img0.baidu.com/it/u=2836960144,3650263035&fm=253&fmt=auto&app=138&f=JPEG?w=474&h=474",
  95. },
  96. }
  97. },
  98. onLoad(parms) {
  99. let self = this;
  100. this.userID = parms.uid || 1;
  101. },
  102. onShow() {
  103. uni.$emit('check_update');
  104. // this.loadData();
  105. this.loadData();
  106. this.loadWorksList();
  107. },
  108. methods: {
  109. onLinqu(item) {
  110. uni.navigateTo({
  111. url: '/pages/my/wishHelp?id=' + item.myid,
  112. })
  113. },
  114. selPhoto(item, sel) {
  115. this.selImg = sel;
  116. this.home_image = this.image_list[sel];
  117. },
  118. loadInfo() {
  119. console.log({
  120. uuid: getApp().globalData.uuid,
  121. skey: getApp().globalData.skey
  122. });
  123. uni.request({
  124. url: this.$apiHost + '/User/getinfo',
  125. data: {
  126. uuid: getApp().globalData.uuid,
  127. skey: getApp().globalData.skey
  128. },
  129. header: {
  130. "content-type": "application/json",
  131. 'sign': getApp().globalData.headerSign
  132. },
  133. success: (res) => {
  134. console.log("----:", res.data);
  135. if (res.data.need_login == "yes") {
  136. // getApp().globalData.skey = "";
  137. // getApp().globalData.uuid = "";
  138. // uni.removeStorageSync("wapptoken");
  139. // uni.redirectTo({
  140. // url: '/pages/login/login'
  141. // });
  142. // return;
  143. }
  144. if (res.data.aihao) {
  145. this.aihao_tags = res.data.aihao.split(",");
  146. }
  147. this.myinfo = res.data;
  148. },
  149. complete: (com) => {
  150. // uni.hideLoading();
  151. },
  152. fail: (e) => {
  153. console.log("----e:", e);
  154. }
  155. });
  156. },
  157. toArr(imgs) {
  158. let arr = imgs.split("|");
  159. return arr;
  160. },
  161. previewOpen(imgs1, index) {
  162. this.imgs = imgs1.split("|");
  163. setTimeout(() => this.$refs.previewImage.open(index), 0)
  164. // 传入当前选中的图片地址或序号
  165. return; //如需测试和uni原生预览差别可注释这两行
  166. },
  167. loadData() {
  168. // console.log({
  169. // uuid: getApp().globalData.uuid,
  170. // skey: getApp().globalData.skey
  171. // });
  172. uni.request({
  173. url: this.$apiHost + '/Member/getHomeInfo',
  174. data: {
  175. uuid: getApp().globalData.uuid,
  176. userID: this.userID
  177. },
  178. header: {
  179. "content-type": "application/json",
  180. 'sign': getApp().globalData.headerSign
  181. },
  182. success: (res) => {
  183. console.log("----:", res.data);
  184. this.myinfo = res.data;
  185. if (res.data.aihao) {
  186. this.aihao_tags = res.data.aihao.split(",");
  187. }
  188. this.myinfo = res.data;
  189. },
  190. complete: (com) => {
  191. // uni.hideLoading();
  192. },
  193. fail: (e) => {
  194. console.log("----e:", e);
  195. }
  196. });
  197. },
  198. loadWorksList() {
  199. if (this.isLoading) return;
  200. this.isLoading = true;
  201. uni.request({
  202. url: this.$apiHost + '/Work/getlist',
  203. data: {
  204. uuid: getApp().globalData.uuid,
  205. skey: getApp().globalData.skey,
  206. ismy: 1, // 固定为1,表示获取自己的作品
  207. offset: this.offset,
  208. status: 1
  209. },
  210. header: {
  211. "content-type": "application/json",
  212. 'sign': getApp().globalData.headerSign
  213. },
  214. success: (res) => {
  215. console.log("作品列表数据:", res.data);
  216. if (res.data.success == 'yes' && res.data.list) {
  217. if (res.data.list.length > 0) {
  218. this.worksList = [...this.worksList, ...res.data.list];
  219. this.offset += res.data.list.length;
  220. }
  221. if (res.data.list.length < 20) {
  222. this.hasMore = false;
  223. }
  224. } else {
  225. this.hasMore = false;
  226. }
  227. },
  228. complete: () => {
  229. this.isLoading = false;
  230. },
  231. fail: (e) => {
  232. console.log("请求作品列表失败:", e);
  233. this.isLoading = false;
  234. }
  235. });
  236. },
  237. }
  238. }
  239. </script>
  240. <style scoped lang="scss">
  241. @import 'peopleHome.scss';
  242. </style>