|
@@ -25,13 +25,20 @@ Page({
|
|
|
}
|
|
|
})
|
|
|
// 模拟请求
|
|
|
- var times = setTimeout(function () {
|
|
|
- console.log("模拟请求")
|
|
|
+ var times = setTimeout(async function () {
|
|
|
+ const student = await app.$get(`/lessonStudent`, { student_id: res.data.info.id, is_pay: '1' })
|
|
|
+ if (student.errcode == '0') {
|
|
|
+ for (const val of student.data) {
|
|
|
+ const lesson = await app.$get(`/lesson/${val.lesson_id}`)
|
|
|
+ val.lessonname = lesson.data.title
|
|
|
+ }
|
|
|
+ var schooldata = student.data.map((item) => { return item.lessonname; });
|
|
|
+ }
|
|
|
// 数据
|
|
|
- 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];
|
|
|
+ that.data.schooldata = schooldata;
|
|
|
+ that.data.xdata = ['1月份', '2月份', '3月份', '4月份', '5月份', '6月份', '7月份', '8月份', '9月份', '10月份', '11月份', '12月份'];
|
|
|
+ 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];
|
|
|
clearTimeout(times);
|
|
|
}, 1000)
|
|
|
},
|
|
@@ -59,55 +66,143 @@ Page({
|
|
|
canvas.setChart(chart);
|
|
|
var option = {
|
|
|
tooltip: {
|
|
|
- trigger: 'axis'
|
|
|
+ trigger: 'axis',
|
|
|
+ axisPointer: {
|
|
|
+ type: 'cross',
|
|
|
+ label: {
|
|
|
+ backgroundColor: '#6a7985'
|
|
|
+ }
|
|
|
+ }
|
|
|
+ ,
|
|
|
+ formatter: function (params) {
|
|
|
+ let html = params[0].name + "<br>";
|
|
|
+ for (let i = 0; i < params.length; i++) {
|
|
|
+ html += '<span style="display:inline-block;margin-right:5px;border-radius:10px;width:10px;height:10px;background-color:' + params[i].color + ';"></span>'
|
|
|
+ if (params[i].seriesName == "签到数") {
|
|
|
+ html += params[i].seriesName + ":" + params[i].value + "%<br>";
|
|
|
+ }
|
|
|
+ if (params[i].seriesName == "时长") {
|
|
|
+ html += params[i].seriesName + ":" + params[i].value + "小时<br>";
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return html;
|
|
|
+ }
|
|
|
},
|
|
|
+
|
|
|
legend: {
|
|
|
- data: schooldata
|
|
|
+ textStyle: { color: '#4CA6A3' },
|
|
|
+ x: 'right',
|
|
|
+ data: [{ name: '签到数', icon: 'rect' }, { name: '时长', icon: 'rect' }]
|
|
|
},
|
|
|
grid: {
|
|
|
- left: '3%',
|
|
|
- right: '4%',
|
|
|
+ left: '2%',
|
|
|
+ right: '2%',
|
|
|
bottom: '3%',
|
|
|
containLabel: true
|
|
|
},
|
|
|
- xAxis: {
|
|
|
- type: 'category',
|
|
|
- boundaryGap: false,
|
|
|
- data: xdata
|
|
|
- },
|
|
|
- yAxis: {
|
|
|
- type: 'value'
|
|
|
- },
|
|
|
- series: [
|
|
|
+ xAxis: [
|
|
|
{
|
|
|
- name: schooldata[0],
|
|
|
- type: 'line',
|
|
|
- stack: 'Total',
|
|
|
- data: data1
|
|
|
- },
|
|
|
+ type: 'category',
|
|
|
+ boundaryGap: false,
|
|
|
+ //设置x轴线的属性
|
|
|
+ axisLine: {
|
|
|
+ lineStyle: {
|
|
|
+ color: '#4CA6A3', // 设置x轴字体颜色
|
|
|
+ width: 2, // 设置x轴字体宽度
|
|
|
+ }
|
|
|
+ },
|
|
|
+ data: ['1月', '2月', '3月', '4月', '5月', '6月', '7月', '8月', '9月', '10月', '11月', '12月']
|
|
|
+ }
|
|
|
+ ],
|
|
|
+ yAxis: [
|
|
|
{
|
|
|
- name: schooldata[1],
|
|
|
- type: 'line',
|
|
|
- stack: 'Total',
|
|
|
- data: data2
|
|
|
+ type: 'value',
|
|
|
+ name: '时长',
|
|
|
+ position: 'left',
|
|
|
+ alignTicks: true,
|
|
|
+ axisLine: {
|
|
|
+ show: true,
|
|
|
+ lineStyle: {
|
|
|
+ fontSize: 16,
|
|
|
+ color: '#293C55'
|
|
|
+ }
|
|
|
+ },
|
|
|
+ axisLabel: {
|
|
|
+ formatter: '{value} 小时'
|
|
|
+ }
|
|
|
},
|
|
|
{
|
|
|
- name: schooldata[2],
|
|
|
+ type: 'value',
|
|
|
+ name: "签到数",
|
|
|
+ nameLocation: "center",
|
|
|
+ alignTicks: true,
|
|
|
+ nameGap: 35,
|
|
|
+ nameRotate: 0,
|
|
|
+ nameTextStyle: {
|
|
|
+ fontSize: 16,
|
|
|
+ color: '#293C55'
|
|
|
+ },
|
|
|
+ splitLine: { show: false },//去除网格线
|
|
|
+ min: 0,
|
|
|
+ max: 100,
|
|
|
+ interval: 10,
|
|
|
+ // 设置轴线的属性
|
|
|
+ axisLine: {
|
|
|
+ show: true,
|
|
|
+ lineStyle: {
|
|
|
+ color: '#293C55',
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ ],
|
|
|
+ series: [
|
|
|
+ {
|
|
|
+ name: '签到数',
|
|
|
type: 'line',
|
|
|
- stack: 'Total',
|
|
|
+ stack: '总量',
|
|
|
+ areaStyle: {},
|
|
|
+ itemStyle: {
|
|
|
+ normal: {
|
|
|
+ color: "#25DEDB",//折线点的颜色
|
|
|
+ lineStyle: {
|
|
|
+ color: "#25DEDB"//折线的颜色
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ areaStyle: { // 该属性设置可以使这下图区域颜色达到渐变的效果
|
|
|
+ color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
|
|
|
+ offset: 0,
|
|
|
+ color: '#25DEDB'
|
|
|
+ }, {
|
|
|
+ offset: 1,
|
|
|
+ color: '#ffe'
|
|
|
+ }])
|
|
|
+ },
|
|
|
data: data1
|
|
|
},
|
|
|
{
|
|
|
- name: schooldata[3],
|
|
|
+ name: '时长',
|
|
|
type: 'line',
|
|
|
- stack: 'Total',
|
|
|
+ stack: '总量',
|
|
|
+ areaStyle: {},
|
|
|
+ itemStyle: {
|
|
|
+ normal: {
|
|
|
+ color: "#E96C44",//折线点的颜色
|
|
|
+ lineStyle: {
|
|
|
+ color: "#E96C44"//折线的颜色
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ areaStyle: { // 该属性设置可以使这下图区域颜色达到渐变的效果
|
|
|
+ color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
|
|
|
+ offset: 0,
|
|
|
+ color: '#E96C44'
|
|
|
+ }, {
|
|
|
+ offset: 1,
|
|
|
+ color: '#ffe'
|
|
|
+ }])
|
|
|
+ },
|
|
|
data: data2
|
|
|
- },
|
|
|
- {
|
|
|
- name: schooldata[4],
|
|
|
- type: 'line',
|
|
|
- stack: 'Total',
|
|
|
- data: data1
|
|
|
}
|
|
|
]
|
|
|
};
|