zs 2 năm trước cách đây
mục cha
commit
ef344301e7

+ 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({
 Page({
-
-    /**
-     * 页面的初始数据
-     */
     data: {
     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({
 Page({
-
-    /**
-     * 页面的初始数据
-     */
     data: {
     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%;
+}

+ 1 - 1
pages/smy/index.js

@@ -45,7 +45,7 @@ Page({
                 const arr = await app.$get(`/user/${res.data._id}`);
                 const arr = await app.$get(`/user/${res.data._id}`);
                 if (arr.errcode == '0') {
                 if (arr.errcode == '0') {
                     that.setData({ user: arr.data })
                     that.setData({ user: arr.data })
-                    let btnData = school_menu.find((i) => i.type == arr.data.type);
+                    let btnData = school_menu.find((i) => i.type == '2');
                     that.setData({ list: [...btnData.menu, ...school_sysmenu] })
                     that.setData({ list: [...btnData.menu, ...school_sysmenu] })
                 }
                 }
                 else { wx.showToast({ title: `${arr.errmsg}`, icon: 'error', duration: 2000 }); }
                 else { wx.showToast({ title: `${arr.errmsg}`, icon: 'error', duration: 2000 }); }

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

@@ -42,7 +42,14 @@ Page({
     // 退课
     // 退课
     toDrop: async function (e) {
     toDrop: async function (e) {
         const that = this;
         const that = this;
+        const user = that.data.user;
         const { item } = e.currentTarget.dataset;
         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) {
     toSign: async function (e) {

+ 38 - 44
pages/stuAdmin/fee/list.js

@@ -21,25 +21,20 @@ Page({
             key: 'user',
             key: 'user',
             success: async res => {
             success: async res => {
                 that.setData({ ec: { onInit: that.initChart } })
                 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.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 => {
             fail: async res => {
                 wx.redirectTo({ url: '/pages/index/index' })
                 wx.redirectTo({ url: '/pages/index/index' })
@@ -49,31 +44,30 @@ Page({
     // 饼图
     // 饼图
     initChart(canvas, width, height, dpr) {
     initChart(canvas, width, height, dpr) {
         let that = this;
         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 });
-                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%;
   width: 100%;
   height: 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;
-}