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