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

303 lines
7.4 KiB

2 months ago
  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="section">
  7. <cardHeader :BMI="BMI"></cardHeader>
  8. </view>
  9. <view class="section" v-for="(step, index) in list" :key="step.key">
  10. <view class="flex section-header">
  11. <view class="section-header-index">
  12. <text>{{ index + 1 }}</text>
  13. <image class="section-header-index-icon" :src="step.icon" mode="widthFix"></image>
  14. </view>
  15. <view class="section-header-title">
  16. <view class="section-header-title-zh">{{ step.name }}</view>
  17. <view class="section-header-title-en">{{ step.enTitle }}</view>
  18. </view>
  19. </view>
  20. <view class="section-content">
  21. <!-- 普通标签 -->
  22. <template v-if="step.type == '0'">
  23. <view class="tags">
  24. <view class="tag" v-for="(item, tIdx) in step.schemes" :key="tIdx">{{ item.title }}</view>
  25. </view>
  26. </template>
  27. <!-- 暗色标签 -->
  28. <template v-else-if="step.type === '1'">
  29. <view class="tags">
  30. <view class="tag highlight" v-for="(item, tIdx) in step.schemes" :key="tIdx">{{ item.title }}</view>
  31. </view>
  32. </template>
  33. <!-- 有序文本 -->
  34. <template v-else-if="step.type === '2'">
  35. <!-- todo -->
  36. <!-- <view class="flex section-content-tag">
  37. <image class="section-content-tag-icon" :src="step.tag.icon" mode="widthFix"></image>
  38. <text class="section-content-tag-text">{{ step.tag.text }}</text>
  39. </view> -->
  40. <view>
  41. <view class="section-content-item" v-for="(item, idx) in step.schemes" :key="idx">
  42. <view class="flex section-content-item-header">
  43. <view class="section-content-item-index">{{ `${idx + 1}.` }}</view>
  44. <view class="section-content-item-title">{{ item.title }}</view>
  45. </view>
  46. <view class="section-content-item-detail" v-if="item.info">{{ item.info }}</view>
  47. </view>
  48. </view>
  49. </template>
  50. <!-- 无序文本 -->
  51. <template v-else-if="step.type === '3'">
  52. <view>
  53. <view class="section-content-item" v-for="(item, idx) in step.schemes" :key="idx">
  54. <view class="flex section-content-item-header">
  55. <view class="section-content-item-title">{{ item.title }}</view>
  56. </view>
  57. <view class="section-content-item-detail" v-if="item.info">{{ item.info }}</view>
  58. </view>
  59. </view>
  60. </template>
  61. </view>
  62. </view>
  63. <view class="section tips">
  64. *以上是根据你的营养目标以及饮食运动作息状况给出的针对性健康建议可以辅助你达成营养目标同时养成良好的生活习惯
  65. </view>
  66. </reportCard>
  67. </view>
  68. <view class="bottom">
  69. <button class="flex btn" @click="jumpToNutritionProgram">查看营养方案</button>
  70. </view>
  71. </view>
  72. </template>
  73. <script>
  74. import reportCard from '@/pages_order/components/reportCard.vue';
  75. import cardHeader from './cardHeader.vue';
  76. export default {
  77. components: {
  78. reportCard,
  79. cardHeader,
  80. },
  81. data() {
  82. return {
  83. BMI: 0,
  84. list: [],
  85. }
  86. },
  87. onLoad(arg) {
  88. const { id } = arg
  89. this.id = id
  90. this.fetchReportData(id)
  91. // todo: delete
  92. this.BMI = 16.5
  93. },
  94. methods: {
  95. async fetchReportData(id) {
  96. try {
  97. const { json } = await this.$fetch('getReportDetail', { id })
  98. this.list = JSON.parse(json).map((item, index) => {
  99. let url = `/pages_order/static/report/report-detail-${index + 1}.png`
  100. return {
  101. ...item,
  102. // todo: delete
  103. icon: item.icon || url,
  104. }
  105. })
  106. console.log('list', this.list)
  107. } catch (err) {
  108. }
  109. },
  110. jumpToNutritionProgram() {
  111. this.$utils.navigateTo(`/pages_order/report/nutritionProgram/index?id=${this.id}`)
  112. },
  113. },
  114. }
  115. </script>
  116. <style scoped lang="scss">
  117. .page__view {
  118. width: 100vw;
  119. min-height: 100vh;
  120. background-color: $uni-bg-color;
  121. position: relative;
  122. /deep/ .nav-bar__view {
  123. position: fixed;
  124. top: 0;
  125. left: 0;
  126. }
  127. }
  128. .main {
  129. padding: calc(var(--status-bar-height) + 152rpx) 32rpx 272rpx 32rpx;
  130. }
  131. .section {
  132. & + & {
  133. margin-top: 48rpx;
  134. padding-top: 12rpx;
  135. border-top: 2rpx dashed #989898;
  136. }
  137. &-header {
  138. justify-content: flex-start;
  139. &-index {
  140. position: relative;
  141. font-family: HarmonyOS Sans;
  142. font-weight: 700;
  143. font-size: 96rpx;
  144. line-height: 1.4;
  145. color: #D9D9D9;
  146. &-icon {
  147. position: absolute;
  148. left: 34rpx;
  149. top: 70rpx;
  150. width: 40rpx;
  151. height: 40rpx;
  152. }
  153. }
  154. &-title {
  155. margin-left: 32rpx;
  156. font-family: PingFang SC;
  157. line-height: 1.4;
  158. color: #252545;
  159. &-zh {
  160. font-weight: 600;
  161. font-size: 40rpx;
  162. }
  163. &-en {
  164. font-weight: 400;
  165. font-size: 26rpx;
  166. }
  167. }
  168. }
  169. &-content {
  170. padding-top: 18rpx;
  171. &-item {
  172. font-family: PingFang SC;
  173. font-weight: 400;
  174. line-height: 1.5;
  175. color: #252545;
  176. & + & {
  177. margin-top: 24rpx;
  178. }
  179. &-header {
  180. align-items: flex-start;
  181. justify-content: flex-start;
  182. }
  183. &-index {
  184. display: inline-block;
  185. width: 44rpx;
  186. font-size: 24rpx;
  187. text-align: right;
  188. line-height: 44rpx;
  189. padding-right: 10rpx;
  190. box-sizing: border-box;
  191. }
  192. &-title {
  193. font-size: 28rpx;
  194. }
  195. &-detail {
  196. margin-top: 8rpx;
  197. font-size: 24rpx;
  198. color: #989898;
  199. }
  200. }
  201. &-tag {
  202. margin-bottom: 24rpx;
  203. padding: 16rpx 0;
  204. background: #E5E4EB8C;
  205. border-radius: 16rpx;
  206. column-gap: 16rpx;
  207. &-icon {
  208. width: 40rpx;
  209. height: 40rpx;
  210. }
  211. &-text {
  212. font-family: PingFang SC;
  213. font-weight: 400;
  214. font-size: 28rpx;
  215. line-height: 1.5;
  216. color: #252545;
  217. }
  218. }
  219. }
  220. }
  221. .tags {
  222. display: flex;
  223. flex-wrap: wrap;
  224. gap: 16rpx;
  225. .tag {
  226. padding: 8rpx 40rpx;
  227. font-family: PingFang SC;
  228. font-weight: 400;
  229. font-size: 28rpx;
  230. line-height: 1.5;
  231. color: #252545;
  232. background: #E5E4EB;
  233. border-radius: 30rpx;
  234. &.highlight {
  235. font-weight: 600;
  236. color: #FFFFFF;
  237. background: #252545;
  238. }
  239. }
  240. }
  241. .section.tips {
  242. padding-top: 48rpx;
  243. font-family: PingFang SC;
  244. font-weight: 400;
  245. font-size: 18rpx;
  246. line-height: 1.4;
  247. color: #989898;
  248. }
  249. .bottom {
  250. width: 100%;
  251. position: fixed;
  252. left: 0;
  253. bottom: 0;
  254. padding: 24rpx 40rpx;
  255. padding-bottom: calc(env(safe-area-inset-bottom) + 24rpx);
  256. box-sizing: border-box;
  257. background: #FFFFFF;
  258. .btn {
  259. padding: 16rpx 0;
  260. font-family: PingFang SC;
  261. font-size: 36rpx;
  262. font-weight: 500;
  263. line-height: 1;
  264. color: #FFFFFF;
  265. background-image: linear-gradient(to right, #4B348F, #845CFA);
  266. border-radius: 41rpx;
  267. }
  268. }
  269. </style>