scheme.ts 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. import PageContainerBehavior from "../../../../core/behavior/page-container.behavior";
  2. import TickleBehavior, { getTickleContext } from "../../../../core/behavior/tickle.behavior";
  3. // module/health/pages/scheme/scheme.ts
  4. import { healthSchemeMethod } from "../../request";
  5. import { toReportPage } from "../../router";
  6. Component({
  7. behaviors: [
  8. PageContainerBehavior,
  9. TickleBehavior
  10. ],
  11. lifetimes: {
  12. attached() {
  13. this.getHealthScheme(this.data.id);
  14. }
  15. },
  16. properties: {
  17. id: { type: String, value: '' },
  18. },
  19. data: {
  20. dataset: null,
  21. schemeId: '',
  22. healthIndex: { data: [], loading: false, message: '' },
  23. },
  24. observers: {},
  25. methods: {
  26. async getHealthScheme(id: string) {
  27. wx.showLoading({ title: '加载中' });
  28. try {
  29. const dataset = await healthSchemeMethod(id);
  30. console.log(dataset, '1-->');
  31. this.setData({ dataset });
  32. } catch (error) {
  33. console.log(error);
  34. getTickleContext.call(this).showErrorMessage(error.errMsg || error.message, 0);
  35. }
  36. wx.hideLoading();
  37. },
  38. toReportPage() { toReportPage(this.data.id); }
  39. }
  40. })