Jelajahi Sumber

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

guhongwei 2 tahun lalu
induk
melakukan
a8159b4991

+ 2 - 1
pages/schAdmin/coach/list.js

@@ -154,7 +154,8 @@ Page({
      * 生命周期函数--监听页面隐藏
      */
     onHide: function () {
-
+      const that = this;
+      that.setData({ skip: 0, page: 0, list: [] })
     },
 
     /**

+ 2 - 1
pages/schAdmin/coachprofit/list.js

@@ -46,7 +46,8 @@ Page({
    * 生命周期函数--监听页面隐藏
    */
   onHide: function () {
-
+    const that = this;
+    that.setData({ skip: 0, page: 0, list: [] })
   },
 
   /**

+ 186 - 181
pages/schAdmin/coachstat/list.js

@@ -1,197 +1,202 @@
 const app = getApp()
 import * as echarts from '../../../commpents/ec-canvas/echarts'
 Page({
-  data: {
-    frameStyle: { useTop: true, name: '教练统计', leftArrow: true, useBar: false },
-    // 选中
-    tabs: {
-      active: '0',
-      menu: [
-        { title: '教练出勤率', active: '0' },
-        { title: '教练收入情况', active: '1' },
-      ]
+    data: {
+        frameStyle: { useTop: true, name: '教练统计', leftArrow: true, useBar: false },
+        // 选中
+        tabs: {
+            active: '0',
+            menu: [
+                { title: '教练出勤率', active: '0' },
+                { title: '教练收入情况', active: '1' },
+            ]
+        },
+        coachList: [],
+        percentage: [],
+        date: [],
+        money: [],
     },
-    coachList: [],
-
-  },
-  // 返回
-  back(e) {
-    wx.navigateBack({ delta: 1 })
-  },
-  // 选项卡选择
-  tabsChange: function (e) {
-    const that = this;
-    let data = e.detail;
-    that.setData({ 'tabs.active': data.active })
-  },
-  // 选择教练
-  coachChange: function (e) {
-    const that = this;
-    let data = that.data.coachList[e.detail.value];
-    if (data) {
-      that.setData({ 'form.coach_id': data.coach_id });
-      that.setData({ 'form.zhcoach': data.coach_id_name });
-    }
-  },
-  /**
-   * 生命周期函数--监听页面加载
-   */
-  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.percentage = [18, 36, 65, 30, 78, 40, 33, 99, 80, 67, 55, 79];
-        that.data.money = [11218, 5316, 6165, 8810, 3178, 5140, 2133, 6199, 4180, 6167, 7115, 1719];
-        // 教练
-        const abb = await app.$get(`/rcs`, { school_id: res.data.info.id });
-        if (abb.errcode == '0' && abb.total > 0) {
-          that.setData({ coachList: abb.data })
+    // 返回
+    back(e) {
+        wx.navigateBack({ delta: 1 })
+    },
+    // 选项卡选择
+    tabsChange: function (e) {
+        const that = this;
+        let data = e.detail;
+        that.setData({ 'tabs.active': data.active })
+    },
+    // 选择教练
+    coachChange: function (e) {
+        const that = this;
+        let data = that.data.coachList[e.detail.value];
+        if (data) {
+            that.setData({ 'form.coach_id': data.coach_id });
+            that.setData({ 'form.zhcoach': data.coach_id_name });
         }
-      },
-      fail: async res => {
-        wx.redirectTo({ url: '/pages/index/index' })
-      }
-    })
-  },
-  // 折线图
-  initChart(canvas, width, height, dpr) {
-    let that = this;
-    var date = that.data.date;
-    var percentage = that.data.percentage;
-    var money = that.data.money;
-    const chart = echarts.init(canvas, null, {
-      width: width,
-      height: height,
-      devicePixelRatio: dpr
-    });
-    canvas.setChart(chart);
-    if (that.data.tabs.active == 0) {
-      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: percentage
-          }
-        ]
-      };
-    } else {
-      var option = {
-        grid: {
-          left: 20,
-          right: 20,
-          bottom: 145,
-          top: 60,
-          containLabel: true
-        },
-        tooltip: {
-          show: true,
-          trigger: 'axis',
-          // trigger: 'item',
-          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;
+    },
+    /**
+     * 生命周期函数--监听页面加载
+     */
+    onLoad: function (options) {
+    },
     // 监听用户是否登录
-    that.watchLogin();
-  },
-  /**
-   * 页面上拉触底事件的处理函数
-   */
-  /**
-   * 生命周期函数--监听页面隐藏
+    watchLogin: async function () {
+        const that = this;
+        wx.getStorage({
+            key: 'user',
+            success: async res => {
+                // 教练
+                const abb = await app.$get(`/rcs`, { school_id: res.data.info.id });
+                if (abb.errcode == '0' && abb.total > 0) {
+                    that.setData({ coachList: abb.data })
+                }
+                let date = ['1月', '2月', '3月', '4月', '5月', '6月', '7月', '8月', '9月', '10月', '11月', '12月'];
+                let percentage = [18, 36, 65, 30, 78, 40, 33, 99, 80, 67, 55, 79];
+                let money = [11218, 5316, 6165, 8810, 3178, 5140, 2133, 6199, 4180, 6167, 7115, 1719];
+                that.setData({ money: money })
+                that.setData({ date: date })
+                that.setData({ percentage: percentage })
+                that.setData({ ec: { onInit: that.initChart } })
+            },
+            fail: async res => {
+                wx.redirectTo({ url: '/pages/index/index' })
+            }
+        })
+    },
+    // 折线图
+    initChart(canvas, width, height, dpr) {
+        let that = this;
+        var date = that.data.date;
+        var percentage = that.data.percentage;
+        var money = that.data.money;
+        var active = that.data.tabs.activa
+        const chart = echarts.init(canvas, null, {
+            width: width,
+            height: height,
+            devicePixelRatio: dpr
+        });
+        canvas.setChart(chart);
+        if (active == 0) {
+            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: percentage
+                    }
+                ]
+            };
+        } else {
+            var option = {
+                grid: {
+                    left: 20,
+                    right: 20,
+                    bottom: 145,
+                    top: 60,
+                    containLabel: true
+                },
+                tooltip: {
+                    show: true,
+                    trigger: 'axis',
+                    // trigger: 'item',
+                    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;
+    },
+    /**
+   * 生命周期函数--监听页面初次渲染完成
    */
-  onHide: function () {
+    onReady: function () { },
+    /**
+     * 生命周期函数--监听页面显示
+     */
+    onShow: function () {
+        const that = this;
+        // 监听用户是否登录
+        that.watchLogin();
+    },
+    /**
+     * 页面上拉触底事件的处理函数
+     */
+    /**
+     * 生命周期函数--监听页面隐藏
+     */
+    onHide: function () {
 
-  },
+    },
 
-  /**
-   * 生命周期函数--监听页面卸载
-   */
-  onUnload: function () {
+    /**
+     * 生命周期函数--监听页面卸载
+     */
+    onUnload: function () {
 
-  },
+    },
 
-  /**
-   * 页面相关事件处理函数--监听用户下拉动作
-   */
-  onPullDownRefresh: function () {
+    /**
+     * 页面相关事件处理函数--监听用户下拉动作
+     */
+    onPullDownRefresh: function () {
 
-  },
+    },
 
 
-  /**
-   * 用户点击右上角分享
-   */
-  onShareAppMessage: function (res) {
+    /**
+     * 用户点击右上角分享
+     */
+    onShareAppMessage: function (res) {
 
-  },
+    },
 })

