修改:选择文件时将文件设为公共文件
This commit is contained in:
parent
782b1d6bcb
commit
2147b99c6b
@ -64,6 +64,14 @@ export default {
|
||||
})
|
||||
}
|
||||
},
|
||||
// 将文件设为公共文件
|
||||
setPublic: function(params) {
|
||||
return request({
|
||||
url: 'setPublic',
|
||||
method: 'put',
|
||||
params
|
||||
})
|
||||
},
|
||||
// 删除
|
||||
delete: function(params) {
|
||||
return request({
|
||||
|
||||
@ -64,8 +64,9 @@
|
||||
<script>
|
||||
|
||||
import axios from 'axios'
|
||||
import fileConfig from "@/utils/file-config";
|
||||
import SelectFile from "@/components/ShowFile/SelectFile";
|
||||
import fileApi from '@/api/file-api'
|
||||
import fileConfig from "@/utils/file-config"
|
||||
import SelectFile from "@/components/ShowFile/SelectFile"
|
||||
|
||||
export default {
|
||||
name: 'UploadImageInput',
|
||||
@ -124,8 +125,10 @@ export default {
|
||||
input(value) {
|
||||
},
|
||||
selectedFile(row) {
|
||||
this.currentValue = window.location.origin + fileConfig.previewUrl(this.$store.state.user.name, row, this.$store.getters.token)
|
||||
this.change(this.currentValue)
|
||||
fileApi.setPublic({fileId: row.id}).then(() => {
|
||||
this.currentValue = window.location.origin + fileConfig.previewUrl(this.$store.state.user.name, row, undefined)
|
||||
this.change(this.currentValue)
|
||||
})
|
||||
},
|
||||
handleBeforeUpload(){
|
||||
this.uploadState = 1
|
||||
|
||||
@ -7,7 +7,11 @@ export default {
|
||||
return window.location.origin + `${this.baseUrl}/webDAV/${username}`
|
||||
},
|
||||
previewUrl: function(username, file, token) {
|
||||
return `${this.baseUrl}/file/${username}${file.path}${file.name}?jmal-token=${token}`
|
||||
if (token) {
|
||||
return `${this.baseUrl}/file/${username}${file.path}${file.name}?jmal-token=${token}`
|
||||
} else {
|
||||
return `${this.baseUrl}/file/${username}${file.path}${file.name}`
|
||||
}
|
||||
},
|
||||
mardownPreviewUrl: function (path){
|
||||
return window.location.origin + `${this.baseUrl}${path}`
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user