与牧同行-小程序用户端
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

103 lines
2.7 KiB

  1. Page({
  2. data: {
  3. diagnosisList: [
  4. {
  5. id: 1,
  6. status: 'replied',
  7. createdAt:'2025-02-12',
  8. userInfo: {
  9. avatar: '/pages/images/tx.png',
  10. nickName: '张小明'
  11. },
  12. petInfo: {
  13. type: '狗',
  14. age: 3,
  15. gender: '公'
  16. },
  17. description: '最近三天食欲不振,精神萎靡,偶尔呕吐黄色泡沫,大便偏软带血丝,体温正常但鼻头干燥。',
  18. images: ['/images/pet1.jpg', '/images/pet2.jpg'],
  19. replies: [{}, {}, {}]
  20. },
  21. {
  22. id: 2,
  23. status: 'pending',
  24. createdAt: '2025-02-12',
  25. userInfo: {
  26. avatar: '/pages/images/tx.png',
  27. nickName: '李小花'
  28. },
  29. petInfo: {
  30. type: '猫',
  31. age: 2,
  32. gender: '母'
  33. },
  34. description: '今天发现眼睛有黄色分泌物,频繁抓挠眼睛周围,食欲正常但饮水量减少。',
  35. images: ['/images/cat1.jpg'],
  36. replies: []
  37. },
  38. {
  39. id: 3,
  40. status: 'replied',
  41. createdAt: '2025-02-12',
  42. userInfo: {
  43. avatar: '/pages/images/tx.png',
  44. nickName: '王先生'
  45. },
  46. petInfo: {
  47. type: '狗',
  48. age: 5,
  49. gender: '公'
  50. },
  51. description: '狗狗最近走路跛脚,右前腿不敢着地,触摸时会叫。之前从沙发上跳下来可能受伤了。',
  52. images: [],
  53. replies: [{}, {}]
  54. }
  55. ]
  56. },
  57. onLoad: function() {
  58. // 页面加载
  59. },
  60. // 格式化日期显示
  61. formatDate: function(dateString) {
  62. const date = new Date(dateString);
  63. const now = new Date();
  64. const diff = now - date;
  65. const diffDays = Math.floor(diff / (1000 * 60 * 60 * 24));
  66. const diffHours = Math.floor(diff / (1000 * 60 * 60));
  67. const diffMinutes = Math.floor(diff / (1000 * 60));
  68. if (diffMinutes < 60) {
  69. return `${diffMinutes}分钟前`;
  70. } else if (diffHours < 24) {
  71. return `${diffHours}小时前`;
  72. } else if (diffDays === 1) {
  73. return '昨天';
  74. } else if (diffDays === 2) {
  75. return '前天';
  76. } else if (diffDays < 7) {
  77. return `${diffDays}天前`;
  78. } else {
  79. const month = date.getMonth() + 1;
  80. const day = date.getDate();
  81. return `${month}${day}`;
  82. }
  83. },
  84. // 显示创建问诊单
  85. showCreateModal: function() {
  86. wx.navigateTo({
  87. url: '/pagesA/pages/askingSyAdd/askingSyAdd',
  88. });
  89. },
  90. // 查看详情
  91. viewDetail: function(e) {
  92. const index = e.currentTarget.dataset.index;
  93. const item = this.data.diagnosisList[index];
  94. wx.navigateTo({
  95. url: `/pagesA/pages/askingSyDetails/askingSyDetails`,
  96. });
  97. },
  98. });