Commit e6abb973 authored by 罗超's avatar 罗超

Merge branch 'master' of http://gitlab.oytour.com/viitto/pptist

# Conflicts:
#	src/views/Editor/EditorHeader/index.vue
parents afb41d30 ee776a32
......@@ -95,18 +95,11 @@ const GetTripConfig = async (ConfigId) =>{
ConfigId: ConfigId
}
let datasRes = await ConfigService.triptemplateGetTripConfig(queryMsg);
if (datasRes.data.resultCode == 1) {
if(datasRes.data.data&&datasRes.data.data.length>0&&datasRes.data.data[0].TempId){
isModelStore.setIsModel(true)
marketStore.setMarket(!market)
TempIdStore.setTempId(datasRes.data.data[0].TempId)
}
}else{
return ElMessage({
showClose: true,
message: datasRes.data.message,
type: 'warning',
})
if (datasRes.data.resultCode == 1 && datasRes.data.data && datasRes.data.data.TempId) {
let dataObj = datasRes.data.data
isModelStore.setIsModel(true)
marketStore.setMarket(!market)
TempIdStore.setTempId(dataObj.TempId)
}
} catch (error) {
console.log("triptemplate_GetTripConfig", error);
......
......@@ -12,7 +12,7 @@ export interface ScreenState {
TempId: number,
CoverImg: any,
isCoverImg: boolean,
dataLoading: boolean,
dataLoading: number,
FeatureImg: any
}
......@@ -29,7 +29,7 @@ export const useScreenStore = defineStore('screen', {
TempId: 0, // 模版Id
CoverImg: null, // 封面图
isCoverImg: false, // 封面
dataLoading: false, // 记录保存是否成功
dataLoading: 0, // 记录保存是否成功
FeatureImg: [], // 行程特色图
}),
......@@ -67,7 +67,7 @@ export const useScreenStore = defineStore('screen', {
setTempId(TempId: number) {
this.TempId = TempId
},
setDataLoading(dataLoading: boolean) {
setDataLoading(dataLoading: number) {
this.dataLoading = dataLoading
},
setFeatureImg(FeatureImg: any) {
......
......@@ -116,6 +116,15 @@ interface PPTBaseElement {
name?: string
}
/**
* 数据源
*/
export interface DataSourceType {
Content?: string,
Name?: string,
Id?: number
}
/**
* 文本元素
......@@ -159,7 +168,9 @@ export interface PPTTextElement extends PPTBaseElement {
shadow?: PPTElementShadow
paragraphSpace?: number
vertical?: boolean,
FiledTypeStr?: string
FiledTypeStr?: string,
TemplateList?: unknown,
TemplateDataSource?: DataSourceType,
}
......
......@@ -186,8 +186,7 @@ const goBack = () =>{
}
]
if(model.value) {
// searchData.value.TempId = 0
TempIdStore.setTempId(0)
searchData.value.TempId = 0
marketStore.setMarket(true)
slidesStore.setSlides(list)
layoutsStore.setLayouts([])
......@@ -204,8 +203,7 @@ const goBack = () =>{
}
)
.then(() => {
// searchData.value.TempId = 0
TempIdStore.setTempId(0)
searchData.value.TempId = 0
marketStore.setMarket(true)
slidesStore.setSlides(list)
layoutsStore.setLayouts([])
......@@ -223,9 +221,7 @@ const UploadPsdHandler = () => {
// 新增修改模版
const SetTripTemplateSlide = async () => {
// console.log(JSON.parse(queryObj.value.TempData),'--------')
try {
let TemplateRes = await ConfigService.SetTripTemplateSlide(queryObj.value);
if (TemplateRes.data.resultCode == 1) {
if(!queryObj.value.TempId){
......@@ -237,7 +233,7 @@ const SetTripTemplateSlide = async () => {
message: '操作成功',
type: 'success',
})
dataLoadingStore.setDataLoading(true)
dataLoadingStore.setDataLoading(1)
}else{
ElMessage({
showClose: true,
......@@ -245,15 +241,9 @@ const SetTripTemplateSlide = async () => {
type: 'warning',
})
}
datas.loading = false
} catch (error) {
datas.loading = false
ElMessage({
showClose: true,
message: '操作失败',
type: 'warning',
})
}
} catch (error) {}
datas.loading = false
}
const uploadImageHandler = async ()=>{
......@@ -324,8 +314,14 @@ const SetTripTemplateConfig = async () => {
message: '操作成功',
type: 'success',
})
dataLoadingStore.setDataLoading(true)
// window.parent.postMessage({
// cmd: 'returnHeight',
// params: {
// success: true,
// data: '行程数据保存成功'
// }
// }, '*');
dataLoadingStore.setDataLoading(2)
}else{
ElMessage({
showClose: true,
......@@ -338,11 +334,6 @@ const SetTripTemplateConfig = async () => {
} catch (error) {
FeatureImgStore.setFeatureImg([])
datas.loading = false
ElMessage({
showClose: true,
message: '操作失败',
type: 'warning',
})
}
......@@ -352,7 +343,7 @@ const setTemplate = async () =>{
await uploadImageHandler()
let arr = JSON.parse(JSON.stringify(slides.value))
if(dataLoading.value){
dataLoadingStore.setDataLoading(false)
dataLoadingStore.setDataLoading(0)
}
// console.log(JSON.stringify(slides.value),'----保存接口',queryObj.value)
if(model.value&&userInfo.value.IsEditTripTemplate==1){
......@@ -431,7 +422,12 @@ const setFeatureImgList = async (url) => {
}
}
} catch (error) {
datas.loading = false
ElMessage({
showClose: true,
message: '上传行程文件出错',
type: 'warning',
})
}
}
......
......@@ -119,19 +119,46 @@ watch(() => slideIndex.value, () => {
})
})
// 监听请求保存成功 重新请求数据
// 监听请求保存成功 重新请求数据 1模版
watch(() => dataLoading.value, (n,o) =>{
if(n!=o&&n){
if(dataLoading.value==1){
GetTripTemplate()
}else if(dataLoading.value==2){
GetTripConfig()
}
})
queryObj.value = inject(injectKeyDataSource).queryObj
/**
* 行程保存成功获取行程详情
*/
const GetTripConfig = async () =>{
console.log('行程详情--------')
try {
let queryMsg = {
ConfigId: ConfigId.value
}
let datasRes = await ConfigService.triptemplateGetTripConfig(queryMsg);
if (datasRes.data.resultCode == 1 && datasRes.data.data && datasRes.data.data.TempId) {
let dataObj = datasRes.data.data
let SlidesData = JSON.parse(dataObj.TempData)
let newSlides = []
SlidesData.forEach((x,i)=>{
newSlides.push(x)
if(SlidesData.length-1==i){
slidesStore.setSlides(newSlides)
}
})
}
} catch (error) {
}
}
// 获取行程团数据
const GetTripFiledData = async (status) =>{
if(queryObj.value.TempId&&!status) return
// 获取行程团数据初始化数据
const GetTripFiledData = async () =>{
console.log('初始化行程','----------')
const slidesData = slides.value
try {
let queryMsg = {
......@@ -143,6 +170,10 @@ const GetTripFiledData = async (status) =>{
const travel = dataRes.data.data
const cursors = [] as Array<any>
slidesData.forEach((x,index)=>{
let imageList = x.elements.filter(y=>{
return y.type=='image'
})
let imgIndex = imageList.length
x.elements.forEach(y=>{
if(y.TemplateDataSource && y.TemplateDataSource.Content){
let dataPath = y.TemplateDataSource.Content.split('.')
......@@ -171,7 +202,7 @@ const GetTripFiledData = async (status) =>{
y.content= y.content.replace(getHtmlPlainText(y.content),value)
}else if(value && Array.isArray(value)){
//替换
y.content=value[0]
if(value[imgIndex--]) y.src=value[imgIndex--]
}
}
})
......@@ -185,7 +216,8 @@ const GetTripFiledData = async (status) =>{
// 获取行程模版数据
const GetTripTemplate = async () =>{
if(!queryObj.value.TempId) {
console.log('模版数据------')
if(!searchData.value.TempId) {
let list = [
{
id: 'test-slide-1',
......@@ -201,7 +233,7 @@ const GetTripTemplate = async () =>{
}
try {
let queryMsg = {
TempId:queryObj.value.TempId
TempId:searchData.value.TempId
}
let dataRes = await ConfigService.GetTripTemplateSlide(queryMsg);
if (dataRes.data.resultCode == 1) {
......@@ -237,8 +269,11 @@ const GetTripTemplate = async () =>{
queryObj.value.ColorStr = dataRes.data.data.ColorStr
queryObj.value.TempType = dataRes.data.data.TempType
slidesStore.updateSlideIndex(0)
if(ConfigId.value==0) return
await GetTripFiledData(1)
if(ConfigId.value==0||TempId.value) {
if(TempId.value) await GetTripConfig()
return
}
await GetTripFiledData()
}
} catch (error) {
console.log("GetTripTemplateSlide", error);
......
......@@ -197,7 +197,6 @@
const addTemplate = () =>{
marketStore.setMarket(!market)
// TempIdStore.setTempId(0)
searchData.value.TempId = 0
}
......
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