浏览代码

Merge branch 'dev5.3.2' into dev/new1

luolei 5 年之前
父节点
当前提交
167ad2cf25
共有 3 个文件被更改,包括 7 次插入9 次删除
  1. 1 3
      src/components/MainSuit/index.jsx
  2. 3 3
      src/components/TimeInterval/index.jsx
  3. 3 3
      src/utils/tools.js

+ 1 - 3
src/components/MainSuit/index.jsx

@@ -162,9 +162,7 @@ class MainSuit extends Component{
         return
       }
       ev.target.blur();
-      // ev.target.innerText?(ev.target.innerText = data.substr(0,config.limited)):(ev.target.innerHTML = data.substr(0,config.limited));  //输入法内输入多个字再按enter的情况
-      //console.log(333,data,ev)
-      // ev.target.blur();
+      ev.target.innerText?(ev.target.innerText = data.substr(0,config.limited)):(ev.target.innerHTML = data.substr(0,config.limited));  //输入法内输入多个字再按enter的情况
       this.setState({
         inpText:data.substr(0,config.limited),
         overFlag:true,

+ 3 - 3
src/components/TimeInterval/index.jsx

@@ -64,7 +64,7 @@ class TimeInterval extends React.Component {
       let arr = this.state.endTime.replace(/ |:/g, '-').split('-');
       let dateBegin = (new Date(Date.UTC(tmpTime[0],tmpTime[1],tmpTime[2],tmpTime[3],tmpTime[4]))).getTime();
       let dateEnd = (new Date(Date.UTC(arr[0], arr[1], arr[2], arr[3],arr[4]))).getTime();
-      let dateDes = (dateEnd - dateBegin)/(24 * 3600 * 1000)
+      let dateDes = (dateEnd - dateBegin)/(24 * 3600 * 1000) 
       if(dateEnd - dateBegin < 0){
         Notify.info("终止时间不能早于起始时间");
         return
@@ -81,10 +81,10 @@ class TimeInterval extends React.Component {
     } else if (this.state.flg == 2) {
       let time = getCalendarDate(date);
       let tmpTime = time.replace(/ |:/g, '-').split('-');
-      let arr = this.state.endTime.replace(/ |:/g, '-').split('-');
+      let arr = this.state.startTime.replace(/ |:/g, '-').split('-');
       let dateBegin = (new Date(Date.UTC(arr[0], arr[1], arr[2], arr[3],arr[4]))).getTime();
       let dateEnd = (new Date(Date.UTC(tmpTime[0],tmpTime[1],tmpTime[2],tmpTime[3],tmpTime[4]))).getTime();
-      let dateDes = (dateEnd - dateBegin)/(24 * 3600 * 1000)
+      let dateDes = (dateEnd - dateBegin)/(24 * 3600 * 1000);
       if(dateEnd - dateBegin < 0){
         Notify.info("终止时间不能早于起始时间");
         return

+ 3 - 3
src/utils/tools.js

@@ -818,7 +818,7 @@ function getCurrentDate(flg,con){
     var h = myDate.getHours();
     var m = myDate.getMinutes();
     var s = myDate.getSeconds();
-    date = year+link+(mon<10?"0"+mon:mon)+link+(day<10?"0"+day:day)+' '+(h<10?"0"+h:h)+':'+(m<10?"0"+m:m)+':'+(s<10?"0"+s:s);
+    date = year+link+(mon<10?"0"+mon:mon)+link+(day<10?"0"+day:day)+' '+(h<10&&h!=0?"0"+h:h)+':'+(m<10&&m!=0?"0"+m:m)+':'+(s<10&&s!=0?"0"+s:s);
   }else{
     date = year+link+(mon<10?"0"+mon:mon)+link+(day<10?"0"+day:day);
   }
@@ -930,7 +930,7 @@ function dateParser(timestamp,link = '-'){
   let minute = time.getMinutes();
   let second = time.getSeconds();
   // let result = year+link+month+link+date;
-  let result = year+link+(month<10?"0"+month:month)+link+(date<10?"0"+date:date)+' '+(hour<10?"0"+hour:hour)+':'+(minute<10?"0"+minute:minute)+':'+(second<10?"0"+second:second);
+  let result = year+link+(month<10?"0"+month:month)+link+(date<10?"0"+date:date)+' '+(hour<10&&hour!=0?"0"+hour:hour)+':'+(minute<10&&minute!=0?"0"+minute:minute)+':'+(second<10&&second!=0?"0"+second:second);
   return result;
 }
 
@@ -1178,7 +1178,7 @@ function getIds(data){
  */
 function getCalendarDate(info) {
   let conect = '-';
-  let date = info.year + conect + (info.month < 10 ? '0' + info.month : info.month) + conect + (info.day < 10 ? '0' + info.day : info.day) + ' '+ (info.hour < 10 ? '0' + info.hour : info.hour)+':'+ (info.minute < 10 ? '0' + info.minute : info.minute)+':'+ (info.second < 10 ? '0' + info.second : info.second);
+  let date = info.year + conect + (info.month < 10 ? '0' + info.month : info.month) + conect + (info.day < 10 ? '0' + info.day : info.day) + ' '+ (info.hour < 10&&info.hour != 0 ? '0' + info.hour : info.hour)+':'+ (info.minute < 10&&info.minute != 0 ? '0' + info.minute : info.minute)+':'+ (info.second < 10&&info.second != 0 ? '0' + info.second : info.second);
   return date;
 }