mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/vue/learning-system-mobile.git
synced 2025-12-06 09:26:45 +08:00
排行榜接口对接
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user