Commit 1f297b3b authored by zhengke's avatar zhengke

优化上传行程特色图片

parent efb102d7
export const domainManager = () => {
const locationName = window.location.hostname
console.log(window.location.hostname, '=====hostname')
const obj = {
domainUrl: locationName.indexOf('oytour') !== -1 || locationName.indexOf('viitto') !== -1 ? "http://upload.oytour.com" : "http://192.168.10.214/api/common/post",
domainUrl: locationName.indexOf('oytour') !== -1 ? "http://upload.oytour.com" : "http://192.168.10.214/api/common/post",
//上传站点
UploadUrl: locationName.indexOf('oytour') !== -1 || locationName.indexOf('viitto') !== -1 ? "http://upload.oytour.com" : "http://192.168.10.214:8120",
UploadUrl: locationName.indexOf('oytour') !== -1 ? "http://upload.oytour.com" : "http://192.168.10.214:8120",
//文件站点
ViittoFileUrl: locationName.indexOf('oytour') !== -1 || locationName.indexOf('viitto') !== -1 ? "http://imgfile.oytour.com/" : 'http://192.168.10.214:8130/',
ViittoFileUrl: locationName.indexOf('oytour') !== -1 ? "http://imgfile.oytour.com/" : 'http://192.168.10.214:8130',
}
return obj
}
\ No newline at end of file
import service, { ApiResult } from "../configs/axiosUpload";
import { userStore } from "@/store/user";
import md5 from "md5-ts";
export interface HttpResponse {
status: number
......
......@@ -262,7 +262,7 @@ const SetTripTemplateConfig = async () => {
message: '操作成功',
type: 'success',
})
FeatureImgStore.setFeatureImg([])
dataLoadingStore.setDataLoading(true)
}else{
ElMessage({
......@@ -271,8 +271,10 @@ const SetTripTemplateConfig = async () => {
type: 'warning',
})
}
FeatureImgStore.setFeatureImg([])
datas.loading = false
} catch (error) {
FeatureImgStore.setFeatureImg([])
datas.loading = false
ElMessage({
showClose: true,
......@@ -284,12 +286,6 @@ const SetTripTemplateConfig = async () => {
// 保存
const setTemplate = async () =>{
let arr = JSON.parse(JSON.stringify(slides.value))
arr.forEach(x=>{
x.elements.forEach(y=>{
delete y.TemplateList
delete y.TemplateDataSource
})
})
if(ConfigId.value&&FeatureImg.value.length>0){
FeatureImg.value.forEach(item=>{
setTimeout(()=>{
......@@ -302,13 +298,21 @@ const setTemplate = async () =>{
}
// console.log(JSON.stringify(slides.value),'----保存接口',queryObj.value)
if(model.value&&userInfo.value.IsEditTripTemplate==1){
if(CoverImg&&CoverImg.value) queryObj.value.CoverImg = CoverImg.value
else return ElMessage({
showClose: true,
message: '请生成封面图',
type: 'warning',
arr.forEach(x=>{
x.elements.forEach(y=>{
delete y.TemplateList
delete y.TemplateDataSource
})
})
if(CoverImg&&CoverImg.value) queryObj.value.CoverImg = CoverImg.value
else {
mainStore.setToolbarState(ToolbarStates.EL_TEMPLATEDATA)
return ElMessage({
showClose: true,
message: '请生成封面图',
type: 'warning',
})
}
if(queryObj.value.Title==''||!queryObj.value.LineId||!queryObj.value.LtId
||queryObj.value.CoverImg==''
||queryObj.value.CountryName==''||queryObj.value.SeasonName==''
......@@ -346,10 +350,9 @@ const setTemplate = async () =>{
// }
// }
}
queryObj.value.TempData = JSON.stringify(arr)
datas.loading = true
if(model.value&&userInfo.value.IsEditTripTemplate==1){
queryObj.value.TempData = JSON.stringify(arr)
await SetTripTemplateSlide()
}else if(ConfigId.value){
await SetTripTemplateConfig()
......@@ -366,7 +369,7 @@ const setFeatureImgList = async (url) => {
let path = `?fileType=1&fileLimit=5&&filePath=Feature/${ConfigId.value}_`
let Res = await UploadService.UploadBase64Two(path,queryObj);
if (Res.data&&Res.data.FilePath) {
datas.FeatureImgList.push(`${domainManager().ViittoFileUrl}${Res.data.FilePath}`)
datas.FeatureImgList.push(`${domainManager().ViittoFileUrl}/${Res.data.FilePath}`)
}
} catch (error) {
......
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