Browse Source

整合学生端和教师端

wangjinbiao 5 years ago
parent
commit
ba26ba59d1

+ 13 - 2
dorm-manager-wx/pages/student/application/application.js

@@ -197,6 +197,8 @@ Page({
     })
   },
   next:function(){
+    debugger
+    console.log(this.data)
     if(!this.data.photo){
       wx.showToast({
         title: '请先上传头像照',
@@ -204,13 +206,20 @@ Page({
       })
       return false
     }else if(this.data.current==1){
-      if (!this.data.name && !this.data.idcard && !this.data.phone && !this.data.text) {
+      if (!this.data.name || !this.data.idcard || !this.data.phone || !this.data.text) {
         wx.showToast({
           title: '资料请填写完整',
           icon: 'none'
         })
         return false
       }
+      if (!(/^[\u4E00-\u9FA5\uf900-\ufa2d·s]{2,20}$/.test(this.data.name))){
+        wx.showToast({
+          title: '名称输入不合法',
+          icon: 'none'
+        })
+        return false
+      }
       if (!(/^[1-9]\d{7}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])\d{3}$|^[1-9]\d{5}[1-9]\d{3}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])\d{3}([0-9]|X)$/.test(this.data.idcard))){
         wx.showToast({
           title: '身份证输入不合法',
@@ -229,8 +238,10 @@ Page({
     this.data.current++
     this.setData({
       current: this.data.current,
-      swipercurrent: this.data.current
+      swipercurrent: this.data.current,
+      isYesno: true
     })
+    
   },
 
   /**

+ 2 - 2
dorm-manager-wx/pages/student/application/application.wxml

@@ -65,7 +65,7 @@
         <view class="textarea">
           <view class="input-name"><text>通</text><text>行</text><text>原</text><text>因</text></view>
           <view>:</view>
-          <textarea bindblur="text" name='text'></textarea>
+          <textarea maxlength="28" placeholder="最多输入28个汉字" bindblur="text" name='text'></textarea>
         </view>
       </view>
     </swiper-item>
@@ -94,7 +94,7 @@
           </view>
           <view class="result-content">
             <view class="result-name">通行原因:</view>
-            <view class="result-data1">{{text?text:'未填'}}</view>
+            <view class="result-data1" style="text-align:left;word-break:break-all;">{{text?text:'未填'}}</view>
           </view>
           
         </view>

+ 1 - 1
dorm-manager-wx/pages/student/application/application.wxss

@@ -194,7 +194,7 @@ textarea{
 
 .result{
   width: 690rpx;
-  height: 620rpx;
+  height: 630rpx;
   background: #fff;
   margin: 0 auto;
   margin-top: 20rpx;

+ 27 - 15
dorm-manager-wx/pages/student/facephoto/facephoto.js

@@ -20,6 +20,7 @@ Page({
         that.setData({
           ditufile: that.data.dtFilePaths
         })
+        that.upload(that.data.dtFilePaths,'false')
       }
     })
   },
@@ -35,14 +36,12 @@ Page({
         that.setData({
           fengmianfile: that.data.fmFilePaths
         })
+        that.upload(that.data.fmFilePaths, 'true')
       }
     })
   },
   submit:function(){
     let that=this
-    wx.showLoading({
-      title: '正在上传',
-    })
     if (!that.data.ditufile&&!that.data.fengmianfile){
       if (!that.data.dtFilePaths) {
         wx.showToast({
@@ -67,7 +66,8 @@ Page({
     that.data.pathscount=0
     if (that.data.dtFilePaths){
       that.data.pathscount++
-    } else if (that.data.fmFilePaths){
+    }
+    if (that.data.fmFilePaths){
       that.data.pathscount++
     }
     if(that.data.dtFilePaths){
@@ -78,6 +78,9 @@ Page({
     }
   },
   upload: function (file, isShowPhoto){
+    wx.showLoading({
+      title: '正在上传',
+    })
     let that=this
     wx.uploadFile({
       url: api.updateUserHeadImage,
@@ -92,17 +95,26 @@ Page({
       success(res) {
         wx.hideLoading()
         if (JSON.parse(res.data).youtuMessage.error_code==0){
-          if (that.data.pathscount==1){
-            wx.redirectTo({
-              url: '/pages/success/index',
-            })
-          }else{
-            if (isShowPhoto=='true'){
-              wx.redirectTo({
-                url: '/pages/success/index',
-              })
-            }
-          }
+          wx.showToast({
+            title: '上传成功',
+            icon:'none'
+          })
+          // if (that.data.pathscount==1){
+          //   wx.redirectTo({
+          //     url: '/pages/success/index',
+          //   })
+          // }else{
+          //   if (isShowPhoto=='true'){
+          //     wx.redirectTo({
+          //       url: '/pages/success/index',
+          //     })
+          //   }
+          // }
+        }else{
+          wx.showToast({
+            title: JSON.parse(res.data).youtuMessage.result.error_msg,
+            icon:'none'
+          })
         }
       }
     })

+ 1 - 1
dorm-manager-wx/pages/student/facephoto/facephoto.wxml

@@ -16,4 +16,4 @@
     </view>
   </view>
 </view>
-<button bindtap="submit">提交</button>
+<!-- <button bindtap="submit">提交</button> -->

+ 1 - 1
dorm-manager-wx/pages/student/pass/pass.wxml

@@ -25,7 +25,7 @@
       <view class="line-top">
         <view class="line-ps" style="background:#3e61fd"></view>
         <view class="line-data">{{item.openTime}}</view>
-        <view class="line-title">{{item.state==1?'出寝':'归寝'}}</view>
+        <view class="line-title">{{item.state==1?'归寝':'出寝'}}</view>
       </view>
       <view class="line-bottom">
         <image src="/images/dizhi.png"></image>

+ 15 - 11
dorm-manager-wx/pages/student/statistics/statistics.js

@@ -48,21 +48,25 @@ Page({
             color: '#333333'
           },
           series: [{
-            name: '成交量1',
+            name: '正常进入',
             data: res.data.data.nomalInTimes,
-            stroke: false
+            stroke: false,
+            color: '#6282f4'
           }, {
-            name: '成交量2',
-              data: res.data.data.nomalOutTimes,
-            stroke: false
+            name: '正常外出',
+            data: res.data.data.nomalOutTimes,
+            stroke: false,
+            color: '#ed5c68'
           }, {
-            name: '成交量3',
+              name: '晚归',
               data: res.data.data.laterTimes,
-            stroke: false
+              stroke: false,
+              color: '#89c997'
           }, {
-            name: '成交量4',
+              name: '未归寝',
               data: res.data.data.UnreturnedTimes,
-            stroke: false
+              stroke: false,
+              color: '#f29b76'
           }],
         });
       }
@@ -112,12 +116,12 @@ Page({
         name: '正常外出',
         data: 0,
         stroke: false,
-          color:'#ed5c68'
+        color:'#ed5c68'
       }, {
         name: '晚归',
         data: 0,
         stroke: false,
-          color:'#89c997'
+        color:'#89c997'
       }, {
         name: '未归寝',
         data: 0,