waistLine.vue 8.8 KB

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