first commit
This commit is contained in:
@@ -0,0 +1,125 @@
|
||||
const uploadFileType = ['jpg', 'png', 'doc', 'docx', 'xls', 'xlsx', 'pdf']
|
||||
const docType = ['doc', 'docx', 'xls', 'xlsx', 'pdf']
|
||||
|
||||
const FILE_UPLOAD_ADDRESS = '/file_server/uploadFile'
|
||||
const FILE_DELETE_ADDRESS = '/file_server/deleteFile'
|
||||
const FILE_STREAM_PREVIEW_ADDRESS = '/file_server/fileStreamPreview'
|
||||
const FILE_STREAM_DOWNLOAD_ADDRESS = '/file_server/download'
|
||||
|
||||
const preview = async (filename, id) => {
|
||||
const suffix = filename.substring(filename.lastIndexOf('.') + 1)
|
||||
if (!docType.includes(suffix.toLowerCase())) {
|
||||
let image = new Image();
|
||||
image.src = FILE_STREAM_PREVIEW_ADDRESS + "?id=" + id
|
||||
let viewer = new Viewer(image);
|
||||
viewer.show();
|
||||
} else {
|
||||
let pdfStreamUrl = encodeURIComponent(FILE_STREAM_PREVIEW_ADDRESS + '?id=' + id) //将路径转码
|
||||
window.open('/assets/platform/plugins/pdfJs/web/viewer.html?file=' + pdfStreamUrl, filename)
|
||||
}
|
||||
}
|
||||
|
||||
const download = (id) => {
|
||||
window.open(FILE_STREAM_DOWNLOAD_ADDRESS + '?id=' + id)
|
||||
}
|
||||
|
||||
|
||||
const PREVIEW_IMAGE = (val) => {
|
||||
let image = new Image();
|
||||
image.src = FILE_STREAM_PREVIEW_ADDRESS + "?id=" + val
|
||||
let viewer = new Viewer(image);
|
||||
viewer.show();
|
||||
}
|
||||
|
||||
const CREATE_PREVIEW_URL = (val) => {
|
||||
return FILE_STREAM_PREVIEW_ADDRESS + "?id=" + val
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 遮盖层颜色
|
||||
* @type {string}
|
||||
*/
|
||||
const COVER_LAYER_COLOR = "rgba(0,0,0,.45)"
|
||||
|
||||
/**
|
||||
* 民族
|
||||
* @type {string[]}
|
||||
*/
|
||||
const nation = [
|
||||
'汉族',
|
||||
'蒙古族',
|
||||
'回族',
|
||||
'藏族',
|
||||
'维吾尔族',
|
||||
'苗族',
|
||||
'彝族',
|
||||
'壮族',
|
||||
'布依族',
|
||||
'朝鲜族',
|
||||
'满族',
|
||||
'侗族',
|
||||
'瑶族',
|
||||
'白族',
|
||||
'土家族',
|
||||
'哈尼族',
|
||||
'哈萨克族',
|
||||
'傣族',
|
||||
'黎族',
|
||||
'傈僳族',
|
||||
'佤族',
|
||||
'畲族',
|
||||
'高山族',
|
||||
'拉祜族',
|
||||
'水族',
|
||||
'东乡族',
|
||||
'纳西族',
|
||||
'景颇族',
|
||||
'柯尔克孜族',
|
||||
'土族',
|
||||
'达翰尔族',
|
||||
'么佬族',
|
||||
'羌族',
|
||||
'布朗族',
|
||||
'撒拉族',
|
||||
'毛南族',
|
||||
'仡佬族',
|
||||
'锡伯族',
|
||||
'阿昌族',
|
||||
'普米族',
|
||||
'塔吉克族',
|
||||
'怒族',
|
||||
'乌孜别克族',
|
||||
'俄罗斯族',
|
||||
'鄂温克族',
|
||||
'德昂族',
|
||||
'保安族',
|
||||
'裕固族',
|
||||
'京族',
|
||||
'塔塔尔族',
|
||||
'独龙族',
|
||||
'鄂伦春族',
|
||||
'赫哲族',
|
||||
'门巴族',
|
||||
'珞巴族',
|
||||
'基诺族'
|
||||
];
|
||||
|
||||
const loc = () => {
|
||||
return location.href.replace(location.search, "").replace(location.hash, "")
|
||||
}
|
||||
|
||||
const clone = (obj) => {
|
||||
return JSON.parse(JSON.stringify(obj))
|
||||
}
|
||||
|
||||
const calcTableHeight = (eleIds = []) => {
|
||||
if (eleIds) {
|
||||
eleIds.forEach(e_id => {
|
||||
const ele = document.querySelector('#' + e_id)
|
||||
if (ele) {
|
||||
ele.style.height = (innerHeight - ele.getBoundingClientRect().top - parseInt(ele.dataset.bottom)) + 'px'
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user