gut-index.vue 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311
  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 v-if="hasFamily">
  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 v-else>
  89. <FamilyEmptyState type="card" />
  90. </view>
  91. </view>
  92. </template>
  93. <script>
  94. import { getLatestHealthReport } from '../../utils/api.js'
  95. import config from '@/config.js'
  96. var healthRequest = function(url, data) {
  97. var token = uni.getStorageSync('token')
  98. return new Promise(function(resolve, reject) {
  99. uni.request({
  100. url: config.API_BASE_URL + url,
  101. method: 'POST',
  102. data: data,
  103. header: {
  104. 'Content-Type': 'application/json',
  105. 'Authorization': token ? 'Bearer ' + token : ''
  106. },
  107. success: function(res) {
  108. if (res.data.code === 200) {
  109. resolve(res.data)
  110. } else {
  111. reject(res.data)
  112. }
  113. },
  114. fail: function(err) {
  115. reject(err)
  116. }
  117. })
  118. })
  119. }
  120. export default {
  121. data() {
  122. return {}
  123. },
  124. computed: {
  125. hasFamily: function() {
  126. return this.$store.getters.hasFamily
  127. }
  128. },
  129. methods: {
  130. goBack: function() {
  131. uni.navigateBack()
  132. },
  133. goToReportUpload: function() {
  134. uni.navigateTo({
  135. url: '/pages/health/report-upload'
  136. })
  137. },
  138. goToMyReport: function() {
  139. var self = this
  140. var memberId = uni.getStorageSync('currentChildId')
  141. if (!memberId) {
  142. var userId = uni.getStorageSync('userId')
  143. memberId = userId
  144. }
  145. if (!memberId) {
  146. uni.showToast({ title: '未找到孩子信息', icon: 'none' })
  147. return
  148. }
  149. healthRequest('/api/health/report/latest', { memberId: memberId }).then(function(res) {
  150. if (res.data && res.data.id) {
  151. uni.navigateTo({
  152. url: '/pages/health/gut-flora-detail?reportId=' + res.data.id
  153. })
  154. } else {
  155. uni.showToast({ title: '暂无菌群报告', icon: 'none' })
  156. }
  157. }).catch(function(e) {
  158. console.log('获取报告失败', e)
  159. uni.showToast({ title: '获取报告失败', icon: 'none' })
  160. })
  161. }
  162. }
  163. }
  164. </script>
  165. <style scoped>
  166. .page {
  167. min-height: 100vh;
  168. background-color: #F5F7FA;
  169. display: flex;
  170. flex-direction: column;
  171. }
  172. .nav-bar {
  173. display: flex;
  174. align-items: center;
  175. justify-content: center;
  176. height: 88rpx;
  177. padding-top: var(--status-bar-height, 0);
  178. background-color: #FFFFFF;
  179. position: relative;
  180. border-bottom: 1rpx solid #f0f0f0;
  181. }
  182. .nav-back {
  183. position: absolute;
  184. left: 30rpx;
  185. top: 50%;
  186. transform: translateY(-50%);
  187. padding: 10rpx;
  188. }
  189. .back-text {
  190. font-size: 28rpx;
  191. color: #333;
  192. }
  193. .nav-title {
  194. font-size: 32rpx;
  195. font-weight: 600;
  196. color: #333;
  197. }
  198. .content {
  199. flex: 1;
  200. padding: 30rpx;
  201. }
  202. .card {
  203. display: flex;
  204. background-color: #FFFFFF;
  205. border-radius: 20rpx;
  206. margin-bottom: 30rpx;
  207. box-shadow: 0 2rpx 12rpx rgba(0, 0, 0, 0.06);
  208. overflow: hidden;
  209. }
  210. .card-accent {
  211. width: 8rpx;
  212. background-color: #FF8C42;
  213. flex-shrink: 0;
  214. }
  215. .card-body {
  216. flex: 1;
  217. padding: 30rpx;
  218. }
  219. .card-title {
  220. font-size: 30rpx;
  221. font-weight: 600;
  222. color: #333;
  223. margin-bottom: 16rpx;
  224. display: block;
  225. }
  226. .card-desc {
  227. font-size: 24rpx;
  228. color: #666;
  229. line-height: 1.6;
  230. display: block;
  231. margin-bottom: 20rpx;
  232. }
  233. .info-list {
  234. display: flex;
  235. flex-direction: column;
  236. gap: 20rpx;
  237. }
  238. .info-item {
  239. display: flex;
  240. flex-direction: column;
  241. gap: 6rpx;
  242. }
  243. .info-age {
  244. font-size: 26rpx;
  245. font-weight: 500;
  246. color: #FF8C42;
  247. display: block;
  248. }
  249. .info-desc {
  250. font-size: 24rpx;
  251. color: #666;
  252. line-height: 1.6;
  253. display: block;
  254. }
  255. .action-section {
  256. display: flex;
  257. justify-content: center;
  258. padding: 20rpx 0 40rpx;
  259. }
  260. .action-btn {
  261. background-color: #FF8C42;
  262. border-radius: 40rpx;
  263. padding: 24rpx 80rpx;
  264. box-shadow: 0 4rpx 12rpx rgba(255, 140, 66, 0.3);
  265. }
  266. .action-btn-secondary {
  267. background-color: #fff;
  268. border-radius: 40rpx;
  269. padding: 24rpx 80rpx;
  270. margin-top: 20rpx;
  271. border: 2rpx solid #FF8C42;
  272. }
  273. .action-btn-secondary-text {
  274. font-size: 28rpx;
  275. color: #FF8C42;
  276. font-weight: 500;
  277. }
  278. .action-btn-text {
  279. font-size: 28rpx;
  280. color: #FFFFFF;
  281. font-weight: 500;
  282. }
  283. </style>