/*文件大小转换*/
gg.core.getFileSize = function (appByts) {
var mb = 1024 * 1024;
if (appByts > mb) {
var bb = appByts / (1024 * 1024);
bb = bb.toFixed(2);
return bb + "M";
}
var bk = appByts / 1024;
bk = bk.toFixed(1);
return bk + "K";
}
gg.core.formatVersion = function (value) {
var ver = value.toString();
if (ver.length > 10)
ver = ver.substr(0, 10);
for (var i = ver.length; i <= 9; i++)
ver = "0" + ver;
var data = [
parseInt(ver.substr(0, 2)).toString(),
parseInt(ver.substr(2, 2)).toString(),
parseInt(ver.substr(4, 2)).toString(),
ver.substr(6, 4)
];
return data.join(".");
};
转载于:https://www.cnblogs.com/tutao1995/p/9777291.html