C端集团版
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

139 行
2.3 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. // Http.setToken(app.globalData.token);
  24. let that = this;
  25. Http.get({
  26. url: config.api.bannerlist,
  27. data: {
  28. pageNum: 1,
  29. pageSize: 7
  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. setTimeout(() => { //延时300ms 否则 拿不到token%3..x
  55. this.getBannerlist()
  56. console.log(123)
  57. }, 300)
  58. this.gitSquareLis()
  59. },
  60. /*
  61. 获取集团下面的广场
  62. */
  63. gitSquareLis(){
  64. const tempData = wx.getStorageSync("subMalls");
  65. console.log(wx.getStorageSync("subMalls"))
  66. this.setData({
  67. subMalls: tempData
  68. })
  69. },
  70. /**
  71. * 生命周期函数--监听页面初次渲染完成
  72. */
  73. onReady: function () {
  74. },
  75. /**
  76. * 生命周期函数--监听页面显示
  77. */
  78. onShow: function () {
  79. //测试发送请求
  80. // this.getInfo();
  81. },
  82. //获取用户信息
  83. getInfo() {
  84. Http.post({
  85. url: config.api.login,
  86. data: {
  87. }
  88. }).then(res => {
  89. console.log(res)
  90. })
  91. },
  92. /**
  93. * 生命周期函数--监听页面隐藏
  94. */
  95. onHide: function () {
  96. },
  97. /**
  98. * 生命周期函数--监听页面卸载
  99. */
  100. onUnload: function () {
  101. },
  102. /**
  103. * 页面相关事件处理函数--监听用户下拉动作
  104. */
  105. onPullDownRefresh: function () {
  106. },
  107. /**
  108. * 页面上拉触底事件的处理函数
  109. */
  110. onReachBottom: function () {
  111. },
  112. /**
  113. * 用户点击右上角分享
  114. */
  115. onShareAppMessage: function () {
  116. }
  117. })