index.js 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  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. wx.hideLoading()
  28. },
  29. async searchConfig() {
  30. const that = this;
  31. const res = await app.$api('config', 'GET', {});
  32. if (res.errcode == '0') {
  33. // index,长图。
  34. if (res.data && res.data.longlogo_url && res.data.longlogo_url.length > 0) {
  35. let logo = res.data.longlogo_url[0].url
  36. that.setData({ logo })
  37. wx.redirectTo({ url: '/pagesCommon/login/index'})
  38. }
  39. wx.setStorage({ key: "config", data: res.data })
  40. }
  41. },
  42. /**
  43. * 生命周期函数--监听页面隐藏
  44. */
  45. onHide() {
  46. },
  47. /**
  48. * 生命周期函数--监听页面卸载
  49. */
  50. onUnload() {
  51. },
  52. /**
  53. * 页面相关事件处理函数--监听用户下拉动作
  54. */
  55. onPullDownRefresh() {
  56. },
  57. /**
  58. * 页面上拉触底事件的处理函数
  59. */
  60. onReachBottom() {
  61. },
  62. /**
  63. * 用户点击右上角分享
  64. */
  65. onShareAppMessage() {
  66. }
  67. })