bloodPressureDetail.vue 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210
  1. <template>
  2. <view class="container">
  3. <view class="datebox">
  4. <picker mode="date" fields="day" :value="date" :start="startDate" :end="endDate" @change="bindDateChange">
  5. <view class="datebox-item border-line flex-bt">
  6. <view>日期</view>
  7. <view class="datebox-item-right">
  8. <text :class="date ? '':'default'">{{date ? date : "请选择日期"}}</text>
  9. <image src="@/static/images/pages_watch/icons/my_right_arrow_right_icon.png"></image>
  10. </view>
  11. </view>
  12. </picker>
  13. <picker mode="time" :value="time" @change="bindTimeChange">
  14. <view class="datebox-item flex-bt">
  15. <view>测量时间</view>
  16. <view class="datebox-item-right">
  17. <text :class="time ? '':'default'">{{time ? time : "请选择测量时间"}}</text>
  18. <image src="@/static/images/pages_watch/icons/my_right_arrow_right_icon.png"></image>
  19. </view>
  20. </view>
  21. </picker>
  22. </view>
  23. <view class="datebox-detail">
  24. <view class="datebox-detail-header flex-bt">
  25. <view>收缩压</view>
  26. <view class="datebox-detail-header-right">
  27. <text class="num">{{sbp}}</text>
  28. <text>mmol/L</text>
  29. </view>
  30. </view>
  31. <view class="scale">
  32. <simpleScale ref="simpleSBPScale" :minVal="0" :maxVal="300" :int="true" :single="10" :h="h" :active="sbp" :scroll="false" :style="style"
  33. @value="getSBPScroll" />
  34. </view>
  35. <view class="datebox-detail-header flex-bt" style="margin-top: 48rpx;">
  36. <view>舒张压</view>
  37. <view class="datebox-detail-header-right">
  38. <text class="num">{{dbp}}</text>
  39. <text>mmol/L</text>
  40. </view>
  41. </view>
  42. <view class="scale">
  43. <simpleScale ref="simpleDBPScale" :minVal="0" :maxVal="300" :int="true" :single="10" :h="h" :active="dbp" :scroll="false" :style="style"
  44. @value="getDBPScroll" />
  45. </view>
  46. </view>
  47. </view>
  48. </template>
  49. <script>
  50. import simpleScale from "@/pages_watch/components/simpleScale/simpleScale.vue"
  51. import { bpInfo } from "@/api/pages_watch/healthMonitoring.js"
  52. export default {
  53. components: {
  54. simpleScale
  55. },
  56. data() {
  57. return {
  58. // 表示有效日期范围的开始,字符串格式为"YYYY-MM-DD"
  59. startDate: "2020-01-01",
  60. // 表示有效日期范围的结束,字符串格式为"YYYY-MM-DD"
  61. endDate: this.$timeFormat(new Date()),
  62. date: "2024-01-01",
  63. time: "17:12",
  64. // 收缩压
  65. sbp: "0",
  66. // 舒张压
  67. dbp: "0",
  68. loading: false,
  69. style: {
  70. line: '#ccc',
  71. bginner: '#fbfbfb',
  72. bgoutside: '#ffffff',
  73. fontColor: '#333',
  74. fontSize: 16
  75. },
  76. h: uni.upx2px(88)
  77. }
  78. },
  79. onLoad(option) {
  80. const param = JSON.parse(option.param)
  81. this.date = param.createTime && param.createTime.split(' ')[0]
  82. this.time = param.createTime && param.createTime.substring(11, 16)
  83. this.sbp = String(param.sbp || 0)
  84. this.dbp = String(param.dbp || 0)
  85. this.$nextTick(()=>{
  86. this.$refs.simpleSBPScale.init()
  87. this.$refs.simpleDBPScale.init()
  88. })
  89. },
  90. methods: {
  91. bindDateChange(e) {
  92. this.date = e.detail.value
  93. this.getList()
  94. },
  95. bindTimeChange(e) {
  96. this.time = e.detail.value
  97. this.getList()
  98. },
  99. getSBPScroll(e) {
  100. this.sbp = e
  101. },
  102. getDBPScroll(e) {
  103. this.dbp = e
  104. },
  105. // 查询数据
  106. getList() {
  107. this.loading = true
  108. const param = {
  109. startTime: this.date.replace(/-/g, '/') +" " +this.time + ":00",
  110. endTime: this.date.replace(/-/g, '/') +" " + this.time + ":59",
  111. deviceId: uni.getStorageSync("deviceId"),
  112. }
  113. bpInfo(param).then(res => {
  114. this.loading = false
  115. if (res.code == 200) {
  116. if(res.data && res.data.length > 0) {
  117. this.date = res.data[0].createTime && res.data[0].createTime.split(' ')[0]
  118. this.time = res.data[0].createTime && res.data[0].createTime.substring(11, 16)
  119. this.sbp = String(res.data[0].sbp || 0)
  120. this.dbp = String(res.data[0].dbp || 0)
  121. console.log(this.sbp,this.dbp)
  122. } else {
  123. this.sbp = "0"
  124. this.dbp = "0"
  125. }
  126. } else {
  127. this.sbp = "0"
  128. this.dbp = "0"
  129. }
  130. this.$nextTick(()=>{
  131. this.$refs.simpleSBPScale.init()
  132. this.$refs.simpleDBPScale.init()
  133. })
  134. }).catch(() => {
  135. this.loading = false
  136. })
  137. }
  138. }
  139. }
  140. </script>
  141. <style lang="scss" scoped>
  142. @mixin u-flex($flexD, $alignI, $justifyC) {
  143. display: flex;
  144. flex-direction: $flexD;
  145. align-items: $alignI;
  146. justify-content: $justifyC;
  147. }
  148. .flex-bt {
  149. @include u-flex(row, center, space-between);
  150. }
  151. .default {
  152. font-weight: 400;
  153. font-size: 28rpx;
  154. color: #999999;
  155. }
  156. .container {
  157. padding: 20rpx 24rpx;
  158. font-family: PingFang SC, PingFang SC;
  159. font-weight: 500;
  160. font-size: 32rpx;
  161. color: #333333;
  162. }
  163. .datebox {
  164. padding: 0 32rpx;
  165. margin-bottom: 20rpx;
  166. background: #FFFFFF;
  167. border-radius: 16rpx 16rpx 16rpx 16rpx;
  168. &-item {
  169. height: 120rpx;
  170. &-right {
  171. font-weight: 400;
  172. font-size: 32rpx;
  173. @include u-flex(row, center, flex-start);
  174. image {
  175. width: 48rpx;
  176. height: 48rpx;
  177. }
  178. }
  179. }
  180. }
  181. .datebox-detail {
  182. background: #FFFFFF;
  183. border-radius: 16rpx 16rpx 16rpx 16rpx;
  184. padding: 40rpx 32rpx;
  185. &-header-right {
  186. flex-shrink: 0;
  187. font-weight: 400;
  188. font-size: 28rpx;
  189. color: #999999;
  190. .num {
  191. font-size: 48rpx;
  192. color: #333333;
  193. margin-right: 14rpx;
  194. }
  195. }
  196. }
  197. .scale {
  198. height: 176rpx;
  199. margin-top: 36rpx;
  200. overflow: hidden;
  201. background: #FFFFFF;
  202. box-shadow: 0rpx 4rpx 8rpx 0rpx rgba(170,170,170,0.1);
  203. border-radius: 0rpx 0rpx 0rpx 0rpx;
  204. border: 2rpx solid #ECECEC;
  205. // width: 200rpx;
  206. // height: 600rpx;
  207. }
  208. </style>