|
@@ -9,24 +9,20 @@ Page({
|
|
|
* 页面的初始数据
|
|
|
*/
|
|
|
data: {
|
|
|
+ userInfo: '',
|
|
|
isregiste: true,
|
|
|
- arrayCollege: ['软件工程学院', '文学院', '法学院'],
|
|
|
+ arrayCollege: [],
|
|
|
+ listCollege: '',
|
|
|
indexCollege: 0,
|
|
|
- arrayDept: ['计算机应用系', '文学系', '数学系'],
|
|
|
+ arrayDept: [],
|
|
|
+ listDept: '',
|
|
|
indexDept: 0,
|
|
|
- arrayClass: ['一班', '二班', '三班'],
|
|
|
+ arrayClass: [],
|
|
|
indexClass: 0,
|
|
|
- list: [{
|
|
|
- img: '/images/head.png',
|
|
|
- name: '刘天仙',
|
|
|
- address: '一号宿舍楼 502宿舍',
|
|
|
- time: '2019-10-28 15:18'
|
|
|
- }, {
|
|
|
- img: '/images/head.png',
|
|
|
- name: '陈方明',
|
|
|
- address: '一号宿舍楼 508宿舍',
|
|
|
- time: '2019-10-28 15:18'
|
|
|
- }]
|
|
|
+ listClass: '',
|
|
|
+ registerCount: '',
|
|
|
+ unRegisterCount: '',
|
|
|
+ list: []
|
|
|
},
|
|
|
|
|
|
checkTab: function(e) {
|
|
@@ -34,12 +30,18 @@ Page({
|
|
|
that.setData({
|
|
|
isregiste: !that.data.isregiste
|
|
|
})
|
|
|
+ if (that.data.isregiste) {
|
|
|
+ that.getRegisterInfo(0)
|
|
|
+ } else {
|
|
|
+ that.getRegisterInfo(1)
|
|
|
+ }
|
|
|
},
|
|
|
|
|
|
pickerChangeCollege: function(e) {
|
|
|
this.setData({
|
|
|
indexCollege: e.detail.value
|
|
|
})
|
|
|
+ this.getDeptInfo();
|
|
|
},
|
|
|
|
|
|
pickerChangeDept: function(e) {
|
|
@@ -54,15 +56,79 @@ Page({
|
|
|
})
|
|
|
},
|
|
|
|
|
|
- getRegisterInfo: function(e) {
|
|
|
-
|
|
|
+ getCollegeInfo: function(e) {
|
|
|
+ const that = this;
|
|
|
+ util.httpRequest(api.getDeptInfo, {
|
|
|
+ companyId: that.data.userInfo.companyId,
|
|
|
+ level: 1
|
|
|
+ }, 'post').then(res => {
|
|
|
+ let arrayCollege = [];
|
|
|
+ if (res.data.length > 1) {
|
|
|
+ for (let i = 0; i < res.data.length; i++) {
|
|
|
+ arrayCollege.push(res.data[i].deptName)
|
|
|
+ if (i == res.data.length - 1) {
|
|
|
+ that.setData({
|
|
|
+ arrayCollege: arrayCollege,
|
|
|
+ listCollege: res.data
|
|
|
+ })
|
|
|
+ that.getDeptInfo();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ that.setData({
|
|
|
+ arrayCollege: arrayCollege
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+
|
|
|
+ getDeptInfo: function(e) {
|
|
|
+ const that = this;
|
|
|
+ util.httpRequest(api.getDeptInfo, {
|
|
|
+ companyId: that.data.userInfo.companyId,
|
|
|
+ parentId: that.data.listCollege[that.data.indexCollege].deptId
|
|
|
+ }, 'post').then(res => {
|
|
|
+ let arrayDept = [];
|
|
|
+ if (res.data.length > 1) {
|
|
|
+ for (let i = 0; i < res.data.length; i++) {
|
|
|
+ arrayDept.push(res.data[i].deptName)
|
|
|
+ if (i == res.data.length - 1) {
|
|
|
+ that.setData({
|
|
|
+ arrayDept: arrayDept,
|
|
|
+ listDept: res.data
|
|
|
+ })
|
|
|
+ that.getRegisterInfo();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ that.setData({
|
|
|
+ arrayDept: arrayDept
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+
|
|
|
+ getRegisterInfo: function(status = 0) {
|
|
|
+ const that = this;
|
|
|
+ util.httpRequest(api.getRegisterInfo, {
|
|
|
+ deptId: that.data.listDept[that.data.indexDept].deptId,
|
|
|
+ register: status
|
|
|
+ }, 'post').then(res => {
|
|
|
+ that.setData({
|
|
|
+ registerCount: res.data.data.registerCount,
|
|
|
+ unRegisterCount: res.data.data.unEegisterCount,
|
|
|
+ list: res.data.data.data
|
|
|
+ })
|
|
|
+ })
|
|
|
},
|
|
|
|
|
|
/**
|
|
|
* 生命周期函数--监听页面加载
|
|
|
*/
|
|
|
onLoad: function(options) {
|
|
|
-
|
|
|
+ const that = this;
|
|
|
+ that.data.userInfo = wx.getStorageSync('lnkjUserInfo');
|
|
|
+ that.getCollegeInfo();
|
|
|
},
|
|
|
|
|
|
/**
|