|
|
|
@ -2,9 +2,11 @@ |
|
|
|
|
// #ifdef APP-PLUS || MP
|
|
|
|
|
// const baseUrl = "http://116.62.210.143:9002";
|
|
|
|
|
const baseUrl = "http://118.89.79.160:8800/HiatmpPro"; |
|
|
|
|
const chatUrl = "http://118.89.79.160:8800/HiatmpPro"; |
|
|
|
|
// #endif
|
|
|
|
|
// #ifdef H5
|
|
|
|
|
const baseUrl = "/HiatmpPro"; |
|
|
|
|
const chatUrl = "/hitapChat"; |
|
|
|
|
// #endif
|
|
|
|
|
|
|
|
|
|
// 图片路径的公用部分
|
|
|
|
@ -34,15 +36,15 @@ module.exports = { |
|
|
|
|
// 视频name值
|
|
|
|
|
fileVideoKey, |
|
|
|
|
baseUrl, |
|
|
|
|
|
|
|
|
|
chatUrl, |
|
|
|
|
// ----------------------校验----------------------
|
|
|
|
|
// 处理时间两位数
|
|
|
|
|
timeDealTwo(value){ |
|
|
|
|
timeDealTwo(value) { |
|
|
|
|
let val = Number(value) |
|
|
|
|
return val < 10 ? '0' + val : val |
|
|
|
|
}, |
|
|
|
|
// 判断两个对象是否相同
|
|
|
|
|
isObjEqual (o1, o2) { |
|
|
|
|
isObjEqual(o1, o2) { |
|
|
|
|
var props1 = Object.getOwnPropertyNames(o1) |
|
|
|
|
var props2 = Object.getOwnPropertyNames(o2) |
|
|
|
|
if (props1.indexOf('__ob__') !== -1) { |
|
|
|
@ -66,20 +68,20 @@ module.exports = { |
|
|
|
|
} |
|
|
|
|
return a && b |
|
|
|
|
}, |
|
|
|
|
checkHasKey(key,str){ |
|
|
|
|
if(str.indexOf(key) != -1){ |
|
|
|
|
checkHasKey(key, str) { |
|
|
|
|
if (str.indexOf(key) != -1) { |
|
|
|
|
return true |
|
|
|
|
} |
|
|
|
|
return false |
|
|
|
|
}, |
|
|
|
|
// 非空验证(包含数字)
|
|
|
|
|
isEmpty(value,isnumber = false){ |
|
|
|
|
if(isnumber){ |
|
|
|
|
if(value <= 0){ |
|
|
|
|
isEmpty(value, isnumber = false) { |
|
|
|
|
if (isnumber) { |
|
|
|
|
if (value <= 0) { |
|
|
|
|
return false |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
if(value == '' || value == null || typeof(value) == 'undefined'){ |
|
|
|
|
if (value == '' || value == null || typeof(value) == 'undefined') { |
|
|
|
|
return false |
|
|
|
|
} |
|
|
|
|
return true |
|
|
|
@ -182,14 +184,14 @@ module.exports = { |
|
|
|
|
}; |
|
|
|
|
}, |
|
|
|
|
// 处理时间
|
|
|
|
|
dealTimeLength(value){ |
|
|
|
|
dealTimeLength(value) { |
|
|
|
|
let num = Number(value) |
|
|
|
|
let str = num < 10 ? '0' + num : num |
|
|
|
|
// let str = value.toString()
|
|
|
|
|
return str |
|
|
|
|
}, |
|
|
|
|
// 是否是正整数
|
|
|
|
|
isNum(num){ |
|
|
|
|
isNum(num) { |
|
|
|
|
if (!(/(^[1-9]\d*$)/.test(num))) { |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
@ -198,7 +200,7 @@ module.exports = { |
|
|
|
|
// 是否有小数点
|
|
|
|
|
isDot(num) { |
|
|
|
|
var result = (num.toString()).indexOf("."); |
|
|
|
|
if(result != -1) { |
|
|
|
|
if (result != -1) { |
|
|
|
|
return false |
|
|
|
|
alert("含有小数点"); |
|
|
|
|
} |
|
|
|
@ -206,25 +208,25 @@ module.exports = { |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
// ----------------------原生----------------------
|
|
|
|
|
setNavName(value){ |
|
|
|
|
setNavName(value) { |
|
|
|
|
uni.setNavigationBarTitle({ |
|
|
|
|
title:value |
|
|
|
|
title: value |
|
|
|
|
}) |
|
|
|
|
}, |
|
|
|
|
// 查看文件
|
|
|
|
|
checkFile(url){ |
|
|
|
|
checkFile(url) { |
|
|
|
|
uni.showLoading({ |
|
|
|
|
mask: true, |
|
|
|
|
}); |
|
|
|
|
uni.downloadFile({ |
|
|
|
|
url: url, //仅为示例,并非真实的资源
|
|
|
|
|
success: function(res){ |
|
|
|
|
success: function(res) { |
|
|
|
|
if (res.statusCode === 200) { |
|
|
|
|
uni.hideLoading(); |
|
|
|
|
var filePath = res.tempFilePath; |
|
|
|
|
uni.openDocument({ |
|
|
|
|
filePath: filePath, |
|
|
|
|
success: function (res) { |
|
|
|
|
success: function(res) { |
|
|
|
|
console.log("打开文档成功"); |
|
|
|
|
}, |
|
|
|
|
}); |
|
|
|
@ -233,10 +235,10 @@ module.exports = { |
|
|
|
|
}); |
|
|
|
|
}, |
|
|
|
|
// 扫一扫
|
|
|
|
|
scanCode(callback){ |
|
|
|
|
scanCode(callback) { |
|
|
|
|
uni.scanCode({ |
|
|
|
|
scanType: ['barCode','qrCode'], |
|
|
|
|
success (res) { |
|
|
|
|
scanType: ['barCode', 'qrCode'], |
|
|
|
|
success(res) { |
|
|
|
|
callback(res) |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
@ -344,7 +346,7 @@ module.exports = { |
|
|
|
|
uni.switchTab({ |
|
|
|
|
url: '/pages/index/index' |
|
|
|
|
}) |
|
|
|
|
}else{ |
|
|
|
|
} else { |
|
|
|
|
this.$router.go(-1) |
|
|
|
|
} |
|
|
|
|
return; |
|
|
|
@ -390,10 +392,10 @@ module.exports = { |
|
|
|
|
uni.clearStorage(); |
|
|
|
|
}, |
|
|
|
|
// 设置底部导航
|
|
|
|
|
setBar(index,text){ |
|
|
|
|
setBar(index, text) { |
|
|
|
|
uni.setTabBarItem({ |
|
|
|
|
index:index, |
|
|
|
|
text:text |
|
|
|
|
index: index, |
|
|
|
|
text: text |
|
|
|
|
}) |
|
|
|
|
}, |
|
|
|
|
// 打开地图选择地址
|
|
|
|
@ -421,7 +423,7 @@ module.exports = { |
|
|
|
|
}) |
|
|
|
|
}, |
|
|
|
|
// 复制
|
|
|
|
|
copy(text,toasttext = '复制成功') { |
|
|
|
|
copy(text, toasttext = '复制成功') { |
|
|
|
|
// #ifdef APP-PLUS
|
|
|
|
|
uni.setClipboardData({ |
|
|
|
|
data: text, |
|
|
|
@ -463,47 +465,83 @@ module.exports = { |
|
|
|
|
|
|
|
|
|
// ----------------------自封方法----------------------
|
|
|
|
|
// 获取分发类型
|
|
|
|
|
getTypeFenFa(){ |
|
|
|
|
return [ |
|
|
|
|
{type:1,label:'代表发文'}, |
|
|
|
|
{type:2,label:'收文'}, |
|
|
|
|
{type:3,label:'呈报事项'}, |
|
|
|
|
{type:4,label:'纪检发文'}, |
|
|
|
|
{type:5,label:'会议通知'}, |
|
|
|
|
{type:6,label:'重大事项通知'}, |
|
|
|
|
{type:7,label:'议案分发提议人'}, |
|
|
|
|
{type:8,label:'公文流转'}, |
|
|
|
|
getTypeFenFa() { |
|
|
|
|
return [{ |
|
|
|
|
type: 1, |
|
|
|
|
label: '代表发文' |
|
|
|
|
}, |
|
|
|
|
{ |
|
|
|
|
type: 2, |
|
|
|
|
label: '收文' |
|
|
|
|
}, |
|
|
|
|
{ |
|
|
|
|
type: 3, |
|
|
|
|
label: '呈报事项' |
|
|
|
|
}, |
|
|
|
|
{ |
|
|
|
|
type: 4, |
|
|
|
|
label: '纪检发文' |
|
|
|
|
}, |
|
|
|
|
{ |
|
|
|
|
type: 5, |
|
|
|
|
label: '会议通知' |
|
|
|
|
}, |
|
|
|
|
{ |
|
|
|
|
type: 6, |
|
|
|
|
label: '重大事项通知' |
|
|
|
|
}, |
|
|
|
|
{ |
|
|
|
|
type: 7, |
|
|
|
|
label: '议案分发提议人' |
|
|
|
|
}, |
|
|
|
|
{ |
|
|
|
|
type: 8, |
|
|
|
|
label: '公文流转' |
|
|
|
|
}, |
|
|
|
|
] |
|
|
|
|
}, |
|
|
|
|
// 获取员工类型
|
|
|
|
|
getPersonType(){ |
|
|
|
|
return [ |
|
|
|
|
{type:1,label:'集团领导'}, |
|
|
|
|
{type:2,label:'中层领导'}, |
|
|
|
|
{type:3,label:'普通员工'}, |
|
|
|
|
getPersonType() { |
|
|
|
|
return [{ |
|
|
|
|
type: 1, |
|
|
|
|
label: '集团领导' |
|
|
|
|
}, |
|
|
|
|
{ |
|
|
|
|
type: 2, |
|
|
|
|
label: '中层领导' |
|
|
|
|
}, |
|
|
|
|
{ |
|
|
|
|
type: 3, |
|
|
|
|
label: '普通员工' |
|
|
|
|
}, |
|
|
|
|
] |
|
|
|
|
}, |
|
|
|
|
// 获取书记类型
|
|
|
|
|
getTypeSJ(){ |
|
|
|
|
return [ |
|
|
|
|
{type:1,label:'党委书记'}, |
|
|
|
|
{type:2,label:'党委副书记'} |
|
|
|
|
getTypeSJ() { |
|
|
|
|
return [{ |
|
|
|
|
type: 1, |
|
|
|
|
label: '党委书记' |
|
|
|
|
}, |
|
|
|
|
{ |
|
|
|
|
type: 2, |
|
|
|
|
label: '党委副书记' |
|
|
|
|
} |
|
|
|
|
] |
|
|
|
|
}, |
|
|
|
|
// 获取当前时间-年月日
|
|
|
|
|
getNowTimeYMD(){ |
|
|
|
|
getNowTimeYMD() { |
|
|
|
|
let date = new Date(), |
|
|
|
|
year = date.getFullYear(), |
|
|
|
|
month = (date.getMonth()+1) < 10 ? '0' + (date.getMonth()+1) : date.getMonth()+1, |
|
|
|
|
month = (date.getMonth() + 1) < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1, |
|
|
|
|
day = (date.getDate()) < 10 ? '0' + (date.getDate()) : date.getDate(), |
|
|
|
|
days = year + '-' + month + '-' + day |
|
|
|
|
return days |
|
|
|
|
}, |
|
|
|
|
// 获取当前时间-年月日时分
|
|
|
|
|
getNowTimeYMDHM(){ |
|
|
|
|
getNowTimeYMDHM() { |
|
|
|
|
let date = new Date(), |
|
|
|
|
year = date.getFullYear(), |
|
|
|
|
month = (date.getMonth()+1) < 10 ? '0' + (date.getMonth()+1) : date.getMonth()+1, |
|
|
|
|
month = (date.getMonth() + 1) < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1, |
|
|
|
|
day = (date.getDate()) < 10 ? '0' + (date.getDate()) : date.getDate(), |
|
|
|
|
hour = (date.getHours()) < 10 ? '0' + (date.getHours()) : date.getHours(), |
|
|
|
|
min = (date.getMinutes()) < 10 ? '0' + (date.getMinutes()) : date.getMinutes(), |
|
|
|
@ -511,28 +549,28 @@ module.exports = { |
|
|
|
|
return days |
|
|
|
|
}, |
|
|
|
|
// 两个数组合并并且去重
|
|
|
|
|
mergeArr(arr1,arr2,key){ |
|
|
|
|
mergeArr(arr1, arr2, key) { |
|
|
|
|
let arr = arr1.concat(arr2); //两个数组对象合并
|
|
|
|
|
let newArr = []; //盛放去重后数据的新数组
|
|
|
|
|
for(let a = 0; a < arr.length; a++){ //循环json数组对象的内容
|
|
|
|
|
for (let a = 0; a < arr.length; a++) { //循环json数组对象的内容
|
|
|
|
|
let flag = true; //建立标记,判断数据是否重复,true为不重复
|
|
|
|
|
for(let b = 0; b < newArr.length; b++){ //循环新数组的内容
|
|
|
|
|
if(arr[a][key] == newArr[b][key]){ //让json数组对象的内容与新数组的内容作比较,相同的话,改变标记为false
|
|
|
|
|
for (let b = 0; b < newArr.length; b++) { //循环新数组的内容
|
|
|
|
|
if (arr[a][key] == newArr[b][key]) { //让json数组对象的内容与新数组的内容作比较,相同的话,改变标记为false
|
|
|
|
|
flag = false; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
if(flag){ //判断是否重复
|
|
|
|
|
if (flag) { //判断是否重复
|
|
|
|
|
newArr.push(arr[a]); //不重复的放入新数组。 新数组的内容会继续进行上边的循环。
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
return newArr |
|
|
|
|
}, |
|
|
|
|
// 去掉数组重复数据
|
|
|
|
|
delArrRepeat(arr,key){ |
|
|
|
|
delArrRepeat(arr, key) { |
|
|
|
|
var result = []; |
|
|
|
|
var obj = {}; |
|
|
|
|
for(var i =0; i<arr.length; i++){ |
|
|
|
|
if(!obj[arr[i][key]]){ |
|
|
|
|
for (var i = 0; i < arr.length; i++) { |
|
|
|
|
if (!obj[arr[i][key]]) { |
|
|
|
|
result.push(arr[i]); |
|
|
|
|
obj[arr[i][key]] = true; |
|
|
|
|
} |
|
|
|
@ -540,8 +578,8 @@ module.exports = { |
|
|
|
|
return result |
|
|
|
|
}, |
|
|
|
|
// 检查对象是否有某key
|
|
|
|
|
checkObjHasKey(key,obj){ |
|
|
|
|
if(key in obj){ |
|
|
|
|
checkObjHasKey(key, obj) { |
|
|
|
|
if (key in obj) { |
|
|
|
|
return true |
|
|
|
|
} |
|
|
|
|
return false |
|
|
|
@ -550,7 +588,8 @@ module.exports = { |
|
|
|
|
var userAgentInfo = navigator.userAgent; |
|
|
|
|
var Agents = ["Android", "iPhone", |
|
|
|
|
"SymbianOS", "Windows Phone", |
|
|
|
|
"iPad", "iPod"]; |
|
|
|
|
"iPad", "iPod" |
|
|
|
|
]; |
|
|
|
|
var flag = true; |
|
|
|
|
for (var v = 0; v < Agents.length; v++) { |
|
|
|
|
if (userAgentInfo.indexOf(Agents[v]) > 0) { |
|
|
|
@ -561,65 +600,68 @@ module.exports = { |
|
|
|
|
return flag; |
|
|
|
|
}, |
|
|
|
|
// 获取语言列表
|
|
|
|
|
getLanguage(){ |
|
|
|
|
return [ |
|
|
|
|
{id:'cn',name:'CN',type:1}, |
|
|
|
|
getLanguage() { |
|
|
|
|
return [{ |
|
|
|
|
id: 'cn', |
|
|
|
|
name: 'CN', |
|
|
|
|
type: 1 |
|
|
|
|
}, |
|
|
|
|
// {id:'en',name:'English',type:2}
|
|
|
|
|
] |
|
|
|
|
}, |
|
|
|
|
// 检测url是否有某key,并获取值
|
|
|
|
|
urlIsHaveKey(key){ |
|
|
|
|
urlIsHaveKey(key) { |
|
|
|
|
let urlAll = window.location.href |
|
|
|
|
let urls = urlAll.replace('?','&') |
|
|
|
|
let urls = urlAll.replace('?', '&') |
|
|
|
|
let urlArr = urls.split('&') |
|
|
|
|
// console.log(urlArr)
|
|
|
|
|
for(let a = 0; a < urlArr.length;a++){ |
|
|
|
|
for (let a = 0; a < urlArr.length; a++) { |
|
|
|
|
let urlA = urlArr[a].split('=') |
|
|
|
|
if(urlA[0] == key){ |
|
|
|
|
if (urlA[0] == key) { |
|
|
|
|
return urlA[1] |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
return '' |
|
|
|
|
}, |
|
|
|
|
// 计算精度
|
|
|
|
|
getPoint(num){ |
|
|
|
|
getPoint(num) { |
|
|
|
|
let number = 1 |
|
|
|
|
for(let a = 0; a < num;a++){ |
|
|
|
|
for (let a = 0; a < num; a++) { |
|
|
|
|
number = number + '0' |
|
|
|
|
} |
|
|
|
|
return Number(number) |
|
|
|
|
}, |
|
|
|
|
// 获取合约地址
|
|
|
|
|
getContract(){ |
|
|
|
|
getContract() { |
|
|
|
|
return { |
|
|
|
|
'key':'地址', |
|
|
|
|
'key': '地址', |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
// 获取请求域名
|
|
|
|
|
getBaseUrl(){ |
|
|
|
|
getBaseUrl() { |
|
|
|
|
return baseUrl |
|
|
|
|
}, |
|
|
|
|
// 获取图片域名
|
|
|
|
|
getBasePageUrl(){ |
|
|
|
|
getBasePageUrl() { |
|
|
|
|
return 'https://pool.xinhuoshuju.com' |
|
|
|
|
}, |
|
|
|
|
// 判断对象中是否有某key值,如果有该值,直接返回该对象
|
|
|
|
|
checkObjKeyIsValue(arrs,key,value){ |
|
|
|
|
checkObjKeyIsValue(arrs, key, value) { |
|
|
|
|
let items = '' |
|
|
|
|
arrs.forEach((item,k) => { |
|
|
|
|
if(item[key] == value){ |
|
|
|
|
arrs.forEach((item, k) => { |
|
|
|
|
if (item[key] == value) { |
|
|
|
|
items = item |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
if(items){ |
|
|
|
|
if (items) { |
|
|
|
|
return items |
|
|
|
|
} |
|
|
|
|
return false |
|
|
|
|
}, |
|
|
|
|
// 数字转换小数点任意位
|
|
|
|
|
changeNumberPoint(number,length = 2){ |
|
|
|
|
changeNumberPoint(number, length = 2) { |
|
|
|
|
let nums = '1' |
|
|
|
|
for(let a = 0; a < length; a++){ |
|
|
|
|
for (let a = 0; a < length; a++) { |
|
|
|
|
nums = nums + '0' |
|
|
|
|
} |
|
|
|
|
let num = Number(number) / nums // 金额转换小数点后六位
|
|
|
|
@ -627,14 +669,14 @@ module.exports = { |
|
|
|
|
return result |
|
|
|
|
}, |
|
|
|
|
// 检测密码只能是英文大小写加数字
|
|
|
|
|
checkPswEN(psw){ |
|
|
|
|
checkPswEN(psw) { |
|
|
|
|
let check_big = /[A-Z]/g |
|
|
|
|
// console.log(check_big.test(psw))
|
|
|
|
|
let check_small = /[a-z]/g |
|
|
|
|
// console.log(check_small.test(psw))
|
|
|
|
|
let check_num = /[0-9]/g |
|
|
|
|
// console.log(check_num.test(psw))
|
|
|
|
|
if(check_big.test(psw) && check_small.test(psw) && check_num.test(psw)){ |
|
|
|
|
if (check_big.test(psw) && check_small.test(psw) && check_num.test(psw)) { |
|
|
|
|
return true |
|
|
|
|
} |
|
|
|
|
return false |
|
|
|
@ -657,30 +699,30 @@ module.exports = { |
|
|
|
|
|
|
|
|
|
// ----------------------时间转换----------------------
|
|
|
|
|
// 获取当前时间-精确到时分秒
|
|
|
|
|
time_StampToHMS(){ |
|
|
|
|
time_StampToHMS() { |
|
|
|
|
var now = new Date(); |
|
|
|
|
var hour = now.getHours();//得到小时
|
|
|
|
|
var minu = now.getMinutes();//得到分钟
|
|
|
|
|
var sec = now.getSeconds();//得到秒
|
|
|
|
|
if(hour < 10){ |
|
|
|
|
var hour = now.getHours(); //得到小时
|
|
|
|
|
var minu = now.getMinutes(); //得到分钟
|
|
|
|
|
var sec = now.getSeconds(); //得到秒
|
|
|
|
|
if (hour < 10) { |
|
|
|
|
hour = '0' + hour |
|
|
|
|
} |
|
|
|
|
if(minu < 10){ |
|
|
|
|
if (minu < 10) { |
|
|
|
|
minu = '0' + minu |
|
|
|
|
} |
|
|
|
|
if(sec < 10){ |
|
|
|
|
if (sec < 10) { |
|
|
|
|
sec = '0' + sec |
|
|
|
|
} |
|
|
|
|
return hour + ':' + minu + ':' + sec |
|
|
|
|
}, |
|
|
|
|
// 时分秒转换成秒数
|
|
|
|
|
time_HMSToS(time){ |
|
|
|
|
time_HMSToS(time) { |
|
|
|
|
var s = ''; |
|
|
|
|
var hour = time.split(':')[0]; |
|
|
|
|
var min = time.split(':')[1]; |
|
|
|
|
var sec = time.split(':')[2]; |
|
|
|
|
|
|
|
|
|
s = Number(hour*3600) + Number(min*60) + Number(sec); |
|
|
|
|
s = Number(hour * 3600) + Number(min * 60) + Number(sec); |
|
|
|
|
|
|
|
|
|
return s; |
|
|
|
|
}, |
|
|
|
@ -701,67 +743,68 @@ module.exports = { |
|
|
|
|
}, |
|
|
|
|
// 毫秒转换时分秒
|
|
|
|
|
time_MsecToHMS(value) { |
|
|
|
|
var theTime = parseInt(value);// 秒
|
|
|
|
|
var middle= 0;// 分
|
|
|
|
|
var hour= 0;// 小时
|
|
|
|
|
var theTime = parseInt(value); // 秒
|
|
|
|
|
var middle = 0; // 分
|
|
|
|
|
var hour = 0; // 小时
|
|
|
|
|
|
|
|
|
|
if(theTime > 60) { |
|
|
|
|
middle= parseInt(theTime/60); |
|
|
|
|
theTime = parseInt(theTime%60); |
|
|
|
|
if(middle> 60) { |
|
|
|
|
hour= parseInt(middle/60); |
|
|
|
|
middle= parseInt(middle%60); |
|
|
|
|
if (theTime > 60) { |
|
|
|
|
middle = parseInt(theTime / 60); |
|
|
|
|
theTime = parseInt(theTime % 60); |
|
|
|
|
if (middle > 60) { |
|
|
|
|
hour = parseInt(middle / 60); |
|
|
|
|
middle = parseInt(middle % 60); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
var result = parseInt(theTime); |
|
|
|
|
if(theTime < 10){ |
|
|
|
|
result = "0"+theTime; |
|
|
|
|
if (theTime < 10) { |
|
|
|
|
result = "0" + theTime; |
|
|
|
|
} |
|
|
|
|
if(middle > 0) { |
|
|
|
|
if(middle < 10){ |
|
|
|
|
result = "0"+parseInt(middle)+":"+result; |
|
|
|
|
}else{ |
|
|
|
|
result = parseInt(middle)+":"+result; |
|
|
|
|
if (middle > 0) { |
|
|
|
|
if (middle < 10) { |
|
|
|
|
result = "0" + parseInt(middle) + ":" + result; |
|
|
|
|
} else { |
|
|
|
|
result = parseInt(middle) + ":" + result; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
if(hour> 0) { |
|
|
|
|
if(hour < 10){ |
|
|
|
|
result = "0"+parseInt(hour)+":"+result; |
|
|
|
|
}else{ |
|
|
|
|
result = parseInt(hour)+":"+result; |
|
|
|
|
if (hour > 0) { |
|
|
|
|
if (hour < 10) { |
|
|
|
|
result = "0" + parseInt(hour) + ":" + result; |
|
|
|
|
} else { |
|
|
|
|
result = parseInt(hour) + ":" + result; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
return result; |
|
|
|
|
}, |
|
|
|
|
clearEmpty(value){ |
|
|
|
|
return value.replaceAll(' ','') |
|
|
|
|
clearEmpty(value) { |
|
|
|
|
return value.replaceAll(' ', '') |
|
|
|
|
}, |
|
|
|
|
// 秒转换成天时分秒
|
|
|
|
|
time_MsecToDHMS(time){ |
|
|
|
|
time_MsecToDHMS(time) { |
|
|
|
|
time = (time / 1000).toFixed(0) |
|
|
|
|
var days = parseInt(time / (1000 * 60 * 60 * 24)); |
|
|
|
|
var hours = parseInt((time % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60)); |
|
|
|
|
var minutes = parseInt((time % (1000 * 60 * 60)) / (1000 * 60)); |
|
|
|
|
var seconds = (time % (1000 * 60)) / 1000; |
|
|
|
|
return (days).toFixed(0) + " 天 " + (hours).toFixed(0) + " 小时 " + (minutes).toFixed(0) + " 分钟 " + (seconds).toFixed(0) + " 秒 "; |
|
|
|
|
return (days).toFixed(0) + " 天 " + (hours).toFixed(0) + " 小时 " + (minutes).toFixed(0) + " 分钟 " + (seconds) |
|
|
|
|
.toFixed(0) + " 秒 "; |
|
|
|
|
}, |
|
|
|
|
// 秒数转换成时分秒
|
|
|
|
|
time_SToHMS(s){ |
|
|
|
|
time_SToHMS(s) { |
|
|
|
|
var t |
|
|
|
|
if(s > -1){ |
|
|
|
|
var hour = Math.floor(s/3600) |
|
|
|
|
var min = Math.floor(s/60) % 60 |
|
|
|
|
if (s > -1) { |
|
|
|
|
var hour = Math.floor(s / 3600) |
|
|
|
|
var min = Math.floor(s / 60) % 60 |
|
|
|
|
var sec = s % 60 |
|
|
|
|
if(hour < 10) { |
|
|
|
|
t = '0'+ hour + ":" |
|
|
|
|
if (hour < 10) { |
|
|
|
|
t = '0' + hour + ":" |
|
|
|
|
} else { |
|
|
|
|
t = hour + ":" |
|
|
|
|
} |
|
|
|
|
if(min < 10){ |
|
|
|
|
if (min < 10) { |
|
|
|
|
t += "0" |
|
|
|
|
} |
|
|
|
|
t += min + ":" |
|
|
|
|
if(sec < 10){ |
|
|
|
|
if (sec < 10) { |
|
|
|
|
t += "0" |
|
|
|
|
} |
|
|
|
|
t += sec.toFixed(2) |
|
|
|
|