学生成绩查询系统适配;

This commit is contained in:
Saturneric 2021-04-01 02:15:01 +08:00
parent 715555c7e3
commit f50335b4dd
10 changed files with 261 additions and 54 deletions

41
api/course.js Normal file
View File

@ -0,0 +1,41 @@
import request from '../utils/request.js'
export const getGrade = () => {
return request({
url: "/course/grade",
method: "get",
data: {
}
})
}
export const getSemesters = () => {
return request({
url: "/course/semesters",
method: "get",
data: {
}
})
}
export const getSemesterGrades = (semester_id) => {
return request({
url: "/course/grade/semester",
method: "get",
data: {
semesterId: semester_id
}
})
}
export const getCourseGrades = (semester_id) => {
return request({
url: "/course/grade/courses",
method: "get",
data: {
semesterId: semester_id
}
})
}

20
api/message.js Normal file
View File

@ -0,0 +1,20 @@
import request from '../utils/request.js'
export const getMessageUnread = () => {
return request({
url: "/message/unread",
method: "get",
data: {
}
})
}
export const markMessage = (messageId) => {
return request({
url: "/message/mark",
method: "post",
data: {
messageId
}
})
}

11
api/notification.js Normal file
View File

@ -0,0 +1,11 @@
import request from '../utils/request.js'
export const getNotificationNow = () => {
return request({
url: "/notification/byTimeNow",
method: "get",
data: {
}
})
}

View File

@ -1,18 +1,27 @@
// pages/announcement/announcement.js
import {getNotificationNow} from '../../api/notification'
Page({
/**
* 页面的初始数据
*/
data: {
notificationsInfo: [],
showNotification: false,
showIndex: 0,
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
getNotificationNow().then(res => {
console.log(res)
this.setData({
notificationsInfo: res
})
})
},
/**
@ -62,5 +71,18 @@ Page({
*/
onShareAppMessage: function () {
},
onClickNotification(e) {
this.setData({
showNotification: true,
showIndex: e.currentTarget.dataset['index']
})
},
showNotificationsList(e) {
this.setData({
showNotification: false,
showIndex: 0
})
}
})

View File

@ -1,23 +1,23 @@
<!--pages/announcement/announcement.wxml-->
<view class="page" data-weui-theme="{{theme}}">
<view class="page__hd" wx:if="{{false}}">
<view class="page__hd" wx:if="{{!showNotification}}">
<view class="page__title">通知公告</view>
<view class="page__desc">我需要注意的一些事情</view>
</view>
<view class="page__hd" wx:else>
<view class="page__title">教育办通知</view>
<view class="page__desc">蔡老师 2020-9-15</view>
<view class="page__title">{{notificationsInfo[showIndex].title}}</view>
<view class="page__desc">{{notificationsInfo[showIndex].creatorRealName}} {{notificationsInfo[showIndex].creationTime}}</view>
</view>
<view class="page__bd" wx:if="{{false}}">
<view class="page__bd" wx:if="{{!showNotification}}">
<view class="weui-panel">
<view class="weui-panel__hd">通知公告列表</view>
<view class="weui-panel__bd">
<view class="weui-panel__bd" wx:for="{{notificationsInfo}}" wx:key="index" bindtap="onClickNotification" data-index="{{index}}">
<view class="weui-media-box weui-media-box_text">
<h4 class="weui-media-box__title">教育办通知</h4>
<view class="weui-media-box__desc">为深入学习贯彻习近平总书记在党史学习教育动员大会上的重要讲话精神引导高校师生以昂扬的状态迎接中国共产党建党100周年教育部、国家语委、中央广播电视总台联合开展《全国大学生党史知识竞答大会》。节目除百名现场竞答选手外还设置“千校学生云答题”环节。答题时间为3月18日彩排、3月20日、3月22日、3月24日、3月26日、3月28日、3月30日、4月1日、4月3日、4月5日、4月7日每天的14:00至15:30共计11场。其中陕西省14:00至14:30集中进行答题。请各位同学积极参与相关参与方式请查看答题须知</view>
<h4 class="weui-media-box__title">{{item.title}}</h4>
<view class="weui-media-box__desc">{{item.context}}</view>
<view class="weui-media-box__info">
<view class="weui-media-box__info__meta">日期 2020-9-15</view>
<view class="weui-media-box__info__meta">发布人 蔡老师</view>
<view class="weui-media-box__info__meta">{{item.creationTime}}</view>
<view class="weui-media-box__info__meta">发布人 {{item.creatorRealName}}</view>
<view class="weui-media-box__info__meta weui-media-box__info__meta_extra">状态 已确认</view>
</view>
</view>
@ -30,12 +30,13 @@
<view class="weui-article__section">
<view class="weui-article__section">
<view class="weui-article__p">
为深入学习贯彻习近平总书记在党史学习教育动员大会上的重要讲话精神引导高校师生以昂扬的状态迎接中国共产党建党100周年教育部、国家语委、中央广播电视总台联合开展《全国大学生党史知识竞答大会》。节目除百名现场竞答选手外还设置“千校学生云答题”环节。答题时间为3月18日彩排、3月20日、3月22日、3月24日、3月26日、3月28日、3月30日、4月1日、4月3日、4月5日、4月7日每天的14:00至15:30共计11场。其中陕西省14:00至14:30集中进行答题。请各位同学积极参与相关参与方式请查看答题须知
{{notificationsInfo[showIndex].context}}
</view>
</view>
</view>
</view>
<a class="weui-btn weui-btn_primary">留言</a>
<a class="weui-btn weui-btn_disabled weui-btn_default" bindtap="showNotificationsList">返回列表</a>
</view>
</view>
</view>

