zs %!s(int64=2) %!d(string=hai) anos
pai
achega
03d24df86a

+ 45 - 23
pagesSchool/coaAdmin/stat/lecture.js

@@ -1,18 +1,37 @@
 const app = getApp()
 import * as echarts from '../../../commpents/ec-canvas/echarts'
+let chart;
 Page({
     data: {
         frameStyle: { useTop: true, name: '授课情况', leftArrow: true, useBar: false },
-        // xdata: []
+        xdata: [],
+        // 学校
+        zhSchool: '',
+        school_id: '',
+        schoolList: [],
     },
     // 返回
     back(e) {
         wx.navigateBack({ delta: 1 })
     },
+    // 选择学校
+    schoolChange: function (e) {
+        const that = this;
+        let data = that.data.schoolList[e.detail.value];
+        if (data) {
+            that.setData({ school_id: data.school_id });
+            that.setData({ zhSchool: data.school_id_name });
+        }
+        that.watchLogin();
+    },
     /**
      * 生命周期函数--监听页面加载
      */
-    onLoad: function (options) {
+    onLoad: async function (options) {
+        const that = this;
+        that.setData({ ec: { onInit: that.initChart } })
+        // 监听用户是否登录
+        await that.watchLogin();
     },
     // 监听用户是否登录
     watchLogin: async function () {
@@ -20,21 +39,21 @@ Page({
         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月' }
-                ];
+                // 学校
+                const school = await app.$get(`/rcs`, { coach_id: res.data.info.id });
+                if (school.errcode == '0' && school.total > 0) {
+                    that.setData({ schoolList: school.data })
+                }
+                if (that.data.school_id) {
+                    const arr = await app.$get(`/statistics/coachLesson`, { school_id: res.data.info.id, coach_id: res.data.info.id });
+                    if (arr.errcode == '0') {
+                        that.setData({ xdata: arr.data })
+                        const option = {
+                            series: [{ data: arr.data }],
+                        }
+                        if (chart) chart.setOption(option)
+                    }
+                }
             },
             fail: async res => {
                 wx.redirectTo({ url: '/pages/index/index' })
@@ -43,9 +62,9 @@ Page({
     },
     // 饼图
     initChart(canvas, width, height, dpr) {
-        let that = this;
+        const that = this;
         var xdata = that.data.xdata;
-        const chart = echarts.init(canvas, null, { width: width, height: height, devicePixelRatio: dpr });
+        chart = echarts.init(canvas, null, { width: width, height: height, devicePixelRatio: dpr });
         canvas.setChart(chart);
         var option = {
             tooltip: { trigger: 'item' },
@@ -56,12 +75,18 @@ Page({
             },
             series: [
                 {
-                    name: '课时',
+                    name: '授课情况',
                     type: 'pie',
                     radius: '50%',
                     data: xdata,
                     emphasis: {
                         itemStyle: { shadowBlur: 10, shadowOffsetX: 0, shadowColor: 'rgba(0, 0, 0, 0.5)' }
+                    },
+                    label: {
+                        normal: {
+                            show: true,
+                            formatter: '{b}({c}节课)'
+                        }
                     }
                 }
             ]
@@ -77,9 +102,6 @@ Page({
      * 生命周期函数--监听页面显示
      */
     onShow: function () {
-        const that = this;
-        // 监听用户是否登录
-        that.watchLogin();
     },
     /**
      * 页面上拉触底事件的处理函数

+ 7 - 1
pagesSchool/coaAdmin/stat/lecture.less

@@ -4,7 +4,13 @@
     background-color: var(--mainColor);
     height: var(--twoHeight);
 
-
+    .top {
+        font-size: var(--font14Size);
+        background: -webkit-linear-gradient(right, lightblue, #53C9F8);
+        padding: 2vw;
+        text-align: center;
+        color: var(--mainColor);
+    }
 
     ec-canvas {
         width: 100%;

+ 5 - 0
pagesSchool/coaAdmin/stat/lecture.wxml

@@ -1,5 +1,10 @@
 <mobile-main frameStyle="{{frameStyle}}" bind:back="back">
     <view slot="info" class="container main">
+        <view class="top">
+            <picker mode="selector" bindchange="schoolChange" name="school_id" value="{{school_id}}" range="{{schoolList}}" range-key="school_id_name">
+                <view class="picker">{{zhSchool||'请选择学校'}}</view>
+            </picker>
+        </view>
         <ec-canvas id="mychart-dom-pie" canvas-id="mychart-pie" ec="{{ ec }}"></ec-canvas>
     </view>
 </mobile-main>

+ 7 - 0
pagesSchool/coaAdmin/stat/lecture.wxss

@@ -3,6 +3,13 @@
   background-color: var(--mainColor);
   height: var(--twoHeight);
 }
+.main .top {
+  font-size: var(--font14Size);
+  background: -webkit-linear-gradient(right, lightblue, #53C9F8);
+  padding: 2vw;
+  text-align: center;
+  color: var(--mainColor);
+}
 .main ec-canvas {
   width: 100%;
   height: 100%;

+ 45 - 23
pagesSchool/coaAdmin/stat/student.js

@@ -1,18 +1,37 @@
 const app = getApp()
 import * as echarts from '../../../commpents/ec-canvas/echarts'
+let chart;
 Page({
     data: {
         frameStyle: { useTop: true, name: '学员情况', leftArrow: true, useBar: false },
-        // xdata: []
+        xdata: [],
+        // 学校
+        zhSchool: '',
+        school_id: '',
+        schoolList: [],
     },
     // 返回
     back(e) {
         wx.navigateBack({ delta: 1 })
     },
+    // 选择学校
+    schoolChange: function (e) {
+        const that = this;
+        let data = that.data.schoolList[e.detail.value];
+        if (data) {
+            that.setData({ school_id: data.school_id });
+            that.setData({ zhSchool: data.school_id_name });
+        }
+        that.watchLogin();
+    },
     /**
      * 生命周期函数--监听页面加载
      */
-    onLoad: function (options) {
+    onLoad: async function (options) {
+        const that = this;
+        that.setData({ ec: { onInit: that.initChart } })
+        // 监听用户是否登录
+        await that.watchLogin();
     },
     // 监听用户是否登录
     watchLogin: async function () {
@@ -20,21 +39,21 @@ Page({
         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月' }
-                ];
+                // 学校
+                const school = await app.$get(`/rcs`, { coach_id: res.data.info.id });
+                if (school.errcode == '0' && school.total > 0) {
+                    that.setData({ schoolList: school.data })
+                }
+                if (that.data.school_id) {
+                    const arr = await app.$get(`/statistics/coachStudentLesson`, { school_id: res.data.info.id, coach_id: res.data.info.id });
+                    if (arr.errcode == '0') {
+                        that.setData({ xdata: arr.data })
+                        const option = {
+                            series: [{ data: arr.data }],
+                        }
+                        if (chart) chart.setOption(option)
+                    }
+                }
             },
             fail: async res => {
                 wx.redirectTo({ url: '/pages/index/index' })
@@ -43,9 +62,9 @@ Page({
     },
     // 饼图
     initChart(canvas, width, height, dpr) {
-        let that = this;
+        const that = this;
         var xdata = that.data.xdata;
-        const chart = echarts.init(canvas, null, { width: width, height: height, devicePixelRatio: dpr });
+        chart = echarts.init(canvas, null, { width: width, height: height, devicePixelRatio: dpr });
         canvas.setChart(chart);
         var option = {
             tooltip: { trigger: 'item' },
@@ -56,12 +75,18 @@ Page({
             },
             series: [
                 {
-                    name: '学员',
+                    name: '学员情况',
                     type: 'pie',
                     radius: '50%',
                     data: xdata,
                     emphasis: {
                         itemStyle: { shadowBlur: 10, shadowOffsetX: 0, shadowColor: 'rgba(0, 0, 0, 0.5)' }
+                    },
+                    label: {
+                        normal: {
+                            show: true,
+                            formatter: '{b}({c}名)'
+                        }
                     }
                 }
             ]
@@ -77,9 +102,6 @@ Page({
      * 生命周期函数--监听页面显示
      */
     onShow: function () {
-        const that = this;
-        // 监听用户是否登录
-        that.watchLogin();
     },
     /**
      * 页面上拉触底事件的处理函数

+ 9 - 1
pagesSchool/coaAdmin/stat/student.less

@@ -1,8 +1,16 @@
+@import (css) "/app.wxss";
+
 .main {
     background-color: var(--mainColor);
     height: var(--twoHeight);
 
-
+    .top {
+        font-size: var(--font14Size);
+        background: -webkit-linear-gradient(right, lightblue, #53C9F8);
+        padding: 2vw;
+        text-align: center;
+        color: var(--mainColor);
+    }
 
     ec-canvas {
         width: 100%;

+ 5 - 0
pagesSchool/coaAdmin/stat/student.wxml

@@ -1,5 +1,10 @@
 <mobile-main frameStyle="{{frameStyle}}" bind:back="back">
     <view slot="info" class="container main">
+        <view class="top">
+            <picker mode="selector" bindchange="schoolChange" name="school_id" value="{{school_id}}" range="{{schoolList}}" range-key="school_id_name">
+                <view class="picker">{{zhSchool||'请选择学校'}}</view>
+            </picker>
+        </view>
         <ec-canvas id="mychart-dom-pie" canvas-id="mychart-pie" ec="{{ ec }}"></ec-canvas>
     </view>
 </mobile-main>

+ 12 - 7
pagesSchool/coaAdmin/stat/student.wxss

@@ -1,11 +1,16 @@
 @import "/app.wxss";
-
 .main {
-    background-color: var(--mainColor);
-    height: var(--twoHeight);
+  background-color: var(--mainColor);
+  height: var(--twoHeight);
+}
+.main .top {
+  font-size: var(--font14Size);
+  background: -webkit-linear-gradient(right, lightblue, #53C9F8);
+  padding: 2vw;
+  text-align: center;
+  color: var(--mainColor);
 }
-
 .main ec-canvas {
-    width: 100%;
-    height: 100%;
-}
+  width: 100%;
+  height: 100%;
+}

+ 44 - 22
pagesSchool/stuAdmin/stat/fee.js

@@ -1,18 +1,37 @@
 const app = getApp()
 import * as echarts from '../../../commpents/ec-canvas/echarts'
+let chart;
 Page({
     data: {
         frameStyle: { useTop: true, name: '付费情况', leftArrow: true, useBar: false },
-        // xdata: []
+        xdata: [],
+        // 学校
+        zhSchool: '',
+        school_id: '',
+        schoolList: [],
     },
     // 返回
     back(e) {
         wx.navigateBack({ delta: 1 })
     },
+    // 选择学校
+    schoolChange: function (e) {
+        const that = this;
+        let data = that.data.schoolList[e.detail.value];
+        if (data) {
+            that.setData({ school_id: data.school_id });
+            that.setData({ zhSchool: data.school_id_name });
+        }
+        that.watchLogin();
+    },
     /**
      * 生命周期函数--监听页面加载
      */
-    onLoad: function (options) {
+    onLoad: async function (options) {
+        const that = this;
+        that.setData({ ec: { onInit: that.initChart } })
+        // 监听用户是否登录
+        await that.watchLogin();
     },
     // 监听用户是否登录
     watchLogin: async function () {
@@ -20,21 +39,21 @@ Page({
         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月' }
-                ];
+                // 学校
+                const school = await app.$get(`/rss`, { student_id: res.data.info.id });
+                if (school.errcode == '0' && school.total > 0) {
+                    that.setData({ schoolList: school.data })
+                }
+                if (that.data.school_id) {
+                    const arr = await app.$get(`/statistics/studentPay`, { school_id: res.data.info.id, student_id: res.data.info.id });
+                    if (arr.errcode == '0') {
+                        that.setData({ xdata: arr.data })
+                        const option = {
+                            series: [{ data: arr.data }],
+                        }
+                        if (chart) chart.setOption(option)
+                    }
+                }
             },
             fail: async res => {
                 wx.redirectTo({ url: '/pages/index/index' })
@@ -43,9 +62,9 @@ Page({
     },
     // 饼图
     initChart(canvas, width, height, dpr) {
-        let that = this;
+        const that = this;
         var xdata = that.data.xdata;
-        const chart = echarts.init(canvas, null, { width: width, height: height, devicePixelRatio: dpr });
+        chart = echarts.init(canvas, null, { width: width, height: height, devicePixelRatio: dpr });
         canvas.setChart(chart);
         var option = {
             tooltip: { trigger: 'item' },
@@ -62,6 +81,12 @@ Page({
                     data: xdata,
                     emphasis: {
                         itemStyle: { shadowBlur: 10, shadowOffsetX: 0, shadowColor: 'rgba(0, 0, 0, 0.5)' }
+                    },
+                    label: {
+                        normal: {
+                            show: true,
+                            formatter: '{b}({c}元)'
+                        }
                     }
                 }
             ]
@@ -77,9 +102,6 @@ Page({
      * 生命周期函数--监听页面显示
      */
     onShow: function () {
-        const that = this;
-        // 监听用户是否登录
-        that.watchLogin();
     },
     /**
      * 页面上拉触底事件的处理函数

+ 8 - 1
pagesSchool/stuAdmin/stat/fee.less

@@ -1,9 +1,16 @@
 @import (css) "/app.wxss";
+
 .main {
     background-color: var(--mainColor);
     height: var(--twoHeight);
 
-
+    .top {
+        font-size: var(--font14Size);
+        background: -webkit-linear-gradient(right, lightblue, #53C9F8);
+        padding: 2vw;
+        text-align: center;
+        color: var(--mainColor);
+    }
 
     ec-canvas {
         width: 100%;

+ 5 - 0
pagesSchool/stuAdmin/stat/fee.wxml

@@ -1,5 +1,10 @@
 <mobile-main frameStyle="{{frameStyle}}" bind:back="back">
     <view slot="info" class="container main">
+        <view class="top">
+            <picker mode="selector" bindchange="schoolChange" name="school_id" value="{{school_id}}" range="{{schoolList}}" range-key="school_id_name">
+                <view class="picker">{{zhSchool||'请选择学校'}}</view>
+            </picker>
+        </view>
         <ec-canvas id="mychart-dom-pie" canvas-id="mychart-pie" ec="{{ ec }}"></ec-canvas>
     </view>
 </mobile-main>

+ 7 - 0
pagesSchool/stuAdmin/stat/fee.wxss

@@ -3,6 +3,13 @@
   background-color: var(--mainColor);
   height: var(--twoHeight);
 }
+.main .top {
+  font-size: var(--font14Size);
+  background: -webkit-linear-gradient(right, lightblue, #53C9F8);
+  padding: 2vw;
+  text-align: center;
+  color: var(--mainColor);
+}
 .main ec-canvas {
   width: 100%;
   height: 100%;

+ 26 - 2
pagesSchool/stuAdmin/stat/study.js

@@ -3,11 +3,25 @@ import * as echarts from '../../../commpents/ec-canvas/echarts'
 Page({
     data: {
         frameStyle: { useTop: true, name: '学校学习情况', leftArrow: true, useBar: false },
+        // 学校
+        zhSchool: '',
+        school_id: '',
+        schoolList: [],
     },
     // 返回
     back(e) {
         wx.navigateBack({ delta: 1 })
     },
+    // 选择学校
+    schoolChange: function (e) {
+        const that = this;
+        let data = that.data.schoolList[e.detail.value];
+        if (data) {
+            that.setData({ school_id: data.school_id });
+            that.setData({ zhSchool: data.school_id_name });
+        }
+        that.watchLogin();
+    },
     /**
      * 生命周期函数--监听页面加载
      */
@@ -26,8 +40,18 @@ Page({
                 })
                 // 模拟请求
                 var times = setTimeout(async function () {
-                    that.data.data1 = [230, 150, 178, 70, 178, 340, 133, 118, 136, 165, 130, 178];
-                    that.data.data2 = [112, 150, 151, 135, 170, 130, 200, 112, 150, 151, 135, 170];
+                    // 学校
+                    const school = await app.$get(`/rss`, { student_id: res.data.info.id });
+                    if (school.errcode == '0' && school.total > 0) {
+                        that.setData({ schoolList: school.data })
+                    }
+                    if (that.data.school_id) {
+                        const arr = await app.$get(`/statistics/studentLearning`, { school_id: res.data.info.id, student_id: res.data.info.id });
+                        if (arr.errcode == '0') {
+                            that.data.data1 = arr.data.signs;
+                            that.data.data2 = arr.data.minutes;
+                        }
+                    }
                     clearTimeout(times);
                 }, 1000)
             },

+ 8 - 0
pagesSchool/stuAdmin/stat/study.less

@@ -4,6 +4,14 @@
     background-color: var(--mainColor);
     height: var(--twoHeight);
 
+    .top {
+        font-size: var(--font14Size);
+        background: -webkit-linear-gradient(right, lightblue, #53C9F8);
+        padding: 2vw;
+        text-align: center;
+        color: var(--mainColor);
+    }
+
     ec-canvas {
         width: 100%;
         height: 100%;

+ 5 - 0
pagesSchool/stuAdmin/stat/study.wxml

@@ -1,5 +1,10 @@
 <mobile-main frameStyle="{{frameStyle}}" bind:back="back">
     <view slot="info" class="container main">
+        <view class="top">
+            <picker mode="selector" bindchange="schoolChange" name="school_id" value="{{school_id}}" range="{{schoolList}}" range-key="school_id_name">
+                <view class="picker">{{zhSchool||'请选择学校'}}</view>
+            </picker>
+        </view>
         <ec-canvas id="mychart-dom-pie" canvas-id="mychart-pie" ec="{{ ec }}"></ec-canvas>
     </view>
 </mobile-main>

+ 7 - 0
pagesSchool/stuAdmin/stat/study.wxss

@@ -3,6 +3,13 @@
   background-color: var(--mainColor);
   height: var(--twoHeight);
 }
+.main .top {
+  font-size: var(--font14Size);
+  background: -webkit-linear-gradient(right, lightblue, #53C9F8);
+  padding: 2vw;
+  text-align: center;
+  color: var(--mainColor);
+}
 .main ec-canvas {
   width: 100%;
   height: 100%;

+ 1 - 1
pagesSchool/system/index.js

@@ -45,7 +45,7 @@ Page({
                 const arr = await app.$get(`/user/${res.data._id}`);
                 if (arr.errcode == '0') {
                     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] })
                 }
                 else { wx.showToast({ title: `${arr.errmsg}`, icon: 'error', duration: 2000 }); }