HW 3 years ago
parent
commit
f5eec111b0

+ 4 - 4
src/app.config.js

@@ -1,10 +1,10 @@
 export default {
   pages: [
+    'pages/egressDetails/index',//公出详情
+    'pages/applyDepart/index',//申请公出
+    'pages/login/index',//登录
     'pages/punchClock/index',//打卡
     'pages/examine/index',//审核
-    'pages/egressDetails/index',//外出详情
-    'pages/applyDepart/index',//申请外出
-    'pages/login/index',//登录
     // 'pages/staffDistribution/index',//员工分布
   ],
   tabBar: {
@@ -25,7 +25,7 @@ export default {
         iconPath: './image/egressUnSelect.png',
         selectedIconPath: './image/egressSelect.png',
         pagePath: 'pages/applyDepart/index',
-        text: '申请出'
+        text: '申请出'
       }],
     'color': '#515151',
     'selectedColor': '#56abe4',

+ 1 - 0
src/app.jsx

@@ -4,6 +4,7 @@ import { Provider } from 'react-redux'
 import configStore from './store'
 
 import './app.less'
+import 'taro-skeleton/dist/index.css'
 
 const store = configStore()
 

+ 3 - 3
src/components/common/DateTimePicker/index.jsx

@@ -1,6 +1,6 @@
 import React,{ Component } from 'react'
 import Taro from '@tarojs/taro';
-import moment from 'moment';
+import dayjs from 'dayjs';
 import { AtIcon } from 'taro-ui';
 import { View, Text, PickerView, PickerViewColumn, } from '@tarojs/components';
 import { getPickerViewList, getDate, getArrWithTime, formatDate, getDayList } from './utils';
@@ -74,11 +74,11 @@ export default class DateTimePicker extends Component {
         const { year, month, day, hour, minute } = this.state;
         const current = formatDate(year, month, day, hour, minute);
 
-        if(moment(moment(current).format('YYYY-MM-DD HH:mm')).isBefore(moment(moment(current).format('YYYY-MM-DD')+' 8:30'))){
+        if(dayjs(dayjs(current).format('YYYY-MM-DD HH:mm')).isBefore(dayjs(dayjs(current).format('YYYY-MM-DD')+' 8:30'))){
           Taro.showToast({title:'不能选择8:30之前的时间',icon:'none'})
           return ;
         }
-        if(moment(moment(current).format('YYYY-MM-DD HH:mm')).isAfter(moment(moment(current).format('YYYY-MM-DD')+' 17:30'))){
+        if(dayjs(dayjs(current).format('YYYY-MM-DD HH:mm')).isAfter(dayjs(dayjs(current).format('YYYY-MM-DD')+' 17:30'))){
           Taro.showToast({title:'不能选择17:30之后的时间',icon:'none'})
           return ;
         }

+ 19 - 6
src/components/common/imagePicker/index.jsx

@@ -1,12 +1,14 @@
 import React,{Component} from "react";
 import Taro from '@tarojs/taro';
 import {Text, View} from "@tarojs/components";
-import {AtImagePicker } from "taro-ui";
+import {AtImagePicker,AtToast } from "taro-ui";
 
 import './index.less';
 
 import 'taro-ui/dist/style/components/image-picker.scss';
 import 'taro-ui/dist/style/components/icon.scss';
+import 'taro-ui/dist/style/components/toast.scss';
+import 'taro-ui/dist/style/components/icon.scss';
 
 import getBaseUrl from "../../../utils/servers/baseUrl";
 
@@ -14,8 +16,9 @@ class ImagePicker extends Component{
   constructor(props) {
     super(props);
     this.state={
-      files:[],
+      files: props.files || [],
       speedProgress:0,
+      loading:false
     }
     this.onImgChange = this.onImgChange.bind(this);
     this.onFail = this.onFail.bind(this);
@@ -35,6 +38,9 @@ class ImagePicker extends Component{
     }else{
       let fileArr = this.state.files.concat([]);
       let arr = type === 'camera' ? files : files.splice(fileArr.length,files.length - fileArr.length)
+      this.setState({
+        loading:true
+      })
       for(let i = 0;i<arr.length;i++){
         const uploadTask = Taro.uploadFile({
           url: BASE_URL + this.props.url, //仅为示例,非真实的接口地址
@@ -56,6 +62,9 @@ class ImagePicker extends Component{
             }else{
               Taro.showToast({title:dataJson.error[0].message,icon:'none'})
               if(dataJson.error[0].field === '403'){
+                _this.setState({
+                  loading:false
+                })
                 Taro.navigateTo({
                   url: '/pages/login/index'
                 })
@@ -73,16 +82,19 @@ class ImagePicker extends Component{
         uploadTask.progress((res) => {
           if(res.progress === 100){
             let num = this.state.speedProgress+1;
-            let speed = num/files.length*100;
+            let speed = num/arr.length*100;
+            console.log(num,arr.length)
+            console.log(num/arr.length)
             this.setState({
-              speedProgress:speed,
+              speedProgress:num,
             },()=>{
               if(speed === 100){
                 setTimeout(()=>{
-                  this.setState({
+                  _this.setState({
                     speedProgress:0,
+                    loading:false
                   })
-                },800)
+                },1200)
               }
             })
           }
@@ -124,6 +136,7 @@ class ImagePicker extends Component{
           onFail={this.onFail}
           onImageClick={this.onImageClick}
         />
+        <AtToast isOpened={this.state.loading} text="图片上传中" status='loading'/>
       </>
     )
   }

+ 3 - 0
src/components/common/listBottomStart/index.jsx

@@ -8,6 +8,9 @@ import './index.less';
 
 import noData from '../../../image/noData.png';
 
+import 'taro-ui/dist/style/components/activity-indicator.scss';
+import 'taro-ui/dist/style/components/loading.scss';
+
 class ListBottomStart extends Component{
   constructor(props) {
     super(props);

BIN
src/image/switch.png


+ 1 - 1
src/pages/applyDepart/index.config.js

@@ -1,3 +1,3 @@
 export default {
-  navigationBarTitleText: '申请出',
+  navigationBarTitleText: '申请出',
 }

+ 38 - 34
src/pages/applyDepart/publicContent.jsx

@@ -1,7 +1,7 @@
 import React,{Component} from 'react';
 import Taro,{getCurrentInstance } from '@tarojs/taro';
 import {Text, View} from '@tarojs/components'
-import moment from 'moment';
+import dayjs from 'dayjs';
 import './index.less';
 import DateTimePicker from '../../components/common/DateTimePicker';
 
@@ -59,15 +59,15 @@ class PublicContent extends Component{
   }
 
   getHours(startTime,endTime){
-    let a1 = moment(startTime);
-    let b1 = moment(endTime);
+    let a1 = dayjs(startTime);
+    let b1 = dayjs(endTime);
     let c1 = b1.diff(a1,'minutes');
     let hourse = parseInt(c1/60);
     let minutes = c1%60
     let minutes1 = parseInt(minutes / 30)*0.5
-    if(a1.isBefore(moment(moment(this.state.rangeStartMinuteVal).format('YYYY-MM-DD')+' 13:30')) && a1.isAfter(moment(moment(this.state.rangeStartMinuteVal).format('YYYY-MM-DD')+' 12:00'))){
-      this.getHours(moment(moment(this.state.rangeStartMinuteVal).format('YYYY-MM-DD')+' 13:30'),endTime);
-    }else if(a1.isBefore(moment(moment(this.state.rangeStartMinuteVal).format('YYYY-MM-DD')+' 13:30'))){
+    if(a1.isBefore(dayjs(dayjs(this.state.rangeStartMinuteVal).format('YYYY-MM-DD')+' 13:30')) && a1.isAfter(dayjs(dayjs(this.state.rangeStartMinuteVal).format('YYYY-MM-DD')+' 12:00'))){
+      this.getHours(dayjs(dayjs(this.state.rangeStartMinuteVal).format('YYYY-MM-DD')+' 13:30'),endTime);
+    }else if(a1.isBefore(dayjs(dayjs(this.state.rangeStartMinuteVal).format('YYYY-MM-DD')+' 13:30'))){
       return hourse+minutes1-1.5
     }else{
       return hourse+minutes1
@@ -75,13 +75,13 @@ class PublicContent extends Component{
   }
 
   getNumHourse(startTime,endTime){
-    if(moment(moment(startTime).format('YYYY-MM-DD')).isSame(moment(moment(endTime).format('YYYY-MM-DD')))){
+    if(dayjs(dayjs(startTime).format('YYYY-MM-DD')).isSame(dayjs(dayjs(endTime).format('YYYY-MM-DD')))){
       this.setState({
         totalDuration:this.getHours(startTime,endTime)
       })
     }else{
-      let a = this.getHours(startTime,moment(startTime.format('YYYY-MM-DD')+' 17:30'));
-      let b = this.getHours(moment(endTime.format('YYYY-MM-DD')+' 8:30'),endTime);
+      let a = this.getHours(startTime,dayjs(startTime.format('YYYY-MM-DD')+' 17:30'));
+      let b = this.getHours(dayjs(endTime.format('YYYY-MM-DD')+' 8:30'),endTime);
       let c = (this.state.validDates.length-2)*7.5;
       this.setState({
         totalDuration:a+b+c
@@ -112,8 +112,12 @@ class PublicContent extends Component{
       return ;
     }
     let annexUrl = '';
-    for(let i of this.state.imgs){
-      annexUrl+=','+i;
+    for(let i in this.state.imgs){
+      if(i === 0){
+        annexUrl+=this.state.imgs[i];
+      }else{
+        annexUrl+=','+this.state.imgs[i];
+      }
     }
     this.setState({
       loading:true
@@ -177,7 +181,7 @@ class PublicContent extends Component{
     return (
       <View className='publicContent'>
           <View className='formItem'>
-            <View className='formName'>出企业:</View>
+            <View className='formName'>出企业:</View>
             <View className='formValue'>{this.props.enterpriseInfor.name}</View>
           </View>
         <View className='formItem'>
@@ -186,26 +190,26 @@ class PublicContent extends Component{
             <DateTimePicker ref={ref=>this.rangeStartRef = ref} onOk={(current)=>{
               let arr = [];
               if(this.state.rangeEndVal){
-                let str = moment(current.current).format('YYYY-MM-DD');
+                let str = dayjs(current.current).format('YYYY-MM-DD');
                 arr.push({value:str});
-                let a = moment(this.state.rangeEndVal.split('-'));
-                let b = moment(str.split('-'));
+                let a = dayjs(this.state.rangeEndVal.split('-'));
+                let b = dayjs(str.split('-'));
                 let num = a.diff(b, 'days');
                 let strAdd = str;
                 for(let i = 0;i<num;i++){
-                  let time = moment(strAdd).add(1, 'days').format('YYYY-MM-DD');
+                  let time = dayjs(strAdd).add(1, 'days').format('YYYY-MM-DD');
                   strAdd = time
                   arr.push({value:time});
                 }
               }
               this.setState({
-                rangeStartVal:moment(current.current).format('YYYY-MM-DD'),
-                rangeStartMinuteVal: moment(current.current).format('YYYY-MM-DD HH:mm:ss'),
+                rangeStartVal:dayjs(current.current).format('YYYY-MM-DD'),
+                rangeStartMinuteVal: dayjs(current.current).format('YYYY-MM-DD HH:mm:ss'),
                 validDates:arr
               },()=>{
                 if(this.state.rangeEndVal){
-                  let a1 = moment(moment(current.current).format('YYYY-MM-DD HH:mm:ss'));
-                  let b1 = moment(moment(this.state.rangeEndMinuteVal).format('YYYY-MM-DD  HH:mm:ss'));
+                  let a1 = dayjs(dayjs(current.current).format('YYYY-MM-DD HH:mm:ss'));
+                  let b1 = dayjs(dayjs(this.state.rangeEndMinuteVal).format('YYYY-MM-DD  HH:mm:ss'));
                   this.getNumHourse(a1,b1)
                 }
               })
@@ -216,7 +220,7 @@ class PublicContent extends Component{
                 validDates:[],
                 totalDuration:0
               })
-            }} initValue={moment().format('YYYY-MM-DD HH:mm:ss')} wrap-class="my-class"  select-item-class="mySelector" />
+            }} initValue={dayjs().format('YYYY-MM-DD HH:mm:ss')} wrap-class="my-class"  select-item-class="mySelector" />
           </View>
         </View>
         <View className='formItem'>
@@ -225,26 +229,26 @@ class PublicContent extends Component{
             <DateTimePicker ref={ref=>this.rangeEndRef = ref} onOk={(current)=>{
               let arr = [];
               if(this.state.rangeStartVal){
-                let str = moment(current.current).format('YYYY-MM-DD');
+                let str = dayjs(current.current).format('YYYY-MM-DD');
                 arr.push({value:this.state.rangeStartVal});
-                let a = moment(this.state.rangeStartVal.split('-'));
-                let b = moment(str.split('-'));
+                let a = dayjs(this.state.rangeStartVal.split('-'));
+                let b = dayjs(str.split('-'));
                 let num = b.diff(a, 'days');
                 let strAdd = this.state.rangeStartVal;
                 for(let i = 0;i<num;i++){
-                  let time = moment(strAdd).add(1, 'days').format('YYYY-MM-DD');
+                  let time = dayjs(strAdd).add(1, 'days').format('YYYY-MM-DD');
                   strAdd = time
                   arr.push({value:time});
                 }
               }
               this.setState({
-                rangeEndVal:moment(current.current).format('YYYY-MM-DD'),
-                rangeEndMinuteVal: moment(current.current).format('YYYY-MM-DD HH:mm:ss'),
+                rangeEndVal:dayjs(current.current).format('YYYY-MM-DD'),
+                rangeEndMinuteVal: dayjs(current.current).format('YYYY-MM-DD HH:mm:ss'),
                 validDates:arr,
               },()=>{
                 if(this.state.rangeStartVal){
-                  let a1 = moment(moment(current.current).format('YYYY-MM-DD HH:mm:ss'));
-                  let b1 = moment(moment(this.state.rangeStartMinuteVal).format('YYYY-MM-DD  HH:mm:ss'));
+                  let a1 = dayjs(dayjs(current.current).format('YYYY-MM-DD HH:mm:ss'));
+                  let b1 = dayjs(dayjs(this.state.rangeStartMinuteVal).format('YYYY-MM-DD  HH:mm:ss'));
                   this.getNumHourse(b1,a1)
                 }
               })
@@ -255,7 +259,7 @@ class PublicContent extends Component{
                 validDates:[],
                 totalDuration:0
               })
-            }} initValue={moment().format('YYYY-MM-DD HH:mm:ss')} wrap-class="my-class"  select-item-class="mySelector" />
+            }} initValue={dayjs().format('YYYY-MM-DD HH:mm:ss')} wrap-class="my-class"  select-item-class="mySelector" />
           </View>
         </View>
         <View className='formItem'>
@@ -272,8 +276,8 @@ class PublicContent extends Component{
             isSwiper={false}
             validDates={this.state.validDates}
             onDayLongClick={(item)=>{
-              if(!(moment(item.value.split('-')).isSame(this.state.rangeStartVal.split('-')) || moment(item.value.split('-')).isSame(this.state.rangeEndVal.split('-')))){
-                if(!(moment(item.value.split('-')).isAfter(this.state.rangeStartVal.split('-')) && moment(item.value.split('-')).isBefore(this.state.rangeEndVal.split('-')))){
+              if(!(dayjs(item.value.split('-')).isSame(this.state.rangeStartVal.split('-')) || dayjs(item.value.split('-')).isSame(this.state.rangeEndVal.split('-')))){
+                if(!(dayjs(item.value.split('-')).isAfter(this.state.rangeStartVal.split('-')) && dayjs(item.value.split('-')).isBefore(this.state.rangeEndVal.split('-')))){
                   return;
                 }
               }else{
@@ -281,7 +285,7 @@ class PublicContent extends Component{
                 return
               }
               let index = this.state.validDates.findIndex(v=>{
-                let lv = moment(v.value.split('-')).isSame(item.value.split('-'));
+                let lv = dayjs(v.value.split('-')).isSame(item.value.split('-'));
                 return lv
               })
               if(index<0){
@@ -336,7 +340,7 @@ class PublicContent extends Component{
           </View>
         </View>
         <View className='operation'>
-          <AtButton type='secondary' circle onClick={()=>{
+          <AtButton disabled={this.state.loading} type='secondary' circle onClick={()=>{
             Taro.eventCenter.trigger('enterpriseBack')
           }}>
             上一步

+ 2 - 2
src/pages/applyDepart/publicContent.less

@@ -3,8 +3,8 @@
   .formItem{
     display: flex;
     align-items: center;
-    font-size: 35px;
-    padding-bottom: 15px;
+    font-size: 30px;
+    padding-bottom: 25px;
     .formName{
       white-space: nowrap;
     }

+ 106 - 28
src/pages/egressDetails/index.jsx

@@ -1,16 +1,22 @@
 import React,{Component} from "react";
-import { View,Image } from '@tarojs/components'
+import { View,Image,Button } from '@tarojs/components'
 import Taro, { getCurrentInstance } from "@tarojs/taro";
 import {AtButton, AtIcon, AtTextarea} from 'taro-ui'
-import {examinePublicRelease} from '../../utils/servers/servers';
+import {examinePublicRelease,getReleasetDails,getListPublicReleaseLog} from '../../utils/servers/servers';
+import {resourceAddress} from '../../utils/config';
+import { AtModal, AtTimeline, AtModalContent, AtModalAction } from "taro-ui"
 import './index.less';
 
 import 'taro-ui/dist/style/components/icon.scss';
 import 'taro-ui/dist/style/components/textarea.scss'
+import 'taro-ui/dist/style/components/modal.scss';
+import 'taro-ui/dist/style/components/timeline.scss';
+import 'taro-ui/dist/style/components/icon.scss';
 
 import Rejected from '../../image/rejected.png';
 import Passed from '../../image/passed.png';
 import Reviewed from '../../image/reviewed.png';
+import ImagePicker from "../../components/common/imagePicker";
 
 class EgressDetails extends Component{
 
@@ -20,26 +26,50 @@ class EgressDetails extends Component{
     super(props);
     this.state={
       dtails:{},
-      remarks:''
+      opinion:'',
+      publicReleaseLog:[]
     }
     this.examinePublicRelease= this.examinePublicRelease.bind(this);
+    this.getReleasetDails= this.getReleasetDails.bind(this);
+    this.getListPublicReleaseLog= this.getListPublicReleaseLog.bind(this);
   }
 
   componentDidShow() {
-    this.setState({
-      dtails:JSON.parse(this.$instance.router.params.dtails),
-      remarks:JSON.parse(this.$instance.router.params.dtails).remarks
+    this.getReleasetDails();
+  }
+
+  getReleasetDails(){
+    getReleasetDails({
+      id:21
+    }).then(v=>{
+      if(v.error.length === 0){
+        let list = [];
+        for(let i of v.data.annexUrl.split(',')){
+          if(i){
+            list.push({'url':resourceAddress + i})
+          }
+        }
+        v.data.annexUrl = list;
+        this.setState({
+          dtails:v.data,
+        })
+      }else{
+        Taro.showToast({title:v.error[0].message,icon:'none'})
+      }
+    }).catch(err=>{
+      Taro.showToast({title:'系统错误,请稍后再试',icon:'none'});
+      console.log(err)
     })
   }
 
   examinePublicRelease(status){
-    if(!this.state.remarks){
+    if(!this.state.opinion){
       Taro.showToast({title:'请填写审批意见',icon:'none'})
       return;
     }
     examinePublicRelease({
       status,
-      remarks:this.state.remarks,
+      remarks:this.state.opinion,
       id:this.state.dtails.id
     }).then(v=>{
       if(v.error.length === 0){
@@ -56,20 +86,43 @@ class EgressDetails extends Component{
     })
   }
 
+  getListPublicReleaseLog(){
+    getListPublicReleaseLog({
+      id:21
+    }).then(v=>{
+      if(v.error.length === 0){
+        let arr = [];
+        for (let i of v.data){
+          arr.push({
+            title:
+              i.status === 0 ? '驳回' :
+                i.status === 1 ? '发起' :
+                  i.status === 2 ? '通过' : '',
+            content: ['审核员:'+i.aname,i.remarks ? '审核意见:'+i.remarks : null],
+            color: i.status === 0 ? '#f31212' :
+                    i.status === 1 ? '#1d4fea' :
+                      i.status === 2 ? '#34de38' : ''
+          })
+        }
+        this.setState({
+          publicReleaseLog:arr,
+          isOpened:true
+        })
+      }else{
+        Taro.showToast({title:v.error[0].message,icon:'none'})
+      }
+    }).catch(err=>{
+      Taro.showToast({title:'系统错误.请稍后重试',icon:'none'})
+      console.log(err)
+    })
+  }
+
   render() {
     const {dtails} = this.state;
-    //aname: "营销员"
-    // createTimes: "2021-06-07 14:40:46"
-    // id: "11"
-    // nickname: "1111111111"
-    // releaseEnds: "2021-06-13 15:40:00"
-    // releaseStarts: "2021-06-07 14:40:00"
-    // status: 1
-    // userName: "肯德基(西客站餐厅)"
     return (
       <View className='egressDetails'>
         <View className='titleContent'>
-          <View className='title'>{dtails.aname}提交的外出申请</View>
+          <View className='title'>{dtails.aname}提交的公出申请</View>
           <View className='address'>
             <AtIcon value='map-pin' size='15' color='#767272'/>
             公出企业:{dtails.nickname}
@@ -77,7 +130,7 @@ class EgressDetails extends Component{
           <View className='state' style={{
             color:dtails.status === 0 ? '#f31212' :
               dtails.status === 1 ? '#1d4fea' :
-                dtails.status === 2 ? '#767272' : ''
+                dtails.status === 2 ? '#34de38' : ''
           }}>
             {
               dtails.status === 0 ? '驳回' :
@@ -92,7 +145,7 @@ class EgressDetails extends Component{
         </View>
         <View className='valueContent'>
           {/*<View className='item'>*/}
-          {/*  <View className='title'>出编号</View>*/}
+          {/*  <View className='title'>出编号</View>*/}
           {/*  <View className='value'>20212584646465495462</View>*/}
           {/*</View>*/}
           {/*<View className='item'>*/}
@@ -108,7 +161,7 @@ class EgressDetails extends Component{
             <View className='value'>{dtails.userName}</View>
             <View className='timeContent'>
               <View className='time'>
-                <View className='num'>外出1.5小时</View>
+                <View className='num'>公出{dtails.duration}小时</View>
                 <View className='journal'>明细</View>
               </View>
               <View className='timeAxis'>
@@ -129,18 +182,28 @@ class EgressDetails extends Component{
             <View className='value'>{dtails.createTimes}</View>
           </View>
           <View className='item'>
-            <View className='title'>外出原因</View>
-            <View className='value'>振权振权振权振权振权振权振权振权振权振权振权振权振权振权振权振权振权振权振权振权振权振权振权振权振权振权振权振权振权振权振权振权振权</View>
+            <View className='title'>公出原因</View>
+            <View className='value'>
+              {dtails.remarks}
+            </View>
+          </View>
+          <View className='item'>
+            <View className='title'>附件</View>
+            <View className='value'>
+              {dtails.annexUrl && dtails.annexUrl.length > 0 ? <ImagePicker
+                files={dtails.annexUrl}
+                showAddBtn={false} /> : null}
+            </View>
           </View>
           {
             this.$instance.router.params.type === '1' ?
               <View className='item'>
                 <View className='title'>填写审批意见</View>
                 <AtTextarea
-                  value={this.state.remarks}
+                  value={this.state.opinion}
                   onChange={(value)=>{
                     this.setState({
-                      remarks:value
+                      opinion:value
                     })
                   }}
                   maxLength={200}
@@ -164,10 +227,25 @@ class EgressDetails extends Component{
               </View> : null
           }
         </View>
-        {/*<View className='valueContent history'>*/}
-        {/*  查看TA的历史记录*/}
-        {/*  <AtIcon value='chevron-right' size='30' color='#767272'/>*/}
-        {/*</View>*/}
+        <View className='valueContent history' onClick={this.getListPublicReleaseLog}>
+          查看TA的历史记录
+          <AtIcon value='chevron-right' size='20' color='#767272'/>
+        </View>
+        <AtModal isOpened={this.state.isOpened}>
+          <AtModalContent>
+            <AtTimeline
+              pending
+              items={this.state.publicReleaseLog}
+            />
+          </AtModalContent>
+          <AtModalAction>
+            <Button onClick={()=>{
+              this.setState({
+                isOpened:false
+              })
+            }}>确定</Button>
+          </AtModalAction>
+        </AtModal>
       </View>
     )
   }

+ 9 - 3
src/pages/egressDetails/index.less

@@ -1,5 +1,5 @@
 .egressDetails{
-  min-height: 100vh;
+  min-height: calc(100vh - 30px);
   background: #F5F5F5;
   padding-bottom: 30px;
   .titleContent{
@@ -32,7 +32,7 @@
     margin: 20px;
     padding: 30px;
     background: white;
-    border-radius: 30px;
+    border-radius: 20px;
     .item{
       padding-bottom: 30px;
       .title{
@@ -100,10 +100,16 @@
     flex-flow: row nowrap;
     justify-content: space-between;
     align-items: center;
-    font-size: 35px;
+    font-size: 30px;
   }
   .operation{
     display: flex;
     flex-flow: row nowrap;
   }
+  .at-image-picker__flex-box{
+    padding-left: 0;
+  }
+  .at-image-picker__remove-btn{
+    display: none;
+  }
 }

+ 0 - 2
src/pages/examine/index.jsx

@@ -4,8 +4,6 @@ import { View } from '@tarojs/components'
 import { getPublicReleaseList } from '../../utils/servers/servers';
 import { AtTabs, AtTabsPane } from 'taro-ui';
 
-import ListBottomStart  from '../../components/common/listBottomStart';
-
 import './index.less';
 
 import 'taro-ui/dist/style/components/tabs.scss';

+ 6 - 3
src/pages/examine/index.less

@@ -1,11 +1,10 @@
 .indexPage{
   position: relative;
   z-index: 1;
-  padding-bottom: 52px;
   background: #F5F5F5;
-  min-height: 100vh;
+  min-height: calc(100vh - 52px);
   .list{
-    padding: 20px 23px 0 23px;
+    padding: 20px 23px 52px 23px;
     .item{
       border-radius: 6px;
       padding: 31px;
@@ -56,4 +55,8 @@
       }
     }
   }
+  .skeleton {
+    border-radius: 11px;
+    margin-bottom: 20px;
+  }
 }

+ 17 - 3
src/pages/examine/myList.jsx

@@ -1,6 +1,7 @@
-import { Component } from 'react';
+import React, { Component } from 'react';
 import Taro from '@tarojs/taro';
 import { View } from '@tarojs/components'
+import Skeleton from 'taro-skeleton'
 
 import ListBottomStart  from '../../components/common/listBottomStart';
 
@@ -17,6 +18,19 @@ class MyList extends Component {
       <View className='indexPage'>
         <View className='list'>
           {
+            this.props.list.length === 0 && this.props.listState === 'LOADING' ?
+              [0,1,2,3].map(v=>(
+                <Skeleton
+                  key={v}
+                  title
+                  row={3}
+                  avatarShape='square'
+                  loading
+                />
+              )):
+              null
+          }
+          {
             this.props.list.map((v,k)=>(
               <View key={k} className='item' onClick={()=>{
                 console.log('/pages/egressDetails/index?type='+this.props.type+'&id='+v.id)
@@ -26,11 +40,11 @@ class MyList extends Component {
               }}>
                 <View className='infor'>
                   <View className='title'>
-                    <View className='aname'>{v.aname}提交的出申请</View>
+                    <View className='aname'>{v.aname}提交的出申请</View>
                     <View className='createTimes'>{v.createTimes}</View>
                   </View>
                   <View className='userName'>
-                    出地点:
+                    出地点:
                     {v.userName}
                   </View>
                   <View className='releaseStarts'>

+ 8 - 2
src/pages/login/index.jsx

@@ -185,7 +185,7 @@ class Login extends Component {
           <View className='loginItem'>
             <AtIcon value='user' size='20' color='#999999'/>
             <Input
-              style={{marginLeft:'15px'}}
+              style={{marginLeft:'15px',width:'100%'}}
               type='text'
               placeholder='请输入您的系统账户'
               value={this.state.username}
@@ -199,7 +199,7 @@ class Login extends Component {
           <View className='loginItem'>
             <AtIcon value='lock' size='20' color='#999999'/>
             <Input
-              style={{marginLeft:'15px'}}
+              style={{marginLeft:'15px',width:'100%'}}
               type='password'
               placeholder='请输入密码'
               value={this.state.password}
@@ -211,6 +211,12 @@ class Login extends Component {
             />
           </View>
           <AtButton type='primary' 	circle loading={this.state.loading} onClick={this.authorization}>登录</AtButton>
+          <View className='tips'>
+            暂无账号?请联系管理员进行添加
+          </View>
+          <View className='company'>
+            湖南科德信息咨询集团有限公司
+          </View>
         </View>
         <AtModal
           isOpened={this.state.isOpened}

+ 22 - 4
src/pages/login/index.less

@@ -8,9 +8,9 @@
     z-index: -1;
     top:0;
     width: 100%;
-    background: url('http://static.jishutao.com/1.1.74/image/bg.jpg');
-    background-size: 100% 100%;
-    padding: 200px 80px 260px 80px;
+    background: url('http://static.jishutao.com/1.1.74/image/bg.jpg') no-repeat;
+    background-size: cover;
+    padding: 200px 80px 300px 80px;
     .welcomeTitle{
       font-size: 60px;
       color: white;
@@ -20,9 +20,10 @@
     }
   }
   .loginContent{
+    position: relative;
     margin: 316px 50px 0 50px;
     background: #ffffff;
-    padding: 100px 30px 337px 30px;
+    padding: 100px 30px 227px 30px;
     border-radius: 30px;
     box-shadow: 0 3px 23px 1px #999999;
     .loginItem{
@@ -33,6 +34,23 @@
       border-bottom: 1px #dac3c3 solid;
       margin-bottom: 100px;
     }
+    .tips{
+      color: #3067d4;
+      padding-top: 20px;
+      font-size: 25px;
+      padding-left: 10px;
+    }
+    .company{
+      position: absolute;
+      bottom: 20px;
+      left: 0;
+      right: 0;
+      text-align: center;
+      color: #aeafb1;
+      padding-top: 20px;
+      font-size: 18px;
+      margin-top: auto;
+    }
   }
   #_n_9{
     position: absolute;

+ 157 - 62
src/pages/punchClock/index.jsx

@@ -1,8 +1,10 @@
 import React, { Component } from 'react'
 import { connect } from 'react-redux'
-import {Map, OpenData, View} from '@tarojs/components'
+import {Map, OpenData, View, Image} from '@tarojs/components'
 import Taro from '@tarojs/taro';
-import moment from 'moment';
+import {AtIcon} from "taro-ui";
+import dayjs from 'dayjs';
+import Skeleton from 'taro-skeleton'
 
 import ImagePicker from '../../components/common/imagePicker';
 
@@ -11,7 +13,8 @@ import { add, minus, asyncAdd } from '../../actions/counter'
 import {getPublicReleaseList,publicReleaseClockIn} from '../../utils/servers/servers';
 
 import './index.less'
-import {AtIcon} from "taro-ui";
+
+import switchIocn from '../../image/switch.png';
 
 import 'taro-ui/dist/style/components/noticebar.scss';
 import 'taro-ui/dist/style/components/icon.scss';
@@ -43,12 +46,14 @@ class PunchClock extends Component {
       addressLatitude:'',
       addressLongitude:'',
       distance:'',
-      dtails:{}
+      dtails:{},
+      loading:true
     }
     this.onChange = this.onChange.bind(this);
     this.getSpacing = this.getSpacing.bind(this);
     this.getPublicReleaseList = this.getPublicReleaseList.bind(this);
     this.publicReleaseClockIn = this.publicReleaseClockIn.bind(this);
+    this.refresh = this.refresh.bind(this);
     this.nowTime = null;
   }
 
@@ -85,40 +90,44 @@ class PunchClock extends Component {
 
     this.nowTime = setInterval(()=>{
       this.setState({
-        nowTime:moment().format('HH:mm:ss')
+        nowTime:dayjs().format('HH:mm:ss')
       })
     },1000)
 
-    // let token = Taro.getStorageSync('token');
-    //   //建立连接
-    //   Taro.connectSocket({
-    //     header:{
-    //       'token': token,
-    //     },
-    //     url: "wss://uat.jishutao.com/websocket",
-    //   //  172.16.0.188:8080
-    //   //  uat.jishutao.com
-    //   })
-    //
-    //   //连接成功
-    //   Taro.onSocketOpen(function() {
-    //     Taro.sendSocketMessage({
-    //       data: 'stock',
-    //     })
-    //   })
-    //
-    //   //接收数据
-    //   Taro.onSocketMessage(function(data) {
-    //     console.log(data,'接收数据')
-    //   })
-    //
-    //   //连接失败
-    //   Taro.onSocketError(function() {
-    //     console.log('websocket连接失败!');
-    //   })
+    let token = Taro.getStorageSync('token');
+      //建立连接
+      Taro.connectSocket({
+        header:{
+          'token': token,
+        },
+        url: "wss://uat.jishutao.com/websocket",
+      //  172.16.0.188:8080
+      //  uat.jishutao.com
+      })
+
+      //连接成功
+      Taro.onSocketOpen(function() {
+        Taro.sendSocketMessage({
+          data: 'stock',
+        })
+      })
+
+      //接收数据
+      Taro.onSocketMessage(function(data) {
+        console.log(data,'接收数据')
+      })
+
+      //连接失败
+      Taro.onSocketError(function() {
+        console.log('websocket连接失败!');
+      })
   }
 
   publicReleaseClockIn(){
+    if(Object.keys(this.state.dtails).length === 0){
+      Taro.showToast({title:'暂无公出申请,无法打卡',icon:'none'})
+      return ;
+    }
     if(isNaN(parseInt(this.state.distance))){
       Taro.showToast({title:'定位错误,请联系管理员',icon:'none'})
       return ;
@@ -149,9 +158,12 @@ class PunchClock extends Component {
   }
 
   getPublicReleaseList(fn){
+    this.setState({
+      loading:true
+    })
     getPublicReleaseList({
       type:0,
-      clockTime:moment().format('YYYY-MM-DD HH:mm:ss')
+      clockTime:dayjs().format('YYYY-MM-DD HH:mm:ss')
     }).then(v=>{
       if(v.error.length === 0){
         if(v.data.list.length === 0){
@@ -161,7 +173,8 @@ class PunchClock extends Component {
             if(value.error.length === 0){
               if(value.data.list.length === 0){
                 this.setState({
-                  dtails: {}
+                  dtails: {},
+                  loading:false
                 })
               }else{
                 this.setState({
@@ -173,12 +186,18 @@ class PunchClock extends Component {
                 })
               }
             }else{
+              this.setState({
+                loading:false
+              })
               Taro.showToast({
                 title:v.error[0].message,
                 icon:'none'
               })
             }
           }).catch(()=>{
+            this.setState({
+              loading:false
+            })
             Taro.showToast({
               title:'系统错误,请稍后再试',
               icon:'none'
@@ -194,12 +213,19 @@ class PunchClock extends Component {
           })
         }
       }else{
+        this.setState({
+          loading:false
+        })
         Taro.showToast({
           title:v.error[0].message,
           icon:'none'
         })
       }
-    }).catch(()=>{
+    }).catch((err)=>{
+      console.log(err)
+      this.setState({
+        loading:false
+      })
       Taro.showToast({
         title:'系统错误,请稍后再试',
         icon:'none'
@@ -223,11 +249,15 @@ class PunchClock extends Component {
       ],
       success: function(res) {//成功后的回调
         _this.setState({
-          distance:res.result.elements[0].distance
+          distance:res.result.elements[0].distance,
+          loading:false
         })
       },
       fail: function(error) {
         console.error(error);
+        _this.setState({
+          loading:false
+        })
       },
       complete: function(res) {
         console.log(res);
@@ -256,38 +286,103 @@ class PunchClock extends Component {
     })
   }
 
+  refresh(){
+    this.getPublicReleaseList(()=>{
+      Taro.startLocationUpdate({
+        success:()=>{
+          Taro.onLocationChange((v)=>{
+            this.getSpacing(v.latitude,v.longitude)
+          })
+        }
+      })
+    });
+  }
+
   render () {
     const {dtails} = this.state;
     return (
-        Object.keys(dtails).length === 0 ?
-          <View>
-            暂无任何公出申请
-          </View>:
-          <View className='punchClock'>
-            <View className='header'>
-              <View className='userAvatarUrl'>
-                <OpenData type='userAvatarUrl'/>
-              </View>
-              <View className='infor'>
-                <View className='name'>
-                  {dtails.aname}
+      <View className='punchClock'>
+          <View className='header'>
+            <Skeleton
+              title
+              avatar
+              row={1}
+              animateName='elastic'
+              avatarShape='square'
+              loading={this.state.loading}
+            >
+              <View className='headerContent'>
+                <View className='userAvatarUrl'>
+                  <OpenData type='userAvatarUrl'/>
                 </View>
-                <View className='address'>
-                  公出企业:{dtails.nickname}
+                <View className='infor'>
+                  <View className='name'>
+                    {
+                      Object.keys(this.state.dtails).length <= 0 ?
+                      Taro.getStorageSync('userInfor').name:
+                      dtails.aname
+                    }
+                  </View>
+                  <View className='address'>
+                    公出企业:
+                    {
+                      Object.keys(this.state.dtails).length <= 0 ?
+                      '无':
+                      dtails.nickname
+                    }
+                  </View>
                 </View>
-              </View>
-              <View className='state' style={{
-                color:dtails.status === 0 ? '#f31212' :
-                  dtails.status === 1 ? '#1d4fea' :
-                    dtails.status === 2 ? '#767272' : ''
-              }}>
                 {
-                  dtails.status === 0 ? '驳回' :
-                    dtails.status === 1 ? '发起' :
-                      dtails.status === 2 ? '通过' : ''
+                  Object.keys(this.state.dtails).length <= 0 ?
+                    <View onClick={this.refresh} className='state' style={{
+                      alignSelf: 'center',
+                      textAlign:'center',
+                      color:'#b6b5b5',
+                      fontSize:'11px'
+                    }}>
+                      <AtIcon value='reload' size='20'/>
+                      <View>刷新</View>
+                    </View> :
+                    <View className='state' style={{
+                      color:dtails.status === 0 ? '#f31212' :
+                        dtails.status === 1 ? '#1d4fea' :
+                          dtails.status === 2 ? '#767272' : ''
+                    }}>
+                      {
+                        dtails.status === 0 ? '驳回' :
+                          dtails.status === 1 ? '发起' :
+                            dtails.status === 2 ? '通过' : ''
+                      }
+                      <Image src={switchIocn} className='switchItem'/>
+                    </View>
                 }
               </View>
-            </View>
+            </Skeleton>
+          </View>
+        {
+          Object.keys(this.state.dtails).length <= 0 ?
+            <View className='content'>
+              <View className='punchClockContent'  onClick={this.publicReleaseClockIn} style={{
+                boxShadow:  '1px 1px 15px 1px #acb8ad',
+                background: '#acb8ad',
+                marginTop: '85px',
+              }}>
+                <View className='punchClockTitle'>公出打卡</View>
+                <View className='punchClockTime'>{this.state.nowTime}</View>
+              </View>
+              <View className='noData'>
+                <View className='tipsNoData'>
+                  暂无公出申请
+                </View>
+                <View className='goOut' onClick={()=>{
+                  Taro.switchTab({
+                    url: '/pages/applyDepart/index',
+                  })
+                }}>
+                  点击前往申请公出
+                </View>
+              </View>
+            </View>:
             <View className='content'>
               <View className='timeContent'>
                 <View className='timeItem'>
@@ -347,8 +442,8 @@ class PunchClock extends Component {
               </View>
               <View className='tips'>紫色区域为可打卡区域</View>
             </View>
-          </View>
-
+        }
+      </View>
     )
   }
 }

+ 32 - 4
src/pages/punchClock/index.less

@@ -1,16 +1,21 @@
 .punchClock{
   position: relative;
   background: #F5F5F5;
-  min-height: 100vh;
+  min-height: calc(100vh - 50px);
   padding: 25px;
   .header{
     background: #FFFFFF;
     padding: 30px;
     border-radius: 30px;
     margin-bottom: 20px;
-    display: flex;
-    flex-flow: row nowrap;
-    align-items: center;
+    .skeleton{
+      padding: 0;
+    }
+    .headerContent{
+      display: flex;
+      flex-flow: row nowrap;
+      align-items: center;
+    }
     .userAvatarUrl{
       width: 100px;
       height: 100px;
@@ -33,6 +38,11 @@
       font-size: 25px;
       align-self: flex-start;
     }
+    .switchItem{
+      width: 30px;
+      height: 30px;
+      margin-top: 20px;
+    }
   }
   .content{
     background: #FFFFFF;
@@ -42,6 +52,24 @@
     display: flex;
     flex-flow: column nowrap;
     align-items: center;
+    .noData{
+      display: flex;
+      flex-flow: column nowrap;
+      align-items: center;
+      justify-content: center;
+      width: 100%;
+      margin-top: -20px;
+      padding-bottom: 225px;
+      .tipsNoData{
+        font-size: 28px;
+        color: #969696;
+        padding-bottom: 20px;
+      }
+      .goOut{
+        font-size: 28px;
+        color: #007aff;
+      }
+    }
     .timeContent{
       width: 100%;
       padding-top: 20px;

+ 3 - 0
src/utils/config.js

@@ -0,0 +1,3 @@
+// export const resourceAddress = 'http://172.16.0.188:3000/upload'
+export const resourceAddress = 'https://static.jishutao.com//upload'
+

+ 10 - 0
src/utils/servers/servers.js

@@ -56,6 +56,16 @@ export const examinePublicRelease = (postData = {}) => {
   return HTTPREQUEST.post('/api/admin/release/examinePublicRelease', postData)
 }
 
+//获取外出公出详情
+export const getReleasetDails = (postData = {}) => {
+  return HTTPREQUEST.get('/api/admin/release/dtails', postData)
+}
+
+//获取公出日志
+export const getListPublicReleaseLog = (postData = {}) => {
+  return HTTPREQUEST.get('/api/admin/release/listPublicReleaseLog', postData)
+}
+
 //测试
 export const test = (postData = {}) => {
   return HTTPREQUEST.get('/open/getVCode', postData)