Selaa lähdekoodia

云链智安

master
dong 1 vuosi sitten
vanhempi
commit
9b32ee6c42

+ 52
- 66
api/index.js Näytä tiedosto

1
 // api.jshttp://zlink.bjdexn.cn
1
 // api.jshttp://zlink.bjdexn.cn
2
 // const baseUrl = 'http://192.168.8.198:8888';  // 替换为您的接口基础 URL
2
 // const baseUrl = 'http://192.168.8.198:8888';  // 替换为您的接口基础 URL
3
-// const baseUrl = 'https://zlink.bjdexn.cn';  // 替换为您的接口基础 URL
4
-const baseUrl = 'https://esos-iot.bjdexn.cn';  // 替换为您的接口基础 URL
3
+const baseUrl = 'https://www.bjdexn.cn:8443';  // 替换为您的接口基础 URL
4
+// const baseUrl = 'https://esos-iot.bjdexn.cn';  // 替换为您的接口基础 URL
5
 
5
 
6
 // 封装网络请求方法
6
 // 封装网络请求方法
7
 function request(url, method, data) {
7
 function request(url, method, data) {
8
   return new Promise((resolve, reject) => {
8
   return new Promise((resolve, reject) => {
9
-    if (url!='/platform/login') {
10
-      wx.getStorage({
11
-        key: 'cookies',
12
-        success: function(res) {
13
-          wx.request({
14
-            url: baseUrl + url,
15
-            header: {
16
-              'Content-Type': 'application/x-www-form-urlencoded',
17
-              Cookie:res.data},
18
-            method: method,
19
-            data:data,
20
-            success:function(res) {
21
-              // console.log(res);
22
-              // 请求成功处理
23
-              if (res.data.code === 0) {
24
-                resolve(res.data);
25
-              } else {
26
-                reject(res.data.msg);
27
-                if (res.data.status === 400) {
28
-                  wx.navigateTo({
29
-                    url: '/pages/login/index', // 登录页面的路径,注意路径前面加上 '/' 表示从根目录开始
30
-                  });
31
-                }else{
32
-                  wx.navigateTo({
33
-                    url: '/pages/login/index', // 登录页面的路径,注意路径前面加上 '/' 表示从根目录开始
34
-                  });  
35
-                }
36
-              }
37
-            },
38
-            fail:function(err) {
39
-              console.log(err);
40
-              wx.navigateTo({
41
-                url: '/pages/login/index', // 登录页面的路径,注意路径前面加上 '/' 表示从根目录开始
42
-              });
43
-            }
44
-          });
45
-        },
46
-        fail: function(err) {
47
-          console.log(err);
48
-          wx.navigateTo({
49
-            url: '/pages/login/index', // 登录页面的路径,注意路径前面加上 '/' 表示从根目录开始
50
-          });
9
+   if (url!='/auth/login') {
10
+    wx.request({
11
+      url: baseUrl + url,
12
+      header: {
13
+        "Authorization":`Bearer ${wx.getStorageSync('cookies')}`,
14
+        'Content-Type': 'json'},
15
+      method: method,
16
+      data:data,
17
+      success:function(res) {
18
+        // 请求成功处理
19
+        if (res.statusCode === 200 && res.data.status=='ok') {
20
+          resolve(res.data);
21
+        } else if(res.statusCode === 403||res.statusCode === 401) {
22
+           wx.navigateTo({
23
+          url: '/pages/login/index', // 登录页面的路径,注意路径前面加上 '/' 表示从根目录开始
24
+        });
25
+        }else{
26
+          reject(res.data);
27
+          // wx.navigateTo({
28
+          //   url: '/pages/login/index', // 登录页面的路径,注意路径前面加上 '/' 表示从根目录开始
29
+          // });
51
         }
30
         }
52
-      }) 
53
-    }else{
54
-          wx.request({
55
-            url: baseUrl + url,
56
-            header: {
57
-              'Content-Type': 'application/x-www-form-urlencoded'},
58
-            method: method,
59
-            data:data,
60
-            success:function(res) {
61
-              // 请求成功处理
62
-              if (res.statusCode === 200) {
63
-                resolve(res.data);
64
-              } else {
65
-                reject(res.statusCode);
66
-              }
67
-            },
68
-            fail:function(err) {
69
-              wx.navigateTo({
70
-                url: '/pages/login/index', // 登录页面的路径,注意路径前面加上 '/' 表示从根目录开始
71
-              });
72
-            }
73
-          });
31
+      },
32
+      fail:function(err) {
33
+        wx.navigateTo({
34
+          url: '/pages/login/index', // 登录页面的路径,注意路径前面加上 '/' 表示从根目录开始
35
+        });
36
+      }
37
+    });
38
+   }else{
39
+    wx.request({
40
+      url: baseUrl + url,
41
+      header: {
42
+        'Content-Type': 'json'},
43
+      method: method,
44
+      data:data,
45
+      success:function(res) {
46
+        // 请求成功处理
47
+        if (res.statusCode === 200&&res.data.status=='ok') {
48
+          resolve(res.data);
49
+        } else {
50
+          reject(res.data);
74
         }
51
         }
52
+      },
53
+      fail:function(err) {
54
+        // wx.navigateTo({
55
+        //   url: '/pages/login/index', // 登录页面的路径,注意路径前面加上 '/' 表示从根目录开始
56
+        // });
57
+      }
58
+    });
59
+   }
60
+       
75
       });
61
       });
76
   }
62
   }
77
 // 导出封装的请求方法
63
 // 导出封装的请求方法

+ 133
- 90
pages/details/index.js Näytä tiedosto

56
 echartstype:'bar',
56
 echartstype:'bar',
57
 unm:0,
57
 unm:0,
58
 current:0,
58
 current:0,
59
-rangetype:''
59
+rangetype:'',
60
+uuid:'',
61
+chargeTotaldatas:[],
62
+ymdlistdatas:[]
60
   },
63
   },
61
   /**
64
   /**
62
    * 生命周期函数--监听页面加载
65
    * 生命周期函数--监听页面加载
63
    */
66
    */
64
   onLoad(options) {
67
   onLoad(options) {
65
- 
68
+  console.log(options);
69
+   this.setData({
70
+    uuid:options.uuid
71
+   })
66
     // let base64imgages =util.Background_base64('https://esos-iot.bjdexn.cn/wx_images/bj.png')
72
     // let base64imgages =util.Background_base64('https://esos-iot.bjdexn.cn/wx_images/bj.png')
67
     this.setData({
73
     this.setData({
68
      img_path:'https://esos-iot.bjdexn.cn/wx_images/bj.png',
74
      img_path:'https://esos-iot.bjdexn.cn/wx_images/bj.png',
70
    valueitem:`${util.getdataTime('当日')} - ${util.getdataTime('当日')}`,
76
    valueitem:`${util.getdataTime('当日')} - ${util.getdataTime('当日')}`,
71
 
77
 
72
     })
78
     })
73
-    this.ecComponent = this.selectComponent('#mychart_line1');
79
+    // this.ecComponent = this.selectComponent('#mychart_line1');
74
     this.ecline = this.selectComponent('#mychart_line2');
80
     this.ecline = this.selectComponent('#mychart_line2');
75
     this.getlineMonth()
81
     this.getlineMonth()
76
   },
82
   },
90
     console.log(this.data.tapindex);
96
     console.log(this.data.tapindex);
91
 
97
 
92
     if (this.data.tapindex==0) {
98
     if (this.data.tapindex==0) {
93
-      this.ecComponent = this.selectComponent('#mychart_line1');
99
+      // this.ecComponent = this.selectComponent('#mychart_line1');
94
       this.ecline = this.selectComponent('#mychart_line2');
100
       this.ecline = this.selectComponent('#mychart_line2');
95
       this.setData({
101
       this.setData({
96
         labelindex:1,
102
         labelindex:1,
107
         echartstype:'line'
113
         echartstype:'line'
108
       })
114
       })
109
       this.Powertrend();
115
       this.Powertrend();
110
-    }else if(this.data.tapindex==2){
111
-      this.ecline = this.selectComponent('#mychart_line2');
112
-      this.setData({
113
-        labelindex:1,
114
-        value:[new Date(util.getdataTime('当日')).getTime(),new Date(util.getdataTime('当日')).getTime()],
115
-                valueitem:`${util.getdataTime('当日')} - ${util.getdataTime('当日')}`,
116
-        echartstype:'bar'
117
-      })
118
-      this.electrictime()
119
-    }
116
+    } 
120
 
117
 
121
   },
118
   },
122
   onlabel(e){
119
   onlabel(e){
138
         value:[new Date(util.getdataTime(31)).getTime(),new Date(util.getdataTime('当日')).getTime()],
135
         value:[new Date(util.getdataTime(31)).getTime(),new Date(util.getdataTime('当日')).getTime()],
139
         valueitem:`${util.getdataTime(31)} - ${util.getdataTime('当日')}`,
136
         valueitem:`${util.getdataTime(31)} - ${util.getdataTime('当日')}`,
140
       })
137
       })
141
-     }else{
142
-    
143
-      this.setData({
144
-        echartstype:'line',
145
-        value:[new Date(util.getdataTime(365)).getTime(),new Date(util.getdataTime('当日')).getTime()],
146
-        valueitem:`${util.getdataTime(365)} - ${util.getdataTime('当日')}`,
147
-
148
-      })
149
-     }
138
+     } 
150
     this.getlineMonth();
139
     this.getlineMonth();
151
     }else if(this.data.tapindex==1){
140
     }else if(this.data.tapindex==1){
152
       this.ecline = this.selectComponent('#mychart_line2');
141
       this.ecline = this.selectComponent('#mychart_line2');
162
           value:[new Date(util.getdataTime('当日')).getTime(),new Date(util.getdataTime('当日')).getTime()],
151
           value:[new Date(util.getdataTime('当日')).getTime(),new Date(util.getdataTime('当日')).getTime()],
163
         valueitem:`${util.getdataTime('当日')} - ${util.getdataTime('当日')}`,
152
         valueitem:`${util.getdataTime('当日')} - ${util.getdataTime('当日')}`,
164
         })
153
         })