+ 6 - 1
pages/schAdmin/coachstat/list.less

@@ -3,8 +3,13 @@
   height: var(--twoHeight);
 
   .top {
-    margin: 0 10vw;
+    margin: 2vw 10vw;
+    background-color: rgb(79, 165, 112);
+    padding: 2vw;
+    text-align: center;
+    color: var(--mainColor);
   }
+
   .two {
     position: relative;
     flex-grow: 1;

+ 2 - 3
pages/schAdmin/coachstat/list.wxml

@@ -15,9 +15,8 @@
             <view class="one">
               <scroll-view scroll-y="true" class="scroll-view">
                 <view class="list-scroll-view">
-
                   <view class="container">
-                    <ec-canvas id="mychart-dom-pie" canvas-id="mychart-pie" ec="{{ ec }}"></ec-canvas>
+                    <ec-canvas id="mychart" canvas-id="mychart" ec="{{ ec }}"></ec-canvas>
                   </view>
                 </view>
               </scroll-view>
@@ -32,7 +31,7 @@
               <scroll-view scroll-y="true" class="scroll-view">
                 <view class="list-scroll-view">
                   <view class="container">
-                    <ec-canvas id="mychart-dom-pie" canvas-id="mychart-pie" ec="{{ ec }}"></ec-canvas>
+                    <ec-canvas id="mychart" canvas-id="mychart" ec="{{ ec }}"></ec-canvas>
                   </view>
                 </view>
               </scroll-view>

+ 5 - 1
pages/schAdmin/coachstat/list.wxss

@@ -3,7 +3,11 @@
   height: var(--twoHeight);
 }
 .main .top {
-  margin: 0 10vw;
+  margin: 2vw 10vw;
+  background-color: #4fa570;
+  padding: 2vw;
+  text-align: center;
+  color: var(--mainColor);
 }
 .main .two {
   position: relative;

+ 2 - 1
pages/schAdmin/course/coachlist.js

@@ -117,7 +117,8 @@ Page({
      * 生命周期函数--监听页面隐藏
      */
     onHide: function () {
-
+      const that = this;
+      that.setData({ skip: 0, page: 0, list: [] })
     },
 
     /**

+ 21 - 3
pages/schAdmin/course/list.js

@@ -2,6 +2,14 @@ const app = getApp()
 Page({
     data: {
         frameStyle: { useTop: true, name: '课程信息', leftArrow: true, useBar: false },
+        // 选中
+        tabs: {
+            active: '0',
+            menu: [
+                { title: '公开课', active: '0' },
+                { title: '私教课', active: '1' },
+            ]
+        },
         list: [],
         total: 0,
         page: 0,
@@ -20,6 +28,14 @@ Page({
         that.setData({ skip: 0, page: 0, list: [] })
         wx.navigateTo({ url: '/pages/schAdmin/course/add' })
     },
+    // 选项卡选择
+    tabsChange: function (e) {
+        const that = this;
+        let data = e.detail;
+        that.setData({ 'tabs.active': data.active })
+        that.setData({ skip: 0, page: 0, list: [] })
+        that.watchLogin();
+    },
     // 修改
     toEdit: function (e) {
         const that = this;
@@ -65,7 +81,8 @@ Page({
     /**
      * 生命周期函数--监听页面加载
      */
-    onLoad: function (options) { },
+    onLoad: function (options) {
+    },
     // 监听用户是否登录
     watchLogin: async function () {
         const that = this;
@@ -76,7 +93,7 @@ Page({
                 if (aee.errcode == '0' && aee.total > 0) that.setData({ statusList: aee.data[0].list });
                 const acc = await app.$get(`/dict`, { code: "lesson_type" });
                 if (acc.errcode == '0' && aee.total > 0) that.setData({ typeList: acc.data[0].list });
-                let info = { skip: that.data.skip, limit: that.data.limit, school_id: res.data.info.id };
+                let info = { skip: that.data.skip, limit: that.data.limit, school_id: res.data.info.id, type: that.data.tabs.active };
                 const arr = await app.$get(`/lesson`, { ...info });
                 if (arr.errcode == '0') {
                     for (const val of arr.data) {
@@ -129,7 +146,8 @@ Page({
      * 生命周期函数--监听页面隐藏
      */
     onHide: function () {
-
+        const that = this;
+        that.setData({ skip: 0, page: 0, list: [] })
     },
 
     /**

+ 2 - 1
pages/schAdmin/course/list.json

@@ -1,6 +1,7 @@
 {
     "component": true,
     "usingComponents": {
-      "mobile-main": "/commpents/mobile-frame/index"
+      "mobile-main": "/commpents/mobile-frame/index",
+      "s-tab": "/commpents/tabs/index"
     }
   }

+ 22 - 16
pages/schAdmin/course/list.less

@@ -4,31 +4,37 @@
 
     .one {
         display: flex;
-        flex-direction: row;
-        padding: 2vw;
-        border-bottom: 1px solid var(--f1Color);
+        flex-direction: column;
 
-        .one_1 {
-            flex-grow: 1;
+        .top {
+            display: flex;
+            flex-direction: row;
+            padding: 2vw;
+            border-bottom: 1px solid var(--f1Color);
 
-            input {
-                padding: 1vw 0 2vw 2vw;
-                background-color: var(--f1Color);
-                border-radius: 5px;
+            .one_1 {
+                flex-grow: 1;
+
+                input {
+                    padding: 1vw 0 2vw 2vw;
+                    background-color: var(--f1Color);
+                    border-radius: 5px;
+                }
             }
-        }
 
-        .one_2 {
-            width: 20vw;
+            .one_2 {
+                width: 20vw;
 
-            button {
-                width: 100%;
-                padding: 2vw;
-                font-size: var(--font14Size);
+                button {
+                    width: 100%;
+                    padding: 2vw;
+                    font-size: var(--font14Size);
+                }
             }
         }
     }
 
+
     .two {
         flex-grow: 1;
         position: relative;

+ 9 - 4
pages/schAdmin/course/list.wxml

@@ -1,11 +1,16 @@
 <mobile-main frameStyle="{{frameStyle}}" bind:back="back">
     <view slot="info" class="container main">
         <view class="one">
-            <view class="one_1">
-                <input type="text" placeholder="请输入关键词" />
+            <view class="top">
+                <view class="one_1">
+                    <input type="text" placeholder="请输入关键词" />
+                </view>
+                <view class="one_2">
+                    <button type="primary" bindtap="toAdd">添加</button>
+                </view>
             </view>
-            <view class="one_2">
-                <button type="primary" bindtap="toAdd">添加</button>
+            <view class="foot">
+                <s-tab tabs="{{tabs}}" bind:tabsChange="tabsChange"></s-tab>
             </view>
         </view>
         <view class="two">

+ 8 - 4
pages/schAdmin/course/list.wxss

@@ -3,23 +3,27 @@
   background-color: var(--mainColor);
 }
 .main .one {
+  display: flex;
+  flex-direction: column;
+}
+.main .one .top {
   display: flex;
   flex-direction: row;
   padding: 2vw;
   border-bottom: 1px solid var(--f1Color);
 }
-.main .one .one_1 {
+.main .one .top .one_1 {
   flex-grow: 1;
 }
-.main .one .one_1 input {
+.main .one .top .one_1 input {
   padding: 1vw 0 2vw 2vw;
   background-color: var(--f1Color);
   border-radius: 5px;
 }
-.main .one .one_2 {
+.main .one .top .one_2 {
   width: 20vw;
 }
-.main .one .one_2 button {
+.main .one .top .one_2 button {
   width: 100%;
   padding: 2vw;
   font-size: var(--font14Size);

+ 2 - 1
pages/schAdmin/courseexam/list.js

@@ -81,7 +81,8 @@ Page({
      * 生命周期函数--监听页面隐藏
      */
     onHide: function () {
-
+      const that = this;
+      that.setData({ skip: 0, page: 0, list: [] })
     },
 
     /**

+ 2 - 1
pages/schAdmin/coursetryexam/list.js

@@ -90,7 +90,8 @@ Page({
      * 生命周期函数--监听页面隐藏
      */
     onHide: function () {
-
+      const that = this;
+      that.setData({ skip: 0, page: 0, list: [] })
     },
 
     /**

+ 7 - 3
pages/schAdmin/income/list.js

@@ -3,7 +3,9 @@ import * as echarts from '../../../commpents/ec-canvas/echarts'
 Page({
   data: {
     frameStyle: { useTop: true, name: '收入统计', leftArrow: true, useBar: false },
-
+    ec: {},
+    date:[],
+    money:[],
   },
   // 返回
   back(e) {
@@ -21,9 +23,11 @@ Page({
     wx.getStorage({
       key: 'user',
       success: async res => {
+         let date = ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12', '12', '14', '15', '16', '17', '18', '19', '20', '21', '22', '23', '24', '25', '26', '27', '28', '29', '30', '31'];
+         let money = [900, 270, 340, 400, 600, 700, 310, 300, 270, 340, 344, 300, 320, 310, 300, 270, 340, 344, 300, 500, 310, 300, 270, 340, 344, 300, 320, 310, 300, 270, 340, 344, 300, 320, 310];
+        that.setData({money:money})
+        that.setData({date:date})
         that.setData({ ec: { onInit: that.initChart } })
-        that.data.date = ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12', '12', '14', '15', '16', '17', '18', '19', '20', '21', '22', '23', '24', '25', '26', '27', '28', '29', '30', '31'];
-        that.data.money = [900, 270, 340, 400, 600, 700, 310, 300, 270, 340, 344, 300, 320, 310, 300, 270, 340, 344, 300, 500, 310, 300, 270, 340, 344, 300, 320, 310, 300, 270, 340, 344, 300, 320, 310];
       },
       fail: async res => {
         wx.redirectTo({ url: '/pages/index/index' })

+ 1 - 1
pages/schAdmin/income/list.wxml

@@ -7,7 +7,7 @@
       <button type="primary" size="mini">一年内</button>
     </view>
     <view class="container">
-      <ec-canvas id="mychart-dom-pie" canvas-id="mychart-pie" ec="{{ ec }}"></ec-canvas>
+      <ec-canvas id="mychart" canvas-id="mychart" ec="{{ ec }}"></ec-canvas>
     </view>
   </view>
 </mobile-main>

+ 2 - 1
pages/schAdmin/student/list.js

@@ -153,7 +153,8 @@ Page({
      * 生命周期函数--监听页面隐藏
      */
     onHide: function () {
-
+      const that = this;
+      that.setData({ skip: 0, page: 0, list: [] })
     },
 
     /**

+ 5 - 2
pages/schAdmin/stustat/list.js

@@ -3,6 +3,7 @@ import * as echarts from '../../../commpents/ec-canvas/echarts'
 Page({
   data: {
     frameStyle: { useTop: true, name: '学员统计', leftArrow: true, useBar: false },
+    piedata: []
   },
   // 返回
   back(e) {
@@ -18,13 +19,15 @@ Page({
     wx.getStorage({
       key: 'user',
       success: async res => {
-        that.setData({ ec: { onInit: that.initChart } })
-        that.data.piedata = [
+        let piedata = [
           { value: 55, name: '7-10岁' },
           { value: 20, name: '10-13岁' },
           { value: 10, name: '13-16岁' },
           { value: 20, name: '16-18岁' },
           { value: 38, name: '18-26岁' }];
+        that.setData({ piedata: piedata })
+        that.setData({ ec: { onInit: that.initChart } })
+
       },
       fail: async res => {
         wx.redirectTo({ url: '/pages/index/index' })

+ 1 - 1
pages/schAdmin/stustat/list.wxml

@@ -1,5 +1,5 @@
 <mobile-main frameStyle="{{frameStyle}}" bind:back="back">
     <view slot="info" class="container main">
-      <ec-canvas id="myechart" canvas-id="graph" ec="{{ ec }}"></ec-canvas>
+      <ec-canvas id="myechart" canvas-id="mychart" ec="{{ ec }}"></ec-canvas>
     </view>
 </mobile-main>