Browse Source

接口调试

yanym 5 years ago
parent
commit
a7f38c9819

+ 27 - 23
dorm-manager-wx/pages/login/login.js

@@ -1,4 +1,7 @@
 // pages/login/login.js
+const api = require('../../utils/api.js');
+const app=getApp();
+
 Page({
 
   /**
@@ -15,29 +18,30 @@ Page({
       index: e.detail.value
     })
   },
-  formSubmit(e){
-    let that=this
-    if (!e.detail.value.account && !e.detail.value.password){
+  formSubmit(e) {
+    let that = this
+    if (!e.detail.value.account && !e.detail.value.password) {
       wx.showToast({
         title: '请输入账号或密码',
-        icon:'none'
+        icon: 'none'
       })
       return false;
     }
     wx.request({
-      url: app.userLogin,
-      method:'GET',
-      data:{
-        loginId:e.detail.value.account,
-        loginPwd:e.detail.value.password
+      url: api.userLogin,
+      method: 'GET',
+      data: {
+        loginId: e.detail.value.account,
+        loginPwd: e.detail.value.password
       },
-      success(res){
-        if(res.data.status=='success'){
+      success(res) {
+        if (res.data.status == 'success') {
           wx.setStorageSync('loginId', e.detail.value.account)
+          wx.setStorageSync('lnkjUserInfo', res.data.data)
           wx.switchTab({
             url: '/pages/student/menu/menu',
           })
-        }else{
+        } else {
           wx.showToast({
             title: res.data.message,
             icon: 'none'
@@ -49,65 +53,65 @@ Page({
   /**
    * 生命周期函数--监听页面加载
    */
-  onLoad: function (options) {
+  onLoad: function(options) {
 
   },
 
   /**
    * 生命周期函数--监听页面初次渲染完成
    */
-  onReady: function () {
-    if (wx.getStorageSync('loginId')){
+  onReady: function() {
+    if (wx.getStorageSync('loginId')) {
       wx.showLoading({
         title: '正在自动登录',
       })
-      setTimeout(function(){
+      setTimeout(function() {
         wx.switchTab({
           url: '/pages/student/menu/menu',
         })
-      },1000)
+      }, 1000)
     }
   },
 
   /**
    * 生命周期函数--监听页面显示
    */
-  onShow: function () {
+  onShow: function() {
 
   },
 
   /**
    * 生命周期函数--监听页面隐藏
    */
-  onHide: function () {
+  onHide: function() {
 
   },
 
   /**
    * 生命周期函数--监听页面卸载
    */
-  onUnload: function () {
+  onUnload: function() {
 
   },
 
   /**
    * 页面相关事件处理函数--监听用户下拉动作
    */
-  onPullDownRefresh: function () {
+  onPullDownRefresh: function() {
 
   },
 
   /**
    * 页面上拉触底事件的处理函数
    */
-  onReachBottom: function () {
+  onReachBottom: function() {
 
   },
 
   /**
    * 用户点击右上角分享
    */
-  onShareAppMessage: function () {
+  onShareAppMessage: function() {
 
   }
 })

+ 91 - 16
dorm-manager-wx/pages/student/menu/menu.js

@@ -5,68 +5,143 @@ Page({
    * 页面的初始数据
    */
   data: {
-    menu: [
-     { 'title': '人脸自助', imagename: 'facephoto',left:'#fec38f',right:'#ff8980' },
-      { 'title': '访客申请', imagename: 'application', left: '#bdc1ff', right: '#ac8efd' },
-      { 'title': '通行记录', imagename: 'pass', left: '#9fd9fc', right: '#7abcf2' }, 
-      { 'title': '考勤统计', imagename: 'statistics', left: '#ffca93', right: '#fdb957' }
-     ],
-    list: [{ 'title': '报修服务', nav: 'baoxiu' }, { 'title': '快递物流', nav: 'kuaidi' }, { 'title': '投诉建议', nav: 'tousu' }, { 'title': '问卷调查', nav: 'diaocha' }]
+    roleType: '',
+    menuStudent: [{
+        'title': '人脸自助',
+        imagename: 'facephoto',
+        left: '#fec38f',
+        right: '#ff8980'
+      },
+      {
+        'title': '访客申请',
+        imagename: 'application',
+        left: '#bdc1ff',
+        right: '#ac8efd'
+      },
+      {
+        'title': '通行记录',
+        imagename: 'pass',
+        left: '#9fd9fc',
+        right: '#7abcf2'
+      },
+      {
+        'title': '考勤统计',
+        imagename: 'statistics',
+        left: '#ffca93',
+        right: '#fdb957'
+      }
+    ],
+    listStudent: [{
+      'title': '报修服务',
+      nav: 'baoxiu'
+    }, {
+      'title': '快递物流',
+      nav: 'kuaidi'
+    }, {
+      'title': '投诉建议',
+      nav: 'tousu'
+    }, {
+      'title': '问卷调查',
+      nav: 'diaocha'
+    }],
+    menuTeacher: [{
+        'title': '人脸自助',
+        imagename: 'facephoto',
+        left: '#fec38f',
+        right: '#ff8980'
+      },
+      {
+        'title': '访客审核',
+        imagename: 'visitorcheck',
+        left: '#bdc1ff',
+        right: '#ac8efd'
+      },
+      {
+        'title': '通行记录',
+        imagename: 'pass',
+        left: '#9fd9fc',
+        right: '#7abcf2'
+      },
+      {
+        'title': '考勤统计',
+        imagename: 'statistics',
+        left: '#ffca93',
+        right: '#fdb957'
+      }
+    ],
+    listTeacher: [{
+      'title': '预紧提醒',
+      nav: 'yujing-2',
+      url: 'warning'
+    }, {
+      'title': '报表管理',
+      nav: 'baobiaoguanli'
+    }, {
+      'title': '投诉建议',
+      nav: 'tousu'
+    }, {
+      'title': '报修管理',
+      nav: 'baoxiu'
+    }]
   },
 
   /**
    * 生命周期函数--监听页面加载
    */
-  onLoad: function (options) {
-
+  onLoad: function(options) {
+    const that = this;
+    let roleType = wx.getStorageSync('lnkjUserInfo').roleType;
+    that.setData({
+      roleType: roleType
+    })
   },
 
   /**
    * 生命周期函数--监听页面初次渲染完成
    */
-  onReady: function () {
+  onReady: function() {
 
   },
 
   /**
    * 生命周期函数--监听页面显示
    */
-  onShow: function () {
+  onShow: function() {
 
   },
 
   /**
    * 生命周期函数--监听页面隐藏
    */
-  onHide: function () {
+  onHide: function() {
 
   },
 
   /**
    * 生命周期函数--监听页面卸载
    */
-  onUnload: function () {
+  onUnload: function() {
 
   },
 
   /**
    * 页面相关事件处理函数--监听用户下拉动作
    */
-  onPullDownRefresh: function () {
+  onPullDownRefresh: function() {
 
   },
 
   /**
    * 页面上拉触底事件的处理函数
    */
-  onReachBottom: function () {
+  onReachBottom: function() {
 
   },
 
   /**
    * 用户点击右上角分享
    */
-  onShareAppMessage: function () {
+  onShareAppMessage: function() {
 
   }
 })

+ 4 - 4
dorm-manager-wx/pages/student/menu/menu.wxml

@@ -1,6 +1,6 @@
 <view class="menu">
-  <block wx:for='{{menu}}' wx:key='{{index}}'>
-    <navigator url="../{{item.imagename}}/{{item.imagename}}">
+  <block wx:for='{{roleType==10001?menuTeacher:menuStudent}}' wx:key='{{index}}'>
+    <navigator url="/pages/{{roleType==10001?'teacher':'student'}}/{{item.imagename}}/{{item.imagename}}">
       <view class="menu-list" style="background-image: linear-gradient(to right, {{item.left}} , {{item.right}});">
         <image class="menu-icon" src='/images/{{item.imagename}}.png'></image>
         <view class='menu-title'>{{item.title}}</view>
@@ -9,8 +9,8 @@
   </block>
 </view>
 <view class="list">
-  <block wx:for='{{list}}' wx:key='{{index}}'>
-    <navigator url="">
+  <block wx:for='{{roleType==10001?listTeacher:listStudent}}' wx:key='{{index}}'>
+    <navigator url="/pages/{{roleType==10001?'teacher':'student'}}/{{item.url}}/{{item.url}}">
       <view class="line">
         <view class="list-title">
           <image src='/images/{{item.nav}}.png'></image>

+ 83 - 17
dorm-manager-wx/pages/teacher/facephoto/facephoto.js

@@ -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();
   },
 
   /**

+ 11 - 11
dorm-manager-wx/pages/teacher/facephoto/facephoto.wxml

@@ -1,24 +1,24 @@
 <!-- facephoto.wxml -->
 <view class="mycontainer" style="padding:0rpx;">
   <view class="tab-item">
-    <view class="item {{isregiste?'item-checked':''}}" bindtap="checkTab">已注册(18)</view>
-    <view class="item {{isregiste?'':'item-checked'}}" bindtap="checkTab">未注册(22)</view>
+    <view class="item {{isregiste?'item-checked':''}}" bindtap="checkTab">已注册({{registerCount}})</view>
+    <view class="item {{isregiste?'':'item-checked'}}" bindtap="checkTab">未注册({{unRegisterCount}})</view>
   </view>
   <view class="picker-item">
-    <picker bindchange="pickerChangeCollege" value="{{indexCollege}}" range="{{arrayCollege}}">
+    <picker bindchange="pickerChangeCollege" value="{{indexCollege}}" range="{{arrayCollege}}" wx:if='{{arrayCollege.length>1}}'>
       <view class="weui-input" style="width:250rpx;">
         <view class="span">{{arrayCollege[indexCollege]}}</view>
         <image src='/images/jiantou-bottom.png' class="imgjt"></image>
       </view>
     </picker>
-    <picker bindchange="pickerChangeDept" value="{{indexDept}}" range="{{arrayDept}}">
-      <view class="weui-input" style="width:250rpx;">
+    <picker bindchange="pickerChangeDept" value="{{indexDept}}" range="{{arrayDept}}" wx:if='{{arrayDept.length>1}}'>
+      <view class="weui-input" style="width:250rpx;margin-left:20rpx;">
         <view class="span">{{arrayDept[indexDept]}}</view>
         <image src='/images/jiantou-bottom.png' class="imgjt"></image>
       </view>
     </picker>
-    <picker bindchange="pickerChangeClass" value="{{indexClass}}" range="{{arrayClass}}">
-      <view class="weui-input" style="width:140rpx;">
+    <picker bindchange="pickerChangeClass" value="{{indexClass}}" range="{{arrayClass}}" wx:if='{{arrayClass.length>1}}'>
+      <view class="weui-input" style="width:140rpx;margin-left:20rpx;">
         <view class="span">{{arrayClass[indexClass]}}</view>
         <image src='/images/jiantou-bottom.png' class="imgjt"></image>
       </view>
@@ -29,12 +29,12 @@
       <view class="list-item" hover-class="myhover" hover-start-time="50" hover-stay-time="50">
         <image src="{{item.img}}" class="head-img"></image>
         <view class="my-column my-flex-sb" style="height:150rpx;">
-          <view class="name">{{item.name}}</view>
+          <view class="name">{{item.userName}}</view>
           <view class="address">
-          <image src="/images/dizhi.png" class="address-img"></image>
-          <view class="create-time">{{item.address}}</view>
+            <image src="/images/dizhi.png" class="address-img"></image>
+            <view class="create-time">{{item.storeyTitle}}{{item.roomTitle}}</view>
           </view>
-          <view class="create-time">注册时间:{{item.time}}</view>
+          <view class="create-time" wx:if='{{isregiste}}'>注册时间:{{item.createDate}}</view>
         </view>
       </view>
     </block>

+ 0 - 1
dorm-manager-wx/pages/teacher/facephoto/facephoto.wxss

@@ -33,7 +33,6 @@ page {
   box-sizing: border-box;
   flex-direction: row;
   display: flex;
-  justify-content: space-between;
   align-items: center;
 }
 

+ 62 - 34
dorm-manager-wx/pages/teacher/pass/pass.js

@@ -1,7 +1,7 @@
 const util = require('../../../utils/util.js');
 const api = require('../../../utils/api.js');
 
-const app=getApp();
+const app = getApp();
 
 Page({
 
@@ -9,95 +9,123 @@ Page({
    * 页面的初始数据
    */
   data: {
-    userIndex:0,
-    userArray:['软件学院计算机系刘天仙','文学院哲学系陈方明'],
-    deviceIndex:0,
-    deviceArray:['1号楼东门','1号楼南门','2号楼南门'],
+    userIndex: 0,
+    userArray: ['软件学院计算机系刘天仙', '文学院哲学系陈方明'],
+    deviceIndex: 2,
+    deviceArray: [],
+    deviceList: '',
     startDate: '2019-10-29',
     endDate: '2019-10-29',
-    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'
-    }]
+    list: []
   },
 
-  bindUserChange: function (e) {
+  bindUserChange: function(e) {
     this.setData({
       userIndex: e.detail.value
     })
   },
 
-  bindDeviceChange: function (e) {
+  bindDeviceChange: function(e) {
     this.setData({
       deviceIndex: e.detail.value
     })
+    this.getPassInfo();
   },
 
-  bindStartDateChange: function (e) {
+  bindStartDateChange: function(e) {
     this.setData({
       startDate: e.detail.value
     })
   },
 
-  bindendDateChange: function (e) {
+  bindendDateChange: function(e) {
     this.setData({
       endDate: e.detail.value
     })
   },
 
+  getDeviceInfo: function(e) {
+    const that = this;
+    util.httpRequest(api.getDeviceInfo, {
+
+    }, 'post').then(res => {
+      let deviceArray = [];
+      for (let i = 0; i < res.data.length; i++) {
+        deviceArray.push(res.data[i].name)
+        if (i == res.data.length - 1) {
+          that.setData({
+            deviceArray: deviceArray,
+            deviceList: res.data
+          })
+          that.getPassInfo();
+        }
+      }
+    })
+  },
+
+  getPassInfo: function(e) {
+    const that = this;
+    util.httpRequest(api.getPassInfo, {
+      loginId: 15286831873,
+      start: that.data.startDate,
+      end: that.data.endDate,
+      driviceId: that.data.deviceList[that.data.deviceIndex].id,
+      rows: 20,
+      page: 1
+    }, 'post').then(res => {
+      that.setData({
+        list: res.data.data
+      })
+    })
+  },
+
   /**
    * 生命周期函数--监听页面加载
    */
-  onLoad: function (options) {
-    
+  onLoad: function(options) {
+    const that = this;
+    that.getDeviceInfo();
   },
 
   /**
    * 生命周期函数--监听页面初次渲染完成
    */
-  onReady: function () {
-    
+  onReady: function() {
+
   },
 
   /**
    * 生命周期函数--监听页面显示
    */
-  onShow: function () {
-    
+  onShow: function() {
+
   },
 
   /**
    * 生命周期函数--监听页面隐藏
    */
-  onHide: function () {
-    
+  onHide: function() {
+
   },
 
   /**
    * 生命周期函数--监听页面卸载
    */
-  onUnload: function () {
-    
+  onUnload: function() {
+
   },
 
   /**
    * 页面相关事件处理函数--监听用户下拉动作
    */
-  onPullDownRefresh: function () {
-    
+  onPullDownRefresh: function() {
+
   },
 
   /**
    * 页面上拉触底事件的处理函数
    */
-  onReachBottom: function () {
-    
+  onReachBottom: function() {
+
   }
 })

+ 5 - 5
dorm-manager-wx/pages/teacher/pass/pass.wxml

@@ -49,16 +49,16 @@
       <view class="list-item" hover-class="myhover" hover-start-time="50" hover-stay-time="50">
         <image src="{{item.img}}" class="head-img"></image>
         <view class="my-column my-flex-sb" style="height:150rpx;">
-          <view class="name">{{item.name}}</view>
+          <view class="name">{{item.displayName}}</view>
           <view class="address">
             <image src="/images/clock.png" class="address-img"></image>
-            <view class="create-time">{{item.time}}</view>
-            <view class="normal" wx:if='{{index==0}}'>正常外出</view>
-            <view class="late" wx:if='{{index==1}}'>晚归</view>
+            <view class="create-time">{{item.openTime}}</view>
+            <view class="normal" wx:if='{{item.state==1}}'>正常外出</view>
+            <view class="late" wx:if='{{item.state==0}}'>晚归</view>
           </view>
           <view class="address">
             <image src="/images/dizhi.png" class="address-img"></image>
-            <view class="create-time">{{item.address}}</view>
+            <view class="create-time">{{item.address?item.address:'洛阳测试中心'}}</view>
           </view>
         </view>
       </view>

+ 49 - 30
dorm-manager-wx/pages/teacher/statistics/statistics.js

@@ -10,35 +10,12 @@ Page({
    * 页面的初始数据
    */
   data: {
+    totalInfo: '',
     startDate: '2019-10-29',
     endDate: '2019-10-29',
     scopeIndex: 0,
-    scopeArray: ['机械工程学院', '电子计算机系', '文学系'],
-    weiguiList: [{
-      name: '刘天仙',
-      build: '1号楼',
-      room: '1101',
-      num: '1',
-      time: ''
-    }, {
-      name: '陈方明',
-      build: '3号楼',
-      room: '1101',
-      num: '1',
-      time: ''
-    }, {
-      name: '刘天仙',
-      build: '1号楼',
-      room: '1101',
-      num: '1',
-      time: ''
-    }, {
-      name: '陈方明',
-      build: '3号楼',
-      room: '1101',
-      num: '1',
-      time: ''
-    }]
+    scopeArray: ['全部人员'],
+    weiguiList: []
   },
 
   bindStartDateChange: function(e) {
@@ -60,6 +37,7 @@ Page({
   },
 
   getChart: function(e) {
+    const that = this;
     ringChart = new wxCharts({
       animation: true,
       canvasId: 'ringCanvas',
@@ -76,18 +54,18 @@ Page({
         fontSize: 15
       },
       subtitle: {
-        name: '98%',
+        name: that.data.totalInfo.attendance * 100 + '%',
         color: '#6282f4',
         fontSize: 18
       },
       series: [{
         name: '归勤',
-        data: 90,
+        data: that.data.totalInfo.attendance * 100,
         stroke: false,
         color: '#6282f4'
       }, {
         name: '缺勤',
-        data: 10,
+        data: 100 - that.data.totalInfo.attendance * 100,
         stroke: false,
         color: '#ed5c68'
       }],
@@ -111,12 +89,53 @@ Page({
     console.log(ringChart.getCurrentDataIndex(e));
   },
 
+  getStatisticsInfo: function(e) {
+    const that = this;
+    util.httpRequest(api.getStatisticsInfo, {
+      start: that.data.startDate,
+      end: that.data.endDate
+    }, 'post').then(res => {
+      that.setData({
+        totalInfo: res.data.data
+      })
+      that.getChart();
+    })
+  },
+
+  getUnInInfo: function(e) {
+    const that = this;
+    util.httpRequest(api.getUnInfo, {
+      start: that.data.startDate,
+      end: that.data.endDate,
+      page: 1,
+      rows: 20
+    }, 'post').then(res => {
+
+    })
+  },
+
+  getOutAndInInfo: function(e) {
+    const that = this;
+    util.httpRequest(api.getOutAndInInfo, {
+      startDate: that.data.startDate,
+      endDate: that.data.endDate,
+      page: 1,
+      rows: 20
+    }, 'post').then(res => {
+      that.setData({
+        weiguiList: res.data.data.data
+      })
+    })
+  },
+
   /**
    * 生命周期函数--监听页面加载
    */
   onLoad: function(options) {
     const that = this;
-    that.getChart();
+    that.getStatisticsInfo();
+    that.getUnInInfo();
+    that.getOutAndInInfo();
   },
 
   /**

+ 11 - 11
dorm-manager-wx/pages/teacher/statistics/statistics.wxml

@@ -50,34 +50,34 @@
     <view class="charts-right">
       <view class="charts-line">
         <view class="charts-icon1 charts-icon"></view>
-        <view class="charts-data">全员人数1324人</view>
+        <view class="charts-data">全员人数{{totalInfo.out+totalInfo.unOut}}人</view>
       </view>
     </view>
     <view class="bottom">
       <view class="my-column my-align-c">
-        <view class="bottom-bigback1 item">0</view>
+        <view class="bottom-bigback1 item">{{totalInfo.unAccessCount}}</view>
         <view class="desc">无进出记录人员</view>
       </view>
       <view class="my-column my-align-c">
-        <view class="bottom-bigback2 item">1324</view>
+        <view class="bottom-bigback2 item">{{totalInfo.out}}</view>
         <view class="desc">已出宿舍人员</view>
       </view>
       <view class="my-column my-align-c">
-        <view class="bottom-bigback3 item">1319</view>
+        <view class="bottom-bigback3 item">{{totalInfo.in}}</view>
         <view class="desc">已归宿舍人员</view>
       </view>
     </view>
     <view class="bottom" style="margin-top:30rpx;margin-bottom:30rpx;">
       <view class="my-column my-align-c">
-        <view class="bottom-bigback4 item">69</view>
+        <view class="bottom-bigback4 item">{{totalInfo.laterIn}}</view>
         <view class="desc">晚归宿舍人员</view>
       </view>
       <view class="my-column my-align-c">
-        <view class="bottom-bigback5 item">5</view>
+        <view class="bottom-bigback5 item">{{totalInfo.unIn}}</view>
         <view class="desc">未归宿舍人员</view>
       </view>
       <view class="my-column my-align-c">
-        <view class="bottom-bigback6 item">0</view>
+        <view class="bottom-bigback6 item">{{totalInfo.unOut}}</view>
         <view class="desc">未出宿舍人员</view>
       </view>
     </view>
@@ -95,10 +95,10 @@
     </view>
     <block wx:for='{{weiguiList}}'>
       <view class="item">
-        <view class="name">{{item.name}}</view>
-        <view class="name">{{item.build}}</view>
-        <view class="name">{{item.room}}</view>
-        <view class="name">{{item.num}}</view>
+        <view class="name">{{item.userName}}</view>
+        <view class="name">{{item.storeyTitle}}</view>
+        <view class="name">{{item.roomTitle}}</view>
+        <view class="name">1</view>
         <view class="name">{{item.time}}</view>
       </view>
     </block>

+ 7 - 6
dorm-manager-wx/pages/teacher/visitorcheck/visitorcheck.js

@@ -10,8 +10,8 @@ Page({
    */
   data: {
     isregiste: true,
-    approvalNum:0,
-    approvedNum:0,
+    approvalNum: 0,
+    approvedNum: 0,
     list: []
   },
 
@@ -28,8 +28,9 @@ Page({
   },
 
   todetail: function(e) {
+    let id = e.currentTarget.dataset.id;
     wx.navigateTo({
-      url: '../visitorcheckdetail/visitorcheckdetail',
+      url: '../visitorcheckdetail/visitorcheckdetail?id=' + id,
     })
   },
 
@@ -41,9 +42,9 @@ Page({
       page: 1
     }, 'post').then(res => {
       that.setData({
-        list: res.data.data.data,
-        approvalNum:res.data.data.approval,
-        approvedNum:res.data.data.approved
+        list: res.data.data,
+        approvalNum: res.data.data.approval,
+        approvedNum: res.data.data.approved
       })
     })
   },

+ 3 - 3
dorm-manager-wx/pages/teacher/visitorcheck/visitorcheck.wxml

@@ -6,13 +6,13 @@
   </view>
   <scroll-view scroll-y='true'>
     <block wx:for='{{list}}'>
-      <view class="list-item" hover-class="myhover" hover-start-time="50" hover-stay-time="50" bindtap="todetail">
+      <view class="list-item" hover-class="myhover" hover-start-time="50" hover-stay-time="50" bindtap="todetail" data-id="{{item.visitorId}}">
         <image src="{{item.localPhoto?item.localPhoto:'/images/default-urser.png'}}" class="head-img"></image>
         <view class="my-column my-flex-sb" style="height:150rpx;">
-          <view class="name">{{item.inviteName}}</view>
+          <view class="name">{{item.userName}}</view>
           <view class="address">
             <image src="/images/dizhi.png" class="address-img"></image>
-            <view class="create-time">{{item.inviteOrganization}}</view>
+            <view class="create-time">{{item.storeyTitle+item.roomTitle}}</view>
           </view>
           <view class="create-time">提交时间:{{item.createDate}}</view>
         </view>

+ 47 - 38
dorm-manager-wx/pages/teacher/visitorcheckdetail/visitorcheckdetail.js

@@ -9,50 +9,58 @@ Page({
    * 页面的初始数据
    */
   data: {
-    userInfo: {
-      photo: '',
-      name: '辽宁',
-      cardNum: '401311188603041535',
-      phone: '15838122222',
-      visitorName: '软件工程学院计算机系刘天仙',
-      type: '亲属',
-      buildNum: '一号宿舍楼',
-      roomNum: '502宿舍',
-      reason: '探亲'
-    },
+    id:'',
+    userInfo: '',
     list: []
   },
 
   getUserInfoArray: function(e) {
     const that = this;
-    let userInfo = [];
-    userInfo.push({
-      key: '访客姓名:',
-      value: that.data.userInfo.name
-    }, {
-      key: '身份证号:',
-      value: that.data.userInfo.cardNum
-    }, {
-      key: '手机号:',
-      value: that.data.userInfo.phone
-    }, {
-      key: '被访人:',
-      value: that.data.userInfo.visitorName
-    }, {
-      key: '身份类型:',
-      value: that.data.userInfo.type
-    }, {
-      key: '访问楼栋:',
-      value: that.data.userInfo.buildNum
-    }, {
-      key: '访问宿舍:',
-      value: that.data.userInfo.roomNum
-    }, {
-      key: '访问原因:',
-      value: that.data.userInfo.reason
+    util.httpRequest(api.getVisitorInfo, {
+      visitorId: that.data.id
+    }, 'post').then(res => {
+      let userInfo = [];
+      userInfo.push({
+        key: '访客姓名:',
+        value: res.data.data.visitor.visitorName
+      }, {
+        key: '身份证号:',
+        value: res.data.data.visitor.idnumber
+      }, {
+        key: '手机号:',
+        value: res.data.data.visitor.visitorPhone
+      }, {
+        key: '被访人:',
+        value: res.data.data.visitor.inviteName
+      }, {
+        key: '身份类型:',
+        value: res.data.data.visitor.identity
+      }, {
+        key: '访问楼栋:',
+        value: res.data.data.visitor.storey
+      }, {
+        key: '访问宿舍:',
+        value: res.data.data.visitor.room
+      }, {
+        key: '访问原因:',
+        value: res.data.data.visitor.visitorReason
+      })
+      that.setData({
+        list: userInfo,
+        userInfo: res.data.data.visitor
+      })
     })
-    that.setData({
-      list: userInfo
+  },
+
+  check: function(e) {
+    const that = this;
+    let reject = e.currentTarget.dataset.reject;
+    let id = e.currentTarget.dataset.id;
+    util.httpRequest(api.getVisitorCheck, {
+      id: that.data.id,
+      audit: reject == 'approve' ? true : false
+    }, 'post').then(res => {
+
     })
   },
 
@@ -61,6 +69,7 @@ Page({
    */
   onLoad: function(options) {
     const that = this;
+    that.data.id = options.id;
     that.getUserInfoArray();
   },
 

+ 3 - 3
dorm-manager-wx/pages/teacher/visitorcheckdetail/visitorcheckdetail.wxml

@@ -1,7 +1,7 @@
 <!-- visitorcheckdetail.wxml -->
 <view class="mycontainer">
   <view class="list">
-    <image src="{{userInfo.photo!=''?userInfo.photo:'/images/default-urser.png'}}" class="head-img"></image>
+    <image src="{{userInfo.visitorPhoto!=null?userInfo.visitorPhoto:'/images/default-urser.png'}}" class="head-img"></image>
     <block wx:for='{{list}}'>
       <view class="item">
         <view class="key">{{item.key}}</view>
@@ -10,7 +10,7 @@
     </block>
   </view>
   <view class="btn-item">
-    <view class="btn approve" hover-class="myhover" hover-start-time="50" hover-stay-time="50">通过</view>
-    <view class="btn reject" hover-class="myhover" hover-start-time="50" hover-stay-time="50">驳回</view>
+    <view class="btn approve" hover-class="myhover" hover-start-time="50" hover-stay-time="50" bindtap="check" data-reject="approve">通过</view>
+    <view class="btn reject" hover-class="myhover" hover-start-time="50" hover-stay-time="50" bindtap="check" data-reject="reject">驳回</view>
   </view>
 </view>

+ 38 - 10
dorm-manager-wx/pages/teacher/warning/warning.js

@@ -10,15 +10,7 @@ Page({
    */
   data: {
     tab: 1,
-    list: [{
-      img: '/images/head.png',
-      name: '刘天仙',
-      address: '一号宿舍楼 502宿舍'
-    }, {
-      img: '/images/head.png',
-      name: '陈方明',
-      address: '一号宿舍楼 508宿舍'
-    }]
+    list: []
   },
 
   checkTab: function(e) {
@@ -27,13 +19,49 @@ Page({
     that.setData({
       tab: type
     })
+    that.getUnInInfo();
+  },
+
+  getUnInInfo: function(e) {
+    const that = this;
+    let date = new Date();
+    let stoday = date.getFullYear() + "-" + (date.getMonth() + 1) + "-" + date.getDate();
+    let day1 = new Date();
+    day1.setTime(day1.getTime() - 24 * 60 * 60 * 1000);
+    let s1 = day1.getFullYear() + "-" + (day1.getMonth() + 1) + "-" + day1.getDate();
+    let day3 = new Date();
+    day3.setTime(day3.getTime() - 3 * 24 * 60 * 60 * 1000);
+    let s3 = day3.getFullYear() + "-" + (day3.getMonth() + 1) + "-" + day3.getDate();
+    let day5 = new Date();
+    day5.setTime(day5.getTime() - 5 * 24 * 60 * 60 * 1000);
+    let s5 = day5.getFullYear() + "-" + (day5.getMonth() + 1) + "-" + day5.getDate();
+    console.log(s1, s3, s5)
+    util.httpRequest(api.getUnInfo, {
+      start: that.data.tab == 1 ? s1 : that.data.tab == 3 ? s3 : s5,
+      end: stoday,
+      page: 1,
+      rows: 20,
+      unInCount: that.data.tab
+    }, 'post').then(res => {
+      that.setData({
+        list: res.data.data.data
+      })
+    })
+  },
+
+  makePhoneCall: function(e) {
+    let phone = e.currentTarget.dataset.phone;
+    wx.makePhoneCall({
+      phoneNumber: phone,
+    })
   },
 
   /**
    * 生命周期函数--监听页面加载
    */
   onLoad: function(options) {
-
+    const that = this;
+    that.getUnInInfo();
   },
 
   /**

+ 5 - 5
dorm-manager-wx/pages/teacher/warning/warning.wxml

@@ -2,24 +2,24 @@
 <view class="mycontainer" style="padding:0rpx;">
   <view class="tab-item">
     <view class="item {{tab==1?'item-checked':''}}" bindtap="checkTab" data-type="1">一日未归</view>
-    <view class="item {{tab==2?'item-checked':''}}" bindtap="checkTab" data-type="2">三日未归</view>
-    <view class="item {{tab==3?'item-checked':''}}" bindtap="checkTab" data-type="3">五日未归</view>
+    <view class="item {{tab==3?'item-checked':''}}" bindtap="checkTab" data-type="3">三日未归</view>
+    <view class="item {{tab==5?'item-checked':''}}" bindtap="checkTab" data-type="5">五日未归</view>
   </view>
   <scroll-view scroll-y='true'>
     <block wx:for='{{list}}'>
       <view class="list-item">
         <image src="{{item.img}}" class="head-img"></image>
         <view class="my-column my-flex-sb" style="height:170rpx;">
-          <view class="name">{{item.name}}</view>
+          <view class="name">{{item.userName}}</view>
           <view class="address">
             <image src="/images/dizhi.png" class="address-img"></image>
-            <view class="create-time">{{item.address}}</view>
+            <view class="create-time">{{item.storeyTitle+item.roomTitle}}</view>
           </view>
           <view class="my-row my-flex-sb">
             <view class="img-btn" hover-class="myhover" hover-start-time="50" hover-stay-time="50">
               <image src="/images/icon-message.png" class="btn-img"></image>
             </view>
-            <view class="img-btn" hover-class="myhover" hover-start-time="50" hover-stay-time="50">
+            <view class="img-btn" hover-class="myhover" hover-start-time="50" hover-stay-time="50" bindtap="makePhoneCall" data-phone="{{item.loginId}}">
               <image src="/images/icon-phone.png" class="btn-img" style="margin-left:30rpx;"></image>
             </view>
           </view>

+ 9 - 2
dorm-manager-wx/utils/api.js

@@ -92,9 +92,16 @@ const index = 0,
     selfInfo: 'access/selfInfo.if', //访客统计
 
     //宿管系统--教师端
-    getCollegeInfo: 'deptInfo/getDeptInfolevel', //获取学院信息
+    getDeptInfo: 'deptInfo/getDeptInfolevel.if', //获取学院信息
     getRegisterInfo: 'dormManage/registerInfo.if', //获取注册和未注册的用户信息
-    getVisitorCheckInfo: 'visitor/visitorInfo.if' //获取审批中和已审批的访客信息
+    getVisitorCheckInfo: 'visitor/visitorInfo.if', //获取审批中和已审批的访客信息
+    getDeviceInfo: 'access/selectDevices.if', //获取所有设备信息
+    getPassInfo: '/access/getAccess.if', //通行记录
+    getStatisticsInfo: '/access/statistics.if', //考勤统计
+    getOutAndInInfo: '/access/outAndIn.if', //已出已归记录
+    getVisitorInfo: '/visitor/searchInviteVisitor.if', //查询访客详情
+    getVisitorCheck: '/visitor/approvalAlumniVisitor.if', //访客信息审批
+    getUnInfo: '/access/unIn.if' //未归记录
   },
   [root] = [
     ["http://10.32.2.209:7088/oneportal/"],

+ 1 - 1
dorm-manager-wx/utils/util.js

@@ -127,7 +127,7 @@ function httpRequest(url, data = {}, method = "GET") {
       },
       success: function(res) {
         console.log(res);
-        if (res.data.errmsg == "success" || res.data.errmsg == '成功') {
+        if (res.data.errmsg == "success" || res.data.errmsg == '成功' || res.data.errmsg == null) {
           resolve(res);
         } else {
           console.log('请求失败');