소스 검색

增加小程序配置

HW 3 년 전
부모
커밋
373fb6e258

+ 18 - 2
src/app.jsx

@@ -7,7 +7,7 @@ import './app.less'
 import 'taro-skeleton/dist/index.css'
 import Taro from "@tarojs/taro";
 
-import { AtDrawer  } from 'taro-ui'
+import {getWxConfig} from './utils/servers/servers';
 
 import 'taro-ui/dist/style/components/drawer.scss';
 import 'taro-ui/dist/style/components/list.scss';
@@ -28,12 +28,28 @@ class App extends Component {
     if(token){
       this.getStorageSync();
     }
+    this.getWxConfig();
   }
 
   componentDidHide(){
     Taro.closeSocket();
   }
 
+  getWxConfig(){
+    getWxConfig({}).then(v=>{
+      if(v.error.length === 0){
+        Taro.setStorageSync("wxConfig", v.data || {});
+      }else{
+        Taro.showToast({
+          title:v.error[0].message,
+          icon:'none'
+        })
+      }
+    }).catch((error)=>{
+      console.log(error)
+    })
+  }
+
   getStorageSync(){
     let token = Taro.getStorageSync('token');
     //建立连接
@@ -41,7 +57,7 @@ class App extends Component {
       header:{
         'token': token,
       },
-      url: "wss://uat.jishutao.com/webSocketServer",
+      url: "wss://bm.jishutao.com/webSocketServer",
       //  172.16.0.188:8080
       //  uat.jishutao.com
     })

BIN
src/image/bg.jpg


+ 5 - 4
src/pages/applyDepart/publicContent.jsx

@@ -7,8 +7,6 @@ import DateTimePicker from '../../components/common/DateTimePicker';
 
 import ImagePicker from '../../components/common/imagePicker'
 
-import {radiusRange} from '../../utils/config';
-
 import {AtButton, AtTextarea, AtIcon, AtCalendar} from 'taro-ui'
 import {addPublicRelease,getWorkingHoursList} from '../../utils/servers/servers';
 
@@ -25,6 +23,8 @@ import 'taro-ui/dist/style/components/calendar.scss';
 import './publicContent.less';
 import InquiryModal from "../../components/common/inquiryModal";
 
+const wxConfig = Taro.getStorageSync('wxConfig');
+
 class PublicContent extends Component{
   constructor(props) {
     super(props);
@@ -199,8 +199,9 @@ class PublicContent extends Component{
                 })
               }
             }} value={this.state.workType} rangeKey='name' range={this.state.workTypeList}>
-              <view >
+              <view style={{display:'flex',alignItems:'center'}}>
                 {this.state.workTypeList[this.state.workType] ? this.state.workTypeList[this.state.workType].name : ''}
+                <AtIcon value='chevron-right' size='20' color='#bbbbbb'/>
               </view>
             </picker>
           </View>
@@ -363,7 +364,7 @@ class PublicContent extends Component{
               <AtIcon value='chevron-right' size='30' color='#bbbbbb'/>
           </View>
         </View>
-        <View className='tips'>以地图中红标为中心{radiusRange}米范围为可打卡区域,移动红标只需要拖动地图即可</View>
+        <View className='tips'>以地图中红标为中心{wxConfig.clockInRange}米范围为可打卡区域,移动红标只需要拖动地图即可</View>
         <View className='formItem' style={{display:'block',paddingTop:'15px'}}>
           <View className='formName'>公出事由:</View>
           <View className='formValue' style={{paddingTop:'10px',textAlign:'left'}}>

+ 3 - 0
src/pages/egressDetails/index.jsx

@@ -111,11 +111,13 @@ class EgressDetails extends Component{
       Taro.showToast({title:'请填写审批意见',icon:'none'})
       return;
     }
+    Taro.showLoading({title:'加载中...'})
     examinePublicRelease({
       status,
       remarks:this.state.opinion,
       id:this.state.dtails.id
     }).then(v=>{
+      Taro.hideLoading();
       if(v.error.length === 0){
         Taro.showToast({title:status===0?'驳回成功':'通过成功',icon:'none'});
         this.state.dtails.status=status;
@@ -132,6 +134,7 @@ class EgressDetails extends Component{
         Taro.showToast({title:v.error[0].message,icon:'none'})
       }
     }).catch(()=>{
+      Taro.hideLoading();
       Taro.showToast({title:'系统错误,请稍后再试',icon:'none'})
     })
   }

+ 6 - 3
src/pages/egressDetails/publicContent.jsx

@@ -6,7 +6,7 @@ import './index.less';
 import DateTimePicker from '../../components/common/DateTimePicker';
 
 import ImagePicker from '../../components/common/imagePicker'
-import {resourceAddress,radiusRange} from '../../utils/config';
+import {resourceAddress} from '../../utils/config';
 
 import { AtButton,AtTextarea ,AtIcon,AtCalendar   } from 'taro-ui'
 import {updatePublicRelease,getWorkingHoursList} from '../../utils/servers/servers';
@@ -24,6 +24,8 @@ import 'taro-ui/dist/style/components/calendar.scss';
 import './publicContent.less';
 import InquiryModal from "../../components/common/inquiryModal";
 
+const wxConfig = Taro.getStorageSync('wxConfig');
+
 class PublicContent extends Component{
   constructor(props) {
     super(props);
@@ -229,8 +231,9 @@ class PublicContent extends Component{
                 })
               }
             }} value={this.state.workType} rangeKey='name' range={this.state.workTypeList}>