165
-       }else if(this.data.labelindex==2){
166
-       
167
-        this.setData({
168
-          echartstype:'line',
169
-          value:[new Date(util.getdataTime(31)).getTime(),new Date(util.getdataTime('当日')).getTime()],
170
-        valueitem:`${util.getdataTime(31)} - ${util.getdataTime('当日')}`,
171
-        })
172
-       }else{
154
+       } else{
173
      
155
      
174
         this.setData({
156
         this.setData({
175
           echartstype:'line',
157
           echartstype:'line',
276
     // 电量
258
     // 电量
277
   getlineMonth(){
259
   getlineMonth(){
278
     let data={
260
     let data={
279
-      startDate:moment(this.data.value[0]).format('YYYY-MM-DD'),
280
-      endDate:moment(this.data.value[1]).format('YYYY-MM-DD')
261
+      page:1,
262
+      rows:10000,
263
+      starttime:moment(this.data.value[0]).format('YYYY-MM-DD')+' 00:00:00',
264
+      stoptime:moment(this.data.value[1]).format('YYYY-MM-DD')+' 00:00:00',
265
+      // starttime:'2024-07-29 00:00:00',
266
+      // stoptime:'2024-07-30 00:00:00',
267
+      filter:'5c465aaa-b65e-463f-a9ae-a338a630a4c1_delta,469dc1cc-e5ad-492f-a350-f7bc473d55ee_delta',
268
+      uuid:this.data.uuid
269
+    }
270
+    let daymonth = ''
271
+    if (this.data.labelindex==1) {
272
+      daymonth = 'day'
273
+    }else if(this.data.labelindex==2){
274
+      daymonth = 'month'
275
+
276
+    }else if(this.data.labelindex==3){
277
+      daymonth = 'year'
278
+
281
     }
279
     }
282
-    api.request(`/stats/singleStation/${wx.getStorageSync('station').id}/betweenhe`, 'POST',data )
280
+    api.request(`/api/v1/hisdata/hour/datas`, 'get',data )
283
     .then((res) => {
281
     .then((res) => {
284
-     
285
-        let { list } = res.data;
286
-        let chargeTotal = list.map(item => item.chargeTotal);
287
-        let dischargeTotal = list.map(item => item.dischargeTotal);
288
-        let ymdlist = list.map(item => item.ymd.slice(5, 11));
282
+        let list = res.data.list;
283
+        let chargeTotal = list.map(item => item["5c465aaa-b65e-463f-a9ae-a338a630a4c1_delta"]);
284
+        let dischargeTotal = list.map(item => item["469dc1cc-e5ad-492f-a350-f7bc473d55ee_delta"]);
285
+        let ymdlist = list.map(item => item.recordtime.slice(5, 11));
289
         this.setData({
286
         this.setData({
290
-          Electricitylevel: res.data,
287
+          // Electricitylevel: res.data,
291
           chargeTotal: chargeTotal,
288
           chargeTotal: chargeTotal,
292
           dischargeTotal: dischargeTotal,
289
           dischargeTotal: dischargeTotal,
293
           ymdlist: ymdlist,
290
           ymdlist: ymdlist,
294
         });
291
         });
295
-      this.initChartright()
292
+      // this.initChartright()
296
       this.initChart_right()
293
       this.initChart_right()
297
     })
294
     })
298
     .catch((err) => {
295
     .catch((err) => {
300
       // 在这里处理请求失败的情况
297
       // 在这里处理请求失败的情况
301
     });
298
     });
302
   },
299
   },
300
+  // 收益
303
   Powertrend(){
301
   Powertrend(){
304
-  // 充放电功率
305
- api.request(`/station/${wx.getStorageSync('station').id}/system/power/trend`, 'POST',{data:this.data.valueitem} )
306
- .then((res) => {
307
-   let list = res.data;
308
-   console.log(list);
309
-  let chargeTotal = list.gridPower.map(item => item.totalActivePower);
310
-  let dischargeTotal = list.storedPower.map(item => item.totalActivePower);
311
-  let ymdlist = list.gridPower.map(item => item.ts.slice(12, 16));
312
-  this.setData({
313
-    Electricitylevel: res.data,
314
-    chargeTotal: chargeTotal,
315
-    dischargeTotal: dischargeTotal,
316
-    ymdlist: ymdlist,
317
-  });
318
- 
319
-  this.initChart_right()
320
- })
321
- .catch((err) => {
322
-   console.error('请求失败:', err);
323
-   // 在这里处理请求失败的情况
324
- 
325
-   
326
- });
327
-  },
328
-  // 充放电时间
329
-  electrictime(){
330
     let data={
302
     let data={
331
-      startDate:moment(this.data.value[0]).format('YYYY-MM-DD'),
332
-      endDate:moment(this.data.value[1]).format('YYYY-MM-DD')
303
+      page:1,
304
+      rows:10000,
305
+      starttime:moment(this.data.value[0]).format('YYYY-MM-DD') + "00:00:00",
306
+      stoptime:moment(this.data.value[1]).format('YYYY-MM-DD') + "00:00:00",
307
+      //  starttime:'2024-07-29 00:00:00',
308
+      // stoptime:'2024-07-30 00:00:00',
309
+      filter:'a0acf8cf-7d12-49af-97d9-1a2e630c4bfe_delta',
310
+      uuid:this.data.uuid
333
     }
311
     }
334
-    
335
-  // 充放电时间
336
- api.request(`/stats/singleStation/${wx.getStorageSync('station').id}/between/time`, 'POST',data )
312
+   
313
+ api.request(`/api/v1/hisdata/hour/datas`, 'get',data)
337
  .then((res) => {
314
  .then((res) => {
338
-   let { list } = res.data;
315
+   let list = res.data.list;
339
    console.log(list);
316
    console.log(list);
340
-  let chargeTotal = list.map(item => item.chargetime);
341
-  let dischargeTotal = list.map(item => item.dischargetime);
342
-  let ymdlist = list.map(item => item.ym.slice(5, 11));
317
+  let chargeTotal = list.map(item => item["a0acf8cf-7d12-49af-97d9-1a2e630c4bfe_delta"]);
318
+  // let dischargeTotal = list.storedPower.map(item => item.totalActivePower);
319
+  let ymdlist = list.map(item => item.recordtime.slice(12, 16));
343
   this.setData({
320
   this.setData({
344
-    Electricitylevel: res.data,
345
-    chargeTotal: chargeTotal,
346
-    dischargeTotal: dischargeTotal,
347
-    ymdlist: ymdlist,
321
+    // Electricitylevel: res.data,
322
+    chargeTotaldatas: chargeTotal,
323
+    // dischargeTotal: dischargeTotal,
324
+    ymdlistdatas: ymdlist,
348
   });
325
   });
349
-  this.initChart_right()
326
+ 
327
+  this.initChart_rightshoyi()
350
  })
328
  })
351
  .catch((err) => {
329
  .catch((err) => {
352
    console.error('请求失败:', err);
330
    console.error('请求失败:', err);
355
    
333
    
356
  });
334
  });
357
   },
335
   },
336
+  
358
   onTabsChange(event) {
337
   onTabsChange(event) {
359
     this.setData({
338
     this.setData({
360
       tapindex:event.detail.value
339
       tapindex:event.detail.value
489
     return chart;
468
     return chart;
490
   })},
469
   })},
491
   initChart_right: function () {
470
   initChart_right: function () {
492
-    var unitName = 'kWh'; 
471
+    var unitName = ''; 
493
     var viewname = ['充电量','放电量']; 
472
     var viewname = ['充电量','放电量']; 
494
     if (this.data.tapindex==0) {
473
     if (this.data.tapindex==0) {
495
       unitName = 'kWh';
474
       unitName = 'kWh';
496
       viewname = ['充电量','放电量'];
475
       viewname = ['充电量','放电量'];
497
     }else if(this.data.tapindex==1){
476
     }else if(this.data.tapindex==1){
498
       unitName = 'kW';
477
       unitName = 'kW';
499
-      viewname = ['峰值充电功率','峰值放电功率'];
500
-
501
-    }else if(this.data.tapindex==2){
502
-      unitName = 'h';
503
-      viewname = ['充电时长','放电时长'];
478
+      viewname = ['收益'];
504
 
479
 
505
-    }
480
+    } 
506
     let _this = this
481
     let _this = this
507
     this.ecline.init((canvas, width, height, dpr)=> {
482
     this.ecline.init((canvas, width, height, dpr)=> {
508
       const chart = echarts.init(canvas, null, {
483
       const chart = echarts.init(canvas, null, {
514
     var option = {
489
     var option = {
515
       legend: { bottom: '0%'},
490
       legend: { bottom: '0%'},
516
       grid: {
491
       grid: {
517
-        left:'1%',
492
+        left:'3%',
518
         top:'20%',
493
         top:'20%',
519
         right:'1%',
494
         right:'1%',
520
         bottom:'20%',
495
         bottom:'20%',
535
         barWidth: 10 // 设置柱状图的宽度
510
         barWidth: 10 // 设置柱状图的宽度
536
       },
511
       },
537
       yAxis: {
512
       yAxis: {
538
-        name:'单位:'+unitName,                   
513
+        name:unitName,                   
539
         x: 'center',                  
514
         x: 'center',                  
540
         type: 'value',
515
         type: 'value',
541
         axisTick: {
516
         axisTick: {
579
   
554
   
580
     chart.setOption(option);
555
     chart.setOption(option);
581
     return chart;
556
     return chart;
557
+  })},
558
+  initChart_rightshoyi: function () {
559
+    var unitName = '元'; 
560
+    var viewname = ['收益']; 
561
+    
562
+    let _this = this
563
+    this.ecline.init((canvas, width, height, dpr)=> {
564
+      const chart = echarts.init(canvas, null, {
565
+        width: width,
566
+        height: height,
567
+        devicePixelRatio: dpr // new
568
+      });
569
+    canvas.setChart(chart);
570
+    var option = {
571
+      legend: { bottom: '0%'},
572
+      grid: {
573
+        left:'2%',
574
+        top:'20%',
575
+        right:'1%',
576
+        bottom:'20%',
577
+        containLabel: true
578
+      },
579
+      tooltip: {
580
+        show: true,
581
+        trigger: 'axis'
582
+      },
583
+      xAxis: {
584
+        type: 'category',
585
+        data:_this.data.ymdlistdatas,
586
+        // show: false,
587
+        axisTick: {
588
+          show: false // 这里设置x轴的刻度线不显示
589
+      },
590
+      
591
+        barWidth: 10 // 设置柱状图的宽度
592
+      },
593
+      yAxis: {
594
+        name:unitName,                   
595
+        x: 'center',                  
596
+        type: 'value',
597
+        axisTick: {
598
+          show: false // 这里设置x轴的刻度线不显示
599
+      },
600
+       
601
+        splitLine: {
602
+          show: false // 这里设置x轴的刻度线不显示
603
+        },
604
+      
605
+        // show: false
606
+      },
607
+      series: [{
608
+        name: viewname[0],
609
+        type: _this.data.echartstype,
610
+        barMaxWidth: 20,// 设置柱状图的宽度
611
+        smooth: true,
612
+        showSymbol: false, 
613
+        data:_this.data.chargeTotaldatas,
614
+        itemStyle: {
615
+          color: 'rgba(60, 158, 250, 0.5)' // 设置数据点颜色为蓝色(使用十六进制表示法)
616
+      },
617
+        areaStyle: {
618
+          color: 'rgba(60, 158, 250, 0.3)'   // 设置区域填充颜色
619
+      }
620
+      } ]
621
+    };
622
+  
623
+    chart.setOption(option);
624
+    return chart;
582
   })}
625
   })}
583
 })
626
 })

+ 7
- 62
pages/details/index.wxml Näytä tiedosto

16
 <view style="{{'height: ' + navStatusBarHeight +'px'}}"></view>
16
 <view style="{{'height: ' + navStatusBarHeight +'px'}}"></view>
17
   <t-tabs value="{{tapindex}}" split="{{fasle}}" bind:change="onTabsChange" t-class="custom-tabs">
17
   <t-tabs value="{{tapindex}}" split="{{fasle}}" bind:change="onTabsChange" t-class="custom-tabs">
18
   <t-tab-panel label="电量" value="0" />
18
   <t-tab-panel label="电量" value="0" />
19
-  <t-tab-panel label="充放电功率" value="1" />
20
-  <t-tab-panel label="充放电时间" value="2" />
19
+  <t-tab-panel label="收益" value="1" />
21
 </t-tabs>
20
 </t-tabs>
22
 <swiper class="swiper" current="{{tapindex}}" bindchange="ontop">
21
 <swiper class="swiper" current="{{tapindex}}" bindchange="ontop">
23
     <swiper-item>
22
     <swiper-item>
26
 
25
 
27
 <view class="proportion_c" style="width:{{(Electricitylevel.total.sumchargeTotal / (Electricitylevel.total.sumchargeTotal+Electricitylevel.total.sumdischargeTotal)) * 100+'%'}}"></view>
26
 <view class="proportion_c" style="width:{{(Electricitylevel.total.sumchargeTotal / (Electricitylevel.total.sumchargeTotal+Electricitylevel.total.sumdischargeTotal)) * 100+'%'}}"></view>
28
 </view>
27
 </view>
29
-<view class="cumulative">
28
+<!-- <view class="cumulative">
30
  <view class="cumulative_1">
29
  <view class="cumulative_1">
31
  <view class="cumulative_2"></view>
30
  <view class="cumulative_2"></view>
32
  <view class="cumulative_3">
31
  <view class="cumulative_3">
41
  <view>{{ Electricitylevel.total.sumdischargeTotal }} kwh</view>
40
  <view>{{ Electricitylevel.total.sumdischargeTotal }} kwh</view>
42
  </view>
41
  </view>
43
  </view>
42
  </view>
44
-</view>
43
+</view> -->
45
 <view class="datelabel" bind:tap="onlabel">
44
 <view class="datelabel" bind:tap="onlabel">
46
 <view class="datelabel_1" data-index="1" style="{{labelindex==1?'border:2rpx solid #007544;color:#007544':'border:2rpx solid #fff;color:#222'}}">日</view>
45
 <view class="datelabel_1" data-index="1" style="{{labelindex==1?'border:2rpx solid #007544;color:#007544':'border:2rpx solid #fff;color:#222'}}">日</view>
47
 <view class="datelabel_2" data-index="2" style="{{labelindex==2?'border:2rpx solid #007544;color:#007544':'border:2rpx solid #fff;color:#222'}}">月</view>
46
 <view class="datelabel_2" data-index="2" style="{{labelindex==2?'border:2rpx solid #007544;color:#007544':'border:2rpx solid #fff;color:#222'}}">月</view>
56
 <!-- <t-calendar visible="{{visible}}" value="{{value}}" minDate="{{minDate}}" maxDate="{{maxDate}}" format="{{format}}" bind:confirm="handleConfirm" type="range" /> -->
55
 <!-- <t-calendar visible="{{visible}}" value="{{value}}" minDate="{{minDate}}" maxDate="{{maxDate}}" format="{{format}}" bind:confirm="handleConfirm" type="range" /> -->
57
 </view>
56
 </view>
58
 <!-- <t-cell arrow title="区间选择日历" /> -->
57
 <!-- <t-cell arrow title="区间选择日历" /> -->
59
-<view class="canvasbox" hidden="{{visible}}">
58
+<!-- <view class="canvasbox" hidden="{{visible}}">
60
 <ec-canvas id="mychart_line1" canvas-id="mychart_line1" ec="{{ ec }}"></ec-canvas>
59
 <ec-canvas id="mychart_line1" canvas-id="mychart_line1" ec="{{ ec }}"></ec-canvas>
61
-</view>
60
+</view> -->
62
 <view class="canvasbox1" hidden="{{visible}}">
61
 <view class="canvasbox1" hidden="{{visible}}">
63
 <ec-canvas id="mychart_line2" canvas-id="mychart_line2" ec="{{ ech }}"></ec-canvas>
62
 <ec-canvas id="mychart_line2" canvas-id="mychart_line2" ec="{{ ech }}"></ec-canvas>
64
 </view>
63
 </view>
71
  <view class="proportion_">
70
  <view class="proportion_">
72
  <view class="proportion_c" style=" width: 40%;"></view>
71
  <view class="proportion_c" style=" width: 40%;"></view>
73
  </view>
72
  </view>
74
- <view class="cumulative">
75
-  <view class="cumulative_1">
76
-  <view class="cumulative_2"></view>
77
-  <view class="cumulative_3">
78
-  <view>峰值充电功率</view>
79
-  <view>{{Electricitylevel.maxChargeActivePower}}kW</view>
80
-  </view>
81
-  </view>
82
-  <view class="cumulative_1">
83
-  <view class="cumulative_22"></view>
84
-  <view class="cumulative_3">
85
-  <view>峰值放电功率</view>
86
-  <view>{{Electricitylevel.maxDischargeActivePower}}kW</view>
87
-  </view>
88
-  </view>
89
- </view>
73
+ 
90
  <view class="proportion_2"></view>
74
  <view class="proportion_2"></view>
91
  <view class="switch">
75
  <view class="switch">
92
  <view class="switch_11" bind:tap="Lastday"><t-icon name="chevron-left" size="18" color="#222" data-name="chevron-left"/><view class="switch_22">上一天</view>  </view>
76
  <view class="switch_11" bind:tap="Lastday"><t-icon name="chevron-left" size="18" color="#222" data-name="chevron-left"/><view class="switch_22">上一天</view>  </view>
103
  </view>
87
  </view>
104
  </view>
88
  </view>
105
     </swiper-item>
89
     </swiper-item>
106
-    <swiper-item>
107
-      <view class="proportion" wx:if="{{tapindex==2}}">
108
-  <view class="proportion_">
109
-<view class="proportion_c" style=" width: 40%;"></view>
110
-</view>
111
-<view class="cumulative">
112
- <view class="cumulative_1">
113
- <view class="cumulative_2"></view>
114
- <view class="cumulative_3">
115
- <view>本日充电时长</view>
116
- <view>{{Electricitylevel.total.accumulatedchargetime}}h</view>
117
- </view>
118
- </view>
119
- <view class="cumulative_1">
120
- <view class="cumulative_22"></view>
121
- <view class="cumulative_3">
122
- <view>本日放电时长</view>
123
- <view>{{Electricitylevel.total.accumulateddischargetime}}h</view>
124
- </view>
125
- </view>
126
-</view>
127
-<view class="datelabel" bind:tap="onlabel">
128
-<view class="datelabel_1" data-index="1" style="{{labelindex==1?'border:2rpx solid #007544;color:#007544':'border:2rpx solid #fff;color:#222'}}">日</view>
129
-<view class="datelabel_2" data-index="2" style="{{labelindex==2?'border:2rpx solid #007544;color:#007544':'border:2rpx solid #fff;color:#222'}}">月</view>
130
-<view class="datelabel_3" data-index="3" style="{{labelindex==3?'border:2rpx solid #007544;color:#007544':'border:2rpx solid #fff;color:#222'}}">年</view>
131
-</view>
132
-<view class="switch1">
133
-<!-- <view class="switch_1"><t-icon name="chevron-left" size="18" color="#222" data-name="chevron-left"/></view> -->
134
-<view class="switch_2_" bind:tap="handleCalendar"><view class="switch_22">{{valueitem}}</view><t-icon name="calendar-2" size="18" color="#222" data-name="calendar-2"/></view>
135
-<!-- <view class="switch_3"> <t-icon name="chevron-right" size="18" color="#222" data-name="chevron-right"/></view> -->
136
-</view>
137
-<view class="tt_calendar">
138
-<!-- <t-calendar visible="{{visible}}" value="{{value}}" minDate="{{minDate}}" maxDate="{{maxDate}}" format="{{format}}" bind:confirm="handleConfirm" type="range" /> -->
139
-</view>
140
-<view class="proportion_2"></view>
141
-<view class="canvasbox1" hidden="{{visible}}">
142
-<ec-canvas id="mychart_line2" canvas-id="mychart_line2" ec="{{ ech }}"></ec-canvas>
143
-</view>
144
-</view>
145
-    </swiper-item>
90
+   
146
 </swiper>
91
 </swiper>
147
 </view>
92
 </view>
148
 <t-calendar visible="{{visible}}" value="{{value}}" minDate="{{minDate}}" maxDate="{{maxDate}}" format="{{format}}" bind:confirm="handleConfirm" bind:close="bindclose" type="{{rangetype}}" />
93
 <t-calendar visible="{{visible}}" value="{{value}}" minDate="{{minDate}}" maxDate="{{maxDate}}" format="{{format}}" bind:confirm="handleConfirm" bind:close="bindclose" type="{{rangetype}}" />

+ 3
- 0
pages/details/index.wxss Näytä tiedosto

271
   width: 100%;
271
   width: 100%;
272
   height: 100%;
272
   height: 100%;
273
   margin-top: 20rpx;
273
   margin-top: 20rpx;
274
+box-sizing: border-box;
275
+
274
 }
276
 }
275
 #mychart_line2{
277
 #mychart_line2{
276
   width: 100%;
278
   width: 100%;
277
   height: 100%;
279
   height: 100%;
278
   margin-top: 20rpx;
280
   margin-top: 20rpx;
281
+box-sizing: border-box;
279
 }
282
 }
280
 .t-bottom {
283
 .t-bottom {
281
   z-index: 999 !important;
284
   z-index: 999 !important;

+ 157
- 152
pages/index/index.js Näytä tiedosto

28
     rotation:0,
28
     rotation:0,
29
     objectArray: [],
29
     objectArray: [],
30
     stationindex:0,
30
     stationindex:0,
31
-    stationName:wx.getStorageSync('station').stationName,
31
+    stationName:wx.getStorageSync('station').name,
32
     timer1:'',
32
     timer1:'',
33
     timer2:'',
33
     timer2:'',
34
     timer3:'',
34
     timer3:'',
35
     chartInstance1:'',
35
     chartInstance1:'',
36
     chartInstance2:'',
36
     chartInstance2:'',
37
-    chartInstance3:''
37
+    chartInstance3:'',
38
+    characteristic:{},
39
+    comStateunm:0 // 设备在线数
38
   },
40
   },
39
   onLoad: function () {
41
   onLoad: function () {
40
     let _this =this
42
     let _this =this
59
   }
61
   }
60
 });
62
 });
61
 
63
 
62
-    const now = new Date();
63
-    const year = now.getFullYear();
64
-    const month = now.getMonth() + 1;
65
-    const date = now.getDate();
64
+    // const now = new Date();
65
+    // const year = now.getFullYear();
66
+    // const month = now.getMonth() + 1;
67
+    // const date = now.getDate();
66
 
68
 
67
-    const dateString = `${year}-${month}-${date}`;
68
-
69
-    this.setData({
70
-      currentDate: dateString // 假设在小程序页面中使用了data属性绑定了currentDate
71
-    });
69
+    // const dateString = `${year}-${month}-${date}`;
70
+  
72
     // 获取组件
71
     // 获取组件
73
     this.ecComponent = this.selectComponent('#dispace_charts');
72
     this.ecComponent = this.selectComponent('#dispace_charts');
74
     this.ecline = this.selectComponent('#mychart_line');
73
     this.ecline = this.selectComponent('#mychart_line');
102
       filePath: tempFilePath,
101
       filePath: tempFilePath,
103
       success: function () {
102
       success: function () {
104
         // 新版本应用成功
103
         // 新版本应用成功
105
-        // _this.getlist()  
106
-        wx.navigateTo({
107
-          url: '/pages/login/index',
108
-        })
104
+        _this.getlist()  
105
+        // wx.navigateTo({
106
+        //   url: '/pages/login/index',
107
+        // })
109
 
108
 
110
       }
109
       }
111
     });
110
     });
