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

302 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 :data="detail">
  6. <view class="section">
  7. <cardHeader :BMI="detail.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. detail: {},
  84. list: [],
  85. }
  86. },
  87. onLoad(arg) {
  88. const { id } = arg
  89. this.id = id
  90. this.fetchReportData(id)
  91. },
  92. methods: {
  93. async fetchReportData(id) {
  94. try {
  95. const { json, ...detail } = await this.$fetch('getReportDetail', { id })
  96. this.detail = detail
  97. this.list = JSON.parse(json).map((item, index) => {
  98. let url = `/pages_order/static/report/report-detail-${index + 1}.png`
  99. return {
  100. ...item,
  101. // todo: delete
  102. icon: item.icon || url,
  103. }
  104. })
  105. console.log('list', this.list)
  106. } catch (err) {
  107. }
  108. },
  109. jumpToNutritionProgram() {
  110. this.$utils.navigateTo(`/pages_order/report/nutritionProgram/index?id=${this.id}`)
  111. },
  112. },
  113. }
  114. </script>
  115. <style scoped lang="scss">
  116. .page__view {
  117. width: 100vw;
  118. min-height: 100vh;
  119. background-color: $uni-bg-color;
  120. position: relative;
  121. /deep/ .nav-bar__view {
  122. position: fixed;
  123. top: 0;
  124. left: 0;
  125. }
  126. }
  127. .main {
  128. padding: calc(var(--status-bar-height) + 152rpx) 32rpx 272rpx 32rpx;
  129. }
  130. .section {
  131. & + & {
  132. margin-top: 48rpx;
  133. padding-top: 12rpx;
  134. border-top: 2rpx dashed #989898;
  135. }
  136. &-header {
  137. justify-content: flex-start;
  138. &-index {
  139. position: relative;
  140. font-family: HarmonyOS Sans;
  141. font-weight: 700;
  142. font-size: 96rpx;
  143. line-height: 1.4;
  144. color: #D9D9D9;
  145. &-icon {
  146. position: absolute;
  147. left: 34rpx;
  148. top: 70rpx;
  149. width: 40rpx;
  150. height: 40rpx;
  151. }
  152. }
  153. &-title {
  154. margin-left: 32rpx;
  155. font-family: PingFang SC;
  156. line-height: 1.4;
  157. color: #252545;
  158. &-zh {
  159. font-weight: 600;
  160. font-size: 40rpx;
  161. }
  162. &-en {
  163. font-weight: 400;
  164. font-size: 26rpx;
  165. }
  166. }
  167. }
  168. &-content {
  169. padding-top: 18rpx;
  170. &-item {
  171. font-family: PingFang SC;
  172. font-weight: 400;
  173. line-height: 1.5;
  174. color: #252545;
  175. & + & {
  176. margin-top: 24rpx;
  177. }
  178. &-header {
  179. align-items: flex-start;
  180. justify-content: flex-start;
  181. }
  182. &-index {
  183. display: inline-block;
  184. width: 44rpx;
  185. font-size: 24rpx;
  186. text-align: right;
  187. line-height: 44rpx;
  188. padding-right: 10rpx;
  189. box-sizing: border-box;
  190. }
  191. &-title {
  192. font-size: 28rpx;
  193. }
  194. &-detail {
  195. margin-top: 8rpx;
  196. font-size: 24rpx;
  197. color: #989898;
  198. }
  199. }
  200. &-tag {
  201. margin-bottom: 24rpx;
  202. padding: 16rpx 0;
  203. background: #E5E4EB8C;
  204. border-radius: 16rpx;
  205. column-gap: 16rpx;
  206. &-icon {
  207. width: 40rpx;
  208. height: 40rpx;
  209. }
  210. &-text {
  211. font-family: PingFang SC;
  212. font-weight: 400;
  213. font-size: 28rpx;
  214. line-height: 1.5;
  215. color: #252545;
  216. }
  217. }
  218. }
  219. }
  220. .tags {
  221. display: flex;
  222. flex-wrap: wrap;
  223. gap: 16rpx;
  224. .tag {
  225. padding: 8rpx 40rpx;
  226. font-family: PingFang SC;
  227. font-weight: 400;
  228. font-size: 28rpx;
  229. line-height: 1.5;
  230. color: #252545;
  231. background: #E5E4EB;
  232. border-radius: 30rpx;
  233. &.highlight {
  234. font-weight: 600;
  235. color: #FFFFFF;
  236. background: #252545;
  237. }
  238. }
  239. }
  240. .section.tips {
  241. padding-top: 48rpx;
  242. font-family: PingFang SC;
  243. font-weight: 400;
  244. font-size: 18rpx;
  245. line-height: 1.4;
  246. color: #989898;
  247. }
  248. .bottom {
  249. width: 100%;
  250. position: fixed;
  251. left: 0;
  252. bottom: 0;
  253. padding: 24rpx 40rpx;
  254. padding-bottom: calc(env(safe-area-inset-bottom) + 24rpx);
  255. box-sizing: border-box;
  256. background: #FFFFFF;
  257. .btn {
  258. padding: 16rpx 0;
  259. font-family: PingFang SC;
  260. font-size: 36rpx;
  261. font-weight: 500;
  262. line-height: 1;
  263. color: #FFFFFF;
  264. background-image: linear-gradient(to right, #4B348F, #845CFA);
  265. border-radius: 41rpx;
  266. }
  267. }
  268. </style>