1234567891011121314151617181920212223242526272829303132333435363738394041 |
- // 获取文件类型
- var type = function (e) {
- if (e) {
- var array = e.split(".")
- return array[array.length - 1]
- }
- }
- // 获取文件大小
- var size = function (e) {
- if (e) {
- var kb = (e / 1024).toFixed(2)
- kb = Number(kb)
- if (kb > 1024) {
- var mb = kb / 1024
- return mb.toFixed(2) + M
- } else {
- return kb + 'Kb'
- }
- }
- }
- // 获取文件上传时间
- var icon = function (e) {
- if (e) {
- var array = e.split(".")
- if (array[array.length - 1] == 'doc' || array[array.length - 1] == 'docx') {
- return '../../../../icon/zzdy/word.png'
- } else if (array[array.length - 1] == 'pdf') {
- return '../../../../icon/zzdy/pdf.png'
- } else if (array[array.length - 1] == 'xls' || array[array.length - 1] == 'xlsx') {
- return '../../../../icon/zzdy/xls.png'
- } else {
- return '../../../../icon/zzdy/jpg.png'
- }
- }
- }
- module.exports = {
- type: type,
- size: size,
- icon: icon
- }
|