Skip to content

Commit

Permalink
v6.0 文件大小计算展示优
Browse files Browse the repository at this point in the history
  • Loading branch information
gongfuxiang committed Apr 15, 2024
1 parent 7456129 commit 25dbf84
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions public/static/common/js/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -4678,16 +4678,16 @@ $(function () {
$.each(this.files, function () {
var unit = 'KB';
var size = 0;
if (this.size < 1024) {
var kb = this.size / 1024;
if (kb < 1024) {
unit = 'KB';
size = Math.round((this.size / 1024) * 100) / 100;
} else if (this.size < 1024 * 1024) {
size = Math.round(kb * 100) / 100;
} else if (kb < 1024 * 1024) {
unit = 'MB';
size = Math.round((this.size / (1024 * 1024)) * 100) / 100;
} else if (this.size < 1024 * 1024 * 1024) {
} else if (kb < 1024 * 1024 * 1024) {
unit = 'GB';
size = Math.round((this.size / (1024 * 1024 * 1024)) * 100) / 100;

}
fileNames += '<span class="am-font-weight">' + this.name + '</span> <span class="am-color-999">(' + size + unit + ')</span>';
});
Expand Down

0 comments on commit 25dbf84

Please sign in to comment.