address.js 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. // customized/pages/address/address.js
  2. let app = getApp();
  3. let host = app.globalData.servsers; // 请求的url
  4. Page({
  5. /**
  6. * 页面的初始数据
  7. */
  8. data: {
  9. addressList: [],
  10. },
  11. /**
  12. * 生命周期函数--监听页面加载
  13. */
  14. onLoad: function (options) {
  15. },
  16. /**
  17. * 生命周期函数--监听页面初次渲染完成
  18. */
  19. onReady: function () {
  20. },
  21. /**
  22. * 生命周期函数--监听页面显示
  23. */
  24. onShow: function () {
  25. this.getaddress()
  26. },
  27. /**
  28. * 生命周期函数--监听页面隐藏
  29. */
  30. onHide: function () {
  31. },
  32. /**
  33. * 生命周期函数--监听页面卸载
  34. */
  35. onUnload: function () {
  36. },
  37. /**
  38. * 页面相关事件处理函数--监听用户下拉动作
  39. */
  40. onPullDownRefresh: function () {
  41. },
  42. /**
  43. * 页面上拉触底事件的处理函数
  44. */
  45. getaddress() {
  46. let that = this;
  47. wx.request({
  48. url: host + '/adressapi/adressview',
  49. header: {
  50. 'content-type': 'application/x-www-form-urlencoded'
  51. },
  52. data: {
  53. userId: app.globalData.user_id,// 'oovpNwjlsY6xx8ceCebFa1dOLd9E' //app.globalData.user_id,
  54. },
  55. success(res) {
  56. console.log(res, "address")
  57. that.setData({
  58. addressList:[...res.rows]
  59. })
  60. }
  61. })
  62. },
  63. addAddress(){
  64. wx.navigateTo({
  65. url: '/customized/pages/address/add/add',
  66. })
  67. }
  68. })