上传对接调整
This commit is contained in:
parent
e8543fd0bb
commit
05eaf0152a
@ -4,7 +4,7 @@ export function list(moduleId) {
|
||||
return request({
|
||||
url: `aerocraftAdminApi/cpLabel/all`,
|
||||
method: 'get',
|
||||
parems: { moduleId }
|
||||
params: { moduleId }
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -30,11 +30,11 @@ export function tree() {
|
||||
})
|
||||
}
|
||||
|
||||
export function allAreas(parems) {
|
||||
export function allAreas(params) {
|
||||
return request({
|
||||
url: 'aerocraftAdminApi/emArea/all',
|
||||
method: 'get',
|
||||
parems
|
||||
params
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -62,7 +62,7 @@ export default {
|
||||
async customUpload(file, insertFn) { // JS 语法
|
||||
upload(_this.imagesUploadApi, file).then(res => {
|
||||
const data = res.data
|
||||
const url = _this.baseApi + '/file/图片/' + data.newFileName
|
||||
const url = data.fileFullPath
|
||||
// 最后插入图片
|
||||
insertFn(url, '', '')
|
||||
})
|
||||
@ -73,9 +73,9 @@ export default {
|
||||
allowedFileTypes: ['video/*'],
|
||||
// 自定义上传
|
||||
async customUpload(file, insertFn) { // JS 语法
|
||||
upload(_this.fileUploadApi, file).then(res => {
|
||||
upload(_this.imagesUploadApi, file).then(res => {
|
||||
const data = res.data
|
||||
const url = _this.baseApi + '/file/视频/' + data.newFileName
|
||||
const url = data.fileFullPath
|
||||
// 最后插入视频
|
||||
insertFn(url, '', '')
|
||||
})
|
||||
@ -91,8 +91,6 @@ export default {
|
||||
computed: {
|
||||
...mapGetters([
|
||||
'imagesUploadApi',
|
||||
'fileUploadApi',
|
||||
'baseApi'
|
||||
])
|
||||
},
|
||||
watch: {
|
||||
|
@ -145,7 +145,6 @@ export default {
|
||||
computed: {
|
||||
...mapGetters([
|
||||
'imagesUploadApi',
|
||||
'baseApi'
|
||||
])
|
||||
},
|
||||
created(){
|
||||
@ -162,11 +161,12 @@ export default {
|
||||
try {
|
||||
this.loading = true;
|
||||
upload(this.imagesUploadApi, uploadFile.raw).then(res => {
|
||||
console.log(res);
|
||||
|
||||
if(res.status === 200){
|
||||
const data = res.data;
|
||||
const url = '/file/图片/' + data.newFileName;
|
||||
const url = res.data.fileFullPath;
|
||||
this.form.photo = url;
|
||||
this.form.fileArray = [{url:this.baseApi+url}];
|
||||
this.form.fileArray = [{url:url}];
|
||||
this.coverHide = true;
|
||||
}else{
|
||||
this.$message.error('图片上传失败!');
|
||||
@ -230,7 +230,7 @@ export default {
|
||||
if(res.photo) {
|
||||
this.coverHide = true;
|
||||
this.form.photo = res.photo;
|
||||
this.form.fileArray = [{url: this.baseApi+this.form.photo}]
|
||||
this.form.fileArray = [{url: this.form.photo}]
|
||||
}
|
||||
}else{
|
||||
this.$message.error('文章获取失败!');
|
||||
|
@ -7,9 +7,9 @@
|
||||
<el-form-item label="封面:">
|
||||
<el-image
|
||||
style="width: 130px;height: 130px;border-radius: 4px;"
|
||||
:src="baseApi+data.photo"
|
||||
:src="data.photo"
|
||||
:zoom-rate="1.2"
|
||||
:preview-src-list="[baseApi+data.photo]"
|
||||
:preview-src-list="[data.photo]"
|
||||
fit="cover"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
@ -90,11 +90,6 @@ export default {
|
||||
loading: false,
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
...mapGetters([
|
||||
'baseApi'
|
||||
])
|
||||
},
|
||||
created(){
|
||||
const { id } = this.$route.query;
|
||||
if(id) {
|
||||
|
@ -8,7 +8,7 @@
|
||||
style="width: 200px" @change="getLabels" filterable>
|
||||
<el-option v-for="(item,index) in modules" :key="index" :label="item.moduleName" :value="item.id" />
|
||||
</el-select>
|
||||
<el-select v-model="query.cplabelId" placeholder="请选择标签" clearable size="small" class="filter-item"
|
||||
<el-select v-model.sync="query.cplabelId" placeholder="请选择标签" clearable size="small" class="filter-item"
|
||||
style="width: 200px" filterable>
|
||||
<el-option v-for="(item,index) in labels" :key="index" :label="item.name" :value="item.id" />
|
||||
</el-select>
|
||||
@ -114,13 +114,12 @@ export default {
|
||||
},
|
||||
// 根据模块id查询标签
|
||||
getLabels(){
|
||||
this.labels = [];
|
||||
delete this.query.cplabelId;
|
||||
if(this.query.moduleId){
|
||||
list(this.query.moduleId).then(res => {
|
||||
this.labels = res;
|
||||
});
|
||||
}else{
|
||||
this.labels = [];
|
||||
this.query.cplabelId = '';
|
||||
}
|
||||
},
|
||||
// 文章详情
|
||||
|
@ -95,8 +95,8 @@
|
||||
<el-table-column :show-overflow-tooltip="true" prop="name" label="素材名称" align="center" />
|
||||
<el-table-column prop="path" label="素材资源" align="center">
|
||||
<template slot-scope="scope">
|
||||
<el-image v-if="Number(scope.row.type) === 1" style="width: 100px;height: 100px;" :src="baseApi+scope.row.path" :preview-src-list="[baseApi+scope.row.path]"></el-image>
|
||||
<video controls width="100px" height="100px" :src="baseApi+scope.row.path" v-else preload="meta" />
|
||||
<el-image v-if="Number(scope.row.type) === 1" style="width: 100px;height: 100px;" :src="scope.row.path" :preview-src-list="[scope.row.path]"></el-image>
|
||||
<video controls width="100px" height="100px" :src="scope.row.path" v-else preload="meta" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column :show-overflow-tooltip="true" prop="type" label="素材类型" align="center"
|
||||
@ -172,9 +172,7 @@ export default {
|
||||
},
|
||||
computed: {
|
||||
...mapGetters([
|
||||
'imagesUploadApi',
|
||||
'fileUploadApi',
|
||||
'baseApi'
|
||||
'imagesUploadApi'
|
||||
])
|
||||
},
|
||||
methods: {
|
||||
@ -204,10 +202,10 @@ export default {
|
||||
this.form.files = uploadFiles
|
||||
this.uploadDisabled = true
|
||||
try {
|
||||
upload(isTypeImage?this.imagesUploadApi:this.fileUploadApi, file.raw).then(res => {
|
||||
upload(this.imagesUploadApi, file.raw).then(res => {
|
||||
if(res.status === 200){
|
||||
const data = res.data;
|
||||
const url = `/file/${isTypeImage?'图片':'视频'}/` + data.newFileName;
|
||||
const url = data.fileFullPath;
|
||||
this.form.path = url;
|
||||
this.loading = false;
|
||||
}else{
|
||||
@ -232,7 +230,7 @@ export default {
|
||||
},
|
||||
[CRUD.HOOK.beforeToEdit](crud, form){
|
||||
this.uploadDisabled = true;
|
||||
form.files = [{url:this.baseApi+form.path}]
|
||||
form.files = [{url:form.path}]
|
||||
console.log('beforeToEdit',crud,form);
|
||||
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user