-              <view >
+              <view style={{display:'flex',alignItems:'center'}}>
                 {this.state.workTypeList[this.state.workType] ? this.state.workTypeList[this.state.workType].name : ''}
+                <AtIcon value='chevron-right' size='20' color='#bbbbbb'/>
               </view>
             </picker>
           </View>
@@ -395,7 +398,7 @@ class PublicContent extends Component{
               <AtIcon value='chevron-right' size='30' color='#bbbbbb'/>
           </View>
         </View>
-        <View className='tips'>以地图中红标为中心{radiusRange}米范围为可打卡区域,移动红标只需要拖动地图即可</View>
+        <View className='tips'>以地图中红标为中心{wxConfig.clockInRange}米范围为可打卡区域,移动红标只需要拖动地图即可</View>
         <View className='formItem' style={{display:'block',paddingTop:'15px'}}>
           <View className='formName'>公出事由:</View>
           <View className='formValue' style={{paddingTop:'10px',textAlign:'left'}}>

+ 4 - 1
src/pages/login/index.jsx

@@ -246,7 +246,10 @@ class Login extends Component {
           color='#FFF'
           onHome={()=>{}}
         />
-        <View className='welcome'>
+        <View className='welcome' style={{
+          background: 'url(../../image/bg.jpg) no-repeat',
+          backgroundSize: 'cover',
+        }}>
           <View className='welcomeTitle'>科德科技服务系统</View>
           <View className='welcomeTitle'>欢迎您!</View>
         </View>

+ 0 - 2
src/pages/login/index.less

@@ -8,8 +8,6 @@
     z-index: -1;
     top:0;
     width: 100%;
-    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;

+ 5 - 5
src/pages/punchClock/punchClocks.jsx

@@ -5,7 +5,6 @@ import Taro from '@tarojs/taro';
 import {AtIcon, AtModal} from "taro-ui";
 import dayjs from 'dayjs';
 import Skeleton from 'taro-skeleton'
-import {radiusRange} from '../../utils/config';
 
 import HistoricalClock from '../../components/historicalClock';
 
@@ -28,6 +27,7 @@ import {getClockState} from "../../utils/tools";
 
 const QQMapWX = require('../../components/common/mapSDK/qqmap-wx-jssdk.min.js');
 
+const wxConfig = Taro.getStorageSync('wxConfig');
 
 @connect(({ counter }) => ({
   counter
@@ -187,7 +187,7 @@ class PunchClocks extends Component {
       Taro.showToast({title:'当前时间不在打卡时间范围内,无法打卡',icon:'none'})
       return ;
     }
-    if(!(this.state.distance <=radiusRange && this.state.distance >= 0)){
+    if(!(this.state.distance <=wxConfig.clockInRange && this.state.distance >= 0)){
       Taro.hideLoading()
       Taro.showToast({title:'当前位置未处于可打卡范围,无法打卡',icon:'none'})
       return ;
@@ -502,13 +502,13 @@ class PunchClocks extends Component {
                 }} style={{
                   boxShadow:
                     (!isNaN(parseInt(this.state.distance)))
-                    && this.state.distance <=radiusRange && this.state.distance >= 0 &&
+                    && this.state.distance <=wxConfig.clockInRange && this.state.distance >= 0 &&
                     !(dayjs().isBefore(this.state.dtails.releaseStarts) || dayjs().isAfter(this.state.dtails.releaseEnds)) &&
                     dtails.status !== 3
                       ? (dtails.clockIn === 1 ? '1px 1px 15px 1px #3f82e8' : '1px 1px 15px 1px #659268') : '1px 1px 15px 1px #acb8ad',
                   background: (!isNaN(parseInt(this.state.distance)))
                   &&
-                  this.state.distance <=radiusRange &&
+                  this.state.distance <=wxConfig.clockInRange &&
                   this.state.distance >= 0 &&
                   !(dayjs().isBefore(this.state.dtails.releaseStarts) || dayjs().isAfter(this.state.dtails.releaseEnds))&&
                   dtails.status !== 3
@@ -547,7 +547,7 @@ class PunchClocks extends Component {
                         longitude: this.state.addressLongitude,
                         color: '#c92ddc82',
                         fillColor: '#c92ddc82',
-                        radius: radiusRange,
+                        radius: wxConfig.clockInRange,
                         strokeWidth: 1
                       }
                     ]}

+ 1 - 2
src/utils/config.js

@@ -1,4 +1,3 @@
 // export const resourceAddress = 'http://172.16.0.188:3000/upload'
-export const resourceAddress = 'https://static.jishutao.com/upload'
-export const radiusRange = 1000                        //打卡半径 单位米
+export const resourceAddress = 'https://s.jishutao.com/upload'
 

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

@@ -88,6 +88,11 @@ export const getWorkingHoursList = (postData = {}) => {
   return HTTPREQUEST.get('/api/admin/department/workingHours/list', postData)
 }
 
+//获取微信参数
+export const getWxConfig = (postData = {}) => {
+  return HTTPREQUEST.get('/open/getWxConfig', postData)
+}
+
 //测试
 export const test = (postData = {}) => {
   return HTTPREQUEST.get('/open/getVCode', postData)