index.js 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. //index.js
  2. //获取应用实例
  3. const getReq = require('./../../config.js').getReq;
  4. const app = getApp();
  5. Page({
  6. data: {
  7. tabs: [],
  8. special_datas:{},
  9. summery:[]
  10. },
  11. onLoad: function () {
  12. var self = this
  13. getReq({
  14. act: 'index',
  15. op: 'tabs'
  16. }, function (res) {
  17. console.log(res);
  18. if (res.code == 200) {
  19. self.getDatas(res.datas.tabs[0].special_id);
  20. self.setData({
  21. tabs: res.datas.tabs
  22. });
  23. }
  24. })
  25. },
  26. onMyEvent: function (e) {
  27. this.setData({
  28. special_datas: {},
  29. summery: []
  30. });
  31. this.getDatas(e.detail.item.special_id)
  32. },
  33. getDatas(special_id) {
  34. wx.showLoading({
  35. title: '加载中'
  36. });
  37. var self = this;
  38. getReq({
  39. act: 'special',
  40. op: 'index',
  41. special_id,
  42. page: 10,
  43. curpage: 1
  44. }, function (res) {
  45. if (res.code == 200) {
  46. self.setData({
  47. special_datas: res.datas,
  48. summery:res.datas.summary
  49. });
  50. }
  51. setTimeout(function () {
  52. wx.hideLoading()
  53. }, 1000)
  54. })
  55. }
  56. })