index_details.js 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325
  1. const app = getApp();
  2. Page({
  3. data: {
  4. information: '', //个人信息
  5. optioninfo: '', //择偶信息
  6. adopticon: '', //认证信息
  7. geifabulous:'', //获取点赞
  8. Fabulous:'', // 点赞
  9. optionsuid: '', //用户uid
  10. collection: '', //收藏
  11. options_img: '', //头像
  12. uploadImages:[], //相册放大图集
  13. albumimg:'', // 相册
  14. albumimgurl: '',// 相册url
  15. watermark: '',
  16. to_id:'',
  17. },
  18. onLoad: function (options) {
  19. var that = this;
  20. app.postRequest('my/images/headurl', {}, function (res) {
  21. if (res.code == 201) {
  22. that.myheadurl = res.data.img
  23. // console.log(res);
  24. // that.setData({
  25. // myheadurl: res.data.img,
  26. // // optioninfocode: res,
  27. // })
  28. }
  29. })
  30. that.to_id = options.uid;
  31. that.setData({
  32. options_img: options.img, //头像
  33. to_id: options.uid
  34. })
  35. // 同步传参
  36. try {
  37. wx.setStorageSync('optionsuid', options.uid)
  38. } catch (e) {
  39. }
  40. var _optionsuid = wx.getStorageSync('optionsuid');
  41. // console.log(_optionsuid)
  42. that.setData({
  43. optionsuid: _optionsuid
  44. })
  45. // 个人相册
  46. let albumimg_url = 'circle/frienddetails/albumimg';
  47. let albumimg_data = {
  48. uid: _optionsuid,
  49. };
  50. app.postRequest(albumimg_url, albumimg_data, function (res) {
  51. // console.log(res.data.url);
  52. console.log(res.data.data);
  53. if (res.code == 201) {
  54. // 对象转数组
  55. var itemList = res.data.data;
  56. //声明一个空的数组
  57. var items = [];
  58. //遍历数据
  59. for (let i in itemList) {
  60. //push到空数组里
  61. items.push(res.data.url + itemList[i].img + res.data.watermark);
  62. }
  63. console.log(items);
  64. that.setData({
  65. uploadImages: items,
  66. albumimg: res.data.data,
  67. albumimgurl: res.data.url,
  68. watermark: res.data.watermark,
  69. })
  70. }
  71. })
  72. // 个人信息
  73. let information_url = 'circle/frienddetails/details';
  74. let information_data = {
  75. uid: this.data.optionsuid,
  76. };
  77. app.postRequest(information_url, information_data, function (res) {
  78. if (res.code == 201) {
  79. // console.log(res.data);
  80. that.setData({
  81. information: res.data
  82. })
  83. }
  84. })
  85. // 择偶信息
  86. let optioninfo_url = 'circle/frienddetails/optiondetails';
  87. let optioninfo_data = {
  88. uid: this.data.optionsuid,
  89. };
  90. app.postRequest(optioninfo_url, optioninfo_data, function (res) {
  91. // console.log(res.data);
  92. if (res.code == 201) {
  93. that.setData({
  94. optioninfo: res.data,
  95. optioninfocode: res,
  96. })
  97. }
  98. })
  99. // 认证信息
  100. let adopticon_url = 'circle/frienddetails/authdetails';
  101. let adopticon_data = {
  102. uid: this.data.optionsuid,
  103. };
  104. app.postRequest(adopticon_url, adopticon_data, function (res) {
  105. // console.log(res.data);
  106. // console.log(res);
  107. if (res.code == 201) {
  108. that.setData({
  109. adopticon: res.data,
  110. adopticoncode: res,
  111. })
  112. }
  113. })
  114. // 获取点赞
  115. let appreciate_url = 'circle/adore/appreciate';
  116. let appreciate_data = {
  117. uuid: this.data.optionsuid,
  118. };
  119. app.postRequest(appreciate_url, appreciate_data, function (res) {
  120. // console.log(res.data);
  121. if (res.code == 201) {
  122. that.setData({
  123. geifabulous: res.data,
  124. // optioninfocode: res,
  125. })
  126. }else{
  127. that.setData({
  128. geifabulous: res.data,
  129. // optioninfocode: res,
  130. })
  131. }
  132. })
  133. // 获取收藏
  134. let collection_url = 'circle/adore/collection';
  135. let collection_data = {
  136. uuid: this.data.optionsuid,
  137. };
  138. app.postRequest(collection_url, collection_data, function (res) {
  139. // console.log(res.data);
  140. if (res.code == 201) {
  141. that.setData({
  142. collection: res.data,
  143. // optioninfocode: res,
  144. })
  145. } else {
  146. that.setData({
  147. collection: res.data,
  148. // optioninfocode: res,
  149. })
  150. }
  151. })
  152. },
  153. // 相册点击放大
  154. enlarge: function (e) {
  155. var that = this;
  156. console.log(that.data.uploadImages)
  157. wx.previewImage({
  158. urls: that.data.uploadImages ,
  159. current: e.currentTarget.dataset.src
  160. })
  161. },
  162. fabulousclick: function(e){
  163. var that = this ;
  164. // 点赞
  165. let appreciateform_url = 'circle/adore/appreciateform';
  166. let appreciateform_data = {
  167. uuid: this.data.optionsuid,
  168. };
  169. app.postRequest(appreciateform_url, appreciateform_data, function (res) {
  170. if (res.code == 201) {
  171. that.setData({
  172. geifabulous: res.data,
  173. // optioninfocode: res,
  174. })
  175. } else {
  176. that.setData({
  177. geifabulous: res.data,
  178. // optioninfocode: res,
  179. })
  180. }
  181. })
  182. },
  183. collectionformclick: function (e) {
  184. var that = this;
  185. // 点赞
  186. let collectionform_url = 'circle/adore/collectionform';
  187. let collectionform_data = {
  188. uuid: this.data.optionsuid,
  189. };
  190. app.postRequest(collectionform_url, collectionform_data, function (res) {
  191. if (res.code == 201) {
  192. that.setData({
  193. collection: res.data,
  194. // optioninfocode: res,
  195. })
  196. } else {
  197. that.setData({
  198. collection: res.data,
  199. // optioninfocode: res,
  200. })
  201. }
  202. })
  203. },
  204. toChat(e) { //跳转进入聊天页面
  205. let that = this;
  206. app.postRequest('circle/dialogue/validate', {to_id:that.data.to_id}, function (res) {
  207. // console.log(res);
  208. // return ;
  209. if (res.code == 201) {
  210. wx.navigateTo({
  211. url: '../information/chat/chat?to_id=' + that.data.to_id + '&headUrl=' + that.data.options_img + '&myheadurl=' + res.data.myHeadImg
  212. });
  213. // wx.navigateTo({
  214. // url: '../chat/chat?to_id=' + + '&myheadurl=' + that.myheadurl + '&headUrl=' + that.data.options_img
  215. // });
  216. return;
  217. }
  218. if (res.data.location == 'shiming') {
  219. wx.showModal({
  220. title: '实名认证',
  221. content: res.msg,
  222. success(res) {
  223. if (res.confirm) {
  224. // console.log('用户点击确定');
  225. wx.navigateTo({
  226. url: '/pages/personal_core/home_list/home_list'
  227. });
  228. } else if (res.cancel) {
  229. // console.log('用户点击取消')
  230. }
  231. }
  232. })
  233. return;
  234. }
  235. if (res.data.location == 'huiyuan') {
  236. wx.showModal({
  237. title: '开通会员',
  238. content: res.msg,
  239. success(res) {
  240. if (res.confirm) {
  241. // console.log('用户点击确定');
  242. wx.navigateTo({
  243. url: '/pages/payment/Member/Member'
  244. });
  245. } else if (res.cancel) {
  246. // console.log('用户点击取消')
  247. }
  248. }
  249. })
  250. return;
  251. }
  252. // if (res.data.location == shiming) {
  253. // wx.navigateTo({
  254. // url: '../chat/chat?to_id=' + that.to_id + '&myheadurl=' + that.myheadurl + '&headUrl=' + that.data.options_img
  255. // });
  256. // }
  257. app.Tips(res.msg);
  258. })
  259. }
  260. })