134
       data: station,
133
       data: station,
135
       success: function () {
134
       success: function () {
136
         _this.setData({
135
         _this.setData({
137
-          stationName:wx.getStorageSync('station').stationName
136
+          stationName:wx.getStorageSync('station').name
138
         })
137
         })
139
         clearInterval(_this.timer1);
138
         clearInterval(_this.timer1);
140
         clearInterval(_this.timer2);
139
         clearInterval(_this.timer2);
145
   },
144
   },
146
   getlist(){
145
   getlist(){
147
    //  电站信息
146
    //  电站信息
148
-api.request(`/station/ectric/${wx.getStorageSync('station').id}`, 'POST')
147
+   let data={
148
+    page:1,
149
+    rows:1000
150
+   }
151
+api.request(`/api/v1/stations/HDES/superStations/${wx.getStorageSync('station').id}`, 'get',data)
149
   .then((res) => {
152
   .then((res) => {
150
-    this.setData({
151
-      stationName:wx.getStorageSync('station').stationName,
152
-      ectricdata:res.data
153
-    })
154
-    
155
-    // console.log('请求成功:', res);
156
-  // 先卸载旧图表
157
-
158
-  this.beforeDestroy();
159
-
160
-  // 重新初始化图表
161
-  this.initCharts(res.data.quantity/100);
162
-    // 在这里处理返回的数据
163
-  })
164
-  .catch((err) => {
165
-    console.error('请求失败:', err);
166
-    // 在这里处理请求失败的情况
167
-  });
168
-// 电量信息
169
-api.request(`/stats/singleStation/${wx.getStorageSync('station').id}/between/time`, 'POST',{startDate:this.data.currentDate,endDate:this.data.currentDate})
170
-  .then((res) => {
171
-    if (res.data.length>0) {
153
+    if (res.code==200) {
154
+      let unm = 0
155
+      for (let index = 0; index < res.data.list.length; index++) {
156
+         if (res.data.list[index].comState=='在线') {
157
+          unm++
158
+         }
159
+        
160
+      }
172
       this.setData({
161
       this.setData({
173
-        between:res.data,
162
+        stationName:wx.getStorageSync('station').name,
163
+        ectricdata:res.data.list,
164
+        comStateunm:unm,
165
+        characteristic:res.data.characteristic,
166
+        currentDate: util.CumulativeTimess(0) // 假设在小程序页面中使用了data属性绑定了currentDate
174
       })
167
       })
175
-    }else{
176
-      this.setData({
177
-        between:{
178
-          list:[{chargetime: 0,
179
-            dischargetime: 0,
180
-            ym: "2024-07-08"},
181
-          ],
182
-          total:{accumulatedchargetime: "0",
183
-          accumulateddischargetime: "0"} ,
184
-          zonghe:{
185
-            accumulatedchargetime: "0",
186
-accumulateddischargetime: "0"
187
-          }
188
-        },
189
-      }) 
190
-    }
168
+   
169
+      // console.log('请求成功:', res);
170
+    // 先卸载旧图表
171
+  
172
+    this.beforeDestroy();
191
     this.beforeDestroys();
173
     this.beforeDestroys();
192
     this.initChartright()
174
     this.initChartright()
175
+    // 重新初始化图表
176
+    this.initCharts(res.data.characteristic.soc/100);
177
+      // 在这里处理返回的数据
178
+        // 这里是延时执行的代码
179
+        // this.getsuperStations()
180
+    }else{
181
+
182
+    }
183
+  
193
   })
184
   })
194
   .catch((err) => {
185
   .catch((err) => {
195
     console.error('请求失败:', err);
186
     console.error('请求失败:', err);
196
     // 在这里处理请求失败的情况
187
     // 在这里处理请求失败的情况
197
   });
188
   });
198
-  //设备监测
199
-  this.getfitness()
200
-    this.timer1=setInterval(() => {
201
-      this.getfitness()
202
-          }, 10000)
203
-  },
204
-  // 获取首页数据
205
-  getfitness(){
206
-    api.request(`/station/fitness/${wx.getStorageSync('station').id}`, 'POST')
207
-    .then((res) => {
208
-      this.setData({
209
-        fitnessdata:res.data,
210
-      })
211
-      // console.log('请求成功:', res);
212
-     
213
-      // 在这里处理返回的数据
214
-    })
215
-    .catch((err) => {
216
-      console.error('请求失败:', err);
217
-      // 在这里处理请求失败的情况
218
-    });
189
+
219
   },
190
   },
