diff --git a/api/document.js b/api/document.js
index 3dac0b8..6c6cd57 100644
--- a/api/document.js
+++ b/api/document.js
@@ -93,4 +93,14 @@ export const searchStudents = (numbering) => {
numbering
}
})
+}
+
+export const getUserProfileSupervisor = (documentId) => {
+ return request({
+ url: "/document/profile/supervisor",
+ method: "get",
+ data: {
+ documentId
+ }
+ })
}
\ No newline at end of file
diff --git a/pages/account-doc-info/account-doc-info.js b/pages/account-doc-info/account-doc-info.js
index 14cbbcf..9dcfd7c 100644
--- a/pages/account-doc-info/account-doc-info.js
+++ b/pages/account-doc-info/account-doc-info.js
@@ -1,4 +1,6 @@
// pages/account-doc-info/account-doc-info.js
+import {getUserProfileSupervisor} from '../../api/document'
+
const app = getApp()
Page({
@@ -10,36 +12,51 @@ Page({
hasUserDocument: false,
userInfo: null,
userDocuement: null,
+ admin: false,
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
-
- },
-
- /**
- * 生命周期函数--监听页面初次渲染完成
- */
- onReady: function () {
-
- },
-
- /**
- * 生命周期函数--监听页面显示
- */
- onShow: function () {
- if(app.globalData.userInfo){
- let userInfo = app.globalData.userInfo
-
- this.setData({
- hasUserInfo: true,
- userInfo: userInfo
+ console.log(options)
+ if(options.admin === "true") {
+ const eventChannel = this.getOpenerEventChannel()
+ let that = this
+ eventChannel.on('acceptDataFromOpenerPage', function(data) {
+ console.log(data)
+ that.setData({
+ hasUserInfo: false,
+ userInfo: {}
+ })
+ that.setUserDocument(data.userDocument)
+ if(data.userDocument.connected) {
+ getUserProfileSupervisor(data.userDocument.id).then(res => {
+ console.log(res)
+ that.setData({
+ hasUserInfo: true,
+ userInfo: res
+ })
+ })
+ }
})
+ } else {
+ if(app.globalData.userInfo){
+
+ this.setData({
+ hasUserInfo: true,
+ userInfo: app.globalData.userInfo
+ })
+ }
+ if(app.globalData.userDocument){
+ this.setUserDocument(app.globalData.userDocument)
+ }
}
- if(app.globalData.userDocument){
- let userDocument = app.globalData.userDocument
+ },
+
+ setUserDocument(document) {
+
+ let userDocument = document
switch(userDocument.gender) {
case 'F':
userDocument.gender = '女'
@@ -66,7 +83,21 @@ Page({
hasUserDocument: true,
userDocument: userDocument
})
- }
+
+ },
+
+ /**
+ * 生命周期函数--监听页面初次渲染完成
+ */
+ onReady: function () {
+
+ },
+
+ /**
+ * 生命周期函数--监听页面显示
+ */
+ onShow: function () {
+
},
/**
diff --git a/pages/my-students/my-students.js b/pages/my-students/my-students.js
index a0a915b..ebe668e 100644
--- a/pages/my-students/my-students.js
+++ b/pages/my-students/my-students.js
@@ -8,7 +8,8 @@ Page({
*/
data: {
inputShowed: false,
- inputVal: ""
+ inputVal: "",
+ searchStudentsList: []
},
/**
@@ -86,6 +87,27 @@ Page({
});
},
+ onClickShowDocument(e) {
+ let showIndex = e.currentTarget.dataset['index']
+ let userDocument = this.data.searchStudentsList[showIndex]
+ wx.navigateTo({
+ url: '../account-doc-info/account-doc-info?admin=true',
+ events: {
+ // 为指定事件添加一个监听器,获取被打开页面传送到当前页面的数据
+ acceptDataFromOpenedPage: function(data) {
+ console.log(data)
+ },
+ someEvent: function(data) {
+ console.log(data)
+ }
+ },
+ success: function(res) {
+ // 通过eventChannel向被打开页面传送数据
+ res.eventChannel.emit('acceptDataFromOpenerPage', { userDocument: userDocument })
+ }
+ })
+ },
+
inputTyping: function (e) {
let inputVal = e.detail.value
this.setData({
@@ -93,6 +115,9 @@ Page({
});
searchStudents(inputVal).then(res => {
console.log(res)
+ this.setData({
+ searchStudentsList: res
+ })
})
}
})
\ No newline at end of file
diff --git a/pages/my-students/my-students.wxml b/pages/my-students/my-students.wxml
index fb82e28..5400608 100644
--- a/pages/my-students/my-students.wxml
+++ b/pages/my-students/my-students.wxml
@@ -20,24 +20,9 @@
取消
-
+
- 实时搜索文本
-
-
-
-
- 实时搜索文本
-
-
-
-
- 实时搜索文本
-
-
-
-
- 实时搜索文本
+ [{{item.numbering}}] {{item.realName}}