bloodSugar.vue 9.7 KB

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