代码调整;页面添加;功能适配;

This commit is contained in:
Saturneric 2021-03-27 17:19:31 +08:00
parent d956020d4e
commit 715555c7e3
26 changed files with 628 additions and 57 deletions

19
api/account.js Normal file
View File

@ -0,0 +1,19 @@
import request from '../utils/request.js'
export const getSupervisorsProfile = () => {
return request({
url: "/account/supervisors",
method: "get",
data: {
}
})
}
export const getChildrenProfile = () => {
return request({
url: "/account/children",
method: "get",
data: {
}
})
}

View File

@ -30,3 +30,57 @@ export const bindDocument = (documentCode) => {
}
})
}
export const checkParents = () => {
return request({
url: "/document/parents/check",
method: "get",
data: {
}
})
}
export const getParents = () => {
return request({
url: "/document/parents",
method: "get",
data: {
}
})
}
export const checkChildren = () => {
return request({
url: "/document/children/check",
method: "get",
data: {
}
})
}
export const getChildren = () => {
return request({
url: "/document/children",
method: "get",
data: {
}
})
}
export const checkSupervisors = () => {
return request({
url: "/document/supervisors/check",
method: "get",
data: {
}
})
}
export const getSupervisors = () => {
return request({
url: "/document/supervisors",
method: "get",
data: {
}
})
}

View File

