peopleHome.vue 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321
  1. <template>
  2. <view class="page">
  3. <view class="topUser">
  4. <image :src="home_image" class="home_image" mode="aspectFill"></image>
  5. <view class="list">
  6. <view class="img" :class="selImg==index?'active':''" v-for="(item,index) in image_list" :key="index"
  7. @click="selPhoto(item,index)">
  8. <image :src="item" mode="aspectFill"></image>
  9. </view>
  10. </view>
  11. </view>
  12. <view class="body">
  13. <view class="item">
  14. <view class="nickname">
  15. <text class="name">{{myinfo.nickname}}</text>
  16. <view class="sex1" v-if="myinfo.sex == 1">
  17. <image class="icon" mode="widthFix" src="../../static/home/icon_sex1.png"></image>
  18. <text>{{myinfo.age}}</text>
  19. </view>
  20. <view class="sex2" v-else>
  21. <image class="icon" mode="widthFix" src="../../static/home/icon_sex2.png"></image>
  22. <text>{{myinfo.age}}</text>
  23. </view>
  24. <image src="../../static/me/icon_vip.png" mode="widthFix" v-if="myinfo.is_vip > 0" />
  25. </view>
  26. </view>
  27. <view class="item">
  28. <view class="desc">{{myinfo.qianmin}}</view>
  29. </view>
  30. <view class="item">
  31. <view class="tag_list">
  32. <view class="tag2" v-for="(item,index) in tag_list" :key="index">
  33. <text>{{item}}</text>
  34. </view>
  35. </view>
  36. </view>
  37. <view class="item2">
  38. <view class="left">
  39. </view>
  40. <view class="more" v-if="false">
  41. 更多
  42. <image class="icon" src="../../static/me/arrow_right_gray.png" mode="widthFix">
  43. </image>
  44. </view>
  45. </view>
  46. <view class="list_info">
  47. <block v-for="(item,index) in myinfo.article_list" :key="index">
  48. <view class="item">
  49. <view class="avator">
  50. <image class="icon" :src="item.avator" mode="aspectFill">
  51. </image>
  52. </view>
  53. <view class="tit">
  54. <view class="list1">
  55. <view class="name">
  56. {{item.nickname}}
  57. </view>
  58. <view class="sex2" v-if="item.sex == 2">
  59. <image class="icon" src="../../static/icon/woman.png" mode="widthFix">
  60. </image>
  61. {{item.age}}
  62. </view>
  63. <view class="sex1" v-else>
  64. <image class="icon" src="../../static/icon/man.png" mode="widthFix">
  65. </image>
  66. {{item.age}}
  67. </view>
  68. <view class="xinzuo" v-if="item.xinzuo != ''">{{item.xinzuo}}</view>
  69. </view>
  70. <view class="time">{{item.dtime}}</view>
  71. </view>
  72. <view class="state">
  73. </view>
  74. </view>
  75. <view class="content">
  76. {{item.content}}
  77. </view>
  78. <view class="photo_list">
  79. <view class="img" v-for="(item2,index2) in toArr(item.images)" :key="index2"
  80. @click="previewOpen(item.images,index2)" v-if="item2 != ''">
  81. <image class="icon" :src="item2" mode="aspectFill"></image>
  82. </view>
  83. </view>
  84. <view class="desc">
  85. <view class="addr">{{item.city}}</view>
  86. <view class="img" @click="ZhanTA(item,index)" v-if="item.is_like < 1">
  87. <image class="icon" src="../../static/icon/zan.png" mode="widthFix"></image>
  88. {{item.num_like}}
  89. </view>
  90. <view class="img" v-else>
  91. <image class="icon" src="../../static/icon/like.png" mode="widthFix"></image>
  92. {{item.num_like}}
  93. </view>
  94. <view class="img" v-if="false">
  95. <image class="icon" src="../../static/icon/reply.png" mode="widthFix"></image>
  96. {{item.num_comment}}
  97. </view>
  98. </view>
  99. </block>
  100. <view class="blankHeight"></view>
  101. </view>
  102. <view class="item2" style="margin-top: 20rpx;">
  103. <view class="left">
  104. </view>
  105. <view class="more">
  106. 更多
  107. <image class="icon" src="../../static/me/arrow_right_gray.png" mode="widthFix">
  108. </image>
  109. </view>
  110. </view>
  111. <view class="list_wish">
  112. <view class="item" v-for="(item,index) in list_wish">
  113. <view class="avator">
  114. <image class="icon" :src="item.image" mode="widthFix" />
  115. </view>
  116. <view class="left">
  117. <view class="name">{{item.name}}</view>
  118. <view class="jindu">
  119. <view class="bord">
  120. <view class="active" :style="'width:' + item.num_bfb + '%;'"></view>
  121. </view>
  122. <text class="tips">{{item.num_bfb}}%</text>
  123. </view>
  124. </view>
  125. <text class="right">
  126. <block v-if="item.status == 1">
  127. <view class="btn_submit" @click="onLinqu(item)">邀请助力</view>
  128. </block>
  129. <block v-if="item.status == 2">
  130. <view class="state">待发货</view>
  131. </block>
  132. <block v-if="item.status == 9">
  133. <view class="state">已发货</view>
  134. </block>
  135. </text>
  136. </view>
  137. <view class="blankHeight"></view>
  138. </view>
  139. </view>
  140. <view class="btn_submit" @click="chatTA()">
  141. <image class="icon" src="../../static/icon/icon_chat_white.png" mode="widthFix"></image>
  142. 私聊
  143. </view>
  144. <view class="thread2"></view>
  145. <view class="thread2"></view>
  146. <previewImage ref="previewImage" :opacity="0.8" :circular="true" :imgs="imgs" :descs="descs"></previewImage>
  147. </view>
  148. </template>
  149. <script>
  150. import previewImage from '@/components/kxj-previewImage/kxj-previewImage.vue'; //引用插件
  151. export default {
  152. components: {
  153. previewImage
  154. },
  155. data() {
  156. return {
  157. title: '',
  158. userID: 0,
  159. selImg: 0,
  160. home_image: '',
  161. myinfo: {},
  162. tag_list: [],
  163. image_list: [],
  164. imgs: [],
  165. descs: [],
  166. list_wish: []
  167. }
  168. },
  169. onLoad(parms) {
  170. let self = this;
  171. this.userID = parms.uid || 1069;
  172. },
  173. onShow() {
  174. uni.$emit('check_update');
  175. this.loadData();
  176. this.loadWishData();
  177. },
  178. methods: {
  179. onLinqu(item) {
  180. uni.navigateTo({
  181. url: '/pages/my/wishHelp?id=' + item.myid,
  182. })
  183. },
  184. selPhoto(item, sel) {
  185. this.selImg = sel;
  186. this.home_image = this.image_list[sel];
  187. },
  188. chatTA() {
  189. // uni.navigateTo({
  190. // url: '/pages/chat/detail?userID=1&nickName=' + encodeURIComponent("昵称") +
  191. // "&conversationType=C2C"
  192. // });
  193. let conversationID = "";
  194. let conversationType = "C2C";
  195. let userID = "" + this.myinfo.userID;
  196. let nickName = this.myinfo.nickname;
  197. var jsonConversationID = encodeURIComponent(JSON.stringify(conversationID));
  198. var jsonConversationType = encodeURIComponent(JSON.stringify(conversationType));
  199. var jsonUserID = encodeURIComponent(JSON.stringify(userID));
  200. var jsonNickName = encodeURIComponent(JSON.stringify(nickName));
  201. uni.navigateTo({
  202. url: "/pages/chat/detail?userID=" + jsonUserID + "&nickName=" + jsonNickName +
  203. "&conversationID=" + jsonConversationID + "&conversationType=" + jsonConversationType
  204. })
  205. },
  206. toArr(imgs) {
  207. let arr = imgs.split("|");
  208. return arr;
  209. },
  210. previewOpen(imgs1, index) {
  211. this.imgs = imgs1.split("|");
  212. setTimeout(() => this.$refs.previewImage.open(index), 0)
  213. // 传入当前选中的图片地址或序号
  214. return; //如需测试和uni原生预览差别可注释这两行
  215. },
  216. loadWishData() {
  217. uni.request({
  218. url: this.$apiHost + '/Wish/getMyList',
  219. data: {
  220. uuid: getApp().globalData.uuid,
  221. userID: this.userID
  222. },
  223. header: {
  224. 'content-type': 'application/json'
  225. },
  226. success: (res) => {
  227. console.log("res", res.data)
  228. this.list_wish = res.data.list;
  229. }
  230. });
  231. },
  232. loadData() {
  233. // console.log({
  234. // uuid: getApp().globalData.uuid,
  235. // skey: getApp().globalData.skey
  236. // });
  237. uni.request({
  238. url: this.$apiHost + '/Member/getHomeInfo',
  239. data: {
  240. uuid: getApp().globalData.uuid,
  241. userID: this.userID
  242. },
  243. header: {
  244. "content-type": "application/json",
  245. 'sign': getApp().globalData.headerSign
  246. },
  247. success: (res) => {
  248. console.log("----:", res.data);
  249. this.myinfo = res.data;
  250. if (res.data.tags != "") {
  251. this.tag_list = res.data.tags.split(",");
  252. }
  253. if (res.data.images != "") {
  254. this.image_list = res.data.images.split(",");
  255. this.home_image = this.image_list[0];
  256. } else {
  257. this.home_image = "../../static/home/avator.png";
  258. }
  259. },
  260. complete: (com) => {
  261. // uni.hideLoading();
  262. },
  263. fail: (e) => {
  264. console.log("----e:", e);
  265. }
  266. });
  267. },
  268. ZhanTA(item, index) {
  269. // this.list[index].is_like = 1;
  270. // this.list[index].num_like++;
  271. // return;
  272. let that = this;
  273. uni.request({
  274. url: this.$apiHost + '/Article/zanTA',
  275. data: {
  276. uuid: getApp().globalData.uuid,
  277. id: item.id
  278. },
  279. header: {
  280. "content-type": "application/json",
  281. 'sign': getApp().globalData.headerSign
  282. },
  283. success: (res) => {
  284. console.log("----:", res.data);
  285. if (res.data.success == "yes") {
  286. that.myinfo.article_list[index].is_like = 1;
  287. that.myinfo.article_list[index].num_like++;
  288. }
  289. },
  290. complete: (com) => {
  291. // uni.hideLoading();
  292. },
  293. fail: (e) => {
  294. console.log("----e:", e);
  295. }
  296. });
  297. }
  298. }
  299. }
  300. </script>
  301. <style scoped lang="scss">
  302. @import 'peopleHome.scss';
  303. </style>