gut-index.vue 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263
  1. <template>
  2. <scroll-view class="content" scroll-y>
  3. <view class="card">
  4. <view class="card-accent"></view>
  5. <view class="card-body">
  6. <text class="card-title">认识肠道菌群</text>
  7. <text class="card-desc">肠道菌群是生活在人体肠道内的微生物群落,被称为人体的"第二基因组"。它们对健康起着至关重要的作用:</text>
  8. <view class="info-list">
  9. <view class="info-item">
  10. <text class="info-age">帮助消化吸收</text>
  11. <text class="info-desc">分解食物中的纤维素,合成维生素 K 和 B 族维生素,促进营养吸收。</text>
  12. </view>
  13. <view class="info-item">
  14. <text class="info-age">增强免疫力</text>
  15. <text class="info-desc">调节免疫系统功能,抵抗有害菌入侵,减少过敏和感染风险。</text>
  16. </view>
  17. <view class="info-item">
  18. <text class="info-age">影响情绪和认知</text>
  19. <text class="info-desc">通过"肠脑轴"影响神经递质产生,对情绪、压力和睡眠有重要作用。</text>
  20. </view>
  21. </view>
  22. </view>
  23. </view>
  24. <view class="card">
  25. <view class="card-accent"></view>
  26. <view class="card-body">
  27. <text class="card-title">有益菌食物</text>
  28. <view class="info-list">
  29. <view class="info-item">
  30. <text class="info-age">🥛 发酵乳制品</text>
  31. <text class="info-desc">酸奶、开菲尔、发酵乳富含益生菌,直接补充肠道有益菌群。</text>
  32. </view>
  33. <view class="info-item">
  34. <text class="info-age">🥒 发酵蔬菜</text>
  35. <text class="info-desc">泡菜、酸菜、纳豆等发酵食品含有丰富益生菌和酶,促进肠道健康。</text>
  36. </view>
  37. <view class="info-item">
  38. <text class="info-age">🌿 高纤维食物</text>
  39. <text class="info-desc">燕麦、香蕉、洋葱、大蒜、芦笋等富含益生元,为有益菌提供养料。</text>
  40. </view>
  41. <view class="info-item">
  42. <text class="info-age">🍎 多酚类食物</text>
  43. <text class="info-desc">蓝莓、可可、绿茶、核桃富含多酚,促进有益菌生长,抑制有害菌。</text>
  44. </view>
  45. </view>
  46. </view>
  47. </view>
  48. <view class="card">
  49. <view class="card-accent"></view>
  50. <view class="card-body">
  51. <text class="card-title">维护肠道健康</text>
  52. <view class="info-list">
  53. <view class="info-item">
  54. <text class="info-age">均衡饮食</text>
  55. <text class="info-desc">多样化饮食,多吃蔬菜水果和全谷物,为肠道菌群提供丰富的营养来源。</text>
  56. </view>
  57. <view class="info-item">
  58. <text class="info-age">充足水分</text>
  59. <text class="info-desc">每天饮用足够的水,促进肠道蠕动,帮助消化和排便。</text>
  60. </view>
  61. <view class="info-item">
  62. <text class="info-age">规律运动</text>
  63. <text class="info-desc">适度运动促进肠道蠕动,增加肠道菌群多样性,改善肠道环境。</text>
  64. </view>
  65. <view class="info-item">
  66. <text class="info-age">合理使用抗生素</text>
  67. <text class="info-desc">抗生素会破坏肠道菌群平衡,遵医嘱使用,必要时补充益生菌。</text>
  68. </view>
  69. </view>
  70. </view>
  71. </view>
  72. <view class="action-section">
  73. <view class="action-btn" @tap="goToReportUpload">
  74. <text class="action-btn-text">上传检测报告</text>
  75. </view>
  76. <view class="action-btn-secondary" @tap="goToMyReport">
  77. <text class="action-btn-secondary-text">查看我的菌群报告</text>
  78. </view>
  79. </view>
  80. </scroll-view>
  81. </template>
  82. <script>
  83. import { getLatestHealthReport } from '../../utils/api.js'
  84. import config from '@/config.js'
  85. var healthRequest = function(url, data) {
  86. var token = uni.getStorageSync('token')
  87. return new Promise(function(resolve, reject) {
  88. uni.request({
  89. url: config.API_BASE_URL + url,
  90. method: 'POST',
  91. data: data,
  92. header: {
  93. 'Content-Type': 'application/json',
  94. 'Authorization': token ? 'Bearer ' + token : ''
  95. },
  96. success: function(res) {
  97. if (res.data.code === 200) {
  98. resolve(res.data)
  99. } else {
  100. reject(res.data)
  101. }
  102. },
  103. fail: function(err) {
  104. reject(err)
  105. }
  106. })
  107. })
  108. }
  109. export default {
  110. data() {
  111. return {}
  112. },
  113. methods: {
  114. goBack: function() {
  115. uni.navigateBack()
  116. },
  117. goToReportUpload: function() {
  118. uni.navigateTo({
  119. url: '/pages/health/report-upload'
  120. })
  121. },
  122. goToMyReport: function() {
  123. var self = this
  124. var memberId = uni.getStorageSync('currentChildId')
  125. if (!memberId) {
  126. var userId = uni.getStorageSync('userId')
  127. memberId = userId
  128. }
  129. if (!memberId) {
  130. uni.showToast({ title: '未找到成员信息', icon: 'none' })
  131. return
  132. }
  133. healthRequest('/api/health/report/latest', { memberId: memberId }).then(function(res) {
  134. if (res.data && res.data.id) {
  135. uni.navigateTo({
  136. url: '/pages/health/gut-flora-detail?reportId=' + res.data.id
  137. })
  138. } else {
  139. uni.showToast({ title: '暂无菌群报告', icon: 'none' })
  140. }
  141. }).catch(function(e) {
  142. console.log('获取报告失败', e)
  143. uni.showToast({ title: '获取报告失败', icon: 'none' })
  144. })
  145. }
  146. }
  147. }
  148. </script>
  149. <style scoped>
  150. .page {
  151. min-height: 100vh;
  152. background-color: #F5F7FA;
  153. display: flex;
  154. flex-direction: column;
  155. }
  156. .content {
  157. flex: 1;
  158. padding: 30rpx;
  159. }
  160. .card {
  161. display: flex;
  162. background-color: #FFFFFF;
  163. border-radius: 20rpx;
  164. margin-bottom: 30rpx;
  165. box-shadow: 0 2rpx 12rpx rgba(0, 0, 0, 0.06);
  166. overflow: hidden;
  167. }
  168. .card-accent {
  169. width: 8rpx;
  170. background-color: #FF8C42;
  171. flex-shrink: 0;
  172. }
  173. .card-body {
  174. flex: 1;
  175. padding: 30rpx;
  176. }
  177. .card-title {
  178. font-size: 30rpx;
  179. font-weight: 600;
  180. color: #333;
  181. margin-bottom: 16rpx;
  182. display: block;
  183. }
  184. .card-desc {
  185. font-size: 24rpx;
  186. color: #666;
  187. line-height: 1.6;
  188. display: block;
  189. margin-bottom: 20rpx;
  190. }
  191. .info-list {
  192. display: flex;
  193. flex-direction: column;
  194. gap: 20rpx;
  195. }
  196. .info-item {
  197. display: flex;
  198. flex-direction: column;
  199. gap: 6rpx;
  200. }
  201. .info-age {
  202. font-size: 26rpx;
  203. font-weight: 500;
  204. color: #FF8C42;
  205. display: block;
  206. }
  207. .info-desc {
  208. font-size: 24rpx;
  209. color: #666;
  210. line-height: 1.6;
  211. display: block;
  212. }
  213. .action-section {
  214. display: flex;
  215. justify-content: center;
  216. padding: 20rpx 0 40rpx;
  217. }
  218. .action-btn {
  219. background-color: #FF8C42;
  220. border-radius: 40rpx;
  221. padding: 24rpx 80rpx;
  222. box-shadow: 0 4rpx 12rpx rgba(255, 140, 66, 0.3);
  223. }
  224. .action-btn-secondary {
  225. background-color: #fff;
  226. border-radius: 40rpx;
  227. padding: 24rpx 80rpx;
  228. margin-top: 20rpx;
  229. border: 2rpx solid #FF8C42;
  230. }
  231. .action-btn-secondary-text {
  232. font-size: 28rpx;
  233. color: #FF8C42;
  234. font-weight: 500;
  235. }
  236. .action-btn-text {
  237. font-size: 28rpx;
  238. color: #FFFFFF;
  239. font-weight: 500;
  240. }
  241. </style>