【fix ESLint】src/components/jero/JImageUpload

This commit is contained in:
zhaoxiao
2023-03-06 09:10:33 +08:00
parent 5b1b0c2502
commit d4b3fd5727
@@ -33,7 +33,7 @@ import { getFileAccessHttpUrl } from '@/api/manage'
const Base64 = require('js-base64').Base64
const uidGenerator = () => {
return '-' + parseInt(Math.random() * 10000 + 1, 10)
return '-' + parseInt(Math.random() * 10000 + 1 + '', 10)
}
export default {
name: 'JImageUpload',
@@ -84,7 +84,6 @@ export default {
computed: {
// 透传给下级组件的事件,需要排除本组件使用的change事件
childListeners () {
const vm = this
const result = Object.assign({},
this.$listeners
)
@@ -94,13 +93,13 @@ export default {
},
watch: {
value: {
handler (val, oldValue) {
handler (val) {
if (val instanceof Array) {
this.initFileList(val.join(','))
} else {
this.initFileList(val)
}
if (!val || val.length == 0) {
if (!val || val.length === 0) {
this.picUrl = false
}
},
@@ -114,14 +113,14 @@ export default {
},
methods: {
initFileList (paths) {
if (!paths || paths.length == 0) {
if (!paths || paths.length === 0) {
this.fileList = []
return
}
this.picUrl = true
const fileList = []
const arr = paths.split(',')
for (var a = 0; a < arr.length; a++) {
for (let a = 0; a < arr.length; a++) {
const url = getFileAccessHttpUrl(arr[a])
fileList.push({
uid: uidGenerator(),
@@ -138,7 +137,7 @@ export default {
this.fileList = fileList
},
beforeUpload: function (file) {
var fileType = file.type
const fileType = file.type
if (fileType.indexOf('image') < 0) {
this.$message.warning('请上传图片')
return false
@@ -176,7 +175,7 @@ export default {
// 预览
handlePreview (file) {
if (file && file.url) {
var fileFullUrl = `${window._CONFIG.domianWebSocketURL}/${file.url}`
const fileFullUrl = `${window._CONFIG.domianWebSocketURL}/${file.url}`
const url = `${window._CONFIG.onlinePreviewDomainURL}?url=${encodeURIComponent(Base64.encode(fileFullUrl))}`
window.open(url)
}
@@ -190,7 +189,7 @@ export default {
handlePathChange () {
const uploadFiles = this.fileList
let path = ''
if (!uploadFiles || uploadFiles.length == 0) {
if (!uploadFiles || uploadFiles.length === 0) {
path = ''
}
const arr = []