index_details.js 7.1 KB

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