Преглед на файлове

Merge branch 'master' of http://git.cc-lotus.info/ball-court/ball-applet

YY преди 2 години
родител
ревизия
22e830e33e

+ 79 - 30
pages/coaAdmin/lecturestat/list.js

@@ -1,66 +1,115 @@
-// pages/coaAdmin/lecturestat/list.js
+const app = getApp()
+import * as echarts from '../../../commpents/ec-canvas/echarts'
 Page({
-
-    /**
-     * 页面的初始数据
-     */
     data: {
-
+        frameStyle: { useTop: true, name: '授课情况', leftArrow: true, useBar: false },
+        // xdata: []
+    },
+    // 返回
+    back(e) {
+        wx.navigateBack({ delta: 1 })
     },
-
     /**
      * 生命周期函数--监听页面加载
      */
-    onLoad(options) {
-
+    onLoad: function (options) {
     },
-
-    /**
-     * 生命周期函数--监听页面初次渲染完成
-     */
-    onReady() {
-
+    // 监听用户是否登录
+    watchLogin: async function () {
+        const that = this;
+        wx.getStorage({
+            key: 'user',
+            success: async res => {
+                that.setData({ ec: { onInit: that.initChart } })
+                that.data.xdata = [
+                    { value: 2, name: '1月' },
+                    { value: 10, name: '2月' },
+                    { value: 19, name: '3月' },
+                    { value: 20, name: '4月' },
+                    { value: 70, name: '5月' },
+                    { value: 9, name: '6月' },
+                    { value: 12, name: '7月' },
+                    { value: 41, name: '8月' },
+                    { value: 31, name: '9月' },
+                    { value: 13, name: '10月' },
+                    { value: 16, name: '11月' },
+                    { value: 10, name: '12月' }
+                ];
+            },
+            fail: async res => {
+                wx.redirectTo({ url: '/pages/index/index' })
+            }
+        })
+    },
+    // 饼图
+    initChart(canvas, width, height, dpr) {
+        let that = this;
+        var xdata = that.data.xdata;
+        const chart = echarts.init(canvas, null, { width: width, height: height, devicePixelRatio: dpr });
+        canvas.setChart(chart);
+        var option = {
+            tooltip: { trigger: 'item' },
+            legend: {
+                orient: 'vertical',
+                height: 40,
+                padding: 50
+            },
+            series: [
+                {
+                    name: '课时',
+                    type: 'pie',
+                    radius: '50%',
+                    data: xdata,
+                    emphasis: {
+                        itemStyle: { shadowBlur: 10, shadowOffsetX: 0, shadowColor: 'rgba(0, 0, 0, 0.5)' }
+                    }
+                }
+            ]
+        };
+        chart.setOption(option, true);
+        return chart;
     },
-
+    /**
+    * 生命周期函数--监听页面初次渲染完成
+    */
+    onReady: function () { },
     /**
      * 生命周期函数--监听页面显示
      */
-    onShow() {
-
+    onShow: function () {
+        const that = this;
+        // 监听用户是否登录
+        that.watchLogin();
     },
-
+    /**
+     * 页面上拉触底事件的处理函数
+     */
     /**
      * 生命周期函数--监听页面隐藏
      */
-    onHide() {
+    onHide: function () {
 
     },
 
     /**
      * 生命周期函数--监听页面卸载
      */
-    onUnload() {
+    onUnload: function () {
 
     },
 
     /**
      * 页面相关事件处理函数--监听用户下拉动作
      */
-    onPullDownRefresh() {
+    onPullDownRefresh: function () {
 
     },
 
-    /**
-     * 页面上拉触底事件的处理函数
-     */
-    onReachBottom() {
-
-    },
 
     /**
      * 用户点击右上角分享
      */
-    onShareAppMessage() {
+    onShareAppMessage: function (res) {
 
-    }
+    },
 })

+ 6 - 2
pages/coaAdmin/lecturestat/list.json

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

+ 11 - 0
pages/coaAdmin/lecturestat/list.less

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

+ 5 - 2
pages/coaAdmin/lecturestat/list.wxml

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

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

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

+ 79 - 30
pages/coaAdmin/studentstat/list.js

@@ -1,66 +1,115 @@
-// pages/coaAdmin/studentstat/list.js
+const app = getApp()
+import * as echarts from '../../../commpents/ec-canvas/echarts'
 Page({
-
-    /**
-     * 页面的初始数据
-     */
     data: {
-
+        frameStyle: { useTop: true, name: '学员情况', leftArrow: true, useBar: false },
+        // xdata: []
+    },
+    // 返回
+    back(e) {
+        wx.navigateBack({ delta: 1 })
     },
-
     /**
      * 生命周期函数--监听页面加载
      */
-    onLoad(options) {
-
+    onLoad: function (options) {
     },
-
-    /**
-     * 生命周期函数--监听页面初次渲染完成
-     */
-    onReady() {
-
+    // 监听用户是否登录
+    watchLogin: async function () {
+        const that = this;
+        wx.getStorage({
+            key: 'user',
+            success: async res => {
+                that.setData({ ec: { onInit: that.initChart } })
+                that.data.xdata = [
+                    { value: 2, name: '1月' },
+                    { value: 10, name: '2月' },
+                    { value: 19, name: '3月' },
+                    { value: 20, name: '4月' },
+                    { value: 70, name: '5月' },
+                    { value: 9, name: '6月' },
+                    { value: 12, name: '7月' },
+                    { value: 41, name: '8月' },
+                    { value: 31, name: '9月' },
+                    { value: 13, name: '10月' },
+                    { value: 16, name: '11月' },
+                    { value: 10, name: '12月' }
+                ];
+            },
+            fail: async res => {
+                wx.redirectTo({ url: '/pages/index/index' })
+            }
+        })
+    },
+    // 饼图
+    initChart(canvas, width, height, dpr) {
+        let that = this;
+        var xdata = that.data.xdata;
+        const chart = echarts.init(canvas, null, { width: width, height: height, devicePixelRatio: dpr });
+        canvas.setChart(chart);
+        var option = {
+            tooltip: { trigger: 'item' },
+            legend: {
+                orient: 'vertical',
+                height: 40,
+                padding: 50
+            },
+            series: [
+                {
+                    name: '学员',
+                    type: 'pie',
+                    radius: '50%',
+                    data: xdata,
+                    emphasis: {
+                        itemStyle: { shadowBlur: 10, shadowOffsetX: 0, shadowColor: 'rgba(0, 0, 0, 0.5)' }
+                    }
+                }
+            ]
+        };
+        chart.setOption(option, true);
+        return chart;
     },
-
+    /**
+    * 生命周期函数--监听页面初次渲染完成
+    */
+    onReady: function () { },
     /**
      * 生命周期函数--监听页面显示
      */
-    onShow() {
-
+    onShow: function () {
+        const that = this;
+        // 监听用户是否登录
+        that.watchLogin();
     },
-
+    /**
+     * 页面上拉触底事件的处理函数
+     */
     /**
      * 生命周期函数--监听页面隐藏
      */
-    onHide() {
+    onHide: function () {
 
     },
 
     /**
      * 生命周期函数--监听页面卸载
      */
-    onUnload() {
+    onUnload: function () {
 
     },
 
     /**
      * 页面相关事件处理函数--监听用户下拉动作
      */
-    onPullDownRefresh() {
+    onPullDownRefresh: function () {
 
     },
 
-    /**
-     * 页面上拉触底事件的处理函数
-     */
-    onReachBottom() {
-
-    },
 
     /**
      * 用户点击右上角分享
      */
-    onShareAppMessage() {
+    onShareAppMessage: function (res) {
 
-    }
+    },
 })

+ 6 - 2
pages/coaAdmin/studentstat/list.json

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

+ 11 - 0
pages/coaAdmin/studentstat/list.less

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

+ 5 - 2
pages/coaAdmin/studentstat/list.wxml

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

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

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

+ 7 - 0
pages/stuAdmin/course/list.js

@@ -42,7 +42,14 @@ Page({
     // 退课
     toDrop: async function (e) {
         const that = this;
+        const user = that.data.user;
         const { item } = e.currentTarget.dataset;
+        let toRefund = await app.$post(`/lessonStudent/toRefund`, { student_id: user.info.id, lesson_id: item._id });
+        if (toRefund.errcode == '0') {
+            wx.showToast({ title: `退课成功 钱返回余额中`, icon: 'success', duration: 2000 });
+            that.setData({ skip: 0, page: 0, list: [] })
+            that.watchLogin();
+        } else wx.showToast({ title: `${toRefund.errmsg}`, icon: 'none', duration: 2000 })
     },
     // 签到
     toSign: async function (e) {

+ 40 - 59
pages/stuAdmin/fee/list.js

@@ -3,6 +3,7 @@ import * as echarts from '../../../commpents/ec-canvas/echarts'
 Page({
     data: {
         frameStyle: { useTop: true, name: '付费情况', leftArrow: true, useBar: false },
+        // xdata: []
     },
     // 返回
     back(e) {
@@ -19,30 +20,21 @@ Page({
         wx.getStorage({
             key: 'user',
             success: async res => {
-                that.setData({
-                    ec: {
-                        onInit: that.initChart
-                    }
-                })
-                // 模拟请求
-                var times = setTimeout(async function () {
-                    // 数据
-                    that.data.xdata = [
-                        { value: 2, name: '1月(钱数)' },
-                        { value: 10, name: '2月(钱数)' },
-                        { value: 19, name: '3月(钱数)' },
-                        { value: 20, name: '4月(钱数)' },
-                        { value: 70, name: '5月(钱数)' },
-                        { value: 9, name: '6月(钱数)' },
-                        { value: 12, name: '7月(钱数)' },
-                        { value: 41, name: '8月(钱数)' },
-                        { value: 31, name: '9月(钱数)' },
-                        { value: 13, name: '10月(钱数)' },
-                        { value: 16, name: '11月(钱数)' },
-                        { value: 10, name: '12月(钱数)' }
-                    ];
-                    clearTimeout(times);
-                }, 1000)
+                that.setData({ ec: { onInit: that.initChart } })
+                that.data.xdata = [
+                    { value: 2, name: '1月' },
+                    { value: 10, name: '2月' },
+                    { value: 19, name: '3月' },
+                    { value: 20, name: '4月' },
+                    { value: 70, name: '5月' },
+                    { value: 9, name: '6月' },
+                    { value: 12, name: '7月' },
+                    { value: 41, name: '8月' },
+                    { value: 31, name: '9月' },
+                    { value: 13, name: '10月' },
+                    { value: 16, name: '11月' },
+                    { value: 10, name: '12月' }
+                ];
             },
             fail: async res => {
                 wx.redirectTo({ url: '/pages/index/index' })
@@ -52,41 +44,30 @@ Page({
     // 饼图
     initChart(canvas, width, height, dpr) {
         let that = this;
-        // 由于请求数据有延迟所以写一个时间函数,当数据存在的时候再执行绘制
-        var times = setInterval(function () {
-            var xdata = that.data.xdata;
-            if (xdata) {
-                clearInterval(times)
-                const chart = echarts.init(canvas, null, {
-                    width: width,
-                    height: height,
-                    devicePixelRatio: dpr // new
-                });
-                canvas.setChart(chart);
-                var option = {
-                    tooltip: {
-                        trigger: 'item'
-                    },
-                    series: [
-                        {
-                            name: 'Access From',
-                            type: 'pie',
-                            radius: '50%',
-                            data: xdata,
-                            emphasis: {
-                                itemStyle: {
-                                    shadowBlur: 10,
-                                    shadowOffsetX: 0,
-                                    shadowColor: 'rgba(0, 0, 0, 0.5)'
-                                }
-                            }
-                        }
-                    ]
-                };
-                chart.setOption(option, true);
-                return chart;
-            }
-        }, 100)
+        var xdata = that.data.xdata;
+        const chart = echarts.init(canvas, null, { width: width, height: height, devicePixelRatio: dpr });
+        canvas.setChart(chart);
+        var option = {
+            tooltip: { trigger: 'item' },
+            legend: {
+                orient: 'vertical',
+                height: 40,
+                padding: 50
+            },
+            series: [
+                {
+                    name: '课时费',
+                    type: 'pie',
+                    radius: '50%',
+                    data: xdata,
+                    emphasis: {
+                        itemStyle: { shadowBlur: 10, shadowOffsetX: 0, shadowColor: 'rgba(0, 0, 0, 0.5)' }
+                    }
+                }
+            ]
+        };
+        chart.setOption(option, true);
+        return chart;
     },
     /**
     * 生命周期函数--监听页面初次渲染完成

+ 9 - 15
pages/stuAdmin/fee/list.less

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

+ 5 - 13
pages/stuAdmin/fee/list.wxss

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

+ 7 - 4
pages/stuAdmin/study/list.js

@@ -104,7 +104,12 @@ Page({
                         {
                             type: 'category',
                             boundaryGap: false,
-                            //设置x轴线的属性
+                            // 设置x轴线的属性
+                            axisLabel: {
+                                //x轴文字的配置
+                                show: true,
+                                interval: 0,//使x轴文字显示全
+                            },
                             axisLine: {
                                 lineStyle: {
                                     color: '#4CA6A3', // 设置x轴字体颜色
@@ -133,10 +138,8 @@ Page({
                         },
                         {
                             type: 'value',
-                            name: "签到数",
-                            nameLocation: "center",
                             alignTicks: true,
-                            nameGap: 35,
+                            nameGap: 10,
                             nameRotate: 0,
                             nameTextStyle: {
                                 fontSize: 16,