analysis.ts 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. import PageContainerBehavior from "../../../../core/behavior/page-container.behavior";
  2. import TickleBehavior, { getTickleContext } from "../../../../core/behavior/tickle.behavior";
  3. // module/health/pages/analysis/analysis.ts
  4. import { toHomePage } from "../../router";
  5. import { healthAnalysisMethod } from "../../request";
  6. import { AnalysisModel } from "../../model/health.model";
  7. Page({
  8. behaviors: [
  9. PageContainerBehavior,
  10. TickleBehavior
  11. ],
  12. data: {
  13. id: '',
  14. tongue: null as unknown as AnalysisModel,
  15. face: null as unknown as AnalysisModel,
  16. dataset: null as unknown as AnyObject,
  17. },
  18. onLoad(query: any) {
  19. this._load(query);
  20. },
  21. async _load(query: Record<'id' | 'scene', string>) {
  22. wx.showLoading({ title: '加载中' });
  23. try {
  24. const { tongue, face, ...dataset } = await healthAnalysisMethod(query);
  25. this.setData({ tongue, face, dataset });
  26. } catch (error) {
  27. getTickleContext.call(this).showErrorMessage(error.errMsg, 0);
  28. }
  29. wx.hideLoading();
  30. },
  31. toHomePage() { toHomePage(); },
  32. });