diff --git a/api/document.js b/api/document.js index 22e2f9b..56e3f84 100644 --- a/api/document.js +++ b/api/document.js @@ -8,4 +8,15 @@ export const getDocument = openid => { openid } }) +} + +export const searchDocument = (userRole, documentCode) => { + return request({ + url: "/document/search", + method: "get", + data: { + userRole, + documentCode + } + }) } \ No newline at end of file diff --git a/pages/bind-document/bind-document.js b/pages/bind-document/bind-document.js index d3ac3ea..41f8765 100644 --- a/pages/bind-document/bind-document.js +++ b/pages/bind-document/bind-document.js @@ -1,4 +1,7 @@ // pages/bind-document.js + +import {searchDocument} from '../../api/document' + Page({ /** @@ -9,8 +12,14 @@ Page({ radioItems: [ { name: '1', value: '学生', checked: 'true'}, { name: '2', value: '家长'}, - { name: '2', value: '辅导员'}, + { name: '3', value: '辅导员'}, ], + userRoleType: '1', + currentValue: '', + document: null, + showDocument: false, + warnToast: false, + hideWarnToast: true }, /** @@ -67,5 +76,97 @@ Page({ */ onShareAppMessage: function () { + }, + + radioChange(res) { + console.log(res.detail.value) + this.setData({ + userRoleType: res.detail.value + }) + }, + + onCurrentInput(res) { + this.setData({ + currentValue: res.detail.value + }) + }, + + onReset() { + this.setData({ + document: null, + showDocument: false + }) + }, + + onBind() { + + }, + + onConfirm() { + + let documentCode = this.data.currentValue + let userRoleName; + switch(this.data.userRoleType) { + case '1': + userRoleName = 'Student' + break; + case '2': + userRoleName = 'Parent' + break; + case '3': + userRoleName = 'Supervisor' + break; + } + searchDocument(userRoleName, documentCode).then(res => { + console.log(res) + let document = res + + // 转换部分字段 + + switch(document.gender) { + case 'M': + document.gender = '男' + break; + case 'F': + document.gender = '女' + break; + case 'U': + document.gender = '未知' + break; + } + + switch(document.role) { + case 'ROLE_STUDENT': + document.role = '学生' + break; + case 'ROLE_PARENT': + document.role = '家长' + break; + case 'ROLE_SUPERVISOR': + document.role = '辅导员' + break; + } + + this.setData({ + document: document, + showDocument: true + }) + }).catch(err => { + console.log(err) + this.setData({ + warnToast: true + }); + setTimeout(() => { + this.setData({ + hidewarnToast: true + }); + setTimeout(() => { + this.setData({ + warnToast: false, + hidewarnToast: false, + }); + }, 300); + }, 3000); + }) } }) \ No newline at end of file diff --git a/pages/bind-document/bind-document.wxml b/pages/bind-document/bind-document.wxml index 803dbd7..e9f5170 100644 --- a/pages/bind-document/bind-document.wxml +++ b/pages/bind-document/bind-document.wxml @@ -1,11 +1,17 @@ -

绑定您的个人档案

+ +

绑定您的个人档案

在这里将您的账户与您在学院留存的档案绑定,以便确认您的身份。绑定完成后,系统将通过档案获知您的账号与其他账号的关系。 +
+ +

确认您的档案信息

+ 您的档案已找到,请确认这是属于您的档案。确认无误后,点击绑定按钮完成绑定流程。 如果有误的,请重新查询。 +
- + 账号类型 @@ -25,21 +31,92 @@ - + 档案口令 - + + + 档案信息 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - 查询档案 + + 查询档案 + + 重新查询 + 绑定 + + + + + + + 未找到对应档案 + + + diff --git a/pages/get-user-info/get-user-info.wxml b/pages/get-user-info/get-user-info.wxml index 440530d..9a2536e 100644 --- a/pages/get-user-info/get-user-info.wxml +++ b/pages/get-user-info/get-user-info.wxml @@ -7,5 +7,5 @@ - +