Commit f01a9614 authored by liwei's avatar liwei

修改了上传逻辑

parent 25c28b46
......@@ -86,3 +86,11 @@ export function getOssUrl(id) {
method: 'GET'
})
}
// oss查询图片路径
export function getUploadType() {
return request({
url: '/opmarticle/getUploadType',
method: 'GET'
})
}
......@@ -367,7 +367,7 @@ import { VueEditor } from 'vue2-editor'
import { yesOrNo, enableOrDisable } from '@/utils/allPageData'
import { uploadLocal, uploadPublic } from '@/api/system/ossInfo'
import 'quill/dist/quill.core.css'
import { getOssUrl } from '@/api/contentManagement/opmArticle'
import { getOssUrl, getUploadType } from '@/api/contentManagement/opmArticle'
import axios from 'axios'
export default {
components: {
......@@ -437,7 +437,9 @@ export default {
rules: {
startDateS: [],
endDateS: []
}
},
// 上传类型
uploadType: 'aliYun_direct'
}
},
computed: {
......@@ -455,7 +457,6 @@ export default {
}
return match
})
console.log('formattedDetails', updatedHtml)
return updatedHtml
}
},
......@@ -471,6 +472,12 @@ export default {
this.setFormDefaults()
},
methods: {
// 获取上传类型
getUploadType() {
getUploadType().then(res => {
this.uploadType = res.data
})
},
// 时间填写验证
validateEndTime(rule, value, callback) {
if (value && this.form.startTime) {
......@@ -501,8 +508,8 @@ export default {
try {
// 发起上传请求
uploadPublic(formData).then(response => {
if (response.data.ossInfoId !== null && response.data.ossInfoId !== '' && response.data.ossInfoId !== undefined){
// oss
if (this.uploadType === 'aliYun_direct') {
// oss客户端直
axios({
method: 'PUT',
url: response.data.url,
......@@ -523,7 +530,7 @@ export default {
})
})
} else {
// 本地上传
// 本地上传 minio上传 oss服务端上传
getOssUrl(response.data.businessId).then(res1 => {
const businessId = response.data.businessId
// 更新 fileList,保存文件的 URL 和其他信息
......
......@@ -194,7 +194,7 @@ import { addCmsBanner, delCmsBanner, getCmsBanner, listCmsBanner, updateCmsBanne
import { enableOrDisable, typeField } from '@/utils/allPageData'
import commonField from '@/utils/commonField'
import { uploadPublic } from '@/api/system/ossInfo'
import { getOssUrl } from '@/api/contentManagement/opmArticle'
import { getOssUrl, getUploadType } from '@/api/contentManagement/opmArticle'
import axios from 'axios'
export default {
name: 'CmsBanner',
......@@ -247,7 +247,9 @@ export default {
{ required: true, message: '请输入权重', trigger: 'change' }
]
}
},
// 上传类型
uploadType: 'aliYun_direct'
}
},
computed: {
......@@ -257,9 +259,15 @@ export default {
},
created() {
this.getList() // 列表查询
this.getUploadType()
},
methods: {
/** 上传 */
// 获取上传类型
getUploadType() {
getUploadType().then(res => {
this.uploadType = res.data
})
},
// 获取对应的分类名称
getTypeValue(type) {
// 查找 type 对应的 value
......@@ -449,8 +457,8 @@ export default {
try {
// 发起上传请求
uploadPublic(formData).then(response => {
if (response.data.ossInfoId !== null && response.data.ossInfoId !== '' && response.data.ossInfoId !== undefined){
// oss
if (this.uploadType === 'aliYun_direct') {
// oss客户端直
axios({
method: 'PUT',
url: response.data.url,
......@@ -471,7 +479,7 @@ export default {
})
})
} else {
// 本地上传
// 本地上传 minio上传 oss服务端上传
getOssUrl(response.data.businessId).then(res1 => {
const businessId = response.data.businessId
// 更新 fileList,保存文件的 URL 和其他信息
......
......@@ -165,7 +165,7 @@ import {
import { VueEditor } from 'vue2-editor'
import { yesOrNo, enableOrDisable } from '@/utils/allPageData'
import { uploadPublic } from '@/api/system/ossInfo'
import { getOssUrl } from '@/api/contentManagement/opmArticle'
import { getOssUrl, getUploadType } from '@/api/contentManagement/opmArticle'
import 'quill/dist/quill.core.css'
import axios from 'axios'
export default {
......@@ -244,7 +244,9 @@ export default {
rules: {
startDateS: [],
endDateS: []
}
},
// 上传类型
uploadType: 'aliYun_direct'
}
},
computed: {
......@@ -277,6 +279,12 @@ export default {
this.setFormDefaults()
},
methods: {
// 获取上传类型
getUploadType() {
getUploadType().then(res => {
this.uploadType = res.data
})
},
// 活动内容预览
contentPreview() {
this.open = true
......@@ -311,8 +319,8 @@ export default {
try {
// 发起上传请求
uploadPublic(formData).then(response => {
if (response.data.ossInfoId !== null && response.data.ossInfoId !== '' && response.data.ossInfoId !== undefined){
// oss
if (this.uploadType === 'aliYun_direct') {
// oss客户端直
axios({
method: 'PUT',
url: response.data.url,
......@@ -333,7 +341,7 @@ export default {
})
})
} else {
// 本地上传
// 本地上传 minio上传 oss服务端上传
getOssUrl(response.data.businessId).then(res1 => {
const businessId = response.data.businessId
// 更新 fileList,保存文件的 URL 和其他信息
......
......@@ -581,7 +581,7 @@ import {
import { getOptions } from '@/utils/options'
import { getMemInfo, getPrivateInfo, updateMemInfo } from '@/api/contentManagement/memInfo'
import { uploadPublic } from '@/api/system/ossInfo'
import { getOssUrl } from '@/api/contentManagement/opmArticle'
import { getOssUrl, getUploadType } from '@/api/contentManagement/opmArticle'
import axios from 'axios'
export default {
data() {
......@@ -752,7 +752,9 @@ export default {
],
showSecretData: true,
memEducationUrl: '',
memWorkUrl: ''
memWorkUrl: '',
// 上传类型
uploadType: 'aliYun_direct'
}
},
computed: {
......@@ -815,6 +817,12 @@ export default {
this.setFormDefaults()
},
methods: {
// 获取上传类型
getUploadType() {
getUploadType().then(res => {
this.uploadType = res.data
})
},
setFormDefaults() {
const isOperation = this.isOperation
// 判断是新增、编辑还是查看
......@@ -1055,8 +1063,8 @@ export default {
try {
// 发起上传请求
uploadPublic(formData).then(response => {
if (response.data.ossInfoId !== null && response.data.ossInfoId !== '' && response.data.ossInfoId !== undefined){
// oss上
if (this.uploadType === 'aliYun_direct') {
// 客户端oss直
axios({
method: 'PUT',
url: response.data.url,
......@@ -1077,7 +1085,7 @@ export default {
})
})
} else {
// 本地上传
// 本地上传 minio上传 oss服务端上传
getOssUrl(response.data.businessId).then(res1 => {
const businessId = response.data.businessId
// 更新 fileList,保存文件的 URL 和其他信息
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment