@@ -54,6 +54,20 @@ module.exports = {
},
/**
+ * 字节转换
+ * @param bytes 字节
+ * @return {string} 大小
+ */
+ bytesToSize(bytes) {
+ if (bytes === 0) return '0 B';
+ let k = 1024;
+ const sizes = ['B','KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'];
+ let i = Math.floor(Math.log(bytes) / Math.log(k));
+ //return (bytes / Math.pow(k, i)) + ' ' + sizes[i];
+ return (bytes / Math.pow(k, i)).toPrecision(3) + ' ' + sizes[i];
+ },
+
+ /**
* 显示排序符号
*
* @param {String} field - 字段名称
@@ -101,8 +101,13 @@ module.exports = appInfo => {
// 上传设置
config.multipart = {
- whitelist: ['.xls', '.xlsx', '.json'],
- fileSize: '10mb',
+ whitelist: ['.json', '.txt',
+ '.xls', '.xlsx',
+ '.doc', '.docx',
+ '.pdf',
+ '.png', '.jpg', '.jpeg', '.gif', '.bmp',
+ '.zip', '.rar', '.7z'],
+ fileSize: '30mb',
};
// 是否压缩替换前端js