analysis.ts 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  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. switchType: "",
  18. },
  19. onLoad(query: any) {
  20. this._load(query);
  21. if (query.scene) {
  22. this.setData({
  23. switchType: query.scene,
  24. });
  25. }
  26. console.log(this.data.switchType,"query1111",query)
  27. },
  28. async _load(query: Record<'id' | 'scene', string>) {
  29. console.log(query,"111");
  30. wx.showLoading({ title: '加载中' });
  31. try {
  32. const { tongue, face, ...dataset } = await healthAnalysisMethod(query);
  33. this.setData({ tongue, face, dataset });
  34. } catch (error) {
  35. getTickleContext.call(this).showErrorMessage(error.errMsg, 0);
  36. }
  37. wx.hideLoading();
  38. },
  39. toHomePage() { toHomePage(this.data.switchType as string); },
  40. });