YY 2 سال پیش
والد
کامیت
1e4ef9eb76

+ 122 - 64
pages/coaAdmin/incomestat/list.js

@@ -1,66 +1,124 @@
-// pages/coaAdmin/incomestat/list.js
+const app = getApp()
+import * as echarts from '../../../commpents/ec-canvas/echarts'
 Page({
 Page({
-
-    /**
-     * 页面的初始数据
-     */
-    data: {
-
-    },
-
-    /**
-     * 生命周期函数--监听页面加载
-     */
-    onLoad(options) {
-
-    },
-
-    /**
-     * 生命周期函数--监听页面初次渲染完成
-     */
-    onReady() {
-
-    },
-
-    /**
-     * 生命周期函数--监听页面显示
-     */
-    onShow() {
-
-    },
-
-    /**
-     * 生命周期函数--监听页面隐藏
-     */
-    onHide() {
-
-    },
-
-    /**
-     * 生命周期函数--监听页面卸载
-     */
-    onUnload() {
-
-    },
-
-    /**
-     * 页面相关事件处理函数--监听用户下拉动作
-     */
-    onPullDownRefresh() {
-
-    },
-
-    /**
-     * 页面上拉触底事件的处理函数
-     */
-    onReachBottom() {
-
-    },
-
-    /**
-     * 用户点击右上角分享
-     */
-    onShareAppMessage() {
-
-    }
+  data: {
+    frameStyle: { useTop: true, name: '收入统计', leftArrow: true, useBar: false },
+  },
+  // 返回
+  back(e) {
+    wx.navigateBack({ delta: 1 })
+  },
+  /**
+   * 生命周期函数--监听页面加载
+   */
+  onLoad: function (options) {
+  },
+  // 监听用户是否登录
+  watchLogin: async function () {
+    const that = this;
+    wx.getStorage({
+      key: 'user',
+      success: async res => {
+        that.setData({ ec: { onInit: that.initChart } })
+        that.data.date = ['1月', '2月', '3月', '4月', '5月', '6月', '7月', '8月', '9月', '10月', '11月', '12月'];
+        that.data.money = [11218, 5316, 6165, 8810, 3178, 5140, 2133, 6199, 4180, 6167, 7115, 1719];
+      },
+      fail: async res => {
+        wx.redirectTo({ url: '/pages/index/index' })
+      }
+    })
+  },
+  // 折线图
+  initChart(canvas, width, height, dpr) {
+    let that = this;
+    var date = that.data.date;
+    var money = that.data.money;
+    const chart = echarts.init(canvas, null, {
+      width: width,
+      height: height,
+      devicePixelRatio: dpr
+    });
+    canvas.setChart(chart);
+    var option = {
+      grid: {
+        left: 20,
+        right: 20,
+        bottom: 145,
+        top: 60,
+        containLabel: true
+      },
+      tooltip: {
+        show: true,
+        trigger: 'axis',
+        formatter: '{b}:{c}%' // 格式化数值百分比输出
+      },
+      xAxis: {
+        type: 'category',
+        boundaryGap: false,
+        data: date,
+        // 设置x轴线的属性
+        //使x轴文字显示全
+        axisLabel: { show: true, interval: 0, },
+      },
+      yAxis: {
+        x: 'center',
+        type: 'value',
+        splitLine: {
+          lineStyle: { type: 'dashed' }
+        }
+      },
+      series: [
+        {
+          type: 'line',
+          smooth: true,
+          data: money
+        }
+      ]
+    };
+    chart.setOption(option, true);
+    return chart;
+  },
+  /**
+ * 生命周期函数--监听页面初次渲染完成
+ */
+  onReady: function () { },
+  /**
+   * 生命周期函数--监听页面显示
+   */
+  onShow: function () {
+    const that = this;
+    // 监听用户是否登录
+    that.watchLogin();
+  },
+  /**
+   * 页面上拉触底事件的处理函数
+   */
+  /**
+   * 生命周期函数--监听页面隐藏
+   */
+  onHide: function () {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面卸载
+   */
+  onUnload: function () {
+
+  },
+
+  /**
+   * 页面相关事件处理函数--监听用户下拉动作
+   */
+  onPullDownRefresh: function () {
+
+  },
+
+
+  /**
+   * 用户点击右上角分享
+   */
+  onShareAppMessage: function (res) {
+
+  },
 })
 })

+ 6 - 1
pages/coaAdmin/incomestat/list.json

@@ -1,3 +1,8 @@
 {
 {
-    "usingComponents": {}
+  "component": true,
+  "usingComponents": {
+    "mobile-main": "/commpents/mobile-frame/index",
+    "ec-canvas": "/commpents/ec-canvas/ec-canvas",
+    "s-tab": "/commpents/tabs/index"
+  }
 }
 }

+ 9 - 0
pages/coaAdmin/incomestat/list.less

@@ -0,0 +1,9 @@
+.main {
+  background-color: var(--mainColor);
+  height: var(--twoHeight);
+
+  ec-canvas {
+      width: 100%;
+      height: 100%;
+  }
+}

+ 7 - 2
pages/coaAdmin/incomestat/list.wxml

@@ -1,2 +1,7 @@
-<!--pages/coaAdmin/incomestat/list.wxml-->
-<text>pages/coaAdmin/incomestat/list.wxml</text>
+<mobile-main frameStyle="{{frameStyle}}" bind:back="back">
+  <view slot="info" class="container main">
+    <view class="container">
+      <ec-canvas id="mychart-dom-pie" canvas-id="mychart-pie" ec="{{ ec }}"></ec-canvas>
+    </view>
+  </view>
+</mobile-main>

+ 8 - 1
pages/coaAdmin/incomestat/list.wxss

@@ -1 +1,8 @@
-/* pages/coaAdmin/incomestat/list.wxss */
+.main {
+  background-color: var(--mainColor);
+  height: var(--twoHeight);
+}
+.main ec-canvas {
+  width: 100%;
+  height: 100%;
+}

+ 5 - 19
pages/schAdmin/coachstat/list.less

@@ -5,8 +5,6 @@
   .top {
   .top {
     margin: 0 10vw;
     margin: 0 10vw;
   }
   }
-
-
   .two {
   .two {
     position: relative;
     position: relative;
     flex-grow: 1;
     flex-grow: 1;
@@ -19,29 +17,17 @@
         position: relative;
         position: relative;
         height: 81vh;
         height: 81vh;
 
 
-        ec-canvas {
-          width: 100%;
-          height: 100%;
-        }
-
         .container {
         .container {
           position: absolute;
           position: absolute;
-          top: 0;
-          bottom: 0;
-          left: 0;
-          right: 0;
-          display: flex;
-          flex-direction: column;
-          align-items: center;
-          justify-content: space-between;
-          box-sizing: border-box;
+
+          ec-canvas {
+            width: 100%;
+            height: 100%;
+          }
         }
         }
       }
       }
     }
     }
   }
   }
