waistLine.vue 7.9 KB

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