peopleHome.vue 8.9 KB

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