|
|
@@ -86,22 +86,22 @@
|
|
|
.then(function (response) {
|
|
|
console.log(response)
|
|
|
console.log(response.data.data.length)
|
|
|
- response.data.data.forEach(item => {
|
|
|
+ response.data.data.forEach((item,index) => {
|
|
|
const div = document.createElement('div');
|
|
|
div.className = 'div-border';
|
|
|
let iconSrc = '';
|
|
|
- if (item.attinfos[0].postfix == 'word' || item.attinfos[0].postfix == 'Word') {
|
|
|
+ if (item.attinfos[index].postfix == 'word' || item.attinfos[index].postfix == 'Word') {
|
|
|
iconSrc = './img/word.svg';
|
|
|
- } else if (item.attinfos[0].postfix == 'pdf' || item.attinfos[0].postfix == 'PDF') {
|
|
|
+ } else if (item.attinfos[index].postfix == 'pdf' || item.attinfos[index].postfix == 'PDF') {
|
|
|
iconSrc = './img/pdfType.svg';
|
|
|
- } else if (item.attinfos[0].postfix == 'png' || item.attinfos[0].postfix == 'PNG' || item.attinfos[0].postfix == 'JPG' || item.attinfos[0].postfix == 'jpg') {
|
|
|
+ } else if (item.attinfos[index].postfix == 'png' || item.attinfos[index].postfix == 'PNG' || item.attinfos[index].postfix == 'JPG' || item.attinfos[index].postfix == 'jpg') {
|
|
|
iconSrc = './img/pngType.svg';
|
|
|
- }else if (item.attinfos[0].postfix == 'ppt' || item.attinfos[0].postfix == 'PPT') {
|
|
|
+ }else if (item.attinfos[index].postfix == 'ppt' || item.attinfos[index].postfix == 'PPT') {
|
|
|
iconSrc = './img/ppt.svg';
|
|
|
- }else if (item.attinfos[0].postfix == 'mp3' || item.attinfos[0].postfix == 'MP3' || item.attinfos[0].postfix == 'MP4' || item.attinfos[0].postfix == 'mp4'
|
|
|
- || item.attinfos[0].postfix == 'mov' || item.attinfos[0].postfix == 'MOV') {
|
|
|
+ }else if (item.attinfos[index].postfix == 'mp3' || item.attinfos[index].postfix == 'MP3' || item.attinfos[index].postfix == 'MP4' || item.attinfos[index].postfix == 'mp4'
|
|
|
+ || item.attinfos[index].postfix == 'mov' || item.attinfos[index].postfix == 'MOV') {
|
|
|
iconSrc = './img/mov.svg';
|
|
|
- }else if (item.attinfos[0].postfix == 'EXCEL' || item.attinfos[0].postfix == 'excel' || item.attinfos[0].postfix == 'xlsx' || item.attinfos[0].postfix == 'XLSX') {
|
|
|
+ }else if (item.attinfos[index].postfix == 'EXCEL' || item.attinfos[index].postfix == 'excel' || item.attinfos[index].postfix == 'xlsx' || item.attinfos[index].postfix == 'XLSX') {
|
|
|
iconSrc = './img/excel.svg';
|
|
|
} else {
|
|
|
iconSrc = './img/default.svg';
|
|
|
@@ -114,8 +114,8 @@
|
|
|
`;
|
|
|
dataContainer.appendChild(div);
|
|
|
div.addEventListener('click', function() {
|
|
|
- console.log(item.attinfos[0].url)
|
|
|
- downloadFile(item.attinfos[0].url)
|
|
|
+ console.log(item.attinfos[index].url)
|
|
|
+ downloadFile(item.attinfos[index].url)
|
|
|
});
|
|
|
})
|
|
|
})
|