C端集团版
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

146 lines
2.4 KiB

  1. // pages/index/index.js
  2. const Http = require("../../utils/HttpBasics");
  3. const config = require("../../config/config.js");
  4. let app = getApp();
  5. Page({
  6. /**
  7. * 跳转到其他小程序
  8. * 接受唯一参数 appId
  9. * */
  10. goPlaza(event) {
  11. let appid = event.currentTarget.dataset.appid
  12. wx.navigateToMiniProgram({
  13. appId: appid,
  14. success(res) {
  15. // 打开成功
  16. }
  17. })
  18. },
  19. /**
  20. * banner
  21. */
  22. getBannerlist: function () {
  23. let that = this;
  24. Http.get({
  25. url: config.api.bannerlist,
  26. data: {
  27. pageNum: 1,
  28. pageSize: 7,
  29. token:app.globalData.token
  30. }
  31. }).then(res => {
  32. // that.getmemberId(app.globalData.token);
  33. // that.checkUserCarStatus();
  34. that.setData({
  35. list: res.data.list
  36. });
  37. })
  38. .catch(err => {
  39. // that.getmemberId(app.globalData.token);
  40. // that.checkUserCarStatus();
  41. });
  42. },
  43. /**
  44. * 页面的初始数据
  45. */
  46. data: {
  47. list: [],
  48. subMalls: [],
  49. },
  50. /**
  51. * 生命周期函数--监听页面加载
  52. */
  53. onLoad: function (options) {
  54. if (app.globalData.token) {
  55. this.getBannerlist()
  56. this.gitSquareLis()
  57. } else {
  58. app.tokenCallback = token => {
  59. this.getBannerlist()
  60. this.gitSquareLis()
  61. }
  62. }
  63. },
  64. /*
  65. 获取集团下面的广场
  66. */
  67. gitSquareLis(){
  68. const tempData = wx.getStorageSync("subMalls");
  69. console.log(wx.getStorageSync("subMalls"))
  70. this.setData({
  71. subMalls: tempData
  72. })
  73. },
  74. /**
  75. * 生命周期函数--监听页面初次渲染完成
  76. */
  77. onReady: function () {
  78. },
  79. /**
  80. * 生命周期函数--监听页面显示
  81. */
  82. onShow: function () {
  83. //测试发送请求
  84. // this.getInfo();
  85. },
  86. //获取用户信息
  87. getInfo() {
  88. Http.post({
  89. url: config.api.login,
  90. data: {
  91. }
  92. }).then(res => {
  93. console.log(res)
  94. })
  95. },
  96. /**
  97. * 生命周期函数--监听页面隐藏
  98. */
  99. onHide: function () {
  100. },
  101. /**
  102. * 生命周期函数--监听页面卸载
  103. */
  104. onUnload: function () {
  105. },
  106. /**
  107. * 页面相关事件处理函数--监听用户下拉动作
  108. */
  109. onPullDownRefresh: function () {
  110. },
  111. /**
  112. * 页面上拉触底事件的处理函数
  113. */
  114. onReachBottom: function () {
  115. },
  116. /**
  117. * 用户点击右上角分享
  118. */
  119. onShareAppMessage: function () {
  120. }
  121. })