care-record.ts 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. // module/health/components/field-ruler/field-ruler.ts
  2. import { getCareRecordListMethod } from "../../request";
  3. Component({
  4. behaviors: ["wx://form-field-group"],
  5. lifetimes: {
  6. attached(this: any) {
  7. this.getCareRecordList();
  8. },
  9. },
  10. methods: {
  11. async getCareRecordList(this: any) {
  12. // 0 进行中 1 已完成
  13. const res = await getCareRecordListMethod("0");
  14. // console.log(res,"所有的调养记录列表");
  15. if (res && res.data && res.data.length > 0) {
  16. this.setData({
  17. careRecordList: res.data,
  18. });
  19. } else {
  20. this.setData({
  21. careRecordList: [],
  22. });
  23. }
  24. },
  25. goDetail(this: any, e: any) {
  26. const id = e.currentTarget.dataset.id;
  27. const name = e.currentTarget.dataset.name;
  28. if (id) {
  29. wx.navigateTo({
  30. url: `/module/care/pages/careDetail/careDetail?id=${id}&name=${name ? name : ''}`,
  31. });
  32. } else {
  33. wx.showToast({
  34. title: "数据异常",
  35. icon: "none",
  36. });
  37. }
  38. },
  39. },
  40. properties: {},
  41. /**
  42. * 组件的初始数据
  43. */
  44. data: {
  45. loading: false,
  46. careRecordList: [],
  47. },
  48. observers: {},
  49. });