index.js 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. const app = getApp()
  2. Page({
  3. /**
  4. * 页面的初始数据
  5. */
  6. data: {
  7. basicInfo: {},
  8. logo: '',
  9. },
  10. /**
  11. * 生命周期函数--监听页面加载
  12. */
  13. onLoad(options) {
  14. },
  15. /**
  16. * 生命周期函数--监听页面初次渲染完成
  17. */
  18. onReady() {
  19. },
  20. /**
  21. * 生命周期函数--监听页面显示
  22. */
  23. async onShow() {
  24. const that = this;
  25. wx.showLoading({ title: '加载中', mask: true })
  26. await this.searchConfig()
  27. await that.search();
  28. wx.hideLoading()
  29. },
  30. async searchConfig() {
  31. const that = this;
  32. // const res = await app.$api('config', 'GET', {});
  33. // if (res.errcode == '0') {
  34. // // index,长图。
  35. // if (res.data && res.data.longlogo_url && res.data.longlogo_url.length > 0) {
  36. // let logo = res.data.longlogo_url[0].url
  37. // that.setData({ logo })
  38. // }
  39. // wx.setStorage({ key: "config", data: res.data })
  40. // }
  41. },
  42. async search() {
  43. let url = '/pagesHome/home/index';
  44. wx.redirectTo({ url })
  45. // wx.login({
  46. // success: async (arr) => {
  47. // const { code: js_code } = arr;
  48. // const { wx_config } = app.globalData;
  49. // wx.getStorage({
  50. // key: 'openid',
  51. // success(res) {
  52. // if (res.data) wx.redirectTo({ url })
  53. // },
  54. // async fail(err) {
  55. // const aee = await app.$api('token/app', 'GET', { js_code: js_code, config: wx_config.config });
  56. // if (aee.errcode == '0') {
  57. // wx.setStorage({ key: "openid", data: aee.data.openid })
  58. // wx.redirectTo({ url })
  59. // } else {
  60. // wx.showToast({ title: `${aee.errmsg}`, icon: 'fail' });
  61. // }
  62. // }
  63. // })
  64. // },
  65. // });
  66. },
  67. /**
  68. * 生命周期函数--监听页面隐藏
  69. */
  70. onHide() {
  71. },
  72. /**
  73. * 生命周期函数--监听页面卸载
  74. */
  75. onUnload() {
  76. },
  77. /**
  78. * 页面相关事件处理函数--监听用户下拉动作
  79. */
  80. onPullDownRefresh() {
  81. },
  82. /**
  83. * 页面上拉触底事件的处理函数
  84. */
  85. onReachBottom() {
  86. },
  87. /**
  88. * 用户点击右上角分享
  89. */
  90. onShareAppMessage() {
  91. }
  92. })