Commit f36021bd authored by zhengke's avatar zhengke

no message

parent c64ee919
...@@ -71,8 +71,8 @@ ...@@ -71,8 +71,8 @@
function RenewalImg() { function RenewalImg() {
var str = '<div class="FillincommentsImgF">' var str = '<div class="FillincommentsImgF">'
var center = '' var center = ''
var end = `<div class="FillincommentsAdd" onclick="uploadFile"> var end = `<div class="FillincommentsAdd">
<input type="file" accept="image/*" multiple style="opacity:0" id="upload"/> <input type="file" accept="image/*" multiple style="opacity:0" id="upload" onchange="uploadFile(event)"/>
</div> </div>
</div>` </div>`
var textHtml = '' var textHtml = ''
...@@ -86,49 +86,43 @@ ...@@ -86,49 +86,43 @@
textHtml = str+center+end textHtml = str+center+end
$(`#FillincommentsImgF`).html(textHtml) $(`#FillincommentsImgF`).html(textHtml)
} }
function uploadFile(){ function uploadFile(e){
// 获取文件输入元素 for(let i=0;i<e.target.files.length;i++){
const fileInput = document.getElementById('upload'); const file = e.target.files[i]; // 获取文件对象
// fileInput.click() const formData = new FormData(); // 创建FormData对象
// 监听文件输入的变化 formData.append('file', file); // 将文件添加到FormData对象中
fileInput.addEventListener('change', function(e) { // 1 文档 2 数据 3 图片
for(let i=0;i<e.target.files.length;i++){ let typeArr = [{
const file = e.target.files[i]; // 获取文件对象 stringArr: 'GIF|JPG|JPEG|PNG|BMP',
const formData = new FormData(); // 创建FormData对象 type: 3
formData.append('file', file); // 将文件添加到FormData对象中 },
// 1 文档 2 数据 3 图片 {
let typeArr = [{ stringArr: 'DOCX|DOC|XLSX|XLS|PPT|PPTX|PDF',
stringArr: 'GIF|JPG|JPEG|PNG|BMP', type: 1
type: 3 },
}, ]
{ let ft = file.name.substring(file.name.lastIndexOf('.') + 1, file.name.length).toUpperCase();
stringArr: 'DOCX|DOC|XLSX|XLS|PPT|PPTX|PDF', let fileTypeNumber = 2;
type: 1 let typeOk = false;
}, typeArr.forEach(x => {
] if (x.stringArr.indexOf(ft) != '-1') {
let ft = file.name.substring(file.name.lastIndexOf('.') + 1, file.name.length).toUpperCase(); fileTypeNumber = x.type;
let fileTypeNumber = 2; typeOk = true;
let typeOk = false;
typeArr.forEach(x => {
if (x.stringArr.indexOf(ft) != '-1') {
fileTypeNumber = x.type;
typeOk = true;
}
})
var path = '/Upload/car/'
let newArr = [];
newArr.push(file)
UploadSelfFile(path, newArr, x => {
importData.push({
Content: x.FilePath,
ID: 0,
Type: fileTypeNumber,
Url: getApiUrl().ViittoFileUrl + x.FilePath,
})
RenewalImg()
}, 1);
} }
}); })
var path = '/Upload/car/'
let newArr = [];
newArr.push(file)
UploadSelfFile(path, newArr, x => {
importData.push({
Content: x.FilePath,
ID: 0,
Type: fileTypeNumber,
Url: getApiUrl().ViittoFileUrl + x.FilePath,
})
RenewalImg()
}, 1);
}
} }
function clickRadio(i) { function clickRadio(i) {
...@@ -354,7 +348,7 @@ ...@@ -354,7 +348,7 @@
var fileHtml = `<h4 class="uploadProof">上传凭证</h4> var fileHtml = `<h4 class="uploadProof">上传凭证</h4>
<div class="FillincommentsImgF" id="FillincommentsImgF"> <div class="FillincommentsImgF" id="FillincommentsImgF">
<div class="FillincommentsAdd"> <div class="FillincommentsAdd">
<input type="file" accept="image/*" multiple style="opacity:0" id="upload" onclick="uploadFile()"/> <input type="file" accept="image/*" multiple style="opacity:0" id="upload" onchange="uploadFile(event)"/>
</div> </div>
</div>` </div>`
var list = [] var list = []
...@@ -428,9 +422,9 @@ ...@@ -428,9 +422,9 @@
</div>` </div>`
} }
var textHtml = str + mark + singleChoice + MultipleChoice + inputText + end var textHtml = str + mark + singleChoice + MultipleChoice + inputText + end
if(i==(dataList.length-1)){ // if(i==(dataList.length-1)){
textHtml+=fileHtml // textHtml+=fileHtml
} // }
element.innerHTML = textHtml element.innerHTML = textHtml
list.push(element) list.push(element)
}) })
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment