uricAcid.vue 9.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424
  1. <template>
  2. <view class="container">
  3. <uni-nav-bar fixed :border="false" :backgroundColor="`rgba(255,255,255,${opacity})`" title="尿酸监测"
  4. :statusBar="true" left-icon="left" @clickLeft="back"></uni-nav-bar>
  5. <image class="page-bg" src="@/static/images/pages_watch/images/sleep_top_bg.png" mode="widthFix"></image>
  6. <view class="container-body">
  7. <dateTimePicker @onChange="onChangeTime" />
  8. <!-- 尿酸趋势 -->
  9. <view class="box">
  10. <view class="box-title">
  11. <view class="box-title-left">尿酸趋势</view>
  12. </view>
  13. <view class="ytitle" v-show="!loading && !isEmpty">单位:μmol/L</view>
  14. <view class="echartbox">
  15. <qiun-data-charts v-show="!isEmpty" type="column" :opts="opts" :chartData="chartData"
  16. tooltipFormat="uaTooltip" />
  17. <myEmpty v-show="isEmpty" style="padding: 40rpx 0 0 0;"></myEmpty>
  18. </view>
  19. <view class="legend" v-show="!loading && !isEmpty">
  20. <view class="legend-item">
  21. <view class="legend-dot" style="background-color: #52D087;"></view><text>150-416μmol/L</text>
  22. </view>
  23. <view class="legend-item">
  24. <view class="legend-dot" style="background-color: #FDBD27;"></view><text>{{'<'}}150μmol/L</text>
  25. </view>
  26. <view class="legend-item">
  27. <view class="legend-dot" style="background-color: #FF5558;"></view><text>{{'>'}}416μmol/L</text>
  28. </view>
  29. </view>
  30. </view>
  31. <!-- 尿酸异常记录 -->
  32. <view class="box">
  33. <view class="box-title" style="height: 80rpx;">
  34. <view class="box-title-left">尿酸异常记录</view>
  35. <view class="box-title-right" @tap="handleMore">
  36. 查看更多<image src="@/static/images/pages_watch/icons/my_right_arrow_right_icon.png"></image>
  37. </view>
  38. </view>
  39. <view class="abnormal">
  40. <view class="abnormal-item colorbg1">
  41. <view class="abnormal-item-title">高风险</view>
  42. <view class="abnormal-item-num">
  43. <text>{{status1}}次</text>
  44. <image src="@/static/images/pages_watch/icons/zyss_arrow_icon1.png"></image>
  45. </view>
  46. </view>
  47. <view class="abnormal-item colorbg2">
  48. <view class="abnormal-item-title">不良</view>
  49. <view class="abnormal-item-num">
  50. <text>{{status2}}次</text>
  51. <image src="@/static/images/pages_watch/icons/zyss_arrow_icon2.png"></image>
  52. </view>
  53. </view>
  54. <view class="abnormal-item colorbg5">
  55. <view class="abnormal-item-title">正常</view>
  56. <view class="abnormal-item-num">
  57. <text>{{status3}}次</text>
  58. <image src="@/static/images/pages_watch/icons/zyss_arrow_icon5.png"></image>
  59. </view>
  60. </view>
  61. </view>
  62. <view class="standard">
  63. <view class="standard-title">
  64. <image src="@/static/images/pages_watch/icons/note_icon.png"></image>
  65. <text>尿酸</text>
  66. <text>最新标准</text>
  67. </view>
  68. <view class="standard-con">
  69. <view>男性正常值:150~416umol/L</view>
  70. <view>女性正常值:89~357μmol/L</view>
  71. </view>
  72. </view>
  73. </view>
  74. </view>
  75. </view>
  76. </template>
  77. <script>
  78. import myEmpty from "@/pages_watch/components/myEmpty/myEmpty.vue"
  79. import dateTimePicker from "@/pages_watch/components/dateTimePicker/dateTimePicker.vue"
  80. import {
  81. ualist,
  82. uaCount
  83. } from "@/api/pages_watch/healthMonitoring.js";
  84. export default {
  85. components: {
  86. myEmpty,
  87. dateTimePicker
  88. },
  89. data() {
  90. return {
  91. opacity: 0,
  92. loading: true,
  93. isEmpty: false,
  94. // 0:正常,1:不良2:高风险
  95. status1: 0,
  96. status2: 0,
  97. status3: 0,
  98. queryParam: {
  99. startTime: "",
  100. endTime: "",
  101. deviceId: uni.getStorageSync("deviceId")
  102. },
  103. chartData: {},
  104. opts: {
  105. padding: [15, 0, 15, 0],
  106. enableScroll: false,
  107. dataLabel: false,
  108. legend: {
  109. show: false
  110. },
  111. xAxis: {
  112. disableGrid: true,
  113. fontSize: 12,
  114. axisLine: false,
  115. fontColor: '#ccc',
  116. labelCount: 7,
  117. format: "formatterTime",
  118. },
  119. yAxis: {
  120. gridType: "dash",
  121. dashLength: 2,
  122. data: [{
  123. fontColor: '#ccc',
  124. min: 0,
  125. // max: 100,
  126. axisLine: false,
  127. fontSize: 12,
  128. }]
  129. },
  130. extra: {
  131. tooltip: {
  132. gridType: "dash",
  133. showArrow: false,
  134. legendShow: true,
  135. legendShape: "circle"
  136. },
  137. column: {
  138. type: "group",
  139. width: 12,
  140. barBorderRadius: [4, 4, 0, 0],
  141. }
  142. }
  143. }
  144. }
  145. },
  146. methods: {
  147. back() {
  148. uni.navigateBack({
  149. delta: 1
  150. })
  151. },
  152. onChangeTime(time) {
  153. const param = {
  154. startTime: this.$timeFormat(time[0], 'yyyy/mm/dd hh:MM:ss'),
  155. endTime: this.$timeFormat(time[1], 'yyyy/mm/dd hh:MM:ss'),
  156. deviceId: uni.getStorageSync("deviceId") || ""
  157. }
  158. this.queryParam = param
  159. this.getServerData(param)
  160. this.getCount(param)
  161. },
  162. getServerData(param) {
  163. this.loading = true
  164. ualist(param).then((res) => {
  165. this.loading = false
  166. this.isEmpty = !(res.data && res.data && res.data.length > 0)
  167. if (res.code == 200 && res.data) {
  168. let chartData = {
  169. categories: res.data.map(item => item.createTime),
  170. series: [{
  171. name: "尿酸",
  172. data: res.data.map(item => ({
  173. value: item.val,
  174. color: item.status === 1 ? "#FDBD27" : item.status ===
  175. 2 ? "#FF5558" : "#52D087"
  176. }))
  177. }]
  178. }
  179. this.chartData = JSON.parse(JSON.stringify(chartData));
  180. } else {
  181. this.avg = undefined
  182. this.max = undefined
  183. this.min = undefined
  184. }
  185. }).catch((err) => {
  186. this.loading = false
  187. });
  188. },
  189. getCount(param) {
  190. this.status1 = 0
  191. this.status2 = 0
  192. this.status3 = 0
  193. uaCount(param).then((res) => {
  194. if (res.code == 200 && res.data && res.data.length > 0) {
  195. // 0:正常,1:偏低2:偏高
  196. res.data.forEach(item => {
  197. this.status1 += item.status == 2 ? item.count : 0
  198. this.status2 += item.status == 1 ? item.count : 0
  199. this.status3 += item.status == 0 ? item.count : 0
  200. })
  201. }
  202. }).catch((err) => {});
  203. },
  204. // 查看等多数据
  205. handleMore() {
  206. uni.navigateTo({
  207. url: "/pages_watch/healthMonitoring/uricAcidAbnormal?startTime="+this.queryParam.startTime+ "&endTime=" + this.queryParam.endTime
  208. })
  209. }
  210. },
  211. onPageScroll(e) {
  212. if (e.scrollTop <= 44) {
  213. this.opacity = e.scrollTop / 44 * 1
  214. } else if (e.scrollTop > 44) {
  215. this.opacity = 1
  216. }
  217. }
  218. }
  219. </script>
  220. <style lang="scss" scoped>
  221. @mixin u-flex($flexD, $alignI, $justifyC) {
  222. display: flex;
  223. flex-direction: $flexD;
  224. align-items: $alignI;
  225. justify-content: $justifyC;
  226. }
  227. .container {
  228. padding: 0 24rpx;
  229. position: relative;
  230. }
  231. .page-bg {
  232. width: 100%;
  233. height: auto;
  234. position: absolute;
  235. top: 0;
  236. left: 0;
  237. }
  238. .container-body {
  239. position: relative;
  240. z-index: 1;
  241. padding-bottom: 24rpx;
  242. }
  243. .box-title {
  244. font-family: PingFang SC, PingFang SC;
  245. font-weight: 400;
  246. font-size: 24rpx;
  247. color: #757575;
  248. @include u-flex(row, center, space-between);
  249. &-left {
  250. font-weight: 500;
  251. font-size: 36rpx;
  252. color: #222222;
  253. line-height: 42rpx;
  254. }
  255. &-right {
  256. @include u-flex(row, center, flex-start);
  257. image {
  258. height: 48rpx;
  259. width: 48rpx;
  260. }
  261. }
  262. }
  263. .ytitle {
  264. margin-top: 10rpx;
  265. line-height: 34rpx;
  266. margin-bottom: 24rpx;
  267. font-family: PingFang SC, PingFang SC;
  268. font-weight: 400;
  269. font-size: 24rpx;
  270. color: #999999;
  271. }
  272. .legend {
  273. height: 48rpx;
  274. margin-top: 44rpx;
  275. margin-bottom: 24rpx;
  276. @include u-flex(row, center, space-between);
  277. font-family: PingFang SC, PingFang SC;
  278. font-weight: 400;
  279. font-size: 24rpx;
  280. color: #757575;
  281. &-item {
  282. flex: 1;
  283. text-align: center;
  284. @include u-flex(row, center, center);
  285. }
  286. &-dot {
  287. width: 12rpx;
  288. height: 12rpx;
  289. border-radius: 50%;
  290. margin: 12rpx;
  291. }
  292. }
  293. .box {
  294. padding: 24rpx;
  295. margin-bottom: 20rpx;
  296. box-sizing: border-box;
  297. background: #FFFFFF;
  298. border-radius: 16rpx 16rpx 16rpx 16rpx;
  299. }
  300. .echartbox {
  301. height: 520rpx;
  302. width: 100%;
  303. }
  304. .abnormal {
  305. font-family: PingFang SC, PingFang SC;
  306. font-weight: 400;
  307. font-size: 24rpx;
  308. color: #757575;
  309. @include u-flex(row, center, flex-start);
  310. flex-wrap: wrap;
  311. // gap: 18rpx;
  312. margin-top: 20rpx;
  313. margin-bottom: -18rpx;
  314. margin-right: -18rpx;
  315. &-item {
  316. width: 206rpx;
  317. height: 144rpx;
  318. padding: 0 24rpx;
  319. margin: 0 18rpx 18rpx 0;
  320. box-sizing: border-box;
  321. border-radius: 16rpx 16rpx 16rpx 16rpx;
  322. border: 2rpx solid #FCF4F4;
  323. @include u-flex(column, flex-start, center);
  324. &-title {
  325. font-weight: 500;
  326. font-size: 32rpx;
  327. color: #333333;
  328. margin-bottom: 12rpx;
  329. }
  330. image {
  331. width: 24rpx;
  332. height: 24rpx;
  333. }
  334. &-num {
  335. width: 100%;
  336. @include u-flex(row, center, space-between);
  337. }
  338. }
  339. .colorbg1 {
  340. background: #FFFCFC;
  341. border-color: #FCF4F4;
  342. }
  343. .colorbg2 {
  344. background: #FEFAF8;
  345. border-color: #FDF7F3;
  346. }
  347. .colorbg3 {
  348. background: #FAFFFC;
  349. border-color: #EBFFF3;
  350. }
  351. }
  352. .standard {
  353. padding: 24rpx;
  354. margin-top: 32rpx;
  355. background: #F5F7FA;
  356. border-radius: 16rpx 16rpx 16rpx 16rpx;
  357. &-title {
  358. @include u-flex(row, center, flex-start);
  359. font-family: PingFang SC, PingFang SC;
  360. font-weight: 500;
  361. font-size: 28rpx;
  362. color: #333333;
  363. image {
  364. width: 48rpx;
  365. height: 48rpx;
  366. margin-right: 14rpx;
  367. }
  368. text:last-child {
  369. color: #FF7700;
  370. }
  371. }
  372. &-con {
  373. margin-top: 28rpx;
  374. font-family: PingFang SC, PingFang SC;
  375. font-weight: 400;
  376. font-size: 24rpx;
  377. color: #757575;
  378. view {
  379. margin-bottom: 12rpx;
  380. padding-left: 24rpx;
  381. position: relative;
  382. &::before {
  383. content: "";
  384. width: 8rpx;
  385. height: 8rpx;
  386. background: rgba(255, 119, 0, 0.5);
  387. border-radius: 50%;
  388. position: absolute;
  389. left: 0;
  390. top: 50%;
  391. transform: translateY(-50%);
  392. }
  393. }
  394. }
  395. }
  396. </style>