191
+  getsuperStations(){
192
+    let _this =this
193
+    //  电站信息
194
+    let data={
195
+     page:1,
196
+     rows:1000
197
+    }
198
+ api.request(`/api/v1/stations/HDES/superStations/${wx.getStorageSync('station').id}`, 'get',data)
199
+   .then((res) => {
200
+     if (res.code==200) {
201
+       let unm = 0
202
+       for (let index = 0; index < res.data.list.length; index++) {
203
+          if (res.data.list[index].comState=='在线') {
204
+           unm++
205
+          }
206
+         
207
+       }
208
+       this.setData({
209
+         stationName:wx.getStorageSync('station').name,
210
+         ectricdata:res.data.list,
211
+         comStateunm:unm,
212
+         characteristic:res.data.characteristic,
213
+         currentDate: util.CumulativeTimess(0)
214
+       })
215
+       
216
+       // console.log('请求成功:', res);
217
+     // 先卸载旧图表
218
+     let data = [res.data.characteristic.soc / 100, res.data.characteristic.soc / 100, res.data.characteristic.soc / 100];
219
+     _this.updateChartData1(res.data.characteristic.soc / 100, data);
220
+     let initialData = {
221
+      accumulatedchargetime: _this.data.characteristic.chargeEnergyDaily,
222
+      accumulateddischargetime: _this.data.characteristic.disChargeEnergyDaily
223
+    };
224
+    this.updateChartData(initialData)
225
+     // 重新初始化图表
226
+       // 在这里处理返回的数据
227
+       this.timer1 = setTimeout(() => {
228
+         // 这里是延时执行的代码
229
+         this.getsuperStations()
230
+       }, 10000); 
231
+     }else{
232
+ 
233
+     }
234
+   
235
+   })
236
+   .catch((err) => {
237
+     console.error('请求失败:', err);
238
+     // 在这里处理请求失败的情况
239
+   });
240
+ 
241
+   },
220
   // 卸载图表,清理资源
242
   // 卸载图表,清理资源
221
 unloadCharts: function () {
243
 unloadCharts: function () {
222
   if (this.charts) {
244
   if (this.charts) {
236
         height: height,
258
         height: height,
237
         devicePixelRatio: dpr
259
         devicePixelRatio: dpr
238
       });
260
       });
239
-      // canvas.setChart(chart);
240
-      
241
       // 初始数据
261
       // 初始数据
242
       let initialData = {
262
       let initialData = {
243
-        accumulatedchargetime: _this.data.between.total.accumulatedchargetime,
244
-        accumulateddischargetime: _this.data.between.total.accumulateddischargetime
263
+        accumulatedchargetime: _this.data.characteristic.chargeEnergyDaily,
264
+        accumulateddischargetime: _this.data.characteristic.disChargeEnergyDaily
245
       };
265
       };
246
-      
266
+      console.log(_this.data.ectricdata);
267
+      // this.updateChartData(initialData)
247
       // 设置初始选项
268
       // 设置初始选项
248
       let option = _this.getChartOption(initialData);
269
       let option = _this.getChartOption(initialData);
249
       chart.setOption(option);
270
       chart.setOption(option);
250
     _this.chartInstance2 = chart;
271
     _this.chartInstance2 = chart;
251
   
272
   
252
 
273
 
253
-    _this.startDataUpdates();
254
      
274
      
255
       return chart;
275
       return chart;
256
     });
276
     });
260
       let updatedOption = this.getChartOption(newData);
280
       let updatedOption = this.getChartOption(newData);
261
       this.chartInstance2.setOption(updatedOption);
281
       this.chartInstance2.setOption(updatedOption);
262
     },
282
     },
263
-// 更新图表数据函数
264
-startDataUpdates() {
265
-  this.timer2 = setInterval(() => {
266
-    api.request(`/stats/singleStation/${wx.getStorageSync('station').id}/between/time`, 'POST',{startDate:this.data.currentDate,endDate:this.data.currentDate})
267
-    .then((res) => {
268
-      if (res.data.length>0) {
269
-        this.setData({
270
-          between:res.data,
271
-        })
272
-      }else{
273
-        this.setData({
274
-          between:{
275
-            list:[{chargetime: 0,
276
-              dischargetime: 0,
277
-              ym: "2024-07-08"},
278
-            ],
279
-            total:{accumulatedchargetime: "0",
280
-            accumulateddischargetime: "0"} ,
281
-            zonghe:{
282
-              accumulatedchargetime: "0",
283
-  accumulateddischargetime: "0"
284
-            }
285
-          },
286
-        }) 
287
-      }
288
-      let initialData = {
289
-        accumulatedchargetime: this.data.between.total.accumulatedchargetime,
290
-        accumulateddischargetime: this.data.between.total.accumulateddischargetime
291
-      };
292
-      this.updateChartData(initialData)
293
-    })
294
-    .catch((err) => {
295
-      console.error('请求失败:', err);
296
-      // 在这里处理请求失败的情况
297
-    });
298
-  }, 10000);
299
-},
283
+
300
   // 辅助函数,用于生成图表选项
284
   // 辅助函数,用于生成图表选项
301
   getChartOption: function (data) {
285
   getChartOption: function (data) {
302
     let _this = this;
286
     let _this = this;
308
         itemHeight: 8,
292
         itemHeight: 8,
309
         itemWidth: 8,
293
         itemWidth: 8,
310
         icon: "circle",
294
         icon: "circle",
295
+        textStyle: {
296
+          color: '#999999', // 设置文字颜色为灰色
297
+          fontSize: 10 // 设置字号为20px
298
+      },
311
         formatter: function (name) {
299
         formatter: function (name) {
312
           return name + `   ${data.accumulatedchargetime} kwh`;
300
           return name + `   ${data.accumulatedchargetime} kwh`;
313
         },
301
         },
302
+        rich:{
303
+          a: {
304
+            color: '#222222',
305
+          fontSize: 12 // 设置字号为20px
306
+           
307
+          }
308
+        },
314
         data: [{ name: '今日充电' }]
309
         data: [{ name: '今日充电' }]
315
       }, {
310
       }, {
316
         left: '0',
311
         left: '0',
318
         itemHeight: 8,
313
         itemHeight: 8,
319
         itemWidth: 8,
314
         itemWidth: 8,
320
         icon: "circle",
315
         icon: "circle",
316
+        textStyle: {
317
+          color: '#999999', // 设置文字颜色为灰色
318
+          fontSize: 10 // 设置字号为20px
319
+      },
321
         formatter: function (name) {
320
         formatter: function (name) {
322
           return name + `   ${data.accumulateddischargetime} kwh`;
321
           return name + `   ${data.accumulateddischargetime} kwh`;
323
         },
322
         },
361
  
360
  
362
 // 设备详情
361
 // 设备详情
363
 onIconTap(){
362
 onIconTap(){
363
+  let _this =this
364
  wx.navigateTo({
364
  wx.navigateTo({
365
-   url: '/pages/details/index',
365
+   url: `/pages/details/index?uuid=${_this.data.ectricdata[0].uuid}`,
366
  })
366
  })
367
 },
367
 },
368
 // 设备健康
368
 // 设备健康
399
     _this.chartInstance3 = charts;
399
     _this.chartInstance3 = charts;
400
 
400
 
401
     // 启动定时器更新数据
401
     // 启动定时器更新数据
402
-    _this.startDataUpdate();
402
+    _this.getsuperStations();
403
 
403
 
404
     // 返回图表实例
404
     // 返回图表实例
405
     return charts;
405
     return charts;
413
 },
413
 },
414
 
414
 
415
 // 启动定时器更新数据
415
 // 启动定时器更新数据
416
-startDataUpdate() {
417
-  let _this =this
418
-  _this.timer3 = setInterval(() => {
419
-    // 获取新数据
420
-    api.request(`/station/ectric/${wx.getStorageSync('station').id}`, 'POST')
421
-      .then((res) => {
422
-        // 更新数据
423
-        let data = [res.data.quantity / 100, res.data.quantity / 100, res.data.quantity / 100];
424
-        _this.updateChartData1(res.data.quantity / 100, data);
416
+// startDataUpdate() {
417
+//   let _this =this
418
+//   _this.timer3 = setInterval(() => {
419
+//     // 获取新数据
420
+//     api.request(`/station/ectric/${wx.getStorageSync('station').id}`, 'POST')
421
+//       .then((res) => {
422
+//         // 更新数据
423
+//         let data = [res.data.quantity / 100, res.data.quantity / 100, res.data.quantity / 100];
424
+//         _this.updateChartData1(res.data.quantity / 100, data);
425
 
425
 
426
-        // console.log('请求成功:', res);
427
-      })
428
-      .catch((err) => {
429
-        console.error('请求失败:', err);
430
-        // 处理请求失败情况
431
-      });
432
-  }, 10000);
433
-},
426
+//         // console.log('请求成功:', res);
427
+//       })
428
+//       .catch((err) => {
429
+//         console.error('请求失败:', err);
430
+//         // 处理请求失败情况
431
+//       });
432
+//   }, 10000);
433
+// },
434
 
434
 
435
 // Vue.js 生命周期钩子
435
 // Vue.js 生命周期钩子
436
 beforeDestroy() {
436
 beforeDestroy() {
437
 
437
 
438
 // 清除定时器
438
 // 清除定时器
439
-if (this.timer3) {
440
-  clearInterval(this.timer3);
441
-}
439
+ 
442
 // 销毁图表实例
440
 // 销毁图表实例
443
 if (this.chartInstance3) {
441
 if (this.chartInstance3) {
444
   this.chartInstance3.dispose(); // 销毁图表
442
   this.chartInstance3.dispose(); // 销毁图表
446
 }
444
 }
447
 },
445
 },
