gut-index.vue 8.0 KB

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