-
-
-
 }
 }
 
 
 .scroll-view {
 .scroll-view {

+ 4 - 13
pages/schAdmin/coachstat/list.wxss

@@ -17,21 +17,12 @@
   position: relative;
   position: relative;
   height: 81vh;
   height: 81vh;
 }
 }
-.main .two .a .one ec-canvas {
-  width: 100%;
-  height: 100%;
-}
 .main .two .a .one .container {
 .main .two .a .one .container {
   position: absolute;
   position: absolute;
-  top: 0;
-  bottom: 0;
-  left: 0;
-  right: 0;
-  display: flex;
-  flex-direction: column;
-  align-items: center;
-  justify-content: space-between;
-  box-sizing: border-box;
+}
+.main .two .a .one .container ec-canvas {
+  width: 100%;
+  height: 100%;
 }
 }
 .scroll-view {
 .scroll-view {
   position: absolute;
   position: absolute;

+ 2 - 2
pages/schAdmin/income/list.js

@@ -50,9 +50,9 @@ Page({
       legend: { data: [] },
       legend: { data: [] },
       grid: {
       grid: {
         left: 20,
         left: 20,
-        // right: 20,
+        right: 60,
         bottom: 15,
         bottom: 15,
-        // top: 40,
+        top: 40,
         containLabel: true
         containLabel: true
       },
       },
       xAxis: [
       xAxis: [

+ 14 - 22
pages/schAdmin/income/list.less

@@ -1,26 +1,18 @@
-.top {
-  display: flex;
-  flex-direction: row;
+.main {
+  background-color: var(--mainColor);
+  height: var(--twoHeight);
 
 
-  button {
-    margin: 0 1vw;
-  }
-}
+  .top {
+    text-align: center;
 
 
-ec-canvas {
-  width: 100%;
-  height: 100%;
-}
+    button {
+      margin: 0 1vw;
+      width: 20vw;
+    }
+  }
 
 
-.container {
-  position: absolute;
-  top: 0;
-  bottom: 0;
-  left: 0;
-  right: 0;
-  display: flex;
-  flex-direction: column;
-  align-items: center;
-  justify-content: space-between;
-  box-sizing: border-box;
+  ec-canvas {
+    width: 100%;
+    height: 100%;
+  }
 }
 }

+ 9 - 17
pages/schAdmin/income/list.wxss

@@ -1,23 +1,15 @@
-.top {
-  display: flex;
-  flex-direction: row;
+.main {
+  background-color: var(--mainColor);
+  height: var(--twoHeight);
 }
 }
-.top button {
+.main .top {
+  text-align: center;
+}
+.main .top button {
   margin: 0 1vw;
   margin: 0 1vw;
+  width: 20vw;
 }
 }
-ec-canvas {
+.main ec-canvas {
   width: 100%;
   width: 100%;
   height: 100%;
   height: 100%;
 }
 }
-.container {
-  position: absolute;
-  top: 0;
-  bottom: 0;
-  left: 0;
-  right: 0;
-  display: flex;
-  flex-direction: column;
-  align-items: center;
-  justify-content: space-between;
-  box-sizing: border-box;
-}

+ 6 - 8
pages/schAdmin/stustat/list.less

@@ -1,11 +1,9 @@
 .main {
 .main {
-    background-color: var(--mainColor);
-    height: var(--twoHeight);
+  background-color: var(--mainColor);
+  height: var(--twoHeight);
 
 
-
-
-    ec-canvas {
-        width: 100%;
-        height: 100%;
-    }
+  ec-canvas {
+    width: 100%;
+    height: 100%;
+  }
 }
 }