zs 2 lat temu
rodzic
commit
116f3294e8

+ 12 - 4
pages/stuAdmin/archives/list.less

@@ -5,13 +5,21 @@
         .content {
             display: flex;
             flex-direction: row;
+            padding: 2vw;
             border-bottom: 1px dashed var(--f1Color);
-            padding: 2vw 0;
-            margin: 0 2vw 2vw 2vw;
+
+            .label {
+                font-size: 16px;
+            }
 
             .value {
-                flex-grow: 1;
-                color: var(--blackColor);
+                font-size: 16px;
+                width: 70vw;
+
+                textarea {
+                    width: 100%;
+                    height: 120px;
+                }
             }
         }
 

+ 3 - 3
pages/stuAdmin/archives/list.wxml

@@ -46,19 +46,19 @@
                 <view class="content">
                     <view class="label">学员简介:</view>
                     <view class="value">
-                        <input type="text" name="brief" 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 type="text" name="honer" 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 type="text" name="exp" value="{{form.exp}}" placeholder="请输入训练经历" />
+                        <textarea maxlength="500" name="exp" value="{{form.exp}}" placeholder="请输入训练经历" />
                     </view>
                 </view>
                 <view class="btn">

+ 10 - 4
pages/stuAdmin/archives/list.wxss

@@ -4,13 +4,19 @@
 .main .one .content {
   display: flex;
   flex-direction: row;
+  padding: 2vw;
   border-bottom: 1px dashed var(--f1Color);
-  padding: 2vw 0;
-  margin: 0 2vw 2vw 2vw;
+}
+.main .one .content .label {
+  font-size: 16px;
 }
 .main .one .content .value {
-  flex-grow: 1;
-  color: var(--blackColor);
+  font-size: 16px;
+  width: 70vw;
+}
+.main .one .content .value textarea {
+  width: 100%;
+  height: 120px;
 }
 .main .one .btn {
   text-align: center;

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

@@ -1,4 +1,5 @@
 const app = getApp()
+import * as echarts from '../../../commpents/ec-canvas/echarts'
 Page({
     data: {
         frameStyle: { useTop: true, name: '学校学习情况', leftArrow: true, useBar: false },
@@ -10,21 +11,114 @@ Page({
     /**
      * 生命周期函数--监听页面加载
      */
-    onLoad: function (options) { },
+    onLoad: function (options) {
+    },
     // 监听用户是否登录
     watchLogin: async function () {
         const that = this;
         wx.getStorage({
             key: 'user',
-            success: async res => { },
+            success: async res => {
+                that.setData({
+                    ec: {
+                        onInit: that.initChart
+                    }
+                })
+                // 模拟请求
+                var times = setTimeout(function () {
+                    console.log("模拟请求")
+                    // 数据
+                    that.data.schooldata = ['学校1', '学校2', '学校3', '学校4'];
+                    that.data.xdata = ['2010', '2011', '2012', '2013', '2014', '2015', '2016', '2017', '2018', '2019', '2020', '2021', '2022'];
+                    that.data.data1 = [230, 150, 178, 70, 178, 340, 133, 118, 136, 165, 130, 178, 340];
+                    that.data.data2 = [112, 150, 151, 135, 170, 130, 200, 112, 150, 151, 135, 170, 130];
+                    clearTimeout(times);
+                }, 1000)
+            },
             fail: async res => {
-                // wx.redirectTo({ url: '/pages/index/index' })
+                wx.redirectTo({ url: '/pages/index/index' })
             }
         })
     },
+    // 折线图
+    initChart(canvas, width, height, dpr) {
+        let that = this;
+        // 由于请求数据有延迟所以写一个时间函数,当数据存在的时候再执行绘制
+        var times = setInterval(function () {
+            var xdata = that.data.xdata;
+            var schooldata = that.data.schooldata;
+            var data1 = that.data.data1;
+            var data2 = that.data.data2;
+            if (xdata && data1 && data2 && schooldata) {
+                clearInterval(times)
+                const chart = echarts.init(canvas, null, {
+                    width: width,
+                    height: height,
+                    devicePixelRatio: dpr // new
+                });
+                canvas.setChart(chart);
+                var option = {
+                    tooltip: {
+                        trigger: 'axis'
+                    },
+                    legend: {
+                        data: schooldata
+                    },
+                    grid: {
+                        left: '3%',
+                        right: '4%',
+                        bottom: '3%',
+                        containLabel: true
+                    },
+                    xAxis: {
+                        type: 'category',
+                        boundaryGap: false,
+                        data: xdata
+                    },
+                    yAxis: {
+                        type: 'value'
+                    },
+                    series: [
+                        {
+                            name: schooldata[0],
+                            type: 'line',
+                            stack: 'Total',
+                            data: data1
+                        },
+                        {
+                            name: schooldata[1],
+                            type: 'line',
+                            stack: 'Total',
+                            data: data2
+                        },
+                        {
+                            name: schooldata[2],
+                            type: 'line',
+                            stack: 'Total',
+                            data: data1
+                        },
+                        {
+                            name: schooldata[3],
+                            type: 'line',
+                            stack: 'Total',
+                            data: data2
+                        },
+                        {
+                            name: schooldata[4],
+                            type: 'line',
+                            stack: 'Total',
+                            data: data1
+                        }
+                    ]
+                };
+                chart.setOption(option, true);
+                return chart;
+            }
+        }, 100)
+    },
     /**
-     * 生命周期函数--监听页面初次渲染完成
-     */
+   * 生命周期函数--监听页面初次渲染完成
+   */
     onReady: function () { },
     /**
      * 生命周期函数--监听页面显示
@@ -58,10 +152,11 @@ Page({
 
     },
 
+
     /**
      * 用户点击右上角分享
      */
-    onShareAppMessage: function () {
+    onShareAppMessage: function (res) {
 
-    }
+    },
 })

+ 6 - 5
pages/stuAdmin/study/list.json

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

+ 17 - 0
pages/stuAdmin/study/list.less

@@ -0,0 +1,17 @@
+ec-canvas {
+    width: 100%;
+    height: 100%;
+}
+
+.container {
+    position: absolute;
+    top: 0;
+    bottom: 0;
+    left: 0;
+    right: 0;
+    display: flex;
+    flex-direction: column;
+    align-items: center;
+    justify-content: space-between;
+    box-sizing: border-box;
+}

+ 1 - 1
pages/stuAdmin/study/list.wxml

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

+ 16 - 1
pages/stuAdmin/study/list.wxss

@@ -1 +1,16 @@
-/* pages/stuAdmin/study/list.wxss */
+ec-canvas {
+  width: 100%;
+  height: 100%;
+}
+.container {
+  position: absolute;
+  top: 0;
+  bottom: 0;
+  left: 0;
+  right: 0;
+  display: flex;
+  flex-direction: column;
+  align-items: center;
+  justify-content: space-between;
+  box-sizing: border-box;
+}