bloodPressure.vue 9.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440
  1. <template>
  2. <view class="hb column hidden container">
  3. <image class="bg" src="/static/images/health/blood_pressure_top_bg.png" mode="widthFix"></image>
  4. <view :style="{height: statusBarHeight,background: bgColor }"></view>
  5. <u-navbar title="血压检测" titleStyle="font-weight: bold;" @rightClick="rightClick" :autoBack="true"
  6. :bg-color="bgColor">
  7. </u-navbar>
  8. <view class="top-fixed">
  9. <!-- tab切换 -->
  10. <dateTimePicker @onChange="onChangeTime" :tab-color="'orange'"/>
  11. </view>
  12. <scroll-view class="content" :scroll-y="true">
  13. <view class="content-box">
  14. <view class="tltle">血压趋势</view>
  15. <view class="subtitle">单位:mmhg</view>
  16. <view class="charts-box">
  17. <qiun-data-charts type="area" :opts="opts" :chartData="chartData" />
  18. </view>
  19. <view class="legend">
  20. <view class="legend-item">
  21. <view class="legend-dot" style="background-color: #FF5030;"></view><text>收缩压90-140mmHg</text>
  22. </view>
  23. <view class="legend-item">
  24. <view class="legend-dot" style="background-color: #008FD3;"></view><text>舒张压60-90mmHg</text>
  25. </view>
  26. </view>
  27. </view>
  28. <view class="content-box">
  29. <view class="align-center justify-between">
  30. <view class="tltle">血压异常记录</view>
  31. <view class="more" @click="navgetTo()">
  32. <text>查看更多</text>
  33. <image class="w48 h48" src="/static/images/health/right_arrow_right_icon24.png"></image>
  34. </view>
  35. </view>
  36. <view class="type-box">
  37. <view class="box bg1">
  38. <view class="fs32 mb12">正常</view>
  39. <view class="align-center justify-between">
  40. <text class="subtitle">4次</text>
  41. <image class="w24 h24" src="/static/images/health/zc_arrow_icon.png"></image>
  42. </view>
  43. </view>
  44. <view class="box bg2">
  45. <view class="fs32 mb12">轻微</view>
  46. <view class="align-center justify-between">
  47. <text class="subtitle">4次</text>
  48. <image class="w24 h24" src="/static/images/health/qw_arrow_icon.png"></image>
  49. </view>
  50. </view>
  51. <view class="box bg3">
  52. <view class="fs32 mb12">严重</view>
  53. <view class="align-center justify-between">
  54. <text class="subtitle">4次</text>
  55. <image class="w24 h24" src="/static/images/health/yz_arrow_icon.png"></image>
  56. </view>
  57. </view>
  58. </view>
  59. </view>
  60. <view class="h20"></view>
  61. <view class="btn-box">
  62. <view class="sub-btn" @click="navgetTo()">记录</view>
  63. </view>
  64. </scroll-view>
  65. </view>
  66. </template>
  67. <script>
  68. import dateTimePicker from "@/pages_echarts/components/dateTimePicker/dateTimePicker.vue"
  69. export default {
  70. components: {
  71. dateTimePicker
  72. },
  73. data() {
  74. return {
  75. loading: false,
  76. isEmpty: false,
  77. statusBarHeight: '',
  78. top: 0,
  79. aIndex:0,
  80. times:[ {name:"每日",val:0},
  81. {name:"每周",val:1},
  82. {name:"每月",val:2}],
  83. indexInfo: [],
  84. chartData: {},
  85. opts: {
  86. padding: [25, 10, 0, 0],
  87. enableScroll: false,
  88. dataLabel: false,
  89. dataPointShapeType: "hollow",
  90. legend: {
  91. show: false
  92. },
  93. xAxis: {
  94. disableGrid: true,
  95. fontSize: 12,
  96. axisLine: false,
  97. fontColor: '#ccc',
  98. labelCount: 7,
  99. format: "formatterTime",
  100. },
  101. yAxis: {
  102. gridType: "dash",
  103. dashLength: 2,
  104. data: [{
  105. fontColor: '#ccc',
  106. min: 0,
  107. axisLine: false,
  108. fontSize: 12,
  109. }]
  110. },
  111. extra: {
  112. tooltip: {
  113. gridType: "dash",
  114. showArrow: false,
  115. legendShow: true,
  116. legendShape: "circle"
  117. },
  118. area: {
  119. type: "straight",
  120. opacity: 0.2,
  121. addLine: true,
  122. width: 2,
  123. gradient: true,
  124. activeType: "solid"
  125. }
  126. }
  127. }
  128. }
  129. },
  130. computed: {
  131. // 计算属性的 getter
  132. bgColor: function() {
  133. var top = this.top / 30;
  134. return 'rgba(11,179,242, ' + top + ')';
  135. },
  136. },
  137. onLoad() {
  138. // 获取系统信息
  139. const sys = uni.getSystemInfoSync()
  140. this.statusBarHeight = sys.statusBarHeight + 'px'
  141. this.getServerData();
  142. },
  143. onUnload() { //普通页面在 onUnload 生命周期中执行
  144. uni.$emit('stop')
  145. },
  146. onHide() { //tabBar页面在onHide生命周期中执行
  147. uni.$emit('stop')
  148. },
  149. onPageScroll(e) {
  150. //console.log(e)
  151. this.top = e.scrollTop;
  152. },
  153. methods: {
  154. // tab切换
  155. orderStatusChange(item) {
  156. this.aIndex = item.val
  157. },
  158. onChangeTime(time) {
  159. const param = {
  160. startTime: this.utils.timeFormat(time[0],'yyyy/mm/dd hh:MM:ss'),
  161. endTime: this.utils.timeFormat(time[1],'yyyy/mm/dd hh:MM:ss'),
  162. deviceId: ''
  163. }
  164. // this.queryParam = param
  165. // this.getServerData(param)
  166. // this.getAbnormalInfo(param)
  167. },
  168. getServerData() {
  169. //模拟从服务器获取数据时的延时
  170. setTimeout(() => {
  171. //模拟服务器返回数据,如果数据格式和标准格式不同,需自行按下面的格式拼接
  172. let res = {
  173. categories: ["1", "2", "3", "4", "5"],
  174. series: [{
  175. name: "收缩压",
  176. color: "#FF5030",
  177. data: [35, 180, 125, 307, 40]
  178. },
  179. {
  180. name: "舒张压",
  181. color: "#008FD3",
  182. data: [135, 18, 125, 370, 40]
  183. }
  184. ],
  185. };
  186. this.chartData = JSON.parse(JSON.stringify(res));
  187. }, 500);
  188. },
  189. navgetTo(index) {
  190. uni.navigateTo({
  191. url: '/pages_echarts/bloodPressureList'
  192. })
  193. },
  194. goToUser() {
  195. uni.navigateTo({
  196. url: '/pages_health/addUser?type=edit&docId='
  197. })
  198. }
  199. }
  200. }
  201. </script>
  202. <style lang="scss" scoped>
  203. .container {
  204. position: relative;
  205. .bg {
  206. width: 100%;
  207. height: 380rpx;
  208. position: absolute;
  209. top: 0;
  210. left: 0;
  211. z-index: -1;
  212. }
  213. }
  214. .top-fixed{
  215. width: 100%;
  216. position: fixed;
  217. top: calc(var(--status-bar-height) + 140rpx);
  218. left: 0;
  219. z-index: 10;
  220. }
  221. .pub-tab-box{
  222. box-sizing: border-box;
  223. width: 400rpx;
  224. // padding: 0 60rpx;
  225. margin: 0 auto;
  226. // background-color: #FFFFFF;
  227. .tab-inner{
  228. height: 88upx;
  229. line-height: 88upx;
  230. display: flex;
  231. align-items: center;
  232. justify-content:space-between;
  233. overflow-x: auto;
  234. }
  235. .item{
  236. font-family: PingFang SC;
  237. font-weight: 400;
  238. font-size: 30rpx;
  239. color: #626468;
  240. line-height: 64rpx;
  241. text-align: center;
  242. &:last-child{
  243. margin-right: 0;
  244. }
  245. &.active{
  246. font-weight: 500;
  247. width: 124rpx;
  248. height: 64rpx;
  249. background: #FF5039;
  250. border-radius: 32rpx 32rpx 32rpx 32rpx;
  251. color: #fff;
  252. }
  253. .text{
  254. position: relative;
  255. z-index: 1;
  256. }
  257. .tab-bg{
  258. width: 72upx;
  259. height: 28upx;
  260. position: absolute;
  261. top: 17upx;
  262. left: 50%;
  263. transform: translateX(-36upx);
  264. z-index: -1;
  265. }
  266. }
  267. }
  268. .content {
  269. padding-top: calc(var(--status-bar-height) + 300rpx) !important;
  270. height: 100vh;
  271. box-sizing: border-box;
  272. width: 100%;
  273. padding: 20rpx;
  274. overflow: hidden;
  275. .btn-box {
  276. height: 120upx;
  277. padding: 0 30upx;
  278. display: flex;
  279. align-items: center;
  280. justify-content: center;
  281. .sub-btn {
  282. width: 388rpx;
  283. height: 72rpx;
  284. line-height: 72upx;
  285. text-align: center;
  286. font-size: 32upx;
  287. font-family: PingFang SC;
  288. font-weight: bold;
  289. color: #FFFFFF;
  290. background: #FF5039;
  291. border-radius: 44upx;
  292. margin-bottom: 40upx;
  293. }
  294. }
  295. .content-box {
  296. // width: 100%;
  297. background: #FFFFFF;
  298. border-radius: 16rpx 16rpx 16rpx 16rpx;
  299. padding: 24rpx;
  300. margin-bottom: 20rpx;
  301. .tltle {
  302. font-family: PingFang SC;
  303. font-weight: 500;
  304. font-size: 36rpx;
  305. color: #222426;
  306. text-align: left;
  307. margin-bottom: 16rpx;
  308. }
  309. .subtitle {
  310. font-weight: 400;
  311. font-size: 24rpx;
  312. color: #898E91;
  313. text-align: left;
  314. }
  315. /* 请根据实际需求修改父元素尺寸,组件自动识别宽高 */
  316. .charts-box {
  317. // width: 100%;
  318. height: 500rpx;
  319. margin-top: 30rpx;
  320. }
  321. .legend {
  322. // height: 34rpx;
  323. margin-top: 44rpx;
  324. // @include u-flex(row, center, space-between);
  325. display: flex;
  326. align-items: center;
  327. justify-content: space-between;
  328. font-family: PingFang SC, PingFang SC;
  329. font-weight: 400;
  330. font-size: 24rpx;
  331. color: #626468;
  332. &-item {
  333. flex: 1;
  334. text-align: center;
  335. // @include u-flex(row, center, center);
  336. display: flex;
  337. align-items: center;
  338. justify-content: center;
  339. }
  340. &-dot {
  341. width: 16rpx;
  342. height: 16rpx;
  343. border-radius: 50%;
  344. margin: 16rpx;
  345. }
  346. }
  347. .more {
  348. display: flex;
  349. align-items: center;
  350. font-family: PingFang SC;
  351. font-weight: 400;
  352. font-size: 24rpx;
  353. color: #898E91;
  354. }
  355. .type-box {
  356. display: flex;
  357. align-items: center;
  358. justify-content: space-between;
  359. margin-top: 20rpx;
  360. .box {
  361. padding: 24rpx;
  362. width: 158rpx;
  363. // height: 144rpx;
  364. border-radius: 16rpx 16rpx 16rpx 16rpx;
  365. &.bg1 {
  366. background: #FAFFFC;
  367. border: 2rpx solid #EBFFF3;
  368. }
  369. &.bg2 {
  370. background: #FEFAF8;
  371. border: 2rpx solid #FDF7F3;
  372. }
  373. &.bg3 {
  374. background: #FFFCFC;
  375. border: 2rpx solid #FCF4F4;
  376. }
  377. }
  378. }
  379. .content-bottom {
  380. padding: 24rpx;
  381. background: #F5F7FA;
  382. border-radius: 16rpx 16rpx 16rpx 16rpx;
  383. margin-top: 32rpx;
  384. .title {
  385. font-family: PingFang SC;
  386. font-weight: 500;
  387. font-size: 28rpx;
  388. color: #222426;
  389. text-align: left;
  390. margin-left: 14rpx;
  391. text {
  392. color: #FF5030;
  393. }
  394. }
  395. .bottom-box {
  396. postion:relative;
  397. font-weight: 400;
  398. font-size: 24rpx;
  399. color: #626468;
  400. text-align: left;
  401. line-height: 40rpx;
  402. padding-top: 24rpx;
  403. padding-left: 24rpx;
  404. view{
  405. position: relative;
  406. }
  407. view::before {
  408. content: "";
  409. width: 8rpx;
  410. height: 8rpx;
  411. background: rgba(255,80,48,0.2);
  412. position: absolute;
  413. left:-22rpx;
  414. top: 20rpx;
  415. border-radius: 50%;
  416. }
  417. }
  418. }
  419. }
  420. }
  421. </style>