Browse Source

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

guhongwei 2 years ago
parent
commit
09c4de3e03

+ 26 - 37
pages/schAdmin/coach/add.less

@@ -1,48 +1,37 @@
 .main {
-    background-color: var(--mainColor);
-    height: var(--twoHeight);
+  background-color: var(--mainColor);
 
-    .one {
+  .one {
+
+    .content {
+      display: flex;
+      flex-direction: row;
+      border-bottom: 1px dashed var(--f1Color);
+      padding: 2vw 0;
+      margin: 0 2vw 2vw 2vw;
+
+      .value {
         flex-grow: 1;
-        position: relative;
-        height: 81vh;
-
-        .content {
-            display: flex;
-            flex-direction: row;
-            border-bottom: 1px dashed var(--f1Color);
-            padding: 2vw 0;
-            margin: 0 2vw 2vw 2vw;
-
-            .value {
-                flex-grow: 1;
-                color: var(--blackColor);
-            }
+        color: var(--blackColor);
+
+        textarea {
+          width: 100%;
+          height: 120px;
         }
+      }
     }
+  }
 
-    .btn {
-        text-align: center;
-        margin: 5vw 0 0 0;
+  .btn {
+    text-align: center;
+    margin: 5vw 0 0 0;
 
-        button {
-            width: 40vw;
-            margin: 0 2vw;
-            padding: 1vw 0;
-        }
+    button {
+      width: 40vw;
+      margin: 0 2vw;
+      padding: 1vw 0;
     }
+  }
 
 }
 
-.scroll-view {
-    position: absolute;
-    top: 0;
-    left: 0;
-    right: 0;
-    bottom: 0;
-
-    .list-scroll-view {
-        display: flex;
-        flex-direction: column;
-    }
-}

+ 68 - 71
pages/schAdmin/coach/add.wxml

@@ -1,73 +1,70 @@
 <mobile-main frameStyle="{{frameStyle}}" bind:back="back">
-    <view slot="info" class="container main">
-        <form catchsubmit="onSubmit">
-            <view class="one">
-                <scroll-view scroll-y="true" class="scroll-view">
-                    <view class="list-scroll-view">
-                        <view class="content">
-                            <view class="label">头像:</view>
-                            <view class="value">
-                                <upload list="{{form.icon}}" count="{{1}}" previewSize="{{30}}" bind:imgUpload="imgUpl" bind:imgDel="imgDel"></upload>
-                            </view>
-                        </view>
-                        <view class="content">
-                            <view class="label">姓名:</view>
-                            <view class="value">
-                                <input name="name" value="{{form.name}}" placeholder="请输入姓名" />
-                            </view>
-                        </view>
-                        <view class="content">
-                            <view class="label">性别:</view>
-                            <view class="value">
-                                <picker mode="selector" bindchange="genderChange" name="gender" value="{{form.gender}}" range="{{genderList}}" range-key="label">
-                                    <view class="picker">{{form.zhGender||'请选择性别'}}</view>
-                                </picker>
-                            </view>
-                        </view>
-                        <view class="content">
-                            <view class="label">年龄:</view>
-                            <view class="value">
-                                <input type="number" name="age" value="{{form.age}}" placeholder="请输入年龄" />
-                            </view>
-                        </view>
-                        <view class="content">
-                            <view class="label">联系电话:</view>
-                            <view class="value">
-                                <input type="number" name="phone" maxlength="11" value="{{form.phone}}" placeholder="请输入联系电话" />
-                            </view>
-                        </view>
-                        <view class="content">
-                            <view class="label">教练等级:</view>
-                            <view class="value">
-                                <picker mode="selector" bindchange="coachChange" name="level" value="{{form.level}}" range="{{levelList}}" range-key="label">
-                                    <view class="picker">{{form.zhLevel||'请选择教练等级'}}</view>
-                                </picker>
-                            </view>
-                        </view>
-                        <view class="content">
-                            <view class="label">教练简介:</view>
-                            <view class="value">
-                                <input name="brief" value="{{form.brief}}" auto-height maxlength="-1" placeholder="请输入教练简介" />
-                            </view>
-                        </view>
-                        <view class="content">
-                            <view class="label">过往荣誉:</view>
-                            <view class="value">
-                                <input name="honor" value="{{form.honor}}" auto-height maxlength="-1" placeholder="请输入过往荣誉" />
-                            </view>
-                        </view>
-                        <view class="content">
-                            <view class="label">教学经历:</view>
-                            <view class="value">
-                                <input name="exp" value="{{form.exp}}" auto-height maxlength="-1" placeholder="请输入教学经历" />
-                            </view>
-                        </view>
-                    </view>
-                </scroll-view>
-            </view>
-            <view class="btn">
-                <button type="primary" size="mini" formType="submit">提交保存</button>
-            </view>
-        </form>
-    </view>
+  <view slot="info" class="container main">
+    <form catchsubmit="onSubmit">
+      <view class="one">
+        <view class="content">
+          <view class="label">头像:</view>
+          <view class="value">
+            <upload list="{{form.icon}}" count="{{1}}" previewSize="{{30}}" bind:imgUpload="imgUpl" bind:imgDel="imgDel"></upload>
+          </view>
+        </view>
+        <view class="content">
+          <view class="label">姓名:</view>
+          <view class="value">
+            <input name="name" value="{{form.name}}" placeholder="请输入姓名" />
+          </view>
+        </view>
+        <view class="content">
+          <view class="label">性别:</view>
+          <view class="value">
+            <picker mode="selector" bindchange="genderChange" name="gender" value="{{form.gender}}" range="{{genderList}}" range-key="label">
+              <view class="picker">{{form.zhGender||'请选择性别'}}</view>
+            </picker>
+          </view>
+        </view>
+        <view class="content">
+          <view class="label">年龄:</view>
+          <view class="value">
+            <input type="number" name="age" value="{{form.age}}" placeholder="请输入年龄" />
+          </view>
+        </view>
+        <view class="content">
+          <view class="label">联系电话:</view>
+          <view class="value">
+            <input type="number" name="phone" maxlength="11" value="{{form.phone}}" placeholder="请输入联系电话" />
+          </view>
+        </view>
+        <view class="content">
+          <view class="label">教练等级:</view>
+          <view class="value">
+            <picker mode="selector" bindchange="coachChange" name="level" value="{{form.level}}" range="{{levelList}}" range-key="label">
+              <view class="picker">{{form.zhLevel||'请选择教练等级'}}</view>
+            </picker>
+          </view>
+        </view>
+        <view class="content">
+          <view class="label">教练简介:</view>
+          <view class="value">
+            <textarea maxlength="500" name="brief" value="{{form.brief}}" placeholder="请输入教练简介" />
+          </view>
+        </view>
+        <view class="content">
+          <view class="label">过往荣誉:</view>
+          <view class="value">
+            <textarea maxlength="500" name="honor" value="{{form.honor}}" placeholder="请输入过往荣誉" />
+          </view>
+        </view>
+        <view class="content">
+          <view class="label">教学经历:</view>
+          <view class="value">
+            <textarea maxlength="500" name="exp" value="{{form.exp}}" placeholder="请输入教学经历" />
+          </view>
+        </view>
+
+      </view>
+      <view class="btn">
+        <button type="primary" size="mini" formType="submit">提交保存</button>
+      </view>
+    </form>
+  </view>
 </mobile-main>

+ 4 - 17
pages/schAdmin/coach/add.wxss

@@ -1,11 +1,5 @@
 .main {
   background-color: var(--mainColor);
-  height: var(--twoHeight);
-}
-.main .one {
-  flex-grow: 1;
-  position: relative;
-  height: 81vh;
 }
 .main .one .content {
   display: flex;
@@ -18,6 +12,10 @@
   flex-grow: 1;
   color: var(--blackColor);
 }
+.main .one .content .value textarea {
+  width: 100%;
+  height: 120px;
+}
 .main .btn {
   text-align: center;
   margin: 5vw 0 0 0;
@@ -27,14 +25,3 @@
   margin: 0 2vw;
   padding: 1vw 0;
 }
-.scroll-view {
-  position: absolute;
-  top: 0;
-  left: 0;
-  right: 0;
-  bottom: 0;
-}
-.scroll-view .list-scroll-view {
-  display: flex;
-  flex-direction: column;
-}

+ 43 - 28
pages/schAdmin/income/list.js

@@ -1,14 +1,6 @@
 const app = getApp()
 import * as echarts from '../../../commpents/ec-canvas/echarts'
-
-function initChart(canvas, width, height, dpr) {
-  const chart = echarts.init(canvas, null, {
-    width: width,
-    height: height,
-    devicePixelRatio: dpr // new
-  });
-  canvas.setChart(chart);
-
+function setOption(chart, piedata) {
   var option = {
     backgroundColor: "#ffffff",
     series: [{
@@ -20,25 +12,9 @@ function initChart(canvas, width, height, dpr) {
       type: 'pie',
       center: ['50%', '50%'],
       radius: ['20%', '40%'],
-      data: [{
-        value: 55,
-        name: '教练一'
-      }, {
-        value: 20,
-        name: '教练二'
-      }, {
-        value: 10,
-        name: '教练三'
-      }, {
-        value: 20,
-        name: '教练四'
-      }, {
-        value: 38,
-        name: '教练五'
-      }]
+      data: piedata
     }]
   };
-
   chart.setOption(option);
   return chart;
 }
@@ -47,9 +23,28 @@ Page({
   data: {
     frameStyle: { useTop: true, name: '收入统计', leftArrow: true, useBar: false },
     ec: {
-      onInit: initChart
+      //onInit: initChart
+      // 将 lazyLoad 设为 true 后,需要手动初始化图表
+      lazyLoad: true
     }
   },
+  initpie: function (piedata) {
+    console.log(piedata);
+    let ecComponent = this.selectComponent('#mychart-dom-pie');
+    ecComponent.init((canvas, width, height, dpr) => {
+      // 获取组件的 canvas、width、height 后的回调函数
+      // 在这里初始化图表
+      const chart = echarts.init(canvas, null, {
+        width: width,
+        height: height,
+        devicePixelRatio: dpr // new
+      });
+      //调用设定EChart报表状态的函数,并且把从后端拿到的数据传过去
+      setOption(chart, piedata);
+      // 注意这里一定要返回 chart 实例,否则会影响事件处理等
+      return chart;
+    })
+  },
   // 返回
   back(e) {
     wx.navigateBack({ delta: 1 })
@@ -57,7 +52,27 @@ Page({
   /**
    * 生命周期函数--监听页面加载
    */
-  onLoad: function (options) { },
+  onLoad: function (options) {
+    const that = this;
+    var piedata = [{
+      value: 55,
+      name: '北京'
+    }, {
+      value: 20,
+      name: '武汉'
+    }, {
+      value: 10,
+      name: '杭州'
+    }, {
+      value: 20,
+      name: '广州'
+    }, {
+      value: 38,
+      name: '上海'
+    }];
+    that.initpie(piedata);
+
+  },
   // 监听用户是否登录
   watchLogin: async function () {
     const that = this;

+ 4 - 0
pages/schAdmin/school/info.less

@@ -12,6 +12,10 @@
             .value {
                 flex-grow: 1;
                 color: var(--blackColor);
+                textarea {
+                  width: 100%;
+                  height: 120px;
+              }
 
             }
         }

+ 67 - 67
pages/schAdmin/school/info.wxml

@@ -1,71 +1,71 @@
 <mobile-main frameStyle="{{frameStyle}}" bind:back="back">
-    <view slot="info" class="container main">
-        <view class="one">
-            <form catchsubmit="onSubmit">
-                <view class="content">
-                    <view class="label">名称:</view>
-                    <view class="value">
-                        <input name="name" value="{{form.name}}" auto-height placeholder="请输入名称" />
-                    </view>
-                </view>
-                <view class="content">
-                    <view class="label">简介:</view>
-                    <view class="value">
-                        <input name="brief" value="{{form.brief}}" auto-height placeholder="请输入简介" />
-                    </view>
-                </view>
-                <view class="content">
-                    <view class="label">联系方式:</view>
-                    <view class="value">
-                        <input name="phone" value="{{form.phone}}" placeholder="请输入联系方式" />
-                    </view>
-                </view>
-                <view class="content">
-                    <view class="label">训练地址:</view>
-                    <view class="value">
-                        <input name="address" value="{{form.address}}" placeholder="请输入训练地址" />
-                    </view>
-                </view>
-                <view class="content">
-                    <view class="label">教练人数:</view>
-                    <view class="value">
-                        <input type="number" name="coach_num" value="{{form.coach_num}}" placeholder="请输入教练人数" />
-                    </view>
-                </view>
-                <view class="content">
-                    <view class="label">学员人数:</view>
-                    <view class="value">
-                        <input type="number" name="student_num" value="{{form.student_num}}" placeholder="请输入学员人数" />
-                    </view>
-                </view>
-                <view class="content">
-                    <view class="label">过往荣誉:</view>
-                    <view class="value">
-                        <input name="honor" value="{{form.honor}}" auto-height placeholder="请输入过往荣誉" />
-                    </view>
-                </view>
-                <view class="content">
-                    <view class="label">网址:</view>
-                    <view class="value">
-                        <input name="url" value="{{form.url}}" placeholder="请输入网址(http://)" />
-                    </view>
-                </view>
-                <view class="content">
-                    <view class="label">营业执照(1):</view>
-                    <view class="value">
-                        <upload list="{{form.yyzz}}" count="{{1}}" previewSize="{{33}}" bind:imgUpload="yzimgUpl" bind:imgDel="yzimgDel"></upload>
-                    </view>
-                </view>
-                <view class="content">
-                    <view class="label">机构图片(6):</view>
-                    <view class="value">
-                        <upload list="{{form.img_url}}" count="{{6}}" previewSize="{{25}}" bind:imgUpload="imgUpl" bind:imgDel="imgDel"></upload>
-                    </view>
-                </view>
-                <view class="btn">
-                    <button type="primary" size="mini" formType="submit">提交保存</button>
-                </view>
-            </form>
+  <view slot="info" class="container main">
+    <view class="one">
+      <form catchsubmit="onSubmit">
+        <view class="content">
+          <view class="label">名称:</view>
+          <view class="value">
+            <input name="name" value="{{form.name}}" auto-height placeholder="请输入名称" />
+          </view>
         </view>
+        <view class="content">
+          <view class="label">简介:</view>
+          <view class="value">
+            <textarea maxlength="500" name="brief" value="{{form.brief}}" placeholder="请输入简介" />
+          </view>
+        </view>
+        <view class="content">
+          <view class="label">联系方式:</view>
+          <view class="value">
+            <input name="phone" value="{{form.phone}}" placeholder="请输入联系方式" />
+          </view>
+        </view>
+        <view class="content">
+          <view class="label">训练地址:</view>
+          <view class="value">
+            <input name="address" value="{{form.address}}" placeholder="请输入训练地址" />
+          </view>
+        </view>
+        <view class="content">
+          <view class="label">教练人数:</view>
+          <view class="value">
+            <input type="number" name="coach_num" value="{{form.coach_num}}" placeholder="请输入教练人数" />
+          </view>
+        </view>
+        <view class="content">
+          <view class="label">学员人数:</view>
+          <view class="value">
+            <input type="number" name="student_num" value="{{form.student_num}}" placeholder="请输入学员人数" />
+          </view>
+        </view>
+        <view class="content">
+          <view class="label">过往荣誉:</view>
+          <view class="value">
+            <textarea maxlength="500" name="honor" value="{{form.honor}}" placeholder="请输入过往荣誉" />
+          </view>
+        </view>
+        <view class="content">
+          <view class="label">网址:</view>
+          <view class="value">
+            <input name="url" value="{{form.url}}" placeholder="请输入网址(http://)" />
+          </view>
+        </view>
+        <view class="content">
+          <view class="label">营业执照(1):</view>
+          <view class="value">
+            <upload list="{{form.yyzz}}" count="{{1}}" previewSize="{{33}}" bind:imgUpload="yzimgUpl" bind:imgDel="yzimgDel"></upload>
+          </view>
+        </view>
+        <view class="content">
+          <view class="label">机构图片(6):</view>
+          <view class="value">
+            <upload list="{{form.img_url}}" count="{{6}}" previewSize="{{25}}" bind:imgUpload="imgUpl" bind:imgDel="imgDel"></upload>
+          </view>
+        </view>
+        <view class="btn">
+          <button type="primary" size="mini" formType="submit">提交保存</button>
+        </view>
+      </form>
     </view>
+  </view>
 </mobile-main>

+ 4 - 0
pages/schAdmin/school/info.wxss

@@ -12,6 +12,10 @@
   flex-grow: 1;
   color: var(--blackColor);
 }
+.main .one .content .value textarea {
+  width: 100%;
+  height: 120px;
+}
 .main .one .btn {
   text-align: center;
   margin: 5vw 0 0 0;

+ 4 - 1
pages/schAdmin/student/add.less

@@ -1,5 +1,4 @@
 .main {
-    height: var(--twoHeight);
     background-color: var(--mainColor);
 
     .one {
@@ -13,6 +12,10 @@
             .value {
                 flex-grow: 1;
                 color: var(--blackColor);
+                textarea {
+                  width: 100%;
+                  height: 120px;
+              }
 
             }
         }

+ 3 - 3
pages/schAdmin/student/add.wxml

@@ -45,19 +45,19 @@
                 <view class="content">
                     <view class="label">学员简介:</view>
                     <view class="value">
-                        <input name="brief" maxlength="-1" auto-height value="{{form.brief}}" placeholder="请输入学员简介" />
+                        <textarea maxlength="500" name="brief"  value="{{form.brief}}" placeholder="请输入学员简介" />
                     </view>
                 </view>
                 <view class="content">
                     <view class="label">过往荣誉:</view>
                     <view class="value">
-                        <input name="honer" maxlength="-1" auto-height value="{{form.honer}}" placeholder="请输入过往荣誉" />
+                        <textarea maxlength="500" name="honer"  value="{{form.honer}}" placeholder="请输入过往荣誉" />
                     </view>
                 </view>
                 <view class="content">
                     <view class="label">训练经历:</view>
                     <view class="value">
-                        <input name="exp" maxlength="-1" auto-height value="{{form.exp}}" placeholder="请输入训练经历" />
+                        <textarea maxlength="500" name="exp"  value="{{form.exp}}" placeholder="请输入训练经历" />
                     </view>
                 </view>
                 <view class="btn">

+ 4 - 1
pages/schAdmin/student/add.wxss

@@ -1,5 +1,4 @@
 .main {
-  height: var(--twoHeight);
   background-color: var(--mainColor);
 }
 .main .one .content {
@@ -13,6 +12,10 @@
   flex-grow: 1;
   color: var(--blackColor);
 }
+.main .one .content .value textarea {
+  width: 100%;
+  height: 120px;
+}
 .main .one .btn {
   text-align: center;
   margin: 5vw 0 0 0;

+ 257 - 99
pages/schAdmin/stustat/list.js

@@ -1,118 +1,276 @@
 const app = getApp()
 import * as echarts from '../../../commpents/ec-canvas/echarts'
 
-function initChart(canvas, width, height, dpr) {
-    const chart = echarts.init(canvas, null, {
-        width: width,
-        height: height,
-        devicePixelRatio: dpr // new
-    });
-    canvas.setChart(chart);
+function echart(chart, leftData, rightData) {//leftData是坐标系左边y轴,rightData是右边y轴
+  var option = {
+    //网格
+    grid: {
+      bottom: 80,
+      show: true,
+      // containLabel: true
+    },
+    //图例
+    legend: {
+      data: [{
+        name: 'leftData',
+        textStyle: { //设置颜色
+          color: '#6076FF',
+          fontSize: '14',
+        }
+      },
+      {
+        name: 'rightData',
+        textStyle: {
+          color: '#FFC560',
+          fontSize: '14',
+        }
+      }
+      ],
+      x: 'left',
+      bottom: 15,
+      left: 30
+    },
+    //x轴
+    xAxis: {
+      type: 'category',
+      boundaryGap: false,
+      disableGrid: true, //绘制X网格
+      data: ['', '', '', '', '', '', '', '', ''],
+      splitLine: {
+        show: true,
+        // 改变轴线颜色
+        lineStyle: {
+          // 使用深浅的间隔色
+          color: ['#DDDDDD']
+        }
+      },
+      //去掉刻度
+      axisTick: {
+        show: false
+      },
+      //去掉x轴线
+      axisLine: {
+        show: false
+      },
+    },
+    //y轴
+    yAxis: [{
+      name: 'mph',
+      type: 'value',
+      min: 0,
+      // max: 40,
+      //y标轴名称的文字样式
+      nameTextStyle: {
+        color: '#FFC560'
+      },
+      //网格线
+      splitLine: {
+        show: true,
+        lineStyle: {
+          color: ['#DDDDDD']
+        }
+      },
+      //去掉刻度
+      axisTick: {
+        show: false
+      },
+      //去掉y轴线
+      axisLine: {
+        show: false
+      },
+    },
+    {
+      name: 'g',
+      type: 'value',
+      // max: 4,
+      min: 0,
+      nameTextStyle: {
+        color: '#6076FF'
+      },
+      //去掉刻度
+      axisTick: {
+        show: false
+      },
+      //去掉y轴线
+      axisLine: {
+        show: false
+      },
 
-    var option = {
-        backgroundColor: "#ffffff",
-        series: [{
-            label: {
-                normal: {
-                    fontSize: 14
-                }
-            },
-            type: 'pie',
-            center: ['50%', '50%'],
-            radius: ['20%', '40%'],
-            data: [{
-                value: 55,
-                name: '教练一'
-            }, {
-                value: 20,
-                name: '教练二'
-            }, {
-                value: 10,
-                name: '教练三'
-            }, {
-                value: 20,
-                name: '教练四'
-            }, {
-                value: 38,
-                name: '教练五'
-            }]
-        }]
-    };
+    }
+    ],
 
-    chart.setOption(option);
-    return chart;
+    series: [{
+      name: 'leftData',
+      type: 'line',
+      animation: true, //动画效果
+      symbol: 'none',
+      //折线区域
+      areaStyle: {
+        //渐变颜色
+        color: {
+          type: 'linear',
+          x: 0,
+          y: 0,
+          x2: 0,
+          y2: 1,
+          colorStops: [{
+            offset: 0,
+            color: '#6076FF' // 0% 处的颜色
+          }, {
+            offset: 1,
+            color: 'rgba(96,118,255,0.1)' // 100% 处的颜色
+          }],
+          global: false, // 缺省为 false
+        },
+      },
+      //折线宽度
+      lineStyle: {
+        width: 2
+      },
+      color: '#6076FF',
+      data: leftData // 后台传过来的动态数据
+      //设置固定的数据
+      // data: [
+      //  23, 30, 20, 23, 30, 26, 20, 25, 25
+      // ] 
+    },
+    {
+      name: 'rightData',
+      type: 'line',
+      yAxisIndex: 1,
+      animation: true,
+      symbol: 'none',
+      areaStyle: {
+        color: {
+          type: 'linear',
+          x: 0,
+          y: 0,
+          x2: 0,
+          y2: 1,
+          colorStops: [{
+            offset: 0,
+            color: '#FFC560' // 0% 处的颜色
+          }, {
+            offset: 1,
+            color: 'rgba(255, 197, 96,0.3)' // 100% 处的颜色
+          }],
+          global: false, // 缺省为 false
+        },
+      },
+      lineStyle: {
+        width: 2
+      },
+      color: '#FFC560',
+      data: rightData,//后台传过来的动态数据
+      //设置固定的数据
+      // data: [
+      //  2, 1, 0.5, 0.9, 2, 1.0, 0.6, 2, 0.5
+      // ]
+    }]
+  }
 }
 
 Page({
-    data: {
-        frameStyle: { useTop: true, name: '学员统计', leftArrow: true, useBar: false },
-        ec: {
-            onInit: initChart
-        }
-    },
-    // 返回
-    back(e) {
-        wx.navigateBack({ delta: 1 })
-    },
-    /**
-     * 生命周期函数--监听页面加载
-     */
-    onLoad: function (options) { },
-    // 监听用户是否登录
-    watchLogin: async function () {
-        const that = this;
-        wx.getStorage({
-            key: 'user',
-            success: async res => {
+  data: {
+    frameStyle: { useTop: true, name: '学员统计', leftArrow: true, useBar: false },
+    ec: {
+      lazyLoad: true //初始化加载
+    }
+  },
+  // 返回
+  back(e) {
+    wx.navigateBack({ delta: 1 })
+  },
+  initGraph: function (leftData, rightData) {
+    let oneComponent = this.selectComponent('#mychart');
+    oneComponent.init((canvas, width, height) => {
+      const chart = echarts.init(canvas, null, {
+        width: width,
+        height: height
+      });
+      initChart(chart, leftData, rightData);
+      this.chart = chart;
+      return chart;
+    });
+  },
+  /**
+   * 生命周期函数--监听页面加载
+   */
+  onLoad: function (options) {
+    const that = this;
+    // let leftData=[{20}]
+    // let url = "xxxxx";
+    // let params = {
+    //   "openId": options.id,
+    // };
+    // wx.request({
+    //   url: "xxxx",
+    //   method: 'POST',
+    //   data: params,
+    //   header: header,
+    //   success: (res) => {//从后台获取的数据
+    //     that.setData({leftData: xxx,rightData: xxxx });
+    //     //给图表加上数据
+    //     that.initGraph(that.data.leftData, that.data.rightData)
+    //   }
+    // })
 
-            },
-            fail: async res => {
-                // wx.redirectTo({ url: '/pages/index/index' })
-            }
-        })
-    },
+  },
+  // 监听用户是否登录
+  watchLogin: async function () {
+    const that = this;
+    wx.getStorage({
+      key: 'user',
+      success: async res => {
 
-    /**
-     * 生命周期函数--监听页面初次渲染完成
-     */
-    onReady: function () { },
-    /**
-     * 生命周期函数--监听页面显示
-     */
-    onShow: function () {
-        const that = this;
-        // 监听用户是否登录
-        that.watchLogin();
-    },
-    /**
-     * 页面上拉触底事件的处理函数
-     */
-    /**
-     * 生命周期函数--监听页面隐藏
-     */
-    onHide: function () {
+      },
+      fail: async res => {
+        // wx.redirectTo({ url: '/pages/index/index' })
+      }
+    })
+  },
 
-    },
+  /**
+   * 生命周期函数--监听页面初次渲染完成
+   */
+  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) {
+
+  },
 })