peopleHome.vue 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261
  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" :key="index">
  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" @touchstart="handleTouchStart">
  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. handleTouchStart(event) {
  110. event.preventDefault(); // 防止页面滚动
  111. console.log('触摸开始');
  112. },
  113. onLinqu(item) {
  114. uni.navigateTo({
  115. url: '/pages/my/wishHelp?id=' + item.myid,
  116. })
  117. },
  118. selPhoto(item, sel) {
  119. this.selImg = sel;
  120. this.home_image = this.image_list[sel];
  121. },
  122. loadInfo() {
  123. console.log({
  124. uuid: getApp().globalData.uuid,
  125. skey: getApp().globalData.skey
  126. });
  127. uni.request({
  128. url: this.$apiHost + '/User/getinfo',
  129. data: {
  130. uuid: getApp().globalData.uuid,
  131. skey: getApp().globalData.skey
  132. },
  133. header: {
  134. "content-type": "application/json",
  135. 'sign': getApp().globalData.headerSign
  136. },
  137. success: (res) => {
  138. console.log("----:", res.data);
  139. if (res.data.need_login == "yes") {
  140. // getApp().globalData.skey = "";
  141. // getApp().globalData.uuid = "";
  142. // uni.removeStorageSync("wapptoken");
  143. // uni.redirectTo({
  144. // url: '/pages/login/login'
  145. // });
  146. // return;
  147. }
  148. if (res.data.aihao) {
  149. this.aihao_tags = res.data.aihao.split(",");
  150. }
  151. this.myinfo = res.data;
  152. },
  153. complete: (com) => {
  154. // uni.hideLoading();
  155. },
  156. fail: (e) => {
  157. console.log("----e:", e);
  158. }
  159. });
  160. },
  161. toArr(imgs) {
  162. let arr = imgs.split("|");
  163. return arr;
  164. },
  165. previewOpen(imgs1, index) {
  166. this.imgs = imgs1.split("|");
  167. setTimeout(() => this.$refs.previewImage.open(index), 0)
  168. // 传入当前选中的图片地址或序号
  169. return; //如需测试和uni原生预览差别可注释这两行
  170. },
  171. loadData() {
  172. // console.log({
  173. // uuid: getApp().globalData.uuid,
  174. // skey: getApp().globalData.skey
  175. // });
  176. uni.request({
  177. url: this.$apiHost + '/Member/getHomeInfo',
  178. data: {
  179. uuid: getApp().globalData.uuid,
  180. userID: this.userID
  181. },
  182. header: {
  183. "content-type": "application/json",
  184. 'sign': getApp().globalData.headerSign
  185. },
  186. success: (res) => {
  187. console.log("----:", res.data);
  188. this.myinfo = res.data;
  189. if (res.data.aihao) {
  190. this.aihao_tags = res.data.aihao.split(",");
  191. }
  192. this.myinfo = res.data;
  193. },
  194. complete: (com) => {
  195. // uni.hideLoading();
  196. },
  197. fail: (e) => {
  198. console.log("----e:", e);
  199. }
  200. });
  201. },
  202. loadWorksList() {
  203. if (this.isLoading) return;
  204. this.isLoading = true;
  205. uni.request({
  206. url: this.$apiHost + '/Work/getlist',
  207. data: {
  208. uuid: getApp().globalData.uuid,
  209. skey: getApp().globalData.skey,
  210. ismy: 1, // 固定为1,表示获取自己的作品
  211. offset: this.offset,
  212. status: 1
  213. },
  214. header: {
  215. "content-type": "application/json",
  216. 'sign': getApp().globalData.headerSign
  217. },
  218. success: (res) => {
  219. console.log("作品列表数据:", res.data);
  220. if (res.data.success == 'yes' && res.data.list) {
  221. if (res.data.list.length > 0) {
  222. this.worksList = [...this.worksList, ...res.data.list];
  223. this.offset += res.data.list.length;
  224. }
  225. if (res.data.list.length < 20) {
  226. this.hasMore = false;
  227. }
  228. } else {
  229. this.hasMore = false;
  230. }
  231. },
  232. complete: () => {
  233. this.isLoading = false;
  234. },
  235. fail: (e) => {
  236. console.log("请求作品列表失败:", e);
  237. this.isLoading = false;
  238. }
  239. });
  240. },
  241. }
  242. }
  243. </script>
  244. <style scoped lang="scss">
  245. @import 'peopleHome.scss';
  246. </style>