123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195 |
- <template>
- <view class="meter-index">
- <view class="meter-box">
- <view class="title">{{title}}</view>
- <view class="sub-title">{{space}}</view>
- <view class="meter-box-content">
- <view class="meter-box-list">
- <view class="content-item">
- <view class="content-item-title">
- <view class="content-item-icon">
- <uni-icons type="icon-jinriyongdianliang" custom-prefix="iconfont" size="26"
- color="#577ff5">
- </uni-icons>
- </view>
- <view class="label">今日用电量</view>
- </view>
- <view class="content-item-article">
- <text class="number">6.86</text>
- <text class="unit">kwh</text>
- </view>
- </view>
- <view class="content-item">
- <view class="content-item-title">
- <view class="content-item-icon">
- <uni-icons type="icon-zongyongdianliang" custom-prefix="iconfont" size="26"
- color="#577ff5">
- </uni-icons>
- </view>
- <view class="label">当月用电量</view>
- </view>
- <view class="content-item-article">
- <text class="number">122.23</text>
- <text class="unit">kwh</text>
- </view>
- </view>
- <view class="content-item">
- <view class="content-item-title">
- <view class="content-item-icon">
- <uni-icons type="icon-dianchidianliang" custom-prefix="iconfont" size="18"
- color="#577ff5">
- </uni-icons>
- </view>
- <view class="label">电池电量</view>
- </view>
- <view class="content-item-article">
- <text class="number">98</text>
- <text class="unit">%</text>
- </view>
- </view>
- </view>
- <image class="meter-image"
- src="https://file-node.oss-cn-shanghai.aliyuncs.com/youji/9819ac743e2e44f58dbd58787bee2848">
- </image>
- </view>
- </view>
- <view class="common-charts">
- <view class="common-chart-title">历史用电量</view>
- <view class="common-chart-box">
- <u-echart ref="echart"></u-echart>
- </view>
- </view>
- </view>
- </template>
- <script>
- import uEchart from './uEchart.vue'
- export default {
- props: ['title', 'space'],
- data() {
- return {
- }
- },
- mounted() {
- setTimeout(() => {
- this.$refs.echart.initCharts({
- type: 'line',
- categories: ['1月', '2月', '3月', '4月', '5月', '6月', '7月', '8月', '9月', '10月'],
- series: [{
- name: '用电量',
- data: [86, 122, 93, 98, 91, 88, 95, 102, 110, 80]
- }],
- animation: true,
- background: "#FFFFFF",
- color: ["#1890FF"],
- padding: [10, 0, 0, 0],
- enableScroll: false,
- legend: {
- show: false
- },
- xAxis: {
- disableGrid: true
- },
- yAxis: {
- gridType: "dash",
- dashLength: 2
- },
- extra: {
- line: {
- type: "straight",
- width: 2,
- activeType: "hollow"
- }
- }
- })
- }, 500)
- },
- components: {
- uEchart
- },
- }
- </script>
- <style lang="scss">
- .meter-index {
- padding: 30rpx;
- .meter-box {
- background: #fff;
- padding: 30rpx;
- border-radius: 16rpx;
- box-shadow: 0px 1px 12px rgba(3, 3, 3, 0.08);
- .title {
- font-size: 40rpx;
- font-weight: 500;
- }
- .sub-title {
- font-size: 24rpx;
- color: $uni-secondary-color;
- font-weight: 200;
- }
- .meter-box-content {
- display: flex;
- align-items: center;
- padding: 80rpx 0 40rpx 0;
- }
- .meter-box-list {
- flex: 1;
- width: 0;
- overflow: hidden;
- }
- .content-item {
- margin-bottom: 20rpx;
- }
- .content-item-title {
- display: flex;
- align-items: center;
- .content-item-icon {
- width: 60rpx;
- height: 60rpx;
- text-align: center;
- line-height: 60rpx;
- }
- .label {
- font-size: 24rpx;
- font-weight: 300;
- margin-left: 10rpx;
- }
- }
- .content-item-article {
- display: flex;
- align-items: flex-end;
- padding-left: 70rpx;
- padding-top: 10rpx;
- .number {
- font-size: 40rpx;
- line-height: 40rpx;
- }
- .unit {
- color: $uni-secondary-color;
- margin-left: 8rpx;
- font-size: 24rpx;
- }
- }
- .meter-image {
- width: 200rpx;
- height: 200rpx;
- margin-right: 40rpx;
- }
- }
- }
- </style>
|