| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164 |
- // pages/statistics/index.js
-
- const api = require('../../api/index.js');
-
- Page({
-
- /**
- * 页面的初始数据
- */
- data: {
- // 状态栏高度
- statusBarHeight: wx.getStorageSync('statusBarHeight'),
- // 导航栏高度
- navBarHeight: wx.getStorageSync('navBarHeight'),
- // 导航栏和状态栏高度
- navStatusBarHeight: wx.getStorageSync('navStatusBarHeight'),
- // 胶囊
- menu:wx.getStorageSync('menu'),
- sunec: {
- lazyLoad: true
- }
- },
-
- /**
- * 生命周期函数--监听页面加载
- */
- onLoad(options) {
- this.sunline = this.selectComponent('#sunlinechart')
- this.onworkorder()
- // this.getsunlinechart()
- },
- onlevel(){
- console.log(1111111);
- wx.navigateBack({
- data:1
- })
- },
- onworkorder(){
- let data = {
- workorderType:''
- }
- api.request(`/workoder/statistics`, 'POST',data)
- .then((res) => {
- console.log(res);
- this.setData({
- workorder:res.data
- })
- })
- .catch((err) => {
- console.error('请求失败:', err);
- // 在这里处理请求失败的情况
- });
- },
- // 日用电价走势
- getsunlinechart() {
- this.sunline.init((canvas, width, height, dpr) => {
- const chart = echarts.init(canvas, null, {
- width: width,
- height: height,
- devicePixelRatio: dpr
- });
- canvas.setChart(chart);
- var option = {
- xAxis: {
- type: 'category',
- data: [1,2,3,4,5,6,7,8,9,10]
- },
- yAxis: {
- type: 'value',
- axisLine: {
- show: true,
- lineStyle: {
- color: '#999',
- width: 1
- }
- },
- axisTick: {
- show: false
- },
- splitLine: {
- show: true,
- lineStyle: {
- type: 'dotted',
- color: '#ccc',
- width: 1,
- opacity: 0.6
- }
- }
- },
- grid: {
- top: '10%',
- left: '0%',
- right: '4%',
- bottom: '3%',
- containLabel: true
- },
- series: [
- {
- data: [10,20,30,40,50,60,70,70,70,70,70],
- showSymbol: false,
- type: 'line',
- step: 'start',
- color: '#B2D5CB',
- }
- ]
- };
-
- chart.setOption(option);
- return chart;
- });
- },
- /**
- * 生命周期函数--监听页面初次渲染完成
- */
- onReady() {
-
- },
- onstatistics(){
- wx.switchTab({
- url: '/pages/tool/index',
- })
- },
- /**
- * 生命周期函数--监听页面显示
- */
- onShow() {
-
- },
-
- /**
- * 生命周期函数--监听页面隐藏
- */
- onHide() {
-
- },
-
- /**
- * 生命周期函数--监听页面卸载
- */
- onUnload() {
-
- },
-
- /**
- * 页面相关事件处理函数--监听用户下拉动作
- */
- onPullDownRefresh() {
-
- },
-
- /**
- * 页面上拉触底事件的处理函数
- */
- onReachBottom() {
-
- },
-
- /**
- * 用户点击右上角分享
- */
- onShareAppMessage() {
-
- }
- })
|