| | |
| | | // }) |
| | | // return |
| | | // } |
| | | |
| | | if (/^http.+(.txt|.doc|.docx|.pdf|.xlsx|.xls|.zip|.rar|.ppt)$/i.test(url)) { |
| | | let name = url.replace(/.+\//g, '').replace(/\.{1}[^.]*$/g, '') |
| | | |
| | | if (/^http.+(.txt|.doc|.docx|.pdf|.xlsx|.xls|.zip|.rar|.ppt)$/i.test(url) || card.linkType === 'download') { |
| | | let name = '' |
| | | if (card.datatype === 'static') { |
| | | name = card.value || '' |
| | | } else if (data.hasOwnProperty(card.field)) { |
| | | name = data[card.field] + '' |
| | | } |
| | | name = name.replace(/\.{1}[^.]*$/g, '') |
| | | name = name ? name + url.replace(/.+\./g, '.') : '' |
| | | |
| | | let d = document.createElement('a') |
| | | d.href = url |
| | | d.setAttribute('download', name) |