普兆健康管家前端代码仓库
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.

490 lines
15 KiB

  1. <template>
  2. <view class="page__view">
  3. <navbar title="报告对比" leftClick @leftClick="$utils.navigateBack" color="#191919" bgColor="#FFFFFF" />
  4. <view class="main">
  5. <reportCard>
  6. <view class="report" v-if="list.length">
  7. <view class="flex section">
  8. <view
  9. v-for="(item, index) in list"
  10. :key="item.id"
  11. :class="['section-item-box', `section-item-box-${index == 0 ? 'left' : 'right'}`]"
  12. >
  13. <view class="section-item info-score">
  14. <view class="time">{{ item.createTime }}</view>
  15. <view class="flex score">
  16. 综合得分
  17. <text class="score-value">{{ item.score }}</text>
  18. <text class="score-unit"></text>
  19. </view>
  20. <view class="score-detail">
  21. <view class="score-detail-item" v-for="(score, sIdx) in item.scoreDetail" :key="sIdx">
  22. <progressBar :progress="score" :total="100"></progressBar>
  23. <view class="score-detail-item-score">{{ `${axis[sIdx]}` }}<text class="highlight">{{ score }}</text></view>
  24. </view>
  25. </view>
  26. </view>
  27. </view>
  28. </view>
  29. <view class="flex section">
  30. <view
  31. v-for="(item, index) in list"
  32. :key="item.id"
  33. :class="['section-item-box', `section-item-box-${index == 0 ? 'left' : 'right'}`]"
  34. >
  35. <view class="section-item info-BMI">
  36. <view class="flex label">
  37. <text>BMI 指数</text>
  38. <text class="highlight">{{ item.BMI || '-' }}</text>
  39. </view>
  40. <view class="progress">
  41. <!-- todo: check -->
  42. <progressBar :progress="item.BMI" :total="30"></progressBar>
  43. </view>
  44. </view>
  45. </view>
  46. </view>
  47. <view class="flex section"
  48. v-for="(step, sIdx) in list[0].children" :key="step.key"
  49. >
  50. <view
  51. v-for="(report, rIdx) in list"
  52. :key="rIdx"
  53. :class="['section-item-box', `section-item-box-${rIdx == 0 ? 'left' : 'right'}`]"
  54. >
  55. <view class="section-item">
  56. <view class="section-header">
  57. <view class="section-header-zh">{{ `${sIdx + 1}.${step.name}` }}</view>
  58. <view class="section-header-en">{{ step.nameEn }}</view>
  59. </view>
  60. <view class="section-content">
  61. <template v-if="step.key === 'improvementGoal'">
  62. <view class="tags">
  63. <view class="tag" v-for="(tag, tIdx) in report.children[sIdx].tags" :key="tIdx">{{ tag }}</view>
  64. </view>
  65. </template>
  66. <template v-else-if="step.key === 'topPriority'">
  67. <view class="tags">
  68. <view class="tag highlight">{{ report.children[sIdx].tag }}</view>
  69. </view>
  70. </template>
  71. <template v-else-if="step.key === 'potentialHealthIssues'">
  72. <view class="flex section-content-tag">
  73. <image class="section-content-tag-icon" :src="report.children[sIdx].tag.icon" mode="widthFix"></image>
  74. <text class="section-content-tag-text">{{ report.children[sIdx].tag.text }}</text>
  75. </view>
  76. <view>
  77. <view class="section-content-item" v-for="(item, idx) in report.children[sIdx].content" :key="idx">
  78. <view class="flex section-content-item-header">
  79. <view class="section-content-item-index" v-if="report.children[sIdx].content.length > 1">{{ `${idx + 1}.` }}</view>
  80. <view class="section-content-item-title">{{ item.title }}</view>
  81. </view>
  82. <view class="section-content-item-detail">{{ item.detail }}</view>
  83. </view>
  84. </view>
  85. </template>
  86. <template v-else>
  87. <view>
  88. <view class="section-content-item" v-for="(item, idx) in report.children[sIdx].content" :key="idx">
  89. <view class="flex section-content-item-header">
  90. <view class="section-content-item-index" v-if="report.children[sIdx].content.length > 1">{{ `${idx + 1}.` }}</view>
  91. <view class="section-content-item-title">{{ item.title }}</view>
  92. </view>
  93. <view class="section-content-item-detail">{{ item.detail }}</view>
  94. </view>
  95. </view>
  96. </template>
  97. </view>
  98. </view>
  99. </view>
  100. </view>
  101. </view>
  102. </reportCard>
  103. </view>
  104. </view>
  105. </template>
  106. <script>
  107. import reportCard from '@/pages_order/components/reportCard.vue';
  108. import progressBar from '@/pages_order/components/progressBar.vue';
  109. export default {
  110. components: {
  111. reportCard,
  112. progressBar,
  113. },
  114. data() {
  115. return {
  116. list: [],
  117. axis: ['饮食', '运动', '心理', '体质', '作息']
  118. }
  119. },
  120. onLoad(arg) {
  121. const ids = JSON.parse(arg.ids)
  122. // todo
  123. const children = [
  124. {
  125. id: '001',
  126. key: 'improvementGoal',
  127. name: '本次改善目标',
  128. nameEn: 'This improvement goal',
  129. url: '/pages_order/static/report/report-detail-1.png',
  130. tags: ['皮肤', '脑力/注意力', '眼睛/视力', '睡眠', '骨骼/关节']
  131. },
  132. {
  133. id: '002',
  134. key: 'topPriority',
  135. name: '首要目标',
  136. nameEn: 'Top priority',
  137. url: '/pages_order/static/report/report-detail-2.png',
  138. tag: '脑力/注意力'
  139. },
  140. {
  141. id: '003',
  142. key: 'targetSuggestion',
  143. name: '健康目标建议',
  144. nameEn: 'Target Suggestion',
  145. url: '/pages_order/static/report/report-detail-3.png',
  146. content: [
  147. { title: '吃一小把混合坚果对皮肤好', detail: '增加不饱和脂肪酸的摄入有益皮肤健康,可以每天食用一小把混合类坚果,例如核桃、葵花籽、开心果等。' },
  148. ]
  149. },
  150. {
  151. id: '004',
  152. key: 'dailyGoals',
  153. name: '每日小目标',
  154. nameEn: 'Daily Small Goals',
  155. url: '/pages_order/static/report/report-detail-4.png',
  156. content: [
  157. { title: '每天吃1个水煮鸡蛋', detail: '每天食用1个鸡蛋可以补充丰富的动物蛋白以及多种维生素和矿物质,如维生素A、维生素D、 维生素B12、胆碱、叶酸、磷和碘等。' },
  158. { title: '今天的饭后甜点是低糖酸奶', detail: '每天食用1个鸡蛋可以补充丰富的动物蛋白以及多种维生素和矿物质,如维生素A、维生素D、 维生素B12、胆碱、叶酸、磷和碘等。' },
  159. ]
  160. },
  161. {
  162. id: '005',
  163. key: 'potentialHealthIssues',
  164. name: '需要注意的潜在健康问题',
  165. nameEn: 'Potential health issues to note',
  166. url: '/pages_order/static/report/report-detail-5.png',
  167. tag: {
  168. text: '心血管问题',
  169. icon: '/pages_order/static/report/cardiovascular.png',
  170. },
  171. content: [
  172. { title: '影响因素', detail: '较少食用富含Omega3的食物(如:深海鱼,坚果)' },
  173. { title: '营养建议', detail: '建议每天吃一把坚果。' },
  174. ]
  175. },
  176. {
  177. id: '006',
  178. key: 'specialReminder',
  179. name: '特殊提醒',
  180. nameEn: 'Special Reminder',
  181. url: '/pages_order/static/report/report-detail-6.png',
  182. content: [
  183. { title: '眼睛长时间感觉到干涩可能是干眼症,一般是由于泪腺泪液分泌不足导致的,严重的话请及时就医。' },
  184. { title: '同时使用不同品牌的膳食补剂容易导致营养素摄入过量, 请注意服用剂量,避免造成补剂摄入过量带来的副作用。' },
  185. ]
  186. },
  187. {
  188. id: '007',
  189. key: 'exerciseRest',
  190. name: '运动 & 作息',
  191. nameEn: 'Exercise & Rest',
  192. url: '/pages_order/static/report/report-detail-7.png',
  193. content: [
  194. { title: '请尽量避免在阳光强烈的时段(通常是中午至下午3点)户外活动。在户外时,涂抹SPF(防晒系数)高的防晒霜在暴露的皮肤上,并穿着长袖衣物、帽子和太阳镜减少皮肤接触到紫外线的机会。' }
  195. ]
  196. },
  197. {
  198. id: '008',
  199. key: 'dietaryRecommendations',
  200. name: '饮食建议',
  201. nameEn: 'Dietary recommendations',
  202. url: '/pages_order/static/report/report-detail-8.png',
  203. content: [
  204. { title: '一天不要超过三杯美式咖啡', detail: '健康成年人每天摄入的咖啡因应控制在400mg以内。1杯 355mL的小杯美式咖啡,所含咖啡因为150mg,所以一天最好不要饮用超过3小杯咖啡。' },
  205. ]
  206. },
  207. ]
  208. this.list = [
  209. {
  210. id: '001',
  211. createTime: '2025-05-01',
  212. score: 56,
  213. scoreDetail: [72, 94, 60, 82, 78],
  214. BMI: 16.5,
  215. children,
  216. },
  217. {
  218. id: '002',
  219. createTime: '2025-05-19',
  220. score: 77,
  221. scoreDetail: [72, 94, 60, 82, 78],
  222. BMI: 16.5,
  223. children,
  224. },
  225. ]
  226. },
  227. methods: {
  228. },
  229. }
  230. </script>
  231. <style scoped lang="scss">
  232. .page__view {
  233. width: 100vw;
  234. min-height: 100vh;
  235. background-color: $uni-bg-color;
  236. position: relative;
  237. /deep/ .nav-bar__view {
  238. position: fixed;
  239. top: 0;
  240. left: 0;
  241. }
  242. }
  243. .main {
  244. padding: calc(var(--status-bar-height) + 152rpx) 32rpx 64rpx 32rpx;
  245. /deep/ .report-card__view {
  246. .card-content {
  247. padding-top: 232rpx;
  248. padding-left: 0;
  249. padding-right: 0;
  250. }
  251. }
  252. }
  253. .section {
  254. width: 100%;
  255. & + & {
  256. .section-item {
  257. padding-top: 32rpx;
  258. border-top: 2rpx dashed #989898;
  259. }
  260. }
  261. &-item {
  262. padding-bottom: 32rpx;
  263. &-box {
  264. flex: 1;
  265. padding: 0 32rpx;
  266. &-left {
  267. padding-left: 24rpx;
  268. }
  269. &-right {
  270. padding-right: 24rpx;
  271. background: #FBFCFE;
  272. }
  273. }
  274. }
  275. &-header {
  276. font-family: PingFang SC;
  277. line-height: 1.4;
  278. color: #252545;
  279. &-zh {
  280. font-weight: 600;
  281. font-size: 32rpx;
  282. }
  283. &-en {
  284. font-weight: 400;
  285. font-size: 24rpx;
  286. }
  287. }
  288. &-content {
  289. padding-top: 18rpx;
  290. &-item {
  291. font-family: PingFang SC;
  292. font-weight: 400;
  293. line-height: 1.5;
  294. color: #252545;
  295. & + & {
  296. margin-top: 24rpx;
  297. }
  298. &-header {
  299. align-items: flex-start;
  300. justify-content: flex-start;
  301. }
  302. &-index {
  303. display: inline-block;
  304. width: 44rpx;
  305. font-size: 24rpx;
  306. text-align: right;
  307. line-height: 44rpx;
  308. padding-right: 10rpx;
  309. box-sizing: border-box;
  310. }
  311. &-title {
  312. font-size: 28rpx;
  313. }
  314. &-detail {
  315. margin-top: 8rpx;
  316. font-size: 24rpx;
  317. color: #989898;
  318. }
  319. }
  320. &-tag {
  321. margin-bottom: 24rpx;
  322. padding: 16rpx 0;
  323. background: #E5E4EB8C;
  324. border-radius: 16rpx;
  325. column-gap: 16rpx;
  326. &-icon {
  327. width: 40rpx;
  328. height: 40rpx;
  329. }
  330. &-text {
  331. font-family: PingFang SC;
  332. font-weight: 400;
  333. font-size: 28rpx;
  334. line-height: 1.5;
  335. color: #252545;
  336. }
  337. }
  338. }
  339. }
  340. .tags {
  341. display: flex;
  342. flex-wrap: wrap;
  343. gap: 16rpx;
  344. .tag {
  345. padding: 8rpx 40rpx;
  346. font-family: PingFang SC;
  347. font-weight: 400;
  348. font-size: 28rpx;
  349. line-height: 1.5;
  350. color: #252545;
  351. background: #E5E4EB;
  352. border-radius: 30rpx;
  353. &.highlight {
  354. font-weight: 600;
  355. color: #FFFFFF;
  356. background: #252545;
  357. }
  358. }
  359. }
  360. .info {
  361. &-score {
  362. padding: 40rpx 0;
  363. .time {
  364. display: inline-flex;
  365. width: auto;
  366. padding: 8rpx 16rpx;
  367. font-family: PingFang SC;
  368. font-weight: 400;
  369. font-size: 28rpx;
  370. line-height: 1.5;
  371. color: #252545;
  372. border: 2rpx solid #252545;
  373. border-radius: 30rpx;
  374. }
  375. .score {
  376. margin-top: 4rpx;
  377. justify-content: flex-start;
  378. column-gap: 8rpx;
  379. font-family: PingFang SC;
  380. font-weight: 400;
  381. font-size: 36rpx;
  382. line-height: 1.2;
  383. color: #252545CC;
  384. &-value {
  385. font-weight: 600;
  386. font-size: 64rpx;
  387. line-height: 1.4;
  388. color: transparent;
  389. background-image: linear-gradient(to right, #4B348F, #845CFA);
  390. background-clip: text;
  391. display: inline-block;
  392. }
  393. &-unit {
  394. font-weight: 600;
  395. font-size: 40rpx;
  396. line-height: 1.4;
  397. color: #252545;
  398. }
  399. }
  400. .score-detail {
  401. margin-top: 20rpx;
  402. &-item {
  403. padding-top: 10rpx;
  404. &-score {
  405. padding: 10rpx 0 0 16rpx;
  406. font-family: PingFang SC;
  407. font-weight: 400;
  408. font-size: 24rpx;
  409. line-height: 1;
  410. color: #8B8B8B;
  411. .highlight {
  412. margin-left: 12rpx;
  413. font-weight: 500;
  414. font-size: 28rpx;
  415. line-height: 1.4;
  416. color: #000000;
  417. }
  418. }
  419. }
  420. }
  421. }
  422. &-BMI {
  423. .label {
  424. white-space: nowrap;
  425. font-family: PingFang SC;
  426. font-weight: 400;
  427. font-size: 36rpx;
  428. line-height: 1.2;
  429. color: #252545CC;
  430. .highlight {
  431. margin-left: 8rpx;
  432. font-size: 64rpx;
  433. font-weight: 600;
  434. line-height: 1.4;
  435. font-family: PingFang SC;
  436. color: transparent;
  437. background-image: linear-gradient(to right, #4B348F, #845CFA);
  438. background-clip: text;
  439. display: inline-block;
  440. }
  441. }
  442. .progress {
  443. margin: 18rpx 0 34rpx 0;
  444. width: 100%;
  445. }
  446. }
  447. }
  448. </style>