448
 beforeDestroys() {
446
 beforeDestroys() {
449
-
450
   // 清除定时器
447
   // 清除定时器
451
-  if (this.timer2) {
452
-    clearInterval(this.timer2);
453
-  }
448
+ 
454
   // 销毁图表实例
449
   // 销毁图表实例
455
   if (this.chartInstance2) {
450
   if (this.chartInstance2) {
456
     this.chartInstance2.dispose(); // 销毁图表
451
     this.chartInstance2.dispose(); // 销毁图表
459
   },
454
   },
460
 // 辅助函数,用于生成图表选项
455
 // 辅助函数,用于生成图表选项
461
 getChartOption1: function (value, data) {
456
 getChartOption1: function (value, data) {
462
-  let color = (value * 100).toFixed(0) < 70 ? '#004403' : '#fff';
457
+  let color = (value * 100).toFixed(2) < 70 ? '#004403' : '#fff';
463
 
458
 
464
   return {
459
   return {
465
     title: {
460
     title: {
466
-      text: (value * 100).toFixed(0) + '%',
461
+      text: (value * 100).toFixed(2) + '%',
467
       textStyle: {
462
       textStyle: {
468
         fontFamily: 'Microsoft Yahei',
463
         fontFamily: 'Microsoft Yahei',
469
         fontWeight: 'normal',
464
         fontWeight: 'normal',
559
     }]
554
     }]
560
   };
555
   };
561
 },
556
 },
557
+onPullDownRefresh(){
558
+  let _this =this
559
+  _this.getlist()
560
+   wx.stopPullDownRefresh();
561
+},
562
  /**
562
  /**
563
    * 生命周期函数--监听页面卸载
563
    * 生命周期函数--监听页面卸载
564
    */
564
    */
565
   onShow(){
565
   onShow(){
566
     let _this =this
566
     let _this =this
567
    // 电站列表stationindex
567
    // 电站列表stationindex
568
-   api.request('/station/list/stationName', 'POST')
568
+   let data ={
569
+    page:1,
570
+    rows:1000
571
+   }
572
+   api.request('/api/v1/superStations', 'get',data)
569
    .then((res) => {
573
    .then((res) => {
574
+     console.log(res);
570
      _this.setData({
575
      _this.setData({
571
-       objectArray:res.data
576
+       objectArray:res.data.list
572
      })
577
      })
573
      if (wx.getStorageSync('station').id) {
578
      if (wx.getStorageSync('station').id) {
574
        for (let index = 0; index < _this.data.objectArray.length; index++) {
579
        for (let index = 0; index < _this.data.objectArray.length; index++) {
584
      }else{
589
      }else{
585
       wx.setStorage({
590
       wx.setStorage({
586
         key: 'station', // 本地缓存中指定的 key
591
         key: 'station', // 本地缓存中指定的 key
587
-        data: res.data[0],
592
+        data: res.data.list[0],
588
         success: function () {
593
         success: function () {
589
                _this.getlist()
594
                _this.getlist()
590
        
595
        
601
   },
606
   },
602
   onHide() {
607
   onHide() {
603
     clearInterval(this.timer1);
608
     clearInterval(this.timer1);
604
-    // clearInterval(_this.timer3);
609
+
605
     this.beforeDestroy()
610
     this.beforeDestroy()
606
     this.beforeDestroys()
611
     this.beforeDestroys()
607
   },
612
   },

+ 2
- 0
pages/index/index.json Näytä tiedosto

1
 {
1
 {
2
   "navigationBarTitleText": "橄榄",
2
   "navigationBarTitleText": "橄榄",
3
   "navigationStyle": "custom",
3
   "navigationStyle": "custom",
4
+  "enablePullDownRefresh": true,
5
+  "backgroundColor": "#B7D7CB",
4
   "usingComponents": {
6
   "usingComponents": {
5
     "ec-canvas": "../../ec-canvas/ec-canvas",
7
     "ec-canvas": "../../ec-canvas/ec-canvas",
6
     "t-icon": "tdesign-miniprogram/icon/icon"
8
     "t-icon": "tdesign-miniprogram/icon/icon"

+ 36
- 23
pages/index/index.wxml Näytä tiedosto

5
   <view style="{{'height: ' + statusBarHeight +'px'}}"></view>
5
   <view style="{{'height: ' + statusBarHeight +'px'}}"></view>
6
   <!--自定义导航栏 -->
6
   <!--自定义导航栏 -->
7
   <view class="navigation-bar" style="{{'height:' + navBarHeight +'px'}}">
7
   <view class="navigation-bar" style="{{'height:' + navBarHeight +'px'}}">
8
-    <picker bindchange="bindPickerChange" range="{{objectArray}}" range-key="stationName" value="{{stationindex}}">
8
+    <picker bindchange="bindPickerChange" range="{{objectArray}}" range-key="name" value="{{stationindex}}">
9
     <view class="title_1" bindtap="rotateImage">{{stationName}}<image class="title_image" src="https://esos-iot.bjdexn.cn/wx_images/switch.png" mode="" animation="{{animationData}}"/></view>
9
     <view class="title_1" bindtap="rotateImage">{{stationName}}<image class="title_image" src="https://esos-iot.bjdexn.cn/wx_images/switch.png" mode="" animation="{{animationData}}"/></view>
10
     </picker>
10
     </picker>
11
   </view>
11
   </view>
12
 </view>
12
 </view>
13
 <view style="{{'height: ' + navStatusBarHeight +'px'}}"></view>
13
 <view style="{{'height: ' + navStatusBarHeight +'px'}}"></view>
14
-<view class="title_2">电站额定容量:{{ectricdata.electric}}kwh</view>
14
+<!-- <view class="title_2">电站额定容量:{{characteristic.ratedCap}}kwh</view> -->
15
 
15
 
16
 	<view class="canvasArea">
16
 	<view class="canvasArea">
17
 		<ec-canvas type="2d" id="dispace_charts" canvas-id="dispace_charts" ec="{{ ec_dispace_charts }}"></ec-canvas>
17
 		<ec-canvas type="2d" id="dispace_charts" canvas-id="dispace_charts" ec="{{ ec_dispace_charts }}"></ec-canvas>
22
       
22
       
23
      <view class="realtime1">
23
      <view class="realtime1">
24
       <view class="realtime_left1">
24
       <view class="realtime_left1">
25
-        <view><text class="realtime_text">{{ectricdata.rate}}</text><text class="realtime_unit">kW</text></view>  
25
+        <view><text class="realtime_text">{{converter.formattoFixed(characteristic.power,1)}}</text><text class="realtime_unit">kW</text></view>  
26
      <view class="realtime_title">当前功率</view>  
26
      <view class="realtime_title">当前功率</view>  
27
       </view>
27
       </view>
28
       <view class="realtime_right1">
28
       <view class="realtime_right1">
29
-        <view><text class="realtime_text">{{ectricdata.fulld}}</text><text class="realtime_unit">h</text></view>  
30
-     <view class="realtime_title">预计充满</view>  
29
+        <view><text class="realtime_text">{{ectricdata.length}}/{{comStateunm}}</text>
30
+        <!-- <text class="realtime_unit">h</text> -->
31
+        </view>  
32
+     <view class="realtime_title">总设备数/在线数</view>  
31
       </view>
33
       </view>
32
      </view>
34
      </view>
33
     </view>
35
     </view>
36
      <view class="realtime2">
38
      <view class="realtime2">
37
       <view class="realtime_left2">
39
       <view class="realtime_left2">
38
      <view class="realtime_title">昨日收益</view>  
40
      <view class="realtime_title">昨日收益</view>  
39
-        <view><text class="realtime_text">{{converter.formatAmount(ectricdata.totalProfit)}}</text><text class="realtime_unit">{{converter.formatAmounts(ectricdata.totalProfit)}}</text></view>  
41
+        <view><text class="realtime_text">{{converter.formatAmount(characteristic.moneyDaily)}}</text><text class="realtime_unit">{{converter.formatAmounts(characteristic.moneyDaily)}}</text></view>  
40
       </view>
42
       </view>
41
       <view class="realtime_right2">
43
       <view class="realtime_right2">
42
      <view class="realtime_title">累计收益</view>  
44
      <view class="realtime_title">累计收益</view>  
43
-        <view><text class="realtime_text">{{converter.formatAmount(ectricdata.yesterdayProfit)}}</text><text class="realtime_unit">{{converter.formatAmounts(ectricdata.yesterdayProfit)}}</text></view>  
45
+        <view><text class="realtime_text">{{converter.formatAmount(characteristic.money)}} </text><text class="realtime_unit">{{converter.formatAmounts(characteristic.money)}}</text></view>  
44
       </view>
46
       </view>
45
     </view>
47
     </view>
46
 	</view>
48
 	</view>
47
     <view class="equipment">
49
     <view class="equipment">
48
-    <view>设备信息 <text class="equipmenttext"> (今日:{{currentDate}})</text></view>
50
+    <view>电站总览 <text class="equipmenttext"> (今日:{{currentDate}})</text></view>
49
     <view class="details">
51
     <view class="details">
50
     <!-- <t-icon name="chevron-right-s" size="24" color="#999999" data-name="chevron-right-s" bind:tap="ondetails"/> -->
52
     <!-- <t-icon name="chevron-right-s" size="24" color="#999999" data-name="chevron-right-s" bind:tap="ondetails"/> -->
51
     </view>
53
     </view>
54
     <view class="electric">
56
     <view class="electric">
55
     <view class="electric1" bind:tap="onIconTap">
57
     <view class="electric1" bind:tap="onIconTap">
56
     <view class="electric_rong">
58
     <view class="electric_rong">
57
-    <view class="electric_">电量</view>
58
-    <t-icon name="chevron-right-s" size="48rpx" data-name="chevron-right-s"/>
59
+    <view class="electric4">电量</view>
60
+    <t-icon name="chevron-right-s" size="40rpx" data-name="chevron-right-s"/>
59
     </view>
61
     </view>
60
     <view class="pic_pic">
62
     <view class="pic_pic">
61
     <ec-canvas id="mychart_line" canvas-id="mychart_line" ec="{{ ec }}"></ec-canvas>
63
     <ec-canvas id="mychart_line" canvas-id="mychart_line" ec="{{ ec }}"></ec-canvas>
65
     <view class="electric2">
67
     <view class="electric2">
66
     <view class="electric21" bind:tap="onIconTap">
68
     <view class="electric21" bind:tap="onIconTap">
67
       <view class="electric_rong">
69
       <view class="electric_rong">
68
-    <view class="electric4">充电时长</view>
70
+    <view class="electric4">充电状态</view>
69
     <t-icon name="chevron-right-s" size="40rpx" data-name="chevron-right-s"  />
71
     <t-icon name="chevron-right-s" size="40rpx" data-name="chevron-right-s"  />
70
     </view>
72
     </view>
71
-    <view>{{between.list[0].chargetime}} <text class="electric3">h</text></view>
72
-    <view class="battery">当前已放电 {{between.list[0].dischargetime}}h</view>
73
+    <!-- <view>{{between.list[0].chargetime}} <text class="electric3">h</text></view> -->
74
+    <!-- 功率>0 放电 -->
75
+    <!-- 功率<0 充电/ -->
76
+    <!-- 功率==0 空闲 -->
77
+    <view class="tag_type1" wx:if="{{characteristic.power>0}}">放电</view>
78
+    <view class="tag_type2" wx:if="{{characteristic.power<0}}">充电</view>
79
+    <view class="tag_type3" wx:if="{{characteristic.power==0}}">空闲</view>
80
+    <view class="batteryccc">当前充放电状态</view>
73
     </view>
81
     </view>
74
-    <view class="electric22" bind:tap="onhealthy">
75
-      <view class="electric_rong">
76
-    <view class="electric4">设备监测</view>
77
-    <t-icon name="chevron-right-s" size="20px" data-name="chevron-right-s"/>
78
-    </view>
79
-    <view class="tag_type2" wx:if="{{fitnessdata.alarmStatus==0}}">离线</view>
80
-    <view class="tag_type1" wx:if="{{fitnessdata.alarmStatus==1}}">正常</view>
81
-    <view class="tag_type3" wx:if="{{fitnessdata.alarmStatus==2}}">故障</view>
82
-    <view class="battery">当前电池温度 {{fitnessdata.temperature}}℃</view>
82
+    <!-- <view class="electric22" bind:tap="onhealthy"> -->
83
+    <view class="electric22">
84
+      <!-- <view class="electric_rong">
85
+    <view class="electric4">系统效率</view>
86
+    <view class="battery">{{characteristic.efficiency}} <text class="batteryccc">%</text> </view>
87
+    </view> -->
88
+ <!-- <view class="battery_bottom"></view> -->
89
+ <view ></view>
90
+    <view class="batteryccc">累计充电 <text class="battery">{{converter.formattoFixed(characteristic.chargeEnergy,2)}} </text> <text>kwh</text> </view>
91
+    <view class="batteryccc">累计放电 <text class="battery">{{converter.formattoFixed(characteristic.disChargeEnergy,2)}} </text> <text>kwh</text> </view>
83
     </view>
92
     </view>
84
     </view>
93
     </view>
85
     </view>
94
     </view>
86
 </view>
95
 </view>
87
 <wxs module="converter">
96
 <wxs module="converter">
97
+ var formattoFixed = function(amount,unm) {
98
+     return amount.toFixed(unm*1);
99
+    }
88
    var formatAmount = function(amount) {
100
    var formatAmount = function(amount) {
89
     if (amount==undefined) {
101
     if (amount==undefined) {
90
         return '1000';
102
         return '1000';
107
     }
119
     }
108
     module.exports = {
120
     module.exports = {
109
       formatAmount: formatAmount,
121
       formatAmount: formatAmount,
110
-      formatAmounts: formatAmounts
122
+      formatAmounts: formatAmounts,
123
+      formattoFixed:formattoFixed
111
     }
124
     }
112
 </wxs>
125
 </wxs>
113
 <!--  -->
126
 <!--  -->

+ 17
- 9
pages/index/index.wxss Näytä tiedosto

290
 }
290
 }
291
 .electric21{
291
 .electric21{
292
   width: 100%;
292
   width: 100%;
293
-  height: 190rpx;
293
+  height: 220rpx;
294
 padding: 20rpx 0rpx;
294
 padding: 20rpx 0rpx;
295
 display: flex;
295
 display: flex;
296
 flex-direction: column;
296
 flex-direction: column;
299
 }
299
 }
300
 .electric22{
300
 .electric22{
301
   width: 100%;
301
   width: 100%;
302
-  height: 190rpx;
302
+  height: 160rpx;
303
   padding: 20rpx 0rpx;
303
   padding: 20rpx 0rpx;
304
   display: flex;
304
   display: flex;
305
   flex-direction: column;
305
   flex-direction: column;
315
   color: #999999;
315
   color: #999999;
316
 }
316
 }
317
 .battery{
317
 .battery{
318
-font-size: 20rpx;
319
-color: #999999;
318
+font-size: 24rpx;
319
+ color: #222222;
320
 
320
 
321
 }
321
 }
322
+.batteryccc{
323
+  font-size: 20rpx;
324
+  color: #999999;
325
+  
326
+  }
327
+  .battery_bottom{
328
+    width: 100%;
329
+    /* border-bottom: 1rpx solid #E1E0F4; */
330
+  }
322
 .tag_type1 {
331
 .tag_type1 {
323
   font-size: 28rpx;
332
   font-size: 28rpx;
324
-  color: #15DB9B;
333
+  color: #F0A26C;
325
   font-weight: 600;
334
   font-weight: 600;
326
-
327
 }
335
 }
328
 
336
 
329
 .tag_type2 {
337
 .tag_type2 {
330
   font-size: 28rpx;
338
   font-size: 28rpx;
331
-  color: red;
339
+  color: #15DB9B;
332
   font-weight: 600;
340
   font-weight: 600;
333
 }
341
 }
334
 
342
 
335
 .tag_type3 {
343
 .tag_type3 {
336
   font-size: 28rpx;
344
   font-size: 28rpx;
337
-  color: #F0A26C;
345
+  color: #b0c4de;
338
   font-weight: 600;
346
   font-weight: 600;
339
-
347
+/* 蓝 */
340
 }
348
 }

+ 6
- 4
pages/login/index.js Näytä tiedosto

69
         let data ={
69
         let data ={
70
           username:this.data.account,
70
           username:this.data.account,
71
           password:this.data.password,
71
           password:this.data.password,
72
-          tenantNo:"",
73
-         rememberMe: true
72
+         rememberMe: 1
74
         }
73
         }
75
-        api.request('/platform/login', 'POST',data).then((res) => {
76
-    if (res.code==0) {
74
+        console.log(data);
75
+        api.request('/auth/login', 'POST',data).then((res) => {
76
+          console.log(res);
77
+    if (res.code==200&&res.status=='ok') {
77
       // 设置数据到本地存储
78
       // 设置数据到本地存储
78
 wx.setStorage({
79
 wx.setStorage({
79
   key: 'cookies',  // 存储的key值
80
   key: 'cookies',  // 存储的key值
80
   data:res.msg,
81
   data:res.msg,
81
   success: function(ress) {
82
   success: function(ress) {
83
+    console.log(ress);
82
  // 获取本地存储的数据
84
  // 获取本地存储的数据
83
  wx.reLaunch({
85
  wx.reLaunch({
84
   url: '/pages/index/index'
86
   url: '/pages/index/index'

+ 11
- 1
pages/setup/index.js Näytä tiedosto

34
   },
34
   },
35
   // 电站详情
35
   // 电站详情
36
   onpowerstation(){
36
   onpowerstation(){
37
+    wx.showToast({
38
+      title: '暂未开放',
39
+      icon: 'none'
40
+    });
41
+    return
37
  this.setData({
42
  this.setData({
38
   showMultiTextAndTitle:true
43
   showMultiTextAndTitle:true
39
  })
44
  })
107
   } catch (e) {
112
   } catch (e) {
108
     console.error("获取小程序版本号失败:", e);
113
     console.error("获取小程序版本号失败:", e);
109
   }
114
   }
110
-    this.getuser()
115
+    // this.getuser()
111
   },
116
   },
112
    getuser(){
117
    getuser(){
113
     api.request(`/platform/user/selectaccountNumber`, 'POST')
118
     api.request(`/platform/user/selectaccountNumber`, 'POST')
126
    },
131
    },
127
    // 个人信息
132
    // 个人信息
128
    onuser(){
133
    onuser(){
134
+    wx.showToast({
135
+      title: '暂未开放',
136
+      icon: 'none'
137
+    });
138
+    return
129
     wx.navigateTo({
139
     wx.navigateTo({
130
       url: '/pages/user/index', // 登录页面的路径,注意路径前面加上 '/' 表示从根目录开始
140
       url: '/pages/user/index', // 登录页面的路径,注意路径前面加上 '/' 表示从根目录开始
131
     });
141
     });

+ 2
- 2
pages/setup/index.wxml Näytä tiedosto

11
 <view class="user">
11
 <view class="user">
12
 <image bind:tap="onuser" class="user_to" src="https://esos-iot.bjdexn.cn/wx_images/to1.jpg" mode=""/>
12
 <image bind:tap="onuser" class="user_to" src="https://esos-iot.bjdexn.cn/wx_images/to1.jpg" mode=""/>
13
 <view class="user_name">
13
 <view class="user_name">
14
-<view class="user_name1">{{user.user.userName}}</view>
15
-<view class="user_name2">电话:{{user.user.phonenumber}}</view>
14
+<!-- <view class="user_name1">{{user.user.userName}}</view> -->
15
+<!-- <view class="user_name2">电话:{{user.user.phonenumber}}</view> -->
16
 </view>
16
 </view>
17
 </view>
17
 </view>
18
 <view class="equipment">
18
 <view class="equipment">

+ 10
- 0
pages/setuplevel/index.js Näytä tiedosto

58
   
58
   
59
   },
59
   },
60
   onuser(){
60
   onuser(){
61
+    wx.showToast({
62
+      title: '暂未开放',
63
+      icon: 'none'
64
+    });
65
+    return
61
     wx.navigateTo({
66
     wx.navigateTo({
62
       url: '/pages/user/index', // 登录页面的路径,注意路径前面加上 '/' 表示从根目录开始
67
       url: '/pages/user/index', // 登录页面的路径,注意路径前面加上 '/' 表示从根目录开始
63
     });
68
     });
73
     
78
     
74
   },
79
   },
75
   onaccountnumber(){
80
   onaccountnumber(){
81
+    wx.showToast({
82
+      title: '暂未开放',
83
+      icon: 'none'
84
+    });
85
+    return
76
     wx.navigateTo({
86
     wx.navigateTo({
77
       url: '/pages/account/index', // 登录页面的路径,注意路径前面加上 '/' 表示从根目录开始
87
       url: '/pages/account/index', // 登录页面的路径,注意路径前面加上 '/' 表示从根目录开始
78
     });
88
     });

+ 14
- 50
pages/station/index.js Näytä tiedosto

1
 // pages/station/index.js
1
 // pages/station/index.js
2
 const api = require('../../api/index.js');
2
 const api = require('../../api/index.js');
3
+const util = require('../../utils/util.js')
4
+
3
 Page({
5
 Page({
4
 
6
 
5
   /**
7
   /**
6
    * 页面的初始数据
8
    * 页面的初始数据
7
    */
9
    */
8
   data: {
10
   data: {
9
-    stickyProps:"",
11
+    baseInfo:"",
10
   },
12
   },
11
 
13
 
12
   /**
14
   /**
15
   onLoad(options) {
17
   onLoad(options) {
16
     this.getlist()
18
     this.getlist()
17
   },
19
   },
18
-  onTabsChange(event) {
19
-    this.setData({
20
-      stickyProps:event.detail.value
21
-    })
22
-    this.getlist()
23
-  },
20
+  
24
  getlist(){
21
  getlist(){
25
   let data ={
22
   let data ={
26
-    onlineStatus:this.data.stickyProps
27
-  }
28
-  api.request('/muitiStation/APP/baseInfo', 'POST',data )
23
+    page:1,
24
+    rows:1000
25
+   }
26
+  api.request(`/api/v1/stations/HDES/superStations/${wx.getStorageSync('station').id}`, 'get',data)
29
   .then((res) => {
27
   .then((res) => {
30
-  
28
+  console.log(res);
29
+  for (let index = 0; index < res.data.list.length; index++) {
30
+    res.data.list[index].createAt = util.timestamp(res.data.list[index].createAt)
31
+    
32
+  }
31
     this.setData({
33
     this.setData({
32
       baseInfo:res.data
34
       baseInfo:res.data
33
     })
35
     })
36
+   
34
   })
37
   })
35
   .catch((err) => {
38
   .catch((err) => {
36
     console.error('请求失败:', err);
39
     console.error('请求失败:', err);
37
     // 在这里处理请求失败的情况
40
     // 在这里处理请求失败的情况
38
   });
41
   });
39
  },
42
  },
40
- onUnbind1(e){
41
-   console.log(e.target.dataset.id);
42
-   let data ={
43
-    deviceId:e.target.dataset.id,
44
-    UnbindStart:1
45
-   }
46
-  api.request('/system/tenantpower/APP/bind', 'POST',data )
47
-  .then((res) => {
48
-    wx.showToast({
49
-      title: res.msg,
50
-      icon: 'none',
51
-    });
52
-    this.getlist()
53
-
54
-  })
55
-  .catch((err) => {
56
-    console.error('请求失败:', err);
57
-    // 在这里处理请求失败的情况
58
-  });
59
-},
60
-onUnbind2(e){
61
-  console.log(e.target.dataset.id);
62
-  let data ={
63
-   deviceId:e.target.dataset.id,
64
-   UnbindStart:0
65
-  }
66
- api.request('/system/tenantpower/APP/bind', 'POST',data )
67
- .then((res) => {
68
-  wx.showToast({
69
-    title: res.msg,
70
-    icon: 'none',
71
-  });
72
-  this.getlist()
73
- })
74
- .catch((err) => {
75
-   console.error('请求失败:', err);
76
-   // 在这里处理请求失败的情况
77
- });
78
-},
79
 ondetails(id){
43
 ondetails(id){
80
   console.log(id.currentTarget.dataset.id);
44
   console.log(id.currentTarget.dataset.id);
81
   wx.navigateTo({
45
   wx.navigateTo({

+ 1
- 2
pages/station/index.json Näytä tiedosto

1
 {
1
 {
2
   "navigationBarTitleText": "我的设备",
2
   "navigationBarTitleText": "我的设备",
3
   "usingComponents": {
3
   "usingComponents": {
4
-    "t-tabs": "tdesign-miniprogram/tabs/tabs",
5
-    "t-tab-panel": "tdesign-miniprogram/tab-panel/tab-panel"
4
+   
6
   }
5
   }
7
 }
6
 }

+ 39
- 62
pages/station/index.wxml Näytä tiedosto

1
 <!--pages/station/index.wxml-->
1
 <!--pages/station/index.wxml-->
2
 <view class="custom-tabs">
2
 <view class="custom-tabs">
3
-<t-tabs defaultValue="{{stickyProps}}" theme="tag" bind:change="onTabsChange" sticky>
4
-  <!-- <t-tab-panel wx:for="{{tablist}}" wx:key="index" label="{{item}}" value="{{index}}" /> -->
5
-  <t-tab-panel label="全部" value="">
6
-  <view class="tagbox">
7
-  <view class="tag_box" wx:for="{{baseInfo}}" wx:key="powerId" data-id="{{item.powerId}}" bind:tap="ondetails">
8
-  <view class="tag_name">{{item.stationName}}</view>
9
-  <!-- <view class="tag_name1"> -->
10
-  <view class="tag_Unbind" wx:if="{{item.unbindStart==0}}" data-id="{{item.powerId}}" catchtap="onUnbind1">绑定</view>
11
-  <view class="tag_Unbind" wx:if="{{item.unbindStart==1}}" data-id="{{item.powerId}}" catchtap="onUnbind2">解绑</view>
3
+<view class="custom_box" wx:for="{{baseInfo.list}}" wx:key="index">
4
+ <view class="custom_title">
5
+ <view class="custom_title_name">设备编号</view>
6
+ <view class="custom_title_gl">{{item.name}} </view>
7
+ </view>
8
+ <view class="custom_div">
9
+ <view class="batteryccc">实时功率</view>
10
+ <view class="custom_title_gl">{{item.power}}<text class="batteryccc"> kW</text> </view>
11
+ </view>
12
+ <view class="custom_div">
13
+ <view class="batteryccc">在线状态</view>
14
+ <view class="tag_type2red" class="{{item.comState=='离线'?'tag_type2red':'tag_type2'}}">{{item.comState}}</view>
15
+ <!-- <view class="tag_type2">{{item.comState}}</view> -->
16
+ </view>
17
+ <view class="custom_div">
18
+ <view class="batteryccc">故障状态</view>
19
+ <!-- <view class="tag_type1">{{item.faultState}}</view> -->
20
+ <view class="tag_type2red" class="{{item.faultState=='正常'?'tag_type2':'tag_type2red'}}">{{item.faultState}}</view>
12
 
21
 
13
-  <view class="tag_type1" wx:if="{{item.onlineStatus==1}}">正常</view>
14
-  <view class="tag_type2" wx:if="{{item.onlineStatus==2}}">故障</view>
15
-  <view class="tag_type3" wx:if="{{item.onlineStatus==0}}">离线</view>
16
-  <!-- </view> -->
17
-  </view>
18
-  </view>
19
-</t-tab-panel>
20
-  <t-tab-panel label="正常" value="1">  
21
-    <view class="tagbox">
22
-  <view class="tag_box" wx:for="{{baseInfo}}" wx:key="powerId">
23
-  <view class="tag_name">{{item.stationName}}</view>
24
-  <!-- <view class="tag_name1"> -->
25
-   <view class="tag_Unbind" wx:if="{{item.unbindStart==0}}" data-id="{{item.powerId}}" catchtap="onUnbind1">绑定</view>
26
-  <view class="tag_Unbind" wx:if="{{item.unbindStart==1}}" data-id="{{item.powerId}}" catchtap="onUnbind2">解绑</view>
27
-  <view class="tag_type1" wx:if="{{item.onlineStatus==1}}">正常</view>
28
-  <view class="tag_type2" wx:if="{{item.onlineStatus==2}}">故障</view>
29
-  <view class="tag_type3" wx:if="{{item.onlineStatus==0}}">离线</view>
30
-  </view>
31
-  <!-- </view> -->
32
-  </view>
33
-</t-tab-panel>
34
-  <t-tab-panel label="故障" value="2">  
35
-    <view class="tagbox">
36
-  <view class="tag_box" wx:for="{{baseInfo}}" wx:key="powerId">
37
-  <view class="tag_name">{{item.stationName}}</view>
38
-  <!-- <view class="tag_name1"> -->
39
-   <view class="tag_Unbind" wx:if="{{item.unbindStart==0}}" data-id="{{item.powerId}}" catchtap="onUnbind1">绑定</view>
40
-  <view class="tag_Unbind" wx:if="{{item.unbindStart==1}}" data-id="{{item.powerId}}" catchtap="onUnbind2">解绑</view>
41
-  <view class="tag_type1" wx:if="{{item.onlineStatus==1}}">正常</view>
42
-  <view class="tag_type2" wx:if="{{item.onlineStatus==2}}">故障</view>
43
-  <view class="tag_type3" wx:if="{{item.onlineStatus==0}}">离线</view>
44
-  </view>
45
-  <!-- </view> -->
46
-  </view>
47
-  <view class="box_image">
48
-  <image class="tag_image" src="https://esos-iot.bjdexn.cn/wx_images/no_data.png" mode=""/>
49
-  </view>
50
-</t-tab-panel>
51
-  <t-tab-panel label="离线" value="0">  
52
-    <view class="tagbox">
53
-  <view class="tag_box" wx:for="{{baseInfo}}" wx:key="powerId">
54
-  <view class="tag_name">{{item.stationName}}</view>
55
-  <!-- <view class="tag_name1"> -->
56
-   <view class="tag_Unbind" wx:if="{{item.unbindStart==0}}" data-id="{{item.powerId}}" catchtap="onUnbind1">绑定</view>
57
-  <view class="tag_Unbind" wx:if="{{item.unbindStart==1}}" data-id="{{item.powerId}}" catchtap="onUnbind2">解绑</view>
58
-  <view class="tag_type1" wx:if="{{item.onlineStatus==1}}">正常</view>
59
-  <view class="tag_type2" wx:if="{{item.onlineStatus==2}}">故障</view>
60
-  <view class="tag_type3" wx:if="{{item.onlineStatus==0}}">离线</view>
61
-  </view>
62
-  <!-- </view> -->
63
-  </view>
64
-</t-tab-panel>
65
-</t-tabs>
22
+ </view>
23
+ <view class="custom_div">
24
+ <view class="batteryccc">运行状态</view>
25
+ <!-- <view class="tag_type3">{{item.runState}}</view> -->
26
+ <view class="tag_type2red" class="{{item.runState=='运行'?'tag_type2':'tag_type3'}}">{{item.runState}}</view>
27
+
28
+ </view>
29
+ <view class="custom_div">
30
+ <view class="batteryccc">投运时间</view>
31
+ <view class="custom_div1">{{item.createAt}}</view>
32
+ </view>
33
+</view>
34
+<view class="tag_typetext">没有更多数据...</view>
66
 </view>
35
 </view>
36
+<!-- 
37
+createAt 投运时间
38
+comState 在线状态
39
+power 实时功率
40
+ 故障状态 faultState
41
+ 运行状态 runState
42
+name  名称
43
+ -->

+ 62
- 56
pages/station/index.wxss Näytä tiedosto

1
 /* pages/station/index.wxss */
1
 /* pages/station/index.wxss */
2
-.t-tabs__item-inner--tag {
3
-  background-color: var(--td-tab-item-tag-bg, var(--td-bg-color-secondarycontainer, var(--td-gray-color-1, #ffffff))) !important;
4
-}
2
+.custom-tabs{
3
+  width: 100%;
4
+  height: 100vh;
5
+  padding: 0rpx 20rpx 20rpx 20rpx;
6
+  background-color: rgb(245, 245, 245);
7
+  overflow: auto;
5
 
8
 
6
-.t-tabs__item-inner--active.t-tabs__item-inner--tag {
7
-  font-weight: 500;
8
-  background-color: var(--td-tab-item-tag-active-bg, var(--td-brand-color-light, var(--td-primary-color-1, #f2f3ff))) !important;
9
+  box-sizing: border-box;
9
 }
10
 }
10
-
11
-.tagbox {
12
-  padding: 0rpx 20rpx;
13
-  padding-bottom: 80rpx;
11
+.custom_box{
12
+  width:100%;
13
+  padding: 1rpx 20rpx 20rpx 20rpx;
14
+  border-radius: 20rpx;
15
+  background-color: #ffffff;
16
+  box-sizing: border-box;
17
+  /* overflow: auto; */
14
 }
18
 }
15
-
16
-.tag_box {
19
+.custom_title{
17
   width: 100%;
20
   width: 100%;
18
-  padding: 20rpx 10rpx;
19
   display: flex;
21
   display: flex;
20
   justify-content: space-between;
22
   justify-content: space-between;
23
+  padding: 20rpx 0rpx;
24
+  border-bottom:1rpx solid #E1E0F4;
21
   box-sizing: border-box;
25
   box-sizing: border-box;
22
-  border-bottom: 1rpx solid #F7F7F7;
23
 }
26
 }
24
-
25
-.tag_name1 {
26
-  display: flex;
27
-  justify-content: space-between;
28
-  margin-top: 30rpx;
29
-}
30
-
31
-.box_image {
27
+ .custom_title_gl{
28
+  font-size: 26rpx;
29
+  color: #222222;
30
+ }
31
+.custom_div{
32
   width: 100%;
32
   width: 100%;
33
   display: flex;
33
   display: flex;
34
-  align-items: center;
35
-  justify-content: center;
36
-}
37
-
38
-.tag_image {
39
-  width: 363rpx;
40
-  height: 330rpx;
41
-  margin-top: 260rpx;
42
-
43
-}
44
-
45
-.tag_name {
46
-  width: 55%;
47
-  color: #222222;
48
-  font-weight: 500;
49
-  white-space: nowrap;
50
-  /* 设置文本不换行 */
51
-  overflow: hidden;
52
-  /* 如果需要超出部分隐藏 */
53
-  text-overflow: ellipsis;
54
-  /* 在超出部分显示省略号 */
34
+  justify-content: space-between;
35
+  margin-top: 20rpx;
55
 }
36
 }
56
-
57
-.tag_Unbind {
58
-  padding: 10rpx 20rpx;
37
+.custom_div1{
59
   font-size: 26rpx;
38
   font-size: 26rpx;
60
-  color: #222222;
61
-  /* background-color: #909090; */
62
-  background-color: #F7F7F7;
63
-  border-radius: 100rpx;
39
+   color: #222222;
64
 }
40
 }
41
+.battery{
42
+  font-size: 24rpx;
43
+   color: #222222;
65
 
44
 
45
+  }
46
+  .batteryccc{
47
+    font-size: 26rpx;
48
+    color: #999999;
49
+    
50
+    }
66
 .tag_type1 {
51
 .tag_type1 {
67
-  font-size: 26rpx;
68
-  color: #15DB9B;
52
+  font-size: 28rpx;
53
+  color: #F0A26C;
54
+  font-weight: 500;
69
 }
55
 }
70
 
56
 
71
 .tag_type2 {
57
 .tag_type2 {
72
-  font-size: 26rpx;
73
-  color: #729CFF;
58
+  font-size: 28rpx;
59
+  color: #15DB9B;
60
+  font-weight: 500;
74
 }
61
 }
75
 
62
 
76
 .tag_type3 {
63
 .tag_type3 {
77
-  font-size: 26rpx;
78
-  color: #F0A26C;
64
+  font-size: 28rpx;
65
+  color: #b0c4de;
66
+  font-weight: 500;
67
+/* 蓝 */
68
+}
69
+.tag_type2red {
70
+  font-size: 28rpx;
71
+  color: red;
72
+  font-weight: 500;
73
+/* 蓝 */
74
+}
75
+.custom_box{
76
+  margin-top: 20rpx;
77
+}
78
+.tag_typetext{
79
+width: 100%;
80
+display: flex;
81
+font-size: 26rpx;
82
+justify-content: center;
83
+color: #b0c4de;
84
+margin-top: 20rpx;
79
 }
85
 }

+ 1
- 1
project.private.config.json Näytä tiedosto

3
   "projectname": "esswisdom_wx",
3
   "projectname": "esswisdom_wx",
4
   "setting": {
4
   "setting": {
5
     "compileHotReLoad": true,
5
     "compileHotReLoad": true,
6
-    "urlCheck": true,
6
+    "urlCheck": false,
7
     "lazyloadPlaceholderEnable": false,
7
     "lazyloadPlaceholderEnable": false,
8
     "bigPackageSizeSupport": true
8
     "bigPackageSizeSupport": true
9
   },
9
   },

+ 0
- 108
utils/privacy.txt Näytä tiedosto

1
-隐私声明
2
-
3
-最后更新于2024年7月3日
4
-
5
-感谢你选择成为晟运("公司"、"我们 "或 "我们的")用户的一员。我们致力于保护您的个人信息和您的隐私权。如果您对本隐私声明或我们对您的个人信息的做法有任何问题或疑虑,请联系我们,www.hongpower.cc。
6
-
7
-本隐私声明描述了在下列情况下我们可能使用您的信息。
8
-
9
-在本隐私声明中,如果我们提到
10
-
11
-"应用程序",我们指的是任何引用或链接到本政策的我们的应用程序,包括上面列出的任何应用程序
12
-
13
-"服务",我们指的是我们的应用程序和其他相关服务,包括任何销售、营销或活动。
14
-
15
-本隐私声明的目的是以最清晰的方式向您解释我们收集哪些信息,我们如何使用这些信息,以及您有哪些相关的权利。如果本隐私声明中有任何您不同意的条款,请立即停止使用我们的服务。
16
-
17
-请仔细阅读本隐私声明,因为它将帮助您了解我们对所收集信息的处理。
18
-
19
-目录
20
-
21
-1. 我们收集什么信息?
22
-
23
-2. 我们如何使用您的信息?
24
-
25
-3. 你的信息是否会与任何人分享?
26
-
27
-4. 我们将您的信息保存多久?
28
-
29
-5. 我们如何保证您的信息安全?
30
-
31
-6. 我们是否收集未成年人的信息?
32
-
33
-7. 你有什么隐私权?
34
-
35
-8. 拒绝跟踪功能的控制
36
-
37
-1. 我们收集什么信息?
38
-
39
-自动收集的信息
40
-
41
-简而言之:一些信息,如您的互联网协议(IP)地址和/或浏览器和设备特征,在您访问我们的App时被自动收集。
42
-
43
-当您访问、使用或浏览App时,我们自动收集某些信息。这些信息不会透露您的具体身份(如您的姓名或联系信息),但可能包括设备和使用信息,如您的IP地址、浏览器和设备特征、操作系统、语言偏好、引用的URL、设备名称、国家、地点、关于您如何和何时使用我们的App的信息以及其他技术信息。这些信息主要是为了维护我们小程序的安全和运行,以及我们的内部分析和报告的需要。
44
-
45
-我们收集的信息包括
46
-
47
-设备数据。我们收集设备数据,如关于您的电脑、手机、平板电脑或您用来访问App的其他设备的信息。根据所使用的设备,该设备数据可能包括诸如您的IP地址(或代理服务器)、设备和应用程序识别号、位置、浏览器类型、硬件模型互联网服务提供商和/或移动运营商、操作系统和系统配置信息。
48
-
49
-通过我们的应用程序收集的信息
50
-
51
-简而言之:当您使用我们的应用程序时,我们收集有关您的移动设备的信息。
52
-
53
-我们的产品是基于小程序环境)开发的,在应用运行过程中需要收集您的设备唯一标识(IMEI/android ID/DEVICE_ID/IDFA,SIM卡IMSI信息),以提供统计分析服务,提高性能和用户体验,为用户提供更好的服务。
54
-
55
-2. 我们如何使用您的信息?
56
-
57
-简而言之:我们处理您的信息的目的是基于合法的商业利益,履行我们与您的合同,遵守我们的法律义务,和/或您的同意。
58
-
59
-我们将通过我们的应用程序收集的个人信息用于下文所述的各种商业目的。我们为这些目的处理您的个人信息,是基于我们的合法商业利益,为了与您签订或履行合同,经您同意,和/或为了遵守我们的法律义务。我们在下面列出的每个目的旁边注明我们所依据的具体处理理由。
60
-
61
-我们使用我们收集或收到的信息。
62
-
63
-用于其他商业目的。我们可能将您的信息用于其他商业目的,如数据分析、确定使用趋势、确定我们促销活动的有效性以及评估和改进我们的应用程序、产品、营销和您的体验。我们可能以汇总和匿名的形式使用和存储这些信息,以便不与个别终端用户相关联,并且不包括个人信息。
64
-
65
-你的信息是否会与任何人分享?
66
-
67
-简而言之:我们只有在征得您的同意,遵守法律,为您提供服务,保护您的权利,或履行商业义务时才会分享信息。
68
-
69
-我们可能会根据以下法律依据来处理或分享我们所持有的您的数据。
70
-
71
-同意。如果您明确同意我们将您的个人信息用于特定目的,我们可能会处理您的数据。
72
-
73
-合法的利益。在为实现我们的合法商业利益而合理需要时,我们可以处理您的数据。
74
-
75
-合同的履行:如果我们已经与您签订了合同,我们可能会处理您的个人信息以履行我们的合同条款。
76
-
77
-法律义务。在法律要求我们这样做的情况下,我们可能会披露您的信息,以遵守适用法律、政府要求、司法程序、法院命令或法律程序,如回应法院命令或传票(包括回应公共当局以满足国家安全或执法要求)。
78
-
79
-重要的利益。如果我们认为有必要对可能违反我们政策的行为、涉嫌欺诈、涉及对任何人的安全的潜在威胁和非法活动的情况进行调查、预防或采取行动,或作为我们参与的诉讼的证据,我们可能会披露您的信息。
80
-
81
-更具体地说,我们可能需要在以下情况下处理您的数据或分享您的个人信息。
82
-
83
-业务转让。我们可能会在与任何合并、公司资产出售、融资或向另一公司收购我们的全部或部分业务有关的情况下,或在谈判期间分享或转让您的信息。
84
-
85
-我们将您的信息保存多久?
86
-
87
-简而言之:除非法律另有规定,否则我们保留您的信息的时间以实现本隐私声明中所述的目的为限。
88
-
89
-我们只在本隐私通知所述目的所需的时间内保留您的个人信息,除非法律要求或允许更长的保留期(如税务、会计或其他法律要求)。本通知中的任何目的都不会要求我们保留您的个人信息超过90天。
90
-
91
-当我们没有持续的合法业务需要处理您的个人信息时,我们将删除或匿名化这些信息,或者,如果这是不可能的(例如,因为您的个人信息已被存储在备份档案中),那么我们将安全地存储您的个人信息,并将其与任何进一步的处理隔离,直到可能的删除。
92
-
93
-我们如何保证您的信息安全?
94
-
95
-简而言之:我们旨在通过一个组织和技术安全措施系统来保护您的个人信息。
96
-
97
-我们已经实施了适当的技术和组织安全措施,旨在保护我们处理的任何个人信息的安全。然而,尽管我们采取了保障措施并努力确保您的信息安全,但没有任何互联网上的电子传输或信息存储技术可以保证100%的安全,因此我们不能承诺或保证黑客、网络犯罪分子或其他未经授权的第三方将无法击败我们的安全,并不适当地收集、访问、窃取或修改您的信息。尽管我们将尽最大努力保护您的个人信息,但向我们的小程序传输个人信息的风险由您自己承担。您应该只在安全的环境中访问小程序。
98
-
99
-我们是否会对本通知进行更新?
100
-
101
-简而言之:是的,我们会在必要时更新本通知,以保持对相关法律的遵守。
102
-
103
-我们可能不时地更新本隐私声明。更新后的版本将以更新后的 "修订 "日期表示,更新后的版本将在可以获得时立即生效。如果我们对本隐私声明进行了实质性的修改,我们可能会通过在显著位置张贴此类修改的通知或直接向您发送通知来通知您。我们鼓励您经常查看本隐私声明,以了解我们是如何保护您的信息的。
104
-
105
-您如何就本通知联系我们?
106
-
107
-如果您对本通知有疑问或意见,您可以给我们发电子邮件:www.hongpower.cc。
108
-

+ 0
- 56
utils/service.txt Näytä tiedosto

1
-欢迎阅读《APP用户服务协议》(以下简称“本协议”)。本协议阐述之条款和条件适用于您(以下简称“用户”)使用APP的服务。
2
-
3
-一. 服务协议的确认
4
-
5
-(1)北京晟运能源科技有限公司及相关关联企业(以下合称“本公司”)同意按照本协议的规定及其不时发布的操作规则提供基于互联网移动网的APP等相关服务(以下简称“本服务”)。
6
-
7
-(2)本服务使用人(以下简称“用户”)应当基于了解本协议全部内容、在独立思考的基础上认可、同意本协议的全部条款并按照页面上的提示完成全部的注册程序,用户的注册、登录、使用等行为将视为完全接受本协议及本公司公示的各项规则、规范。
8
-
9
-(3)本公司享有对本APP、本公司官方网站上一切活动的监督、提示、检查、纠正等权利。
10
-
11
-二. 服务内容
12
-
13
-(1)本服务的具体内容由本公司根据实际情况提供,本公司有权对其提供的服务或产品形态进行升级或其他调整,均以APP、网站内容更新的方式通知用户,不单独通知用户。
14
-
15
-(2)本公司提供的本服务中可能包括广告,用户同意在使用过程中显示本公司和第三方供应商、合作伙伴提供的广告。
16
-
17
-(3)本公司仅提供与本服务相关的技术服务等,除此之外与相关网络服务有关的设备(如个人电脑、手机、及其他与接入互联网或移动网有关的装置)及所需费用(如为接入互联网而支付的电话费及上网费、为使用移动网而支付的手机费)均应由用户自行负担。
18
-
19
-三. 服务变更、中断或终止
20
-
21
-(1)鉴于网络服务的特殊性(包括但不限于不可抗力、网络稳定性、系统稳定性、技术故障、用户所在位置、用户关机、用户手机病毒或恶意的网络攻击行为及其他任何技术、互联网络、通信线路、内容侵权等原因),用户同意,本公司有权随时中断或终止部分或全部本服务,本公司将尽可能及时以合理方式通知用户,并尽可能在第一时间对此进行修复。但对因此导致用户不能发送和接受阅读信息、或接发错信息,本公司不承担任何责任,用户须承担以上风险。
22
-
23
-(2)用户理解,本公司需要定期或不定期地对提供本服务的平台或相关设备进行检修和维护,如因此类情况而造成服务在合理期间内的中断,本公司将尽可能事先通知,但无需为此承担任何责任。
24
-
25
-(3)用户提供的个人资料不真实、用户违反法律法规国家政策或本协议规定的使用规则,本公司有权随时中断或终止向用户提供本协议项下的本服务,而无需对用户或任何第三方承担任何责任。
26
-
27
-四. 使用规则
28
-
29
-(1)用户在申请注册本服务时,必须向本公司提供准确的主体资料(用户为个人时,包括姓名、电话、邮箱等;用户为单位时,包括名称、注册地址、注册号等),如主体资料有任何变动,必须及时更新。因用户提供资料的真实性问题导致协议双方或第三方的任何损失均由用户承担。
30
-
31
-(2)用户注册成功后,将获得一个本帐号及由用户设置的密码,该用户帐号和密码由用户负责保管;用户应当对该用户帐号所有行为负相关法律责任。
32
-
33
-用户在使用本服务过程中,必须遵循以下原则:
34
-
35
-(2.1) 遵守中国有关的法律和法规;
36
-
37
-(2.2) 不得为任何非法目的而使用本服务;
38
-
39
-(2.3) 遵守所有与网络服务有关的网络协议、规定和程序;
40
-
41
-(2.4) 不得利用本服务系统进行任何可能对互联网的正常运转造成不利影响的行为;
42
-
43
-(2.5) 不得利用本网络服务系统进行任何不利于本公司的行为。
44
-
45
-4.3 用户同意在任何情况下不使用其他用户的帐号或密码。在您怀疑他人在使用您的帐号或密码时,您同意立即通知本公司。
46
-
47
-五. 其他条款
48
-
49
-(1)本公司有权随时修改本协议的任何条款,一旦本协议的内容发生变动,本公司将会在本APP平台中公布修改后的协议内容或通过其他适当方式向用户公布修改内容。用户不同意上述修改内容,有权选择停止使用本服务,但用户继续使用,则视为接受本公司对本协议相关条款的修改。
50
-
51
-(2)本《协议》所定的任何条款无论因何种原因部分或全部无效或不具有执行力,本协议的其余条款仍应有效并具备约束力。
52
-
53
-(3)本协议的订立、执行和解释及纠纷的解决均应适用中华人民共和国法律并受中华人民共和国法院管辖。如双方就本协议内容或执行发生任何纠纷或争议,首先应友好协商解决,协商不成的,任何一方均可向本公司所在地的有管辖权的人民法院提起诉讼。
54
-
55
-(4)本协议的版权归本公司所有,本协议各项条款内容的最终解释权及修改权归本公司所有。
56
-

+ 26
- 1
utils/util.js Näytä tiedosto

51
 // return sevenDaysAgo.format('YYYY-MM-DD HH:mm:ss');
51
 // return sevenDaysAgo.format('YYYY-MM-DD HH:mm:ss');
52
 return sevenDaysAgo.format('YYYY-MM-DD');
52
 return sevenDaysAgo.format('YYYY-MM-DD');
53
 }
53
 }
54
+// 获取当前时间
55
+const CumulativeTimess = n => {
56
+  // 引入moment.js库
57
+const moment = require('moment');
58
+// 获取7天前的时间
59
+let sevenDaysAgo = moment().subtract(n, 'days');
60
+return sevenDaysAgo.format('YYYY-MM-DD HH:mm:ss');
61
+}
62
+// 时间戳转时间
63
+const timestamp = n => {
64
+// 使用 Date 对象将时间戳转换为日期时间字符串
65
+const date = new Date(n);
54
 
66
 
67
+// 使用 Date 对象的方法获取年月日时分秒
68
+const year = date.getFullYear();
69
+const month = date.getMonth() + 1; // 月份是从0开始的,需要加1
70
+const day = date.getDate();
71
+const hours = date.getHours();
72
+const minutes = date.getMinutes();
73
+const seconds = date.getSeconds();
74
+
75
+// 构造你需要的日期时间格式
76
+return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
77
+}
55
 module.exports = {
78
 module.exports = {
56
   formatTime,
79
   formatTime,
57
   Background_base64,
80
   Background_base64,
58
   getdataTime,
81
   getdataTime,
59
-  CumulativeTime
82
+  CumulativeTime,
83
+  timestamp,
84
+  CumulativeTimess
60
 }
85
 }

Loading…
Peruuta
Tallenna