排行榜接口对接

This commit is contained in:
zhaofang
2022-11-02 16:00:04 +08:00
parent a25860fb65
commit 4bb3ffc1ed
3 changed files with 254 additions and 86 deletions

View File

@@ -200,3 +200,41 @@ export function userAvatarText(text) {
}
return text;
}
/**截取机构名称路径namePath最后两段不包含第一个 */
export const cutOrgNamePath = (namePath) => {
let newName=namePath;
if(newName){
let names=newName.split('/');
let len=names.length;
//使用最后两们
if(len>1){
//newName=names[len-2]+'/'+names[len-1];
newName=names[1];
}
}
return newName;
};
/**
* 将秒转换成小时
* @author wn
* @date 2022.10.18
* @param {Object} second 秒
* @@return 小时
*/
export function formatSecondToHour(second) {
var n = 1; // 保留小数位
second = Number(second);
var h = second / 3600;
h = h.toFixed(n);
if(isNaN(h)){
h = 0;
}
return h;
}
// 秒换成时分秒
export function getHMS(time) {
const hour = parseInt(time / 3600) < 10 ? '0' + parseInt(time / 3600) : parseInt(time / 3600)
const min = parseInt(time % 3600 / 60) < 10 ? '0' + parseInt(time % 3600 / 60) : parseInt(time % 3600 / 60)
const sec = parseInt(time % 3600 % 60) < 10 ? '0' + parseInt(time % 3600 % 60) : parseInt(time % 3600 % 60)
return hour + ':' + min + ':' + sec
}