index.js 1.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. //index.js
  2. //获取应用实例
  3. const app = getApp()
  4. import fetch from '../../../utils/http'
  5. const $api = require('../../../config/api.js').$api;
  6. import ArticleList from './article.js'
  7. Page({
  8. onShow() {
  9. wx.setNavigationBarTitle({
  10. title: '购房百科'
  11. })
  12. },
  13. onLoad() {
  14. this.ReturnList()
  15. },
  16. data: {
  17. UserInfo: app.globalData.UserInfo, // 用户信息
  18. NavList: [{
  19. value: '准备买房',
  20. id: '1'
  21. }, {
  22. value: '看房选房',
  23. id: '2'
  24. }, {
  25. value: '订房签约',
  26. id: '3'
  27. }, {
  28. value: '收房验房',
  29. id: '4'
  30. }],
  31. ActiveIndex: 0,
  32. List: []
  33. },
  34. CutNav(e) {
  35. this.setData({
  36. ActiveIndex: e.target.dataset.index
  37. })
  38. this.ReturnList()
  39. },
  40. ReturnList() {
  41. let aArr = []
  42. ArticleList.ArticleList.map((item) => {
  43. if (item.Type - 0 === this.data.NavList[this.data.ActiveIndex].id - 0) {
  44. aArr = item.List
  45. }
  46. })
  47. this.setData({
  48. List: aArr
  49. })
  50. },
  51. TapItem(e) {
  52. wx.navigateTo({
  53. url: '/pages/SelfServiceTool/Cyclopedia/Detail?id=' + e.target.dataset.id + '&type=' + e.target.dataset.type,
  54. })
  55. },
  56. /**
  57. * 用户点击右上角分享
  58. */
  59. onShareAppMessage: function () {
  60. return app.globalData.ShareDate
  61. }
  62. })