From 2d59d0eb8ce688e49647c2696896cb08158eb745 Mon Sep 17 00:00:00 2001 From: qiaomu <3520484422@qq.com> Date: Wed, 8 May 2024 15:32:50 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=BC=B4=E8=B4=B9=E8=AE=B0?= =?UTF-8?q?=E5=BD=95=E6=8C=89=E5=B9=B4=E6=9F=A5=E8=AF=A2=E9=94=99=E8=AF=AF?= =?UTF-8?q?=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/echarts/ec-canvas.wxss | 3 +- pages/billDetail/index.js | 65 +++++++++++++++++++++++-------- pages/billDetail/index.wxml | 6 +-- pages/billDetail/index.wxss | 3 +- pages/rechargeRecord/index.js | 7 ++-- 5 files changed, 59 insertions(+), 25 deletions(-) diff --git a/components/echarts/ec-canvas.wxss b/components/echarts/ec-canvas.wxss index 3bc5a6e..1a1cdd3 100644 --- a/components/echarts/ec-canvas.wxss +++ b/components/echarts/ec-canvas.wxss @@ -1,6 +1,7 @@ .ec-canvas { - position: static !important; + position: relative !important; float: none; width: 700rpx; height: 700rpx; + z-index: 0 !important; } diff --git a/pages/billDetail/index.js b/pages/billDetail/index.js index 9adfedf..d84e43f 100644 --- a/pages/billDetail/index.js +++ b/pages/billDetail/index.js @@ -3,7 +3,18 @@ import { alertInfo } from "../../utils/index"; import request from '../../utils/request' import * as echarts from '../../components/echarts/echarts'; const { OK } = request - +const getPixelRatio = () => { + let pixelRatio = 0 + wx.getSystemInfo({ + success: function (res) { + pixelRatio = res.pixelRatio + }, + fail: function () { + pixelRatio = 0 + } + }) + return pixelRatio +} // pages/billDetail/index.js Page({ @@ -81,24 +92,29 @@ Page({ { value: 187.56, name: '本期用电量', itemStyle: { color: 'rgb(80,135,236)' } }, ], - emphasis: { - itemStyle: { - shadowBlur: 10, - shadowOffsetX: 0, - shadowColor: 'rgba(0, 0, 0, 0.5)' - } - } } ] }; this.init_pieCharts(option); + const that = this; + wx.getSystemInfo({ + success: function (res) { + that.setData({ + statusBarHeight : res.statusBarHeight, + navBarHeight : res.statusBarHeight , // 顶部导航栏高度为 44px + jiaonangheight: wx.getMenuButtonBoundingClientRect().height, // 胶囊高度 + jiaonangwidth:wx.getMenuButtonBoundingClientRect().width, + }) + }, + }) }, init_pieCharts: function(options) { this.selectComponent('#echarts').init((canvas, width, height) => { // 初始化图表 const pieChart = echarts.init(canvas, null, { width: width, - height: height + height: height, + devicePixelRatio: getPixelRatio(), }); pieChart.setOption(options); @@ -117,14 +133,31 @@ Page({ confirmText: '复制链接', complete: (res) => { - if (res.cancel) { - - } - if (res.confirm) { - wx.setClipboardData({ - data: `https://zgd.hbhcbn.com/h5/?report=${id}&tenement=${tenement}`, - }) + const result = wx.getAccountInfoSync(); + const { envVersion } = result.miniProgram; + let api = "" + switch (envVersion) { + // 开发版 + case 'develop': + wx.setClipboardData({ + data: `https://zgd.hbhcbn.com/h5/?report=${id}&tenement=${tenement}`, + }) + break; + // 体验版 + case 'trial': + wx.setClipboardData({ + data: `https://zgd.hbhcbn.com/h5/?report=${id}&tenement=${tenement}`, + }) + break; + // 正式版 + case 'release': + wx.setClipboardData({ + data: `https://zgd.hbhcbn.com/reporth5/?report=${id}&tenement=${tenement}`, + }) + break; + } + } } }) diff --git a/pages/billDetail/index.wxml b/pages/billDetail/index.wxml index ea0d1c1..d1057e1 100644 --- a/pages/billDetail/index.wxml +++ b/pages/billDetail/index.wxml @@ -1,6 +1,6 @@ - + @@ -51,12 +51,12 @@ 电费构成 diff --git a/pages/billDetail/index.wxss b/pages/billDetail/index.wxss index a988dbc..a36155e 100644 --- a/pages/billDetail/index.wxss +++ b/pages/billDetail/index.wxss @@ -6,8 +6,7 @@ display: flex; align-items: center; position: sticky; - top: 66px; - z-index: 99; + z-index: 99 !important; } .titleContent { diff --git a/pages/rechargeRecord/index.js b/pages/rechargeRecord/index.js index 6728601..e59ea1d 100644 --- a/pages/rechargeRecord/index.js +++ b/pages/rechargeRecord/index.js @@ -65,15 +65,16 @@ Page({ }, onChangeYear(e) { - const { years, tenement } = this.data; - const currentYear = years[Number(e)] + const { years, codeId } = this.data; + const currentYear = e + console.log('e', e, 'currentYear', currentYear, 'years', years) this.setData({ year: currentYear, type: "", show: false, title: "" }) - this.init(currentYear, tenement) + this.init(currentYear, codeId) }, onChangeMeter(e) { const { id, code } = e;