View File

@ -29,7 +29,7 @@
</view>
<view class="weui-cells__title">功能</view>
<view class="weui-cells demo_badge_cells">
<view class="weui-cell weui-cell_active" wx:for="{{childrenInfo}}" wx:key="{{index}}">
<view class="weui-cell weui-cell_active" wx:for="{{childrenInfo}}" wx:key="index">
<view class="weui-cell__hd">
<image src="{{item.avatarUrl}}"></image>
<text class="weui-badge">8</text>
@ -39,7 +39,7 @@
<view class="demo_badge_desc">我的孩子</view>
</view>
</view>
<view class="weui-cell weui-cell_active" bindtap="bindChildSupervisor" wx:for="{{supervisorsInfo}}" wx:key="{{index}}">
<view class="weui-cell weui-cell_active" bindtap="bindChildSupervisor" wx:for="{{supervisorsInfo}}" wx:key="index">
<view class="weui-cell__hd">
<image src="{{item.avatarUrl}}"></image>
<text class="weui-badge">8</text>

View File

@ -1,18 +1,26 @@
// pages/message/message.js
import {getMessageUnread, markMessage} from '../../api/message'
Page({
/**
* 页面的初始数据
*/
data: {
messagesInfo: [],
showMessage: false,
showIndex: 0
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
getMessageUnread().then(res => {
console.log(res)
this.setData({
messagesInfo: res
})
})
},
/**
@ -62,5 +70,33 @@ Page({
*/
onShareAppMessage: function () {
},
onClickMessage(e) {
this.setData({
showMessage: true,
showIndex: e.currentTarget.dataset['index']
})
},
showMessagesList(e) {
this.setData({
showMessage: false,
showIndex: 0
})
},
onClickMarkMessage() {
let messagesInfo = this.data.messagesInfo;
console.log(messagesInfo[this.data.showIndex].id)
markMessage(messagesInfo[this.data.showIndex].id).then(res => {
if(res) {
messagesInfo[this.data.showIndex].read = true;
this.setData({
messagesInfo
})
}
})
}
})

View File