@ -9,7 +9,11 @@
"pages/my-grade/my-grade",
"pages/child-supervisor/child-supervisor",
"pages/announcement/announcement",
"pages/message/message"
"pages/message/message",
"pages/my-students/my-students",
"pages/students-grade-analyse/students-grade-analyse",
"pages/my-health/my-health",
"pages/my-honors/my-honors"
],
"window": {
"backgroundTextStyle": "light",

View File

@ -1,18 +1,66 @@
// pages/account-relation-info/account-relation-info.js
import {checkParents, checkChildren, getParents, getChildren, checkSupervisors, getSupervisors} from '../../api/document'
Page({
/**
* 页面的初始数据
*/
data: {
parentsInfo: [],
childrenInfo: [],
supervisorsInfo: []
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
checkParents().then(res => {
if(res === true) {
return Promise.resolve(res)
} else {
return Promise.reject(res)
}
}).then(res => {
return getParents()
}).then(res => {
this.setData({
parentsInfo: res
})
}).catch(err => {
}).then(res => {
return checkChildren().then(res=>{
if(res === true) {
return Promise.resolve(res)
} else {
return Promise.reject(res)
}
})
}).then(res => {
return getChildren().then(res => {
this.setData({
childrenInfo: res
})
})
}).catch(err => {
}).then(res => {
return checkSupervisors().then(res=>{
if(res === true) {
return Promise.resolve(res)
} else {
return Promise.reject(res)
}
})
}).then(res => {
return getSupervisors().then(res => {
this.setData({
supervisorsInfo: res
})
})
})
},
/**

View File

@ -4,34 +4,34 @@
<view class="page__title">关系信息</view>
<view class="page__desc">我与其他账号的关系</view>
</view>
<view class="page__bd">
<view class="page__bd" wx:for="{{childrenInfo}}" wx:key="index">
<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>
<label class="weui-form-preview__label">孩子名</label>
<em class="weui-form-preview__value">{{item.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">女</text>
<text class="weui-form-preview__value">{{item.gender === "U" ? "未知" : item.gender === "M" ? "男" : "" }}</text>
</view>
<view class="weui-form-preview__item">
<label class="weui-form-preview__label">入学年份</label>
<text class="weui-form-preview__value">2018</text>
<text class="weui-form-preview__value">{{item.gradeYear}}</text>
</view>
<view class="weui-form-preview__item">
<label class="weui-form-preview__label">专业或大类</label>
<text class="weui-form-preview__value">软件工程</text>
<text class="weui-form-preview__value">{{item.major}}</text>
</view>
<view class="weui-form-preview__item">
<label class="weui-form-preview__label">学院</label>
<text class="weui-form-preview__value">软件学院</text>
<text class="weui-form-preview__value">{{item.college}}</text>
</view>
<view class="weui-form-preview__item">
<label class="weui-form-preview__label">账号绑定状态</label>
<text class="weui-form-preview__value">已绑定</text>
<text class="weui-form-preview__value">{{item.connected ? "已绑定" : "未绑定"}}</text>
</view>
</view>
<view class="weui-form-preview__ft">
@ -39,34 +39,22 @@
</view>
</view>
</view>
<view class="page__bd">
<view class="page__bd" wx:for="{{parentsInfo}}" wx:key="index">
<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">李ok</em>
<em class="weui-form-preview__value">{{item.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">男</text>
</view>
<view class="weui-form-preview__item">
<label class="weui-form-preview__label">所在城市</label>
<text class="weui-form-preview__value">Guangdong</text>
</view>
<view class="weui-form-preview__item">
<label class="weui-form-preview__label">所在省份</label>
<text class="weui-form-preview__value">Shenzhen</text>
</view>
<view class="weui-form-preview__item">
<label class="weui-form-preview__label">联系电话</label>
<text class="weui-form-preview__value">13600000000</text>
<text class="weui-form-preview__value">{{item.gender === "U" ? "未知" : item.gender === "M" ? "男" : "女" }}</text>
</view>
<view class="weui-form-preview__item">
<label class="weui-form-preview__label">账号绑定状态</label>
<text class="weui-form-preview__value">已绑定</text>
<text class="weui-form-preview__value">{{item.connected ? "已绑定" : "未绑定"}}</text>
</view>
</view>
<view class="weui-form-preview__ft">
@ -74,30 +62,34 @@
</view>
</view>
</view>
<view class="page__bd">
<view class="page__bd" wx:for="{{supervisorsInfo}}" wx:key="index">
<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">高xy</em>
<em class="weui-form-preview__value">{{item.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">女</text>
<text class="weui-form-preview__value">{{item.gender === "U" ? "未知" : item.gender === "M" ? "男" : "" }}</text>
</view>
<view class="weui-form-preview__item">
<label class="weui-form-preview__label">邮箱</label>
<text class="weui-form-preview__value">supervisor@nwpu.edu.cn</text>
<label class="weui-form-preview__label">所管年级</label>
<text class="weui-form-preview__value">{{item.gradeYear}}</text>
</view>
<view class="weui-form-preview__item">
<label class="weui-form-preview__label">联系电话</label>
<text class="weui-form-preview__value">13600000000</text>
<label class="weui-form-preview__label">专业或大类</label>
<text class="weui-form-preview__value">{{item.major}}</text>
</view>
<view class="weui-form-preview__item">
<label class="weui-form-preview__label">学院</label>
<text class="weui-form-preview__value">{{item.college}}</text>
</view>
<view class="weui-form-preview__item">
<label class="weui-form-preview__label">账号绑定状态</label>
<text class="weui-form-preview__value">已绑定</text>
<text class="weui-form-preview__value">{{item.connected ? "已绑定" : "未绑定"}}</text>
</view>
</view>
<view class="weui-form-preview__ft">

View File

@ -3,6 +3,8 @@
import {searchDocument, bindDocument} from '../../api/document'
import {attachRole} from '../../api/user'
const app = getApp()
Page({
/**
@ -136,12 +138,12 @@ Page({
toast: false,
hideToast: false,
});
// 绑定成功后,跳转进入小程序首页
wx.navigateTo({
url: '/pages/index/index'
})
// 绑定成功后,跳转进入小程序首页
wx.navigateTo({
url: '/pages/index/index'
})
}, 300);
}, 2000);
}, 3000);
}).catch(err =>{
console.log(err)

View File

@ -2,6 +2,7 @@
import {getDocument} from '../../api/document'
import {login, checkProfile, setProfile, getProfile} from '../../api/user'
import {getSupervisorsProfile, getChildrenProfile} from '../../api/account'
// 获取应用实例
const app = getApp()
@ -17,6 +18,8 @@ Page({
unrecoverable: false,
refresh: false,
unrecoverableInfo: '',
childrenInfo: [],
supervisorsInfo: []
},
handleLogin() {
@ -161,7 +164,24 @@ Page({
})
}
})
}).then(res => {
return getChildrenProfile()
}).then(res => {
this.setData({
childrenInfo: res
})
}).then(res => {
return getSupervisorsProfile()
}).then(res => {
this.setData({
supervisorsInfo: res
})
}).catch(err => {
console.log(err)
this.setData({
loading: false,
unrecoverable: true
})
console.log("账户基本信息未设置")
}).finally(() => {
this.setData({
@ -237,4 +257,28 @@ Page({
url: '/pages/message/message'
})
},
bindMyStudents() {
// 跳转
wx.navigateTo({
url: '/pages/my-students/my-students'
})
},
bindStudentsGradeAnalyse() {
// 跳转
wx.navigateTo({
url: '/pages/students-grade-analyse/students-grade-analyse'
})
},
bindMyHealth() {
// 跳转
wx.navigateTo({
url: '/pages/my-health/my-health'
})
},
bindMyHonors() {
// 跳转
wx.navigateTo({
url: '/pages/my-honors/my-honors'
})
},
})

View File

@ -29,24 +29,24 @@
</view>
<view class="weui-cells__title">功能</view>
<view class="weui-cells demo_badge_cells">
<view class="weui-cell weui-cell_active">
<view class="weui-cell weui-cell_active" wx:for="{{childrenInfo}}" wx:key="{{index}}">
<view class="weui-cell__hd">
<image src="../../images/pic_160.png"></image>
<image src="{{item.avatarUrl}}"></image>
<text class="weui-badge">8</text>
</view>
<view class="weui-cell__bd">
<view>我的孩子</view>
<view class="demo_badge_desc">摘要信息</view>
<view>{{item.nickName}}</view>
<view class="demo_badge_desc">我的孩子</view>
</view>
</view>
<view class="weui-cell weui-cell_active" bindtap="bindChildSupervisor">
<view class="weui-cell weui-cell_active" bindtap="bindChildSupervisor" wx:for="{{supervisorsInfo}}" wx:key="{{index}}">
<view class="weui-cell__hd">
<image src="../../images/pic_160.png"></image>
<image src="{{item.avatarUrl}}"></image>
<text class="weui-badge">8</text>
</view>
<view class="weui-cell__bd">
<view>孩子的辅导员</view>
<view class="demo_badge_desc">摘要信息</view>
<view>{{item.nickName}}</view>
<view class="demo_badge_desc">孩子的辅导员</view>
</view>
</view>
<view class="weui-cell weui-cell_active weui-cell_access" bindtap="bindAnnouncement">
@ -77,30 +77,30 @@
</view>
<view class="weui-cell__ft"></view>
</view>
<view class="weui-cell weui-cell_active weui-cell_access">
<view class="weui-cell weui-cell_active weui-cell_access" bindtap="bindMyHonors">
<view class="weui-cell__bd">
<text class="demo_badge_title">我的荣誉</text>
<text class="weui-badge">New</text>
</view>
<view class="weui-cell__ft"></view>
</view>
<view class="weui-cell weui-cell_active weui-cell_access">
<view class="weui-cell weui-cell_active weui-cell_access" bindtap="bindMyHealth">
<view class="weui-cell__bd">
<text class="demo_badge_title">我的健康</text>
<text class="weui-badge">New</text>
</view>
<view class="weui-cell__ft"></view>
</view>
<view class="weui-cell weui-cell_active weui-cell_access">
<view class="weui-cell weui-cell_active weui-cell_access" bindtap="bindMyStudents">
<view class="weui-cell__bd">
<text class="demo_badge_title">我的学生</text>
<text class="weui-badge">New</text>
</view>
<view class="weui-cell__ft"></view>
</view>
<view class="weui-cell weui-cell_active weui-cell_access">
<view class="weui-cell weui-cell_active weui-cell_access" bindtap="bindStudentsGradeAnalyse">
<view class="weui-cell__bd">
<text class="demo_badge_title">学生成绩</text>
<text class="demo_badge_title">学生成绩分析</text>
<text class="weui-badge">New</text>
</view>
<view class="weui-cell__ft"></view>
@ -113,6 +113,6 @@
</view>
<i-spin size="large" fix wx:if="{{ loading }}"></i-spin>
<i-spin size="large" fix wx:if="{{ unrecoverable }}" custom><view>您的账号已被封禁</view></i-spin>
<i-spin size="large" fix wx:if="{{ unrecoverable }}" custom><view>您的账号不被允许使用服务</view></i-spin>
</view>

View File

@ -0,0 +1,66 @@
// pages/my-health/my-health.js
Page({
/**
* 页面的初始数据
*/
data: {
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
}
})

View File

@ -0,0 +1,3 @@
{
"usingComponents": {}
}

View File

@ -0,0 +1,8 @@
<!--pages/my-health/my-health.wxml-->
<view class="page" data-weui-theme="{{theme}}">
<view class="page__hd">
<view class="page__title">我的健康</view>
<view class="page__desc">我今日的健康信息</view>
</view>
</view>

View File

@ -0,0 +1 @@
/* pages/my-health/my-health.wxss */

View File

@ -0,0 +1,66 @@
// pages/my-honors/my-honors.js
Page({
/**
* 页面的初始数据
*/
data: {
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
}
})

View File

@ -0,0 +1,3 @@
{
"usingComponents": {}
}

View File

@ -0,0 +1,2 @@
<!--pages/my-honors/my-honors.wxml-->
<text>pages/my-honors/my-honors.wxml</text>

View File

@ -0,0 +1 @@
/* pages/my-honors/my-honors.wxss */

View File

@ -0,0 +1,66 @@
// pages/my-student/my-students.js
Page({
/**
* 页面的初始数据
*/
data: {
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
}
})

View File

@ -0,0 +1,3 @@
{
"usingComponents": {}
}

View File

@ -0,0 +1,45 @@
<!--pages/my-student/my-students.wxml-->
<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">
<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">
<view class="weui-cell__bd weui-cell_primary">
<view>实时搜索文本</view>
</view>
</view>
<view class="weui-cell weui-cell_active weui-cell_access">
<view class="weui-cell__bd weui-cell_primary">
<view>实时搜索文本</view>
</view>
</view>
<view class="weui-cell weui-cell_active weui-cell_access">
<view class="weui-cell__bd weui-cell_primary">
<view>实时搜索文本</view>
</view>
</view>
<view class="weui-cell weui-cell_active weui-cell_access">
<view class="weui-cell__bd weui-cell_primary">
<view>实时搜索文本</view>
</view>
</view>
</view>
</view>
</view>

View File

@ -0,0 +1 @@
/* pages/my-student/my-students.wxss */

View File

@ -0,0 +1,66 @@
// pages/students-grade-analyse/students-grade-analyse.js
Page({
/**
* 页面的初始数据
*/
data: {
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
}
})

View File

@ -0,0 +1,3 @@
{
"usingComponents": {}
}

View File

@ -0,0 +1,75 @@
<!--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__title">学生成绩分析</view>
<view class="page__desc">我管理的学生的学业成绩情况</view>
</view>
<view wx:if="{{true}}">
<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">254</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">75.6</text>
</view>
<view class="weui-form-preview__item">
<label class="weui-form-preview__label">平均绩点</label>
<text class="weui-form-preview__value">2.85</text>
</view>
<view class="weui-form-preview__item">
<label class="weui-form-preview__label">挂科记录数</label>
<text class="weui-form-preview__value">12</text>
</view>
<view class="weui-form-preview__item">
<label class="weui-form-preview__label">学期数</label>
<text class="weui-form-preview__value">5</text>
</view>
</view>
<view class="weui-form-preview__ft">
<a class="weui-form-preview__btn weui-form-preview__btn_primary">反映问题</a>
</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">
<view class="weui-cell__bd">
<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">
<view class="weui-cell__bd">
<text class="demo_badge_title">2019-2020学年春季学期</text>
</view>
<view class="weui-cell__ft"></view>
</view>
<view class="weui-cell weui-cell_active weui-cell_access">
<view class="weui-cell__bd">
<text class="demo_badge_title">2020-2021学年秋季学期</text>
</view>
<view class="weui-cell__ft"></view>
</view>
<view class="weui-cell weui-cell_active weui-cell_access">
<view class="weui-cell__bd">
<text class="demo_badge_title">2020-2021学年春季学期</text>
</view>
<view class="weui-cell__ft"></view>
</view>
</view>
</view>
</view>
</view>

View File

@ -0,0 +1 @@
/* pages/students-grade-analyse/students-grade-analyse.wxss */

View File

@ -14,11 +14,9 @@ const refresh_token = app => {
method: 'get'
}).then(res => {
// 设置登录信息
const userInfo = app.globalData.userInfo
userInfo.token = res.token
app.globalData.userBaseInfo.token = res.token
resolve(true)
}).catch(err => {
console.log(err)
// 清空登录信息
app.globalData.login = false
app.globalData.userInfo = {}