scheme.ts 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  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. this.setData({ dataset });
  31. } catch (error) {
  32. console.log(error);
  33. getTickleContext.call(this).showErrorMessage(error.errMsg || error.message, 0);
  34. }
  35. wx.hideLoading();
  36. },
  37. toReportPage() { toReportPage(this.data.id); }
  38. }
  39. })