index.js 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  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. if (res.code == 200) {
  18. self.getDatas(res.datas.tabs[0].special_id);
  19. self.setData({
  20. tabs: res.datas.tabs
  21. });
  22. }
  23. })
  24. },
  25. onMyEvent: function (e) {
  26. this.setData({
  27. special_datas: {},
  28. summery: []
  29. });
  30. this.getDatas(e.detail.item.special_id)
  31. },
  32. getDatas(special_id) {
  33. wx.showLoading({
  34. title: '加载中'
  35. });
  36. var self = this;
  37. getReq({
  38. act: 'special',
  39. op: 'index',
  40. special_id,
  41. page: 10,
  42. curpage: 1
  43. }, function (res) {
  44. if (res.code == 200) {
  45. console.log(res)
  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. })