@ -1,23 +1,42 @@
<view class="page" data-weui-theme="{{theme}}">
<view class="page__hd" wx:if="{{true}}">
<view class="page__hd" wx:if="{{!showMessage}}">
<view class="page__title">收到的消息</view>
<view class="page__desc">一些发给我的消息</view>
</view>
<view class="page__bd" wx:if="{{true}}">
<view class="page__hd" wx:else>
<view class="page__title">{{messagesInfo[showIndex].title}}</view>
<view class="page__desc">{{messagesInfo[showIndex].creatorRealName}} {{messagesInfo[showIndex].creationTime}}</view>
</view>
<view class="page__bd" wx:if="{{!showMessage}}" >
<view class="weui-panel">
<view class="weui-panel__hd">消息列表</view>
<view class="weui-panel__bd">
<view class="weui-panel__bd" wx:for="{{messagesInfo}}" wx:key="index" bindtap="onClickMessage" data-index="{{index}}">
<view class="weui-media-box weui-media-box_text">
<h4 class="weui-media-box__title">学业警告通知</h4>
<view class="weui-media-box__desc">在2029-2020年秋季学期你所修的学分总数低于15分。</view>
<h4 class="weui-media-box__title">{{item.title}}</h4>
<view class="weui-media-box__desc">{{item.context}}</view>
<view class="weui-media-box__info">
<view class="weui-media-box__info__meta">日期 2020-3-12</view>
<view class="weui-media-box__info__meta">发布人 教学办</view>
<view class="weui-media-box__info__meta weui-media-box__info__meta_extra">状态 已确认</view>
<view class="weui-media-box__info__meta">日期 {{item.creationTime}}</view>
<view class="weui-media-box__info__meta">发送人 {{item.creatorRealName}}</view>
<view class="weui-media-box__info__meta weui-media-box__info__meta_extra">状态 {{item.read ? "已读" : "未读"}}</view>
</view>
</view>
</view>
</view>
</view>
<view wx:else>
<view class="page__bd">
<view class="weui-article">
<view class="weui-article__section">
<view class="weui-article__section">
<view class="weui-article__p">
{{messagesInfo[showIndex].context}}
</view>
</view>
</view>
</view>
<a class="weui-btn weui-btn_primary" bindtap="onClickMarkMessage" wx:if="{{!messagesInfo[showIndex].read}}">设置已读</a>
<a class="weui-btn weui-btn_disabled weui-btn_default" bindtap="showMessagesList">返回列表</a>
</view>
</view>
</view>

View File

@ -1,18 +1,40 @@
// pages/my-grade/my-grade.js
import {getGrade, getSemesters, getSemesterGrades, getCourseGrades} from '../../api/course'
Page({
/**
* 页面的初始数据
*/
data: {
gradeInfo: {},
semestersInfo: [],
showSemester: false,
targetSemesterInfo: {},
targetCoursesInfo: [],
showIndex: 0
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
getGrade().then(res => {
console.log(res)
this.setData({
gradeInfo: res
})
}).then(res => {
return getSemesters().then(res => {
console.log(res)
this.setData({
semestersInfo: res
})
})
}).catch(err => {
console.log(err)
})
},
/**
@ -62,5 +84,36 @@ Page({
*/
onShareAppMessage: function () {
},
onClickBack() {
this.setData({
showSemester: false,
targetCoursesInfo: [],
targetSemesterInfo: {}
})
},
onClickSemesterItem(e) {
let index = parseInt(e.currentTarget.dataset['index'])
getSemesterGrades(this.data.semestersInfo[index].id).then(res => {
console.log(res)
this.setData({
targetSemesterInfo: res
})
return Promise.resolve(this.data.semestersInfo[index].id)
}).then(sem_id => {
return getCourseGrades(sem_id).then(res => {
console.log(res)
this.setData({
targetCoursesInfo: res
})
})
}).then(res => {
this.setData({
showSemester: true,
})
})
}
})

View File

