diff --git a/api/document.js b/api/document.js index cb0db76..3dac0b8 100644 --- a/api/document.js +++ b/api/document.js @@ -83,4 +83,14 @@ export const getSupervisors = () => { data: { } }) +} + +export const searchStudents = (numbering) => { + return request({ + url: "/document/students/search", + method: "get", + data: { + numbering + } + }) } \ No newline at end of file diff --git a/api/honor.js b/api/honor.js new file mode 100644 index 0000000..a9e5e0e --- /dev/null +++ b/api/honor.js @@ -0,0 +1,21 @@ +import request from '../utils/request.js' + +export const createHonor = (honor) => { + return request({ + url: "/honor", + method: "post", + data: { + ...honor + } + }) +} + +export const getHonors = (openid) => { + return request({ + url: "/honor/user", + method: "get", + data: { + openid + } + }) +} \ No newline at end of file diff --git a/pages/my-grade/my-grade.js b/pages/my-grade/my-grade.js index 7343482..11a7565 100644 --- a/pages/my-grade/my-grade.js +++ b/pages/my-grade/my-grade.js @@ -22,9 +22,16 @@ Page({ onLoad: function (options) { getGrade().then(res => { console.log(res) - this.setData({ + if(res.failedCourse === 0 && res.passedCourse === 0) { + this.setData({ + recordNotFound: true + }) + } + else { + this.setData({ gradeInfo: res - }) + }) + } }).then(res => { return getSemesters().then(res => { console.log(res) diff --git a/pages/my-grade/my-grade.json b/pages/my-grade/my-grade.json index 8835af0..207522e 100644 --- a/pages/my-grade/my-grade.json +++ b/pages/my-grade/my-grade.json @@ -1,3 +1,5 @@ { - "usingComponents": {} + "usingComponents": { + "i-spin": "../../dist/spin/index" + } } \ No newline at end of file diff --git a/pages/my-grade/my-grade.wxml b/pages/my-grade/my-grade.wxml index 18efd0d..053654f 100644 --- a/pages/my-grade/my-grade.wxml +++ b/pages/my-grade/my-grade.wxml @@ -119,5 +119,7 @@ + 未找到您的成绩记录 + diff --git a/pages/my-honors/my-honors.js b/pages/my-honors/my-honors.js index 82b73c4..452288f 100644 --- a/pages/my-honors/my-honors.js +++ b/pages/my-honors/my-honors.js @@ -1,18 +1,41 @@ // pages/my-honors/my-honors.js +import {createHonor, getHonors} from '../../api/honor' + +const app = getApp() + Page({ /** * 页面的初始数据 */ data: { - + showHonor: false, + showCreate: false, + targetHonorInfo: {}, + honorsInfo: [], + honorDescription: "", + honorClass: "", + honorCategory: "", + honorTitle: "", + toast: false, + hideToast: true, }, /** * 生命周期函数--监听页面加载 */ onLoad: function (options) { - + this.setData({ + userDocument: app.globalData.userDocument + }) + console.log(this.data) + getHonors(app.globalData.userBaseInfo.openid) + .then(res => { + console.log(res) + this.setData({ + honorsInfo: res + }) + }) }, /** @@ -62,5 +85,79 @@ Page({ */ onShareAppMessage: function () { - } + }, + + onTitleInput(res) { + this.setData({ + honorTitle: res.detail.value + }) + }, + + onCategoryInput(res) { + this.setData({ + honorCategory: res.detail.value + }) + }, + + + onDescriptionInput(res) { + this.setData({ + honorDescription: res.detail.value + }) + }, + + onClassInput(res) { + this.setData({ + honorClass: res.detail.value + }) + }, + + onClickAdd() { + this.setData({ + showHonor: false, + showCreate: true, + }) + }, + + + showHonorsList() { + this.setData({ + showHonor: false, + showCreate: false, + }) + }, + + createHonor() { + console.log(this.data) + createHonor({ + title: this.data.honorTitle, + description: this.data.honorDescription, + honorClass: this.data.honorClass, + category: this.data.honorCategory + }).then(res => { + let that = this + console.log(res) + if(res != null) { + that.setData({ + toast: true, + hideToast: false + }); + that.setData({ + hideToast: true, + honorTitle: "", + honorCategory: "", + honorsInfo: "", + honorDescription: "", + honorClass: "" + }); + setTimeout(() => { + that.setData({ + toast: false, + hideToast: true, + }); + }, 3000); + } + }) + }, + }) \ No newline at end of file diff --git a/pages/my-honors/my-honors.wxml b/pages/my-honors/my-honors.wxml index e979595..e139c4d 100644 --- a/pages/my-honors/my-honors.wxml +++ b/pages/my-honors/my-honors.wxml @@ -1,2 +1,112 @@ - -pages/my-honors/my-honors.wxml + + + 我的荣誉 + 科研竞赛社会工作等情况 + + + + + 荣誉基本信息 + + + + + + + + + + + + + + + + + + + + + + + + + + + 荣誉描述 + + + + + 0/200 + + + + + + + 确定 + 返回列表 + + + + + + + + + {{userDocument.realName}} + + + + + + {{honorsInfo.length}} + + + + 0 + + + + 添加荣誉 + + + + + 荣誉列表 + + +

{{item.title}}

+ {{item.category}} + + 创建时间 {{item.creationTime}} + 等级 {{item.honorClass}} + 认证 {{item.read ? "已认证" : "未认证"}} + +
+
+
+
+ + + + + + + {{honorsInfo[showIndex].context}} + + + + + + + + + + + + 添加成功 + + +
diff --git a/pages/my-students/my-students.js b/pages/my-students/my-students.js index 822e667..a0a915b 100644 --- a/pages/my-students/my-students.js +++ b/pages/my-students/my-students.js @@ -1,11 +1,14 @@ // pages/my-student/my-students.js +import {searchStudents} from '../../api/document' + Page({ /** * 页面的初始数据 */ data: { - + inputShowed: false, + inputVal: "" }, /** @@ -62,5 +65,34 @@ Page({ */ onShareAppMessage: function () { + }, + + showInput: function () { + this.setData({ + inputShowed: true + }); + }, + + hideInput: function () { + this.setData({ + inputVal: "", + inputShowed: false + }); + }, + + clearInput: function () { + this.setData({ + inputVal: "" + }); + }, + + inputTyping: function (e) { + let inputVal = e.detail.value + this.setData({ + inputVal + }); + searchStudents(inputVal).then(res => { + console.log(res) + }) } }) \ No newline at end of file diff --git a/pages/my-students/my-students.wxml b/pages/my-students/my-students.wxml index 9088bfd..fb82e28 100644 --- a/pages/my-students/my-students.wxml +++ b/pages/my-students/my-students.wxml @@ -14,7 +14,7 @@ 取消