添加与完善相关页面;
This commit is contained in:
parent
0390f382d0
commit
6f57dcdac8
@ -78,3 +78,32 @@ export const getSemesterGradesForParent = (openid, semester_id) => {
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
export const getStudentsGradeBySemesterAndUser = (semesterId) => {
|
||||
return request({
|
||||
url: "/course/grade/students/semester",
|
||||
method: "get",
|
||||
data: {
|
||||
semesterId
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
export const getStudentWeightedAveragesSemesterValues = (openid) => {
|
||||
return request({
|
||||
url: "/course/students/semesters",
|
||||
method: "get",
|
||||
data: {
|
||||
openid,
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
export const getStudentMaybeInDanger = () => {
|
||||
return request({
|
||||
url: "/course/students/danger",
|
||||
method: "get",
|
||||
data: {
|
||||
}
|
||||
})
|
||||
}
|
4
app.json
4
app.json
@ -15,7 +15,9 @@
|
||||
"pages/my-health/my-health",
|
||||
"pages/my-honors/my-honors",
|
||||
"pages/robot/robot",
|
||||
"pages/my-children/my-children"
|
||||
"pages/my-children/my-children",
|
||||
"pages/student-grade-trend/student-grade-trend",
|
||||
"pages/student-need-concerning/student-need-concerning"
|
||||
],
|
||||
"window": {
|
||||
"backgroundTextStyle": "light",
|
||||
|
250
ec-canvas/ec-canvas.js
Normal file
250
ec-canvas/ec-canvas.js
Normal file
@ -0,0 +1,250 @@
|
||||
import WxCanvas from './wx-canvas';
|
||||
import * as echarts from './echarts';
|
||||
|
||||
let ctx;
|
||||
|
||||
function compareVersion(v1, v2) {
|
||||
v1 = v1.split('.')
|
||||
v2 = v2.split('.')
|
||||
const len = Math.max(v1.length, v2.length)
|
||||
|
||||
while (v1.length < len) {
|
||||
v1.push('0')
|
||||
}
|
||||
while (v2.length < len) {
|
||||
v2.push('0')
|
||||
}
|
||||
|
||||
for (let i = 0; i < len; i++) {
|
||||
const num1 = parseInt(v1[i])
|
||||
const num2 = parseInt(v2[i])
|
||||
|
||||
if (num1 > num2) {
|
||||
return 1
|
||||
} else if (num1 < num2) {
|
||||
return -1
|
||||
}
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
Component({
|
||||
properties: {
|
||||
canvasId: {
|
||||
type: String,
|
||||
value: 'ec-canvas'
|
||||
},
|
||||
|
||||
ec: {
|
||||
type: Object
|
||||
},
|
||||
|
||||
forceUseOldCanvas: {
|
||||
type: Boolean,
|
||||
value: false
|
||||
}
|
||||
},
|
||||
|
||||
data: {
|
||||
isUseNewCanvas: false
|
||||
},
|
||||
|
||||
ready: function () {
|
||||
// Disable prograssive because drawImage doesn't support DOM as parameter
|
||||
// See https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.drawImage.html
|
||||
echarts.registerPreprocessor(option => {
|
||||
if (option && option.series) {
|
||||
if (option.series.length > 0) {
|
||||
option.series.forEach(series => {
|
||||
series.progressive = 0;
|
||||
});
|
||||
}
|
||||
else if (typeof option.series === 'object') {
|
||||
option.series.progressive = 0;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
if (!this.data.ec) {
|
||||
console.warn('组件需绑定 ec 变量,例:<ec-canvas id="mychart-dom-bar" '
|
||||
+ 'canvas-id="mychart-bar" ec="{{ ec }}"></ec-canvas>');
|
||||
return;
|
||||
}
|
||||
|
||||
if (!this.data.ec.lazyLoad) {
|
||||
this.init();
|
||||
}
|
||||
},
|
||||
|
||||
methods: {
|
||||
init: function (callback) {
|
||||
const version = wx.getSystemInfoSync().SDKVersion
|
||||
|
||||
const canUseNewCanvas = compareVersion(version, '2.9.0') >= 0;
|
||||
const forceUseOldCanvas = this.data.forceUseOldCanvas;
|
||||
const isUseNewCanvas = canUseNewCanvas && !forceUseOldCanvas;
|
||||
this.setData({ isUseNewCanvas });
|
||||
|
||||
if (forceUseOldCanvas && canUseNewCanvas) {
|
||||
console.warn('开发者强制使用旧canvas,建议关闭');
|
||||
}
|
||||
|
||||
if (isUseNewCanvas) {
|
||||
// console.log('微信基础库版本大于2.9.0,开始使用<canvas type="2d"/>');
|
||||
// 2.9.0 可以使用 <canvas type="2d"></canvas>
|
||||
this.initByNewWay(callback);
|
||||
} else {
|
||||
const isValid = compareVersion(version, '1.9.91') >= 0
|
||||
if (!isValid) {
|
||||
console.error('微信基础库版本过低,需大于等于 1.9.91。'
|
||||
+ '参见:https://github.com/ecomfe/echarts-for-weixin'
|
||||
+ '#%E5%BE%AE%E4%BF%A1%E7%89%88%E6%9C%AC%E8%A6%81%E6%B1%82');
|
||||
return;
|
||||
} else {
|
||||
console.warn('建议将微信基础库调整大于等于2.9.0版本。升级后绘图将有更好性能');
|
||||
this.initByOldWay(callback);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
initByOldWay(callback) {
|
||||
// 1.9.91 <= version < 2.9.0:原来的方式初始化
|
||||
ctx = wx.createCanvasContext(this.data.canvasId, this);
|
||||
const canvas = new WxCanvas(ctx, this.data.canvasId, false);
|
||||
|
||||
echarts.setCanvasCreator(() => {
|
||||
return canvas;
|
||||
});
|
||||
// const canvasDpr = wx.getSystemInfoSync().pixelRatio // 微信旧的canvas不能传入dpr
|
||||
const canvasDpr = 1
|
||||
var query = wx.createSelectorQuery().in(this);
|
||||
query.select('.ec-canvas').boundingClientRect(res => {
|
||||
if (typeof callback === 'function') {
|
||||
this.chart = callback(canvas, res.width, res.height, canvasDpr);
|
||||
}
|
||||
else if (this.data.ec && typeof this.data.ec.onInit === 'function') {
|
||||
this.chart = this.data.ec.onInit(canvas, res.width, res.height, canvasDpr);
|
||||
}
|
||||
else {
|
||||
this.triggerEvent('init', {
|
||||
canvas: canvas,
|
||||
width: res.width,
|
||||
height: res.height,
|
||||
canvasDpr: canvasDpr // 增加了dpr,可方便外面echarts.init
|
||||
});
|
||||
}
|
||||
}).exec();
|
||||
},
|
||||
|
||||
initByNewWay(callback) {
|
||||
// version >= 2.9.0:使用新的方式初始化
|
||||
const query = wx.createSelectorQuery().in(this)
|
||||
query
|
||||
.select('.ec-canvas')
|
||||
.fields({ node: true, size: true })
|
||||
.exec(res => {
|
||||
const canvasNode = res[0].node
|
||||
this.canvasNode = canvasNode
|
||||
|
||||
const canvasDpr = wx.getSystemInfoSync().pixelRatio
|
||||
const canvasWidth = res[0].width
|
||||
const canvasHeight = res[0].height
|
||||
|
||||
const ctx = canvasNode.getContext('2d')
|
||||
|
||||
const canvas = new WxCanvas(ctx, this.data.canvasId, true, canvasNode)
|
||||
echarts.setCanvasCreator(() => {
|
||||
return canvas
|
||||
})
|
||||
|
||||
if (typeof callback === 'function') {
|
||||
this.chart = callback(canvas, canvasWidth, canvasHeight, canvasDpr)
|
||||
} else if (this.data.ec && typeof this.data.ec.onInit === 'function') {
|
||||
this.chart = this.data.ec.onInit(canvas, canvasWidth, canvasHeight, canvasDpr)
|
||||
} else {
|
||||
this.triggerEvent('init', {
|
||||
canvas: canvas,
|
||||
width: canvasWidth,
|
||||
height: canvasHeight,
|
||||
dpr: canvasDpr
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
canvasToTempFilePath(opt) {
|
||||
if (this.data.isUseNewCanvas) {
|
||||
// 新版
|
||||
const query = wx.createSelectorQuery().in(this)
|
||||
query
|
||||
.select('.ec-canvas')
|
||||
.fields({ node: true, size: true })
|
||||
.exec(res => {
|
||||
const canvasNode = res[0].node
|
||||
opt.canvas = canvasNode
|
||||
wx.canvasToTempFilePath(opt)
|
||||
})
|
||||
} else {
|
||||
// 旧的
|
||||
if (!opt.canvasId) {
|
||||
opt.canvasId = this.data.canvasId;
|
||||
}
|
||||
ctx.draw(true, () => {
|
||||
wx.canvasToTempFilePath(opt, this);
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
touchStart(e) {
|
||||
if (this.chart && e.touches.length > 0) {
|
||||
var touch = e.touches[0];
|
||||
var handler = this.chart.getZr().handler;
|
||||
handler.dispatch('mousedown', {
|
||||
zrX: touch.x,
|
||||
zrY: touch.y
|
||||
});
|
||||
handler.dispatch('mousemove', {
|
||||
zrX: touch.x,
|
||||
zrY: touch.y
|
||||
});
|
||||
handler.processGesture(wrapTouch(e), 'start');
|
||||
}
|
||||
},
|
||||
|
||||
touchMove(e) {
|
||||
if (this.chart && e.touches.length > 0) {
|
||||
var touch = e.touches[0];
|
||||
var handler = this.chart.getZr().handler;
|
||||
handler.dispatch('mousemove', {
|
||||
zrX: touch.x,
|
||||
zrY: touch.y
|
||||
});
|
||||
handler.processGesture(wrapTouch(e), 'change');
|
||||
}
|
||||
},
|
||||
|
||||
touchEnd(e) {
|
||||
if (this.chart) {
|
||||
const touch = e.changedTouches ? e.changedTouches[0] : {};
|
||||
var handler = this.chart.getZr().handler;
|
||||
handler.dispatch('mouseup', {
|
||||
zrX: touch.x,
|
||||
zrY: touch.y
|
||||
});
|
||||
handler.dispatch('click', {
|
||||
zrX: touch.x,
|
||||
zrY: touch.y
|
||||
});
|
||||
handler.processGesture(wrapTouch(e), 'end');
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
function wrapTouch(event) {
|
||||
for (let i = 0; i < event.touches.length; ++i) {
|
||||
const touch = event.touches[i];
|
||||
touch.offsetX = touch.x;
|
||||
touch.offsetY = touch.y;
|
||||
}
|
||||
return event;
|
||||
}
|
4
ec-canvas/ec-canvas.json
Normal file
4
ec-canvas/ec-canvas.json
Normal file
@ -0,0 +1,4 @@
|
||||
{
|
||||
"component": true,
|
||||
"usingComponents": {}
|
||||
}
|
4
ec-canvas/ec-canvas.wxml
Normal file
4
ec-canvas/ec-canvas.wxml
Normal file
@ -0,0 +1,4 @@
|
||||
<!-- 新的:接口对其了H5 -->
|
||||
<canvas wx:if="{{isUseNewCanvas}}" type="2d" class="ec-canvas" canvas-id="{{ canvasId }}" bindinit="init" bindtouchstart="{{ ec.disableTouch ? '' : 'touchStart' }}" bindtouchmove="{{ ec.disableTouch ? '' : 'touchMove' }}" bindtouchend="{{ ec.disableTouch ? '' : 'touchEnd' }}"></canvas>
|
||||
<!-- 旧的 -->
|
||||
<canvas wx:else class="ec-canvas" canvas-id="{{ canvasId }}" bindinit="init" bindtouchstart="{{ ec.disableTouch ? '' : 'touchStart' }}" bindtouchmove="{{ ec.disableTouch ? '' : 'touchMove' }}" bindtouchend="{{ ec.disableTouch ? '' : 'touchEnd' }}"></canvas>
|
4
ec-canvas/ec-canvas.wxss
Normal file
4
ec-canvas/ec-canvas.wxss
Normal file
@ -0,0 +1,4 @@
|
||||
.ec-canvas {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
22
ec-canvas/echarts.js
Normal file
22
ec-canvas/echarts.js
Normal file
File diff suppressed because one or more lines are too long
121
ec-canvas/wx-canvas.js
Normal file
121
ec-canvas/wx-canvas.js
Normal file
@ -0,0 +1,121 @@
|
||||
export default class WxCanvas {
|
||||
constructor(ctx, canvasId, isNew, canvasNode) {
|
||||
this.ctx = ctx;
|
||||
this.canvasId = canvasId;
|
||||
this.chart = null;
|
||||
this.isNew = isNew
|
||||
if (isNew) {
|
||||
this.canvasNode = canvasNode;
|
||||
}
|
||||
else {
|
||||
this._initStyle(ctx);
|
||||
}
|
||||
|
||||
// this._initCanvas(zrender, ctx);
|
||||
|
||||
this._initEvent();
|
||||
}
|
||||
|
||||
getContext(contextType) {
|
||||
if (contextType === '2d') {
|
||||
return this.ctx;
|
||||
}
|
||||
}
|
||||
|
||||
// canvasToTempFilePath(opt) {
|
||||
// if (!opt.canvasId) {
|
||||
// opt.canvasId = this.canvasId;
|
||||
// }
|
||||
// return wx.canvasToTempFilePath(opt, this);
|
||||
// }
|
||||
|
||||
setChart(chart) {
|
||||
this.chart = chart;
|
||||
}
|
||||
|
||||
attachEvent() {
|
||||
// noop
|
||||
}
|
||||
|
||||
detachEvent() {
|
||||
// noop
|
||||
}
|
||||
|
||||
_initCanvas(zrender, ctx) {
|
||||
zrender.util.getContext = function () {
|
||||
return ctx;
|
||||
};
|
||||
|
||||
zrender.util.$override('measureText', function (text, font) {
|
||||
ctx.font = font || '12px sans-serif';
|
||||
return ctx.measureText(text);
|
||||
});
|
||||
}
|
||||
|
||||
_initStyle(ctx) {
|
||||
var styles = ['fillStyle', 'strokeStyle', 'globalAlpha',
|
||||
'textAlign', 'textBaseAlign', 'shadow', 'lineWidth',
|
||||
'lineCap', 'lineJoin', 'lineDash', 'miterLimit', 'fontSize'];
|
||||
|
||||
styles.forEach(style => {
|
||||
Object.defineProperty(ctx, style, {
|
||||
set: value => {
|
||||
if (style !== 'fillStyle' && style !== 'strokeStyle'
|
||||
|| value !== 'none' && value !== null
|
||||
) {
|
||||
ctx['set' + style.charAt(0).toUpperCase() + style.slice(1)](value);
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
ctx.createRadialGradient = () => {
|
||||
return ctx.createCircularGradient(arguments);
|
||||
};
|
||||
}
|
||||
|
||||
_initEvent() {
|
||||
this.event = {};
|
||||
const eventNames = [{
|
||||
wxName: 'touchStart',
|
||||
ecName: 'mousedown'
|
||||
}, {
|
||||
wxName: 'touchMove',
|
||||
ecName: 'mousemove'
|
||||
}, {
|
||||
wxName: 'touchEnd',
|
||||
ecName: 'mouseup'
|
||||
}, {
|
||||
wxName: 'touchEnd',
|
||||
ecName: 'click'
|
||||
}];
|
||||
|
||||
eventNames.forEach(name => {
|
||||
this.event[name.wxName] = e => {
|
||||
const touch = e.touches[0];
|
||||
this.chart.getZr().handler.dispatch(name.ecName, {
|
||||
zrX: name.wxName === 'tap' ? touch.clientX : touch.x,
|
||||
zrY: name.wxName === 'tap' ? touch.clientY : touch.y
|
||||
});
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
set width(w) {
|
||||
if (this.canvasNode) this.canvasNode.width = w
|
||||
}
|
||||
set height(h) {
|
||||
if (this.canvasNode) this.canvasNode.height = h
|
||||
}
|
||||
|
||||
get width() {
|
||||
if (this.canvasNode)
|
||||
return this.canvasNode.width
|
||||
return 0
|
||||
}
|
||||
get height() {
|
||||
if (this.canvasNode)
|
||||
return this.canvasNode.height
|
||||
return 0
|
||||
}
|
||||
}
|
@ -50,7 +50,6 @@
|
||||
<view class="weui-cell weui-cell_active weui-cell_access" bindtap="bindAnnouncement">
|
||||
<view class="weui-cell__bd">
|
||||
<text class="demo_badge_title">公告通知</text>
|
||||
<text class="weui-badge">4</text>
|
||||
</view>
|
||||
<view class="weui-cell__ft"></view>
|
||||
</view>
|
||||
@ -64,7 +63,6 @@
|
||||
<view class="weui-cell weui-cell_active weui-cell_access" wx:if="{{userDocument.role === 'ROLE_PARENT'}}">
|
||||
<view class="weui-cell__bd">
|
||||
<text class="demo_badge_title">问答机器人</text>
|
||||
<text class="weui-badge">8</text>
|
||||
</view>
|
||||
<view class="weui-cell__ft">详细信息</view>
|
||||
</view>
|
||||
|
219
pages/student-grade-trend/student-grade-trend.js
Normal file
219
pages/student-grade-trend/student-grade-trend.js
Normal file
@ -0,0 +1,219 @@
|
||||
// pages/student-grade-trend/student-grade-trend.js
|
||||
import {searchStudents, getUserProfileSupervisor} from '../../api/document'
|
||||
import {getStudentWeightedAveragesSemesterValues} from '../../api/course'
|
||||
import * as echarts from '../../ec-canvas/echarts';
|
||||
|
||||
var option = {
|
||||
title: {
|
||||
text: '各学期学分绩折线图',
|
||||
left: 'center'
|
||||
},
|
||||
color: ["#37A2DA"],
|
||||
legend: {
|
||||
data: ['学分绩'],
|
||||
top: 50,
|
||||
left: 'center',
|
||||
backgroundColor: 'red',
|
||||
z: 100
|
||||
},
|
||||
grid: {
|
||||
containLabel: true
|
||||
},
|
||||
tooltip: {
|
||||
show: true,
|
||||
trigger: 'axis'
|
||||
},
|
||||
xAxis: {
|
||||
type: 'category',
|
||||
boundaryGap: false,
|
||||
data: ['周一', '周二', '周三', '周四', '周五', '周六', '周日'],
|
||||
// show: false
|
||||
},
|
||||
yAxis: {
|
||||
x: 'center',
|
||||
type: 'value',
|
||||
splitLine: {
|
||||
lineStyle: {
|
||||
type: 'dashed'
|
||||
}
|
||||
}
|
||||
// show: false
|
||||
},
|
||||
series: [{
|
||||
name: '学分绩',
|
||||
type: 'line',
|
||||
smooth: true,
|
||||
data: [18, 36, 65, 30, 78, 40, 33]
|
||||
}]
|
||||
};
|
||||
|
||||
|
||||
function initChart(canvas, width, height, dpr) {
|
||||
const chart = echarts.init(canvas, null, {
|
||||
width: width,
|
||||
height: height,
|
||||
devicePixelRatio: dpr // new
|
||||
});
|
||||
canvas.setChart(chart);
|
||||
|
||||
chart.setOption(option);
|
||||
return chart;
|
||||
}
|
||||
|
||||
Page({
|
||||
|
||||
/**
|
||||
* 页面的初始数据
|
||||
*/
|
||||
data: {
|
||||
inputShowed: false,
|
||||
inputVal: "",
|
||||
searchStudentsList: [],
|
||||
showGraph: false,
|
||||
ec: {
|
||||
onInit: initChart
|
||||
},
|
||||
realName: '',
|
||||
numbering: ''
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
onLoad: function (options) {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面初次渲染完成
|
||||
*/
|
||||
onReady: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面显示
|
||||
*/
|
||||
onShow: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面隐藏
|
||||
*/
|
||||
onHide: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面卸载
|
||||
*/
|
||||
onUnload: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面相关事件处理函数--监听用户下拉动作
|
||||
*/
|
||||
onPullDownRefresh: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面上拉触底事件的处理函数
|
||||
*/
|
||||
onReachBottom: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 用户点击右上角分享
|
||||
*/
|
||||
onShareAppMessage: function () {
|
||||
|
||||
},
|
||||
|
||||
showInput: function () {
|
||||
this.setData({
|
||||
inputShowed: true
|
||||
});
|
||||
},
|
||||
|
||||
hideInput: function () {
|
||||
this.setData({
|
||||
inputVal: "",
|
||||
inputShowed: false
|
||||
});
|
||||
},
|
||||
|
||||
clearInput: function () {
|
||||
this.setData({
|
||||
inputVal: ""
|
||||
});
|
||||
},
|
||||
|
||||
onClickShowDocument(e) {
|
||||
let showIndex = e.currentTarget.dataset['index']
|
||||
let userDocument = this.data.searchStudentsList[showIndex]
|
||||
this.setData({
|
||||
realName: userDocument.realName,
|
||||
numbering: userDocument.numbering
|
||||
})
|
||||
getUserProfileSupervisor(userDocument.id).then(res => {
|
||||
console.log(res)
|
||||
return res.openid
|
||||
}).then(res => {
|
||||
return getStudentWeightedAveragesSemesterValues(res).then(res => {
|
||||
console.log(res)
|
||||
let values = []
|
||||
let sems = []
|
||||
res.forEach((v, i) => {
|
||||
values.push(v.value)
|
||||
const sem = v.semesterItem
|
||||
sems.push(`${sem.startYear} ${sem.springAutumn ? '春' : '秋'}` )
|
||||
})
|
||||
|
||||
console.log(values)
|
||||
console.log(sems)
|
||||
|
||||
option.xAxis.data = sems
|
||||
option.series.data = values
|
||||
|
||||
this.setData({
|
||||
showGraph: true,
|
||||
ec: {
|
||||
onInit: initChart
|
||||
}
|
||||
})
|
||||
})
|
||||
})
|
||||
},
|
||||
|
||||
inputTyping: function (e) {
|
||||
let inputVal = e.detail.value
|
||||
this.setData({
|
||||
inputVal
|
||||
});
|
||||
searchStudents(inputVal).then(res => {
|
||||
console.log(res)
|
||||
this.setData({
|
||||
searchStudentsList: res
|
||||
})
|
||||
})
|
||||
},
|
||||
|
||||
onShareAppMessage: function (res) {
|
||||
return {
|
||||
title: 'ECharts 可以在微信小程序中使用啦!',
|
||||
path: '/pages/index/index',
|
||||
success: function () { },
|
||||
fail: function () { }
|
||||
}
|
||||
},
|
||||
|
||||
onClickBack() {
|
||||
this.setData({
|
||||
showGraph: false
|
||||
})
|
||||
}
|
||||
})
|
5
pages/student-grade-trend/student-grade-trend.json
Normal file
5
pages/student-grade-trend/student-grade-trend.json
Normal file
@ -0,0 +1,5 @@
|
||||
{
|
||||
"usingComponents": {
|
||||
"ec-canvas": "../../ec-canvas/ec-canvas"
|
||||
}
|
||||
}
|
38
pages/student-grade-trend/student-grade-trend.wxml
Normal file
38
pages/student-grade-trend/student-grade-trend.wxml
Normal file
@ -0,0 +1,38 @@
|
||||
<!--pages/my-student/my-students.wxml-->
|
||||
<view class="page" data-weui-theme="{{theme}}">
|
||||
<view class="page__hd" wx:if="{{!showGraph}}">
|
||||
<view class="page__title">学生成绩波动趋势</view>
|
||||
<view class="page__desc">学生各学期成绩的变化</view>
|
||||
</view>
|
||||
<view class="page__hd" wx:else>
|
||||
<view class="page__title">{{realName}}</view>
|
||||
<view class="page__desc">学号 {{numbering}}</view>
|
||||
</view>
|
||||
<view class="page__bd" wx:if="{{!showGraph}}">
|
||||
<view class="weui-search-bar {{inputShowed ? 'weui-search-bar_focusing' : ''}}" id="searchBar">
|
||||
<form class="weui-search-bar__form">
|
||||
<view class="weui-search-bar__box">
|
||||
<i class="weui-icon-search"></i>
|
||||
<input type="text" class="weui-search-bar__input" placeholder="搜索" value="{{inputVal}}" focus="{{inputShowed}}" bindinput="inputTyping" />
|
||||
<span class="weui-icon-clear" wx:if="{{inputVal.length > 0}}" bindtap="clearInput"></span>
|
||||
</view>
|
||||
<label class="weui-search-bar__label" bindtap="showInput">
|
||||
<i class="weui-icon-search"></i>
|
||||
<span class="weui-search-bar__text">输入学号搜索</span>
|
||||
</label>
|
||||
</form>
|
||||
<view class="weui-search-bar__cancel-btn" bindtap="hideInput">取消</view>
|
||||
</view>
|
||||
<view class="weui-cells searchbar-result" wx:if="{{inputVal.length > 0}}">
|
||||
<view class="weui-cell weui-cell_active weui-cell_access" wx:for="{{searchStudentsList}}" wx:key="index" data-index="{{index}}" bindtap="onClickShowDocument">
|
||||
<view class="weui-cell__bd weui-cell_primary">
|
||||
<view>[{{item.numbering}}] {{item.realName}}</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="graph" wx:else>
|
||||
<ec-canvas id="mychart-dom-line" canvas-id="mychart-line" ec="{{ ec }}"></ec-canvas>
|
||||
<a class="weui-btn weui-btn_disabled weui-btn_default" bindtap="onClickBack">返回搜索</a>
|
||||
</view>
|
||||
</view>
|
10
pages/student-grade-trend/student-grade-trend.wxss
Normal file
10
pages/student-grade-trend/student-grade-trend.wxss
Normal file
@ -0,0 +1,10 @@
|
||||
/* pages/student-grade-trend/student-grade-trend.wxss */
|
||||
ec-canvas {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.graph {
|
||||
width: 750rpx;
|
||||
height: 300px;
|
||||
}
|
73
pages/student-need-concerning/student-need-concerning.js
Normal file
73
pages/student-need-concerning/student-need-concerning.js
Normal file
@ -0,0 +1,73 @@
|
||||
// pages/student-need-concerning/student-need-concerning.js
|
||||
import {getStudentMaybeInDanger} from '../../api/course'
|
||||
|
||||
Page({
|
||||
|
||||
/**
|
||||
* 页面的初始数据
|
||||
*/
|
||||
data: {
|
||||
studentsList: []
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
onLoad: function (options) {
|
||||
getStudentMaybeInDanger().then(res => {
|
||||
console.log(res)
|
||||
this.setData({
|
||||
studentsList: res
|
||||
})
|
||||
})
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面初次渲染完成
|
||||
*/
|
||||
onReady: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面显示
|
||||
*/
|
||||
onShow: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面隐藏
|
||||
*/
|
||||
onHide: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面卸载
|
||||
*/
|
||||
onUnload: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面相关事件处理函数--监听用户下拉动作
|
||||
*/
|
||||
onPullDownRefresh: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面上拉触底事件的处理函数
|
||||
*/
|
||||
onReachBottom: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 用户点击右上角分享
|
||||
*/
|
||||
onShareAppMessage: function () {
|
||||
|
||||
}
|
||||
})
|
@ -0,0 +1,3 @@
|
||||
{
|
||||
"usingComponents": {}
|
||||
}
|
24
pages/student-need-concerning/student-need-concerning.wxml
Normal file
24
pages/student-need-concerning/student-need-concerning.wxml
Normal file
@ -0,0 +1,24 @@
|
||||
<view class="page" data-weui-theme="{{theme}}">
|
||||
<view class="page__hd">
|
||||
<view class="page__title">需要关注的学生</view>
|
||||
<view class="page__desc">成绩波动幅度较大的学生</view>
|
||||
</view>
|
||||
<view class="page__bd" wx:if="{{!showMessage}}" >
|
||||
<view class="weui-panel weui-panel_access" wx:for="{{studentsList}}" wx:key="index">
|
||||
<view class="weui-panel__hd">{{item.realName}} {{item.numbering}}</view>
|
||||
<view class="weui-panel__bd">
|
||||
<view class="weui-media-box weui-media-box_text" wx:for="{{item.infos}}" wx:key="index">
|
||||
<h4 class="weui-media-box__title">{{item.semesterItem.startYear}}-{{item.semesterItem.endYear}}年{{item.semesterItem.springAutumn ? '春' : '秋'}}季学期</h4>
|
||||
<view class="weui-media-box__desc">学分绩较上学期的波动幅度为{{item.value}}</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="weui-panel__ft">
|
||||
<a class="weui-cell weui-cell_active weui-cell_access weui-cell_link">
|
||||
<view class="weui-cell__bd">查看更多</view>
|
||||
<text class="weui-cell__ft"></text>
|
||||
</a>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
@ -0,0 +1 @@
|
||||
/* pages/student-need-concerning/student-need-concerning.wxss */
|
@ -1,5 +1,5 @@
|
||||
// pages/students-grade-analyse/students-grade-analyse.js
|
||||
import {getStudentsGrade} from '../../api/course'
|
||||
import {getStudentsGrade, getStudentsGradeBySemesterAndUser} from '../../api/course'
|
||||
|
||||
Page({
|
||||
|
||||
@ -7,7 +7,9 @@ Page({
|
||||
* 页面的初始数据
|
||||
*/
|
||||
data: {
|
||||
studentsGradeInfo: {}
|
||||
studentsGradeInfo: {},
|
||||
studentsGradeSemesterInfo: {},
|
||||
showSemester: false
|
||||
},
|
||||
|
||||
/**
|
||||
@ -69,5 +71,35 @@ Page({
|
||||
*/
|
||||
onShareAppMessage: function () {
|
||||
|
||||
},
|
||||
|
||||
onClickGradeTrend() {
|
||||
wx.navigateTo({
|
||||
url: '/pages/student-grade-trend/student-grade-trend'
|
||||
})
|
||||
},
|
||||
|
||||
onClickStudentConerning() {
|
||||
wx.navigateTo({
|
||||
url: '/pages/student-need-concerning/student-need-concerning'
|
||||
})
|
||||
},
|
||||
|
||||
onClickShowSemester(e) {
|
||||
const targetIndex = e.currentTarget.dataset['index'];
|
||||
console.log(targetIndex)
|
||||
getStudentsGradeBySemesterAndUser(targetIndex).then(res => {
|
||||
console.log(res)
|
||||
this.setData({
|
||||
studentsGradeSemesterInfo: res,
|
||||
showSemester: true
|
||||
})
|
||||
})
|
||||
},
|
||||
|
||||
onClickBack() {
|
||||
this.setData({
|
||||
showSemester: false
|
||||
})
|
||||
}
|
||||
})
|
@ -1,10 +1,14 @@
|
||||
<!--pages/students-grade-analyse/students-grade-analyse.wxml-->
|
||||
<view class="page" data-weui-theme="{{theme}}">
|
||||
<view class="page__hd" wx:if="{{true}}">
|
||||
<view class="page__hd" wx:if="{{!showSemester}}">
|
||||
<view class="page__title">学生成绩分析</view>
|
||||
<view class="page__desc">我管理的学生的学业成绩情况</view>
|
||||
</view>
|
||||
<view wx:if="{{true}}">
|
||||
<view class="page__hd" wx:else>
|
||||
<view class="page__title">{{studentsGradeSemesterInfo.semester}}</view>
|
||||
<view class="page__desc">学生在这个学期的学业成绩情况</view>
|
||||
</view>
|
||||
<view wx:if="{{!showSemester}}">
|
||||
<view class="page__bd">
|
||||
<view class="weui-form-preview">
|
||||
<view class="weui-form-preview__hd">
|
||||
@ -39,18 +43,24 @@
|
||||
<view class="page__bd">
|
||||
<view class="weui-cells__title">功能</view>
|
||||
<view class="weui-cells demo_badge_cells">
|
||||
<view class="weui-cell weui-cell_active weui-cell_access">
|
||||
<view class="weui-cell weui-cell_active weui-cell_access" bindtap="onClickStudentConerning">
|
||||
<view class="weui-cell__bd">
|
||||
<text class="demo_badge_title">需要关注的学生</text>
|
||||
</view>
|
||||
<view class="weui-cell__ft"></view>
|
||||
</view>
|
||||
<view class="weui-cell weui-cell_active weui-cell_access">
|
||||
<view class="weui-cell__bd" bindtap="onClickGradeTrend">
|
||||
<text class="demo_badge_title">学生成绩波动趋势</text>
|
||||
</view>
|
||||
<view class="weui-cell__ft"></view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="page__bd">
|
||||
<view class="weui-cells__title">学期概况</view>
|
||||
<view class="weui-cells demo_badge_cells">
|
||||
<view class="weui-cell weui-cell_active weui-cell_access" wx:for="{{studentsGradeInfo.semesterList}}" wx:key="index">
|
||||
<view class="weui-cell weui-cell_active weui-cell_access" wx:for="{{studentsGradeInfo.semesterList}}" wx:key="index" bindtap="onClickShowSemester" data-index="{{index}}">
|
||||
<view class="weui-cell__bd">
|
||||
<text class="demo_badge_title">{{item}}</text>
|
||||
</view>
|
||||
@ -59,5 +69,39 @@
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view wx:else>
|
||||
<view class="page__bd">
|
||||
<view class="weui-form-preview">
|
||||
<view class="weui-form-preview__hd">
|
||||
<view class="weui-form-preview__item">
|
||||
<label class="weui-form-preview__label">学生总人数</label>
|
||||
<em class="weui-form-preview__value">{{studentsGradeSemesterInfo.studentsNumber}}</em>
|
||||
</view>
|
||||
</view>
|
||||
<view class="weui-form-preview__bd">
|
||||
<view class="weui-form-preview__item">
|
||||
<label class="weui-form-preview__label">平均学分积</label>
|
||||
<text class="weui-form-preview__value">{{studentsGradeSemesterInfo.weightedAverage}}</text>
|
||||
</view>
|
||||
<view class="weui-form-preview__item">
|
||||
<label class="weui-form-preview__label">平均绩点</label>
|
||||
<text class="weui-form-preview__value">{{studentsGradeSemesterInfo.gpa}}</text>
|
||||
</view>
|
||||
<view class="weui-form-preview__item">
|
||||
<label class="weui-form-preview__label">挂科记录数</label>
|
||||
<text class="weui-form-preview__value">{{studentsGradeSemesterInfo.failedRecord}}</text>
|
||||
</view>
|
||||
<view class="weui-form-preview__item">
|
||||
<label class="weui-form-preview__label">学期数</label>
|
||||
<text class="weui-form-preview__value">{{studentsGradeSemesterInfo.semesterListSize}}</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="weui-form-preview__ft">
|
||||
<a class="weui-form-preview__btn weui-form-preview__btn_primary">反映问题</a>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<a class="weui-btn weui-btn_disabled weui-btn_default" bindtap="onClickBack">返回</a>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user