@ -1,46 +1,46 @@
<!--pages/my-grade/my-grade.wxml-->
<view class="page" data-weui-theme="{{theme}}">
<view class="page__hd" wx:if="{{false}}">
<view class="page__hd" wx:if="{{!showSemester}}">
<view class="page__title">我的成绩</view>
<view class="page__desc">我在学校学习生活的概况</view>
</view>
<view class="page__hd" wx:else>
<view class="page__title">2020-2021学年秋季学期</view>
<view class="page__title">{{targetSemesterInfo.semester}}</view>
<view class="page__desc">该学期的学习生活概况</view>
</view>
<view wx:if="{{false}}">
<view wx:if="{{!showSemester}}">
<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">李xx</em>
<em class="weui-form-preview__value">{{gradeInfo.realName}}</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">135.5</text>
<label class="weui-form-preview__label">已修得学分</label>
<text class="weui-form-preview__value">{{gradeInfo.credits}}</text>
</view>
<view class="weui-form-preview__item">
<label class="weui-form-preview__label">修完的课程数</label>
<text class="weui-form-preview__value">62</text>
<text class="weui-form-preview__value">{{gradeInfo.passedCourse}}</text>
</view>
<view class="weui-form-preview__item">
<label class="weui-form-preview__label">未通过课程数</label>
<text class="weui-form-preview__value">0</text>
<text class="weui-form-preview__value">{{gradeInfo.failedCourse}}</text>
</view>
<view class="weui-form-preview__item">
<label class="weui-form-preview__label">总学分积</label>
<text class="weui-form-preview__value">89.67</text>
<text class="weui-form-preview__value">{{gradeInfo.weightedAverage}}</text>
</view>
<view class="weui-form-preview__item">
<label class="weui-form-preview__label">总绩点</label>
<text class="weui-form-preview__value">3.85</text>
<text class="weui-form-preview__value">{{gradeInfo.gpa}}</text>
</view>
<view class="weui-form-preview__item">
<label class="weui-form-preview__label">学期数</label>
<text class="weui-form-preview__value">5</text>
<text class="weui-form-preview__value">{{gradeInfo.semesterNumber}}</text>
</view>
</view>
<view class="weui-form-preview__ft">
@ -52,9 +52,9 @@
<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" wx:for="{{semestersInfo}}" wx:key="index" bindtap="onClickSemesterItem" data-index="{{index}}">
<view class="weui-cell__bd">
<text class="demo_badge_title">2021-2022学年 秋季学期</text>
<text class="demo_badge_title">{{item.startYear}}-{{item.endYear}}学年 {{item.springAutumn}}学期</text>
</view>
<view class="weui-cell__ft"></view>
</view>
@ -67,33 +67,37 @@
<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">李xx</em>
<em class="weui-form-preview__value">{{targetSemesterInfo.realName}}</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">32.5</text>
<label class="weui-form-preview__label">计划修习学分</label>
<text class="weui-form-preview__value">{{targetSemesterInfo.totalCredits}}</text>
</view>
<view class="weui-form-preview__item">
<label class="weui-form-preview__label">修得学分</label>
<text class="weui-form-preview__value">{{targetSemesterInfo.credits}}</text>
</view>
<view class="weui-form-preview__item">
<label class="weui-form-preview__label">修完的课程数</label>
<text class="weui-form-preview__value">10</text>
<text class="weui-form-preview__value">{{targetSemesterInfo.passedCourse}}</text>
</view>
<view class="weui-form-preview__item">
<label class="weui-form-preview__label">未通过课程数</label>
<text class="weui-form-preview__value">0</text>
<text class="weui-form-preview__value">{{targetSemesterInfo.failedCourse}}</text>
</view>
<view class="weui-form-preview__item">
<label class="weui-form-preview__label">学期学分积</label>
<text class="weui-form-preview__value">92.85</text>
<text class="weui-form-preview__value">{{targetSemesterInfo.weightedAverage}}</text>
</view>
<view class="weui-form-preview__item">
<label class="weui-form-preview__label">学期绩点</label>
<text class="weui-form-preview__value">3.95</text>
<text class="weui-form-preview__value">{{targetSemesterInfo.gpa}}</text>
</view>
</view>
<view class="weui-form-preview__ft">
<a class="weui-form-preview__btn weui-form-preview__btn_primary">反映问题</a>
<a class="weui-form-preview__btn weui-form-preview__btn_primary" bindtap="onClickBack">返回</a>
</view>
</view>
</view>
@ -101,13 +105,13 @@
<view class="weui-panel">
<view class="weui-panel__hd">各课程情况</view>
<view class="weui-panel__bd">
<view class="weui-media-box weui-media-box_text">
<h4 class="weui-media-box__title">计算机网络</h4>
<view class="weui-media-box__desc">专业核心课程</view>
<view class="weui-media-box weui-media-box_text" wx:for="{{targetCoursesInfo}}" wx:key="index">
<h4 class="weui-media-box__title">{{item.courseName}}</h4>
<view class="weui-media-box__desc">{{item.courseType}}</view>
<view class="weui-media-box__info">
<view class="weui-media-box__info__meta">最终成绩 92.5</view>
<view class="weui-media-box__info__meta">2 学分</view>
<view class="weui-media-box__info__meta weui-media-box__info__meta_extra">绩点 3.9</view>
<view class="weui-media-box__info__meta">最终成绩 {{item.score}}</view>
<view class="weui-media-box__info__meta">{{item.credit}} 学分</view>
<view class="weui-media-box__info__meta weui-media-box__info__meta_extra">绩点 {{item.gpa}}</view>
</view>
</view>
</view>