acid.vue 13 KB

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