acid.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594
  1. <template>
  2. <view class="hb column hidden container">
  3. <image class="bg" src="https://user.test.ylrztop.com/images/uric_acid_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. <dateTimePicker @onChange="onChangeTime" :tabColor="'blue'" ref="datePickerRef"/>
  10. </view>
  11. <scroll-view class="content" :scroll-y="true">
  12. <view class="content-box">
  13. <view class="tltle">尿酸趋势</view>
  14. <view class="subtitle">单位:μmol/L</view>
  15. <view class="charts-box">
  16. <qiun-data-charts type="area":opts="opts" :chartData="chartData" />
  17. </view>
  18. <view class="legend">
  19. <view class="legend-item">
  20. <view class="legend-dot" style="background-color: #52D087;"></view><text>150-416μmol/L</text>
  21. </view>
  22. <view class="legend-item">
  23. <view class="legend-dot" style="background-color: #FDBD27;"></view><text>{{'<'}}150μmol/L</text>
  24. </view>
  25. <view class="legend-item">
  26. <view class="legend-dot" style="background-color: #FF5030;"></view><text>{{'>'}}416μmol/L</text>
  27. </view>
  28. </view>
  29. </view>
  30. <view class="content-box">
  31. <view class="align-center justify-between">
  32. <view class="tltle">尿酸异常记录</view>
  33. <view class="more" @click="goPage()">
  34. <text>查看更多</text>
  35. <image class="w48 h48" src="/static/images/health/right_arrow_right_icon24.png"></image>
  36. </view>
  37. </view>
  38. <view class="type-box">
  39. <view class="box bg3">
  40. <view class="fs32 mb12">高风险</view>
  41. <view class="align-center justify-between">
  42. <text class="subtitle">{{count.count0}}次</text>
  43. <image class="w24 h24" src="/static/images/health/yz_arrow_icon.png"></image>
  44. </view>
  45. </view>
  46. <view class="box bg2">
  47. <view class="fs32 mb12">不良</view>
  48. <view class="align-center justify-between">
  49. <text class="subtitle">{{count.count0}}次</text>
  50. <image class="w24 h24" src="/static/images/health/qw_arrow_icon.png"></image>
  51. </view>
  52. </view>
  53. <view class="box bg1">
  54. <view class="fs32 mb12">正常</view>
  55. <view class="align-center justify-between">
  56. <text class="subtitle">{{count.count0}}次</text>
  57. <image class="w24 h24" src="/static/images/health/zc_arrow_icon.png"></image>
  58. </view>
  59. </view>
  60. </view>
  61. <view class="content-bottom">
  62. <view class="align-center">
  63. <image class="w48 h48" src="/static/images/health/note_icon.png"></image>
  64. <view class="title">尿酸
  65. <text>最新标准</text>
  66. </view>
  67. </view>
  68. <view class="bottom-box">
  69. <view>男性正常值:150~416umol/L</view>
  70. <view>女性正常值:89~357μmol/L</view>
  71. </view>
  72. </view>
  73. </view>
  74. <view class="h20"></view>
  75. <view class="btn-box">
  76. <view class="sub-btn" @click="navgetTo()">记录</view>
  77. </view>
  78. </scroll-view>
  79. </view>
  80. </template>
  81. <script>
  82. import {getUserInfo} from '@/api/user.js'
  83. import {getDataList,getLatest,getLatestList} from '@/api/healthUser.js'
  84. import dateTimePicker from "@/pages_echarts/components/dateTimePicker/dateTimePicker.vue"
  85. export default {
  86. components: {
  87. dateTimePicker
  88. },
  89. data() {
  90. return {
  91. examDate: null,
  92. loading: false,
  93. isEmpty: false,
  94. statusBarHeight: '',
  95. top: 0,
  96. aIndex: 0,
  97. times: [{
  98. name: "每日",
  99. val: 0
  100. },
  101. {
  102. name: "每周",
  103. val: 1
  104. },
  105. {
  106. name: "每月",
  107. val: 2
  108. }
  109. ],
  110. indexInfo: [],
  111. chartData: {},
  112. opts: {
  113. padding: [25, 10, 0, 0],
  114. enableScroll: false,
  115. dataLabel: false,
  116. dataPointShapeType: "hollow",
  117. legend: {
  118. show: false
  119. },
  120. xAxis: {
  121. disableGrid: true,
  122. fontSize: 12,
  123. axisLine: false,
  124. fontColor: '#ccc',
  125. labelCount: 7,
  126. format: "formatterTime",
  127. },
  128. yAxis: {
  129. gridType: "dash",
  130. dashLength: 2,
  131. data: [{
  132. fontColor: '#ccc',
  133. min: 0,
  134. axisLine: false,
  135. fontSize: 12,
  136. }]
  137. },
  138. extra: {
  139. tooltip: {
  140. gridType: "dash",
  141. showArrow: false,
  142. legendShow: true,
  143. legendShape: "circle"
  144. },
  145. area: {
  146. type: "straight",
  147. opacity: 0.2,
  148. addLine: true,
  149. width: 2,
  150. gradient: true,
  151. activeType: "solid"
  152. }
  153. }
  154. },count:{},
  155. user:null
  156. }
  157. },
  158. computed: {
  159. // 计算属性的 getter
  160. bgColor: function() {
  161. var top = this.top / 30;
  162. return 'rgba(11,179,242, ' + top + ')';
  163. },
  164. },
  165. onLoad(options) {
  166. console.log(options, '--')
  167. // this.userId=options.userId
  168. // 获取系统信息
  169. this.userId=options.userId
  170. const sys = uni.getSystemInfoSync()
  171. this.statusBarHeight = sys.statusBarHeight + 'px'
  172. // this.getUserInfo()
  173. // this.getServerData(0);
  174. uni.$on('refreshAcid', () => {
  175. this.aIndex = 0
  176. this.getServerData(0);
  177. })
  178. },
  179. onShow(){
  180. var item={value:'day'}
  181. if (this.$refs.datePickerRef) {
  182. console.log('chufa')
  183. this.$refs.datePickerRef.handleTab(item,0);
  184. this.getServerData(0);
  185. }
  186. },
  187. onUnload() { //普通页面在 onUnload 生命周期中执行
  188. uni.$emit('stop')
  189. },
  190. onHide() { //tabBar页面在onHide生命周期中执行
  191. uni.$emit('stop')
  192. },
  193. onPageScroll(e) {
  194. //console.log(e)
  195. this.top = e.scrollTop;
  196. },
  197. methods: {
  198. // tab切换
  199. orderStatusChange(item) {
  200. this.aIndex = item.val
  201. },
  202. onChangeTime(time,tab) {
  203. this.examDate=time
  204. if (tab) {
  205. this.getServerData(tab);
  206. }
  207. // this.queryParam = param
  208. // this.getServerData(param)
  209. // this.getAbnormalInfo(param)
  210. },
  211. getUserInfo(){
  212. getUserInfo().then(
  213. res => {
  214. if(res.code==200){
  215. if(res.user!=null){
  216. this.user=res.user;
  217. // this.getServerData(0)
  218. }
  219. else{
  220. this.utils.loginOut();
  221. }
  222. }else{
  223. uni.showToast({
  224. icon:'none',
  225. title: "请求失败",
  226. });
  227. }
  228. },
  229. rej => {}
  230. );
  231. },
  232. getServerData(index) {
  233. var that=this
  234. var data={
  235. userId:this.userId,
  236. measurementType: 4,
  237. pageNum:1,
  238. pageSize:100,
  239. timeSearch:this.examDate,
  240. // "value1": 85,
  241. // "measurementTime": this.utils.timeFormat(new Date(),'hh:MM:ss')
  242. }
  243. const weekMap= {
  244. 1: '一',
  245. 2: '二',
  246. 3: '三',
  247. 4: '四',
  248. 5: '五',
  249. 6: '六',
  250. 0: '日' // 注意:JavaScript中getDay()返回0表示周日
  251. };
  252. getLatestList(data).then(
  253. res => {
  254. if (res.code == 200) {
  255. // console.log(res.count0,'res')
  256. this.count=res.count
  257. var list=res.data.list
  258. var time=list.map(item => item.measurementTime).reverse()
  259. var week=list.map(item => '周'+weekMap[item.week]).reverse()
  260. var month=list.map(item => item.measurementDate).reverse()
  261. setTimeout(() => {
  262. //模拟服务器返回数据,如果数据格式和标准格式不同,需自行按下面的格式拼接
  263. let res = {
  264. categories:index==0?time:index==1?week:month,
  265. series: [{
  266. name: "测量值",
  267. data: list.map(item => item.value1)
  268. }
  269. ]
  270. };
  271. this.chartData = JSON.parse(JSON.stringify(res));
  272. }, 500);
  273. } else {
  274. uni.showToast({
  275. icon: 'none',
  276. title: res.msg,
  277. });
  278. }
  279. },
  280. rej => {}
  281. )
  282. },
  283. getServerData1() {
  284. //模拟从服务器获取数据时的延时
  285. setTimeout(() => {
  286. //模拟服务器返回数据,如果数据格式和标准格式不同,需自行按下面的格式拼接
  287. let res = {
  288. categories: ["00:00", "06:00", "12:00", "18:00", "23:59"],
  289. // series: [{
  290. // name: "尿酸",
  291. // data: [{
  292. // value: 23,
  293. // color: '#FDBD27',
  294. // }, {
  295. // value: 123,
  296. // color: '#FF5558',
  297. // },
  298. // {
  299. // value: 90,
  300. // color: '#52D087',
  301. // },
  302. // {
  303. // value: 23,
  304. // color: '#FDBD27',
  305. // },
  306. // {
  307. // value: 90,
  308. // color: '#52D087',
  309. // }
  310. // ]
  311. // }
  312. // ]
  313. };
  314. this.chartData = JSON.parse(JSON.stringify(res));
  315. }, 500);
  316. },
  317. goPage(index) {
  318. uni.navigateTo({
  319. url: '/pages_echarts/acidList?userId='+this.userId
  320. })
  321. },
  322. navgetTo(index) {
  323. uni.navigateTo({
  324. url: '/pages_echarts/acidDetail?type=add&userId='+this.userId
  325. })
  326. },
  327. goToUser() {
  328. uni.navigateTo({
  329. url: '/pages_health/addUser?type=edit&docId='
  330. })
  331. }
  332. }
  333. }
  334. </script>
  335. <style lang="scss" scoped>
  336. .container {
  337. position: relative;
  338. .bg {
  339. width: 100%;
  340. height: 380rpx;
  341. position: absolute;
  342. top: 0;
  343. left: 0;
  344. z-index: -1;
  345. }
  346. }
  347. .top-fixed {
  348. width: 100%;
  349. position: fixed;
  350. top: calc(var(--status-bar-height) + 140rpx);
  351. left: 0;
  352. z-index: 10;
  353. }
  354. .pub-tab-box {
  355. box-sizing: border-box;
  356. width: 400rpx;
  357. // padding: 0 60rpx;
  358. margin: 0 auto;
  359. // background-color: #FFFFFF;
  360. .tab-inner {
  361. height: 88upx;
  362. line-height: 88upx;
  363. display: flex;
  364. align-items: center;
  365. justify-content: space-between;
  366. overflow-x: auto;
  367. }
  368. .item {
  369. font-family: PingFang SC;
  370. font-weight: 400;
  371. font-size: 30rpx;
  372. color: #626468;
  373. line-height: 64rpx;
  374. text-align: center;
  375. &:last-child {
  376. margin-right: 0;
  377. }
  378. &.active {
  379. font-weight: 500;
  380. width: 124rpx;
  381. height: 64rpx;
  382. background: #4585F8;
  383. border-radius: 32rpx 32rpx 32rpx 32rpx;
  384. color: #fff;
  385. }
  386. .text {
  387. position: relative;
  388. z-index: 1;
  389. }
  390. .tab-bg {
  391. width: 72upx;
  392. height: 28upx;
  393. position: absolute;
  394. top: 17upx;
  395. left: 50%;
  396. transform: translateX(-36upx);
  397. z-index: -1;
  398. }
  399. }
  400. }
  401. .content {
  402. padding-top: calc(var(--status-bar-height) + 300rpx) !important;
  403. height: 100vh;
  404. box-sizing: border-box;
  405. width: 100%;
  406. padding: 20rpx;
  407. overflow: hidden;
  408. .btn-box {
  409. height: 120upx;
  410. padding: 0 30upx;
  411. display: flex;
  412. align-items: center;
  413. justify-content: center;
  414. .sub-btn {
  415. width: 388rpx;
  416. height: 72rpx;
  417. line-height: 72upx;
  418. text-align: center;
  419. font-size: 32upx;
  420. font-family: PingFang SC;
  421. font-weight: bold;
  422. color: #FFFFFF;
  423. background: #4585F8;
  424. border-radius: 44upx;
  425. margin-bottom: 40upx;
  426. }
  427. }
  428. .content-box {
  429. // width: 100%;
  430. background: #FFFFFF;
  431. border-radius: 16rpx 16rpx 16rpx 16rpx;
  432. padding: 24rpx;
  433. margin-bottom: 20rpx;
  434. .tltle {
  435. font-family: PingFang SC;
  436. font-weight: 500;
  437. font-size: 36rpx;
  438. color: #222426;
  439. text-align: left;
  440. margin-bottom: 16rpx;
  441. }
  442. .subtitle {
  443. font-weight: 400;
  444. font-size: 24rpx;
  445. color: #898E91;
  446. text-align: left;
  447. }
  448. /* 请根据实际需求修改父元素尺寸,组件自动识别宽高 */
  449. .charts-box {
  450. // width: 100%;
  451. height: 500rpx;
  452. margin-top: 30rpx;
  453. }
  454. .legend {
  455. // height: 34rpx;
  456. margin-top: 44rpx;
  457. // @include u-flex(row, center, space-between);
  458. display: flex;
  459. align-items: center;
  460. justify-content: space-between;
  461. font-family: PingFang SC, PingFang SC;
  462. font-weight: 400;
  463. font-size: 24rpx;
  464. color: #626468;
  465. &-item {
  466. flex: 1;
  467. text-align: center;
  468. display: flex;
  469. align-items: center;
  470. justify-content: center;
  471. // @include u-flex(row, center, center);
  472. }
  473. &-dot {
  474. width: 16rpx;
  475. height: 16rpx;
  476. border-radius: 50%;
  477. margin: 16rpx;
  478. }
  479. }
  480. .more {
  481. display: flex;
  482. align-items: center;
  483. font-family: PingFang SC;
  484. font-weight: 400;
  485. font-size: 24rpx;
  486. color: #898E91;
  487. }
  488. .type-box {
  489. display: flex;
  490. align-items: center;
  491. justify-content: space-between;
  492. margin-top: 20rpx;
  493. .box {
  494. padding: 24rpx;
  495. width: 158rpx;
  496. // height: 144rpx;
  497. border-radius: 16rpx 16rpx 16rpx 16rpx;
  498. &.bg1 {
  499. background: #FAFFFC;
  500. border: 2rpx solid #EBFFF3;
  501. }
  502. &.bg2 {
  503. background: #FEFAF8;
  504. border: 2rpx solid #FDF7F3;
  505. }
  506. &.bg3 {
  507. background: #FFFCFC;
  508. border: 2rpx solid #FCF4F4;
  509. }
  510. }
  511. }
  512. .content-bottom {
  513. padding: 24rpx;
  514. background: #F5F7FA;
  515. border-radius: 16rpx 16rpx 16rpx 16rpx;
  516. margin-top: 32rpx;
  517. .title {
  518. font-family: PingFang SC;
  519. font-weight: 500;
  520. font-size: 28rpx;
  521. color: #222426;
  522. text-align: left;
  523. margin-left: 14rpx;
  524. text {
  525. color: #FF5030;
  526. }
  527. }
  528. .bottom-box {
  529. postion: relative;
  530. font-weight: 400;
  531. font-size: 24rpx;
  532. color: #626468;
  533. text-align: left;
  534. line-height: 40rpx;
  535. padding-top: 24rpx;
  536. padding-left: 24rpx;
  537. view {
  538. position: relative;
  539. }
  540. view::before {
  541. content: "";
  542. width: 8rpx;
  543. height: 8rpx;
  544. background: rgba(255, 80, 48, 0.2);
  545. position: absolute;
  546. left: -22rpx;
  547. top: 20rpx;
  548. border-radius: 50%;
  549. }
  550. }
  551. }
  552. }
  553. }
  554. </style>