fix: 修复windows下的问题
This commit is contained in:
parent
571b7a8a32
commit
092a0084d0
@ -973,7 +973,7 @@ export default {
|
||||
this.selectPin = true
|
||||
}
|
||||
// ctrl + A / cmd + A
|
||||
if (this.isCmd && keyCode == 65) {
|
||||
if (this.isCmd && keyCode === 65) {
|
||||
if (this.inputting || this.editingIndex !== -1) {
|
||||
event.target.select()
|
||||
} else {
|
||||
@ -999,7 +999,6 @@ export default {
|
||||
onmessageFault(msg) {
|
||||
if ('fault' === msg) {
|
||||
this.getFileList()
|
||||
return
|
||||
}
|
||||
},
|
||||
onmessage(msg) {
|
||||
@ -1024,10 +1023,14 @@ export default {
|
||||
}
|
||||
if (fileDoc) {
|
||||
if (fileDoc.$set) {
|
||||
if (this.path + '/' === fileDoc.$set.path) {
|
||||
let path = fileDoc.$set.path
|
||||
path = path.replace(/\\/g, '/')
|
||||
if (this.path + '/' === path) {
|
||||
this.getFileList()
|
||||
}
|
||||
} else {
|
||||
let path = fileDoc.path
|
||||
path = path.replace(/\\/g, '/')
|
||||
if (this.path + '/' === fileDoc.path) {
|
||||
this.getFileList()
|
||||
}
|
||||
@ -1740,6 +1743,7 @@ export default {
|
||||
} else {
|
||||
this.path += '/' + this.pathList[number].folder
|
||||
}
|
||||
this.path = this.path.replace(/\\/g, '/')
|
||||
})
|
||||
if (!unPushLink) {
|
||||
if (!this.$route.query.path) {
|
||||
@ -2069,6 +2073,7 @@ export default {
|
||||
this.listModeSearchOpenDir = row
|
||||
})
|
||||
this.path = row.path + row.name
|
||||
this.path = this.path.replace(/\\/g, '/')
|
||||
},
|
||||
openDir(row, onLoad) {
|
||||
this.beforeLoadData(onLoad)
|
||||
@ -2083,6 +2088,7 @@ export default {
|
||||
this.loadData(res, onLoad)
|
||||
})
|
||||
this.path = row.path + row.name
|
||||
this.path = this.path.replace(/\\/g, '/')
|
||||
},
|
||||
getFileList(onLoad) {
|
||||
this.beforeLoadData(onLoad)
|
||||
|
||||
@ -175,7 +175,7 @@ export default {
|
||||
this.fileList = fileList
|
||||
},
|
||||
format(filepath){
|
||||
this.currentValue = fileConfig.mardownPreviewUrl(filepath)
|
||||
this.currentValue = fileConfig.markdownPreviewUrl(filepath)
|
||||
this.change(this.currentValue)
|
||||
},
|
||||
// url转blob
|
||||
|
||||
@ -21,6 +21,7 @@ export default {
|
||||
// 预览文件的url
|
||||
previewUrl: function(username, file, token, shareToken) {
|
||||
let fileUrl = `${this.baseUrl}/file/${username}${encodeURI(file.path)}${encodeURI(file.name)}`
|
||||
fileUrl = fileUrl.replace(/%5C/g, '/')
|
||||
if (token) {
|
||||
return `${fileUrl}?jmal-token=${token}&name=${username}`
|
||||
}
|
||||
@ -29,13 +30,14 @@ export default {
|
||||
}
|
||||
return fileUrl
|
||||
},
|
||||
// mardown里上传图片后的图片预览地址
|
||||
mardownPreviewUrl: function (path){
|
||||
// markdown里上传图片后的图片预览地址
|
||||
markdownPreviewUrl: function (path){
|
||||
return window.location.origin + `${this.baseUrl}${path}`
|
||||
},
|
||||
// 预览文件
|
||||
preview: function(username, file, token) {
|
||||
const url = this.previewUrl(username, file, token)
|
||||
let url = this.previewUrl(username, file, token)
|
||||
url = url.replace(/%5C/g, '/')
|
||||
window.open(url, '_blank')
|
||||
},
|
||||
// 下载文件
|
||||
|
||||
@ -393,7 +393,7 @@ export default {
|
||||
let response = JSON.parse(responseText)
|
||||
let succMap = {}
|
||||
response.data.forEach(map => {
|
||||
succMap[map.filename] = fileConfig.mardownPreviewUrl(map.filepath)
|
||||
succMap[map.filename] = fileConfig.markdownPreviewUrl(map.filepath)
|
||||
})
|
||||
response.data = {}
|
||||
response.data['succMap'] = succMap
|
||||
@ -405,7 +405,7 @@ export default {
|
||||
linkToImgUrl: '/api/upload-markdown-link-image',
|
||||
linkToImgFormat(responseText) {
|
||||
let response = JSON.parse(responseText)
|
||||
response.data['url'] = fileConfig.mardownPreviewUrl(response.data.url)
|
||||
response.data['url'] = fileConfig.markdownPreviewUrl(response.data.url)
|
||||
return JSON.stringify(response)
|
||||
},
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user