|
|
@@ -119,8 +119,20 @@ export default {
|
|
|
this.$message.error('文件上传失败: ' + response.message)
|
|
|
}
|
|
|
},
|
|
|
+ isValidFileUrl (url) {
|
|
|
+ const value = typeof url === 'string' ? url.trim() : ''
|
|
|
+ if (!value) return false
|
|
|
+ const invalidValues = ['null', 'undefined', '-']
|
|
|
+ if (invalidValues.includes(value.toLowerCase())) return false
|
|
|
+ return /^https?:\/\/[^\s]+$/i.test(value) || /^\/[^\s]*$/.test(value)
|
|
|
+ },
|
|
|
copyFileUrl () {
|
|
|
- this.copyTextToClipboard(this.form.fileUrl)
|
|
|
+ const fileUrl = typeof this.form.fileUrl === 'string' ? this.form.fileUrl.trim() : ''
|
|
|
+ if (!this.isValidFileUrl(fileUrl)) {
|
|
|
+ this.$message.error('获取失败,无法获取下载地址')
|
|
|
+ return
|
|
|
+ }
|
|
|
+ this.copyTextToClipboard(fileUrl)
|
|
|
},
|
|
|
applyAccountItem (accountItem) {
|
|
|
if (!accountItem || !accountItem.id) return
|