bloodPressure.vue 8.8 KB

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