Commit 0a866c0c authored by zhengke's avatar zhengke

优化 广告 模版切换 画布定位

parent fa948abc
......@@ -389,8 +389,11 @@ const GetTripTemplate = async () =>{
let dataRes = await ConfigService.GetTripTemplateSlide(queryMsg);
if (dataRes.data.resultCode == 1) {
if(SalesBack.value==0||(SalesBack.value==1&&searchData.value.TempId)){
let viewportRatios = 1.414
if(dataRes.data.data.TempType==1) viewportRatios = 0.7069
let viewportRatios = 0
if(dataRes.data.data.TemplateType!=2) {
viewportRatios = 1.414
if(dataRes.data.data.TempType==1) viewportRatios = 0.7069
}
if(dataRes.data.data.TemplateType==2&&dataRes.data.data.Width&&dataRes.data.data.Height) {
viewportRatios = dataRes.data.data.Height/dataRes.data.data.Width
queryObj.value.Width = dataRes.data.data.Width
......@@ -444,13 +447,10 @@ const GetTripTemplate = async () =>{
if(queryObj.value.Width){
VIEWPORT_SIZE.Value = queryObj.value.Height
VIEWPORT_VER_SIZE.Value = queryObj.value.Width
// if(viewportRatio.value<1) VIEWPORT_SIZE.Value = queryObj.value.Height
// else VIEWPORT_VER_SIZE.Value = queryObj.value.Width
}else {
VIEWPORT_SIZE.Value = 1754
VIEWPORT_VER_SIZE.Value = 1240
}
if(ConfigId.value==0) return
if(TempId.value&&!searchData.value.TempId) await GetTripConfig()
await GetTripFiledData()
......@@ -478,14 +478,17 @@ const sellGetTripTemplate = async () =>{
else if(TempId.value) queryObj.value.TempId = TempId.value
let dataObj = dataRes.data.data
let viewportRatios = 1.414
if(dataRes.data.data.TempType==1) viewportRatios = 0.7069
queryObj.value.TemplateType = dataRes.data.data.TemplateType
let viewportRatios = 0
if(dataRes.data.data.TemplateType!=2) {
viewportRatios = 1.414
if(dataRes.data.data.TempType==1) viewportRatios = 0.7069
}
if(dataRes.data.data.TemplateType==2&&dataRes.data.data.Width&&dataRes.data.data.Height) {
viewportRatios = dataRes.data.data.Height/dataRes.data.data.Width
queryObj.value.Width = dataRes.data.data.Width
queryObj.value.Height = dataRes.data.data.Height
}
queryObj.value.TemplateType = dataRes.data.data.TemplateType
slidesStore.setViewportRatio(viewportRatios)
if(queryObj.value.Width){
......@@ -495,7 +498,6 @@ const sellGetTripTemplate = async () =>{
VIEWPORT_SIZE.Value = 1754
VIEWPORT_VER_SIZE.Value = 1240
}
if(SalesBack.value==0) slidesStore.setTitle(dataRes.data.data.Title)
if(SalesBack.value==0&&searchData.value.sellId){
console.log(JSON.parse(dataObj.TempData))
......
......@@ -6,7 +6,7 @@
<Thumbnails class="layout-content-left" />
<div class="layout-content-center" style="overflow: hidden;">
<CanvasTool class="center-top" />
<div style="height: calc(100% - 40px);overflow: scroll;background: #f9f9f9;">
<div v-if="!reloadLoading" style="height: calc(100% - 40px);overflow: scroll;background: #f9f9f9;">
<!-- <Canvas class="center-body" :style="{ height: `calc(100% - 40px)`}" /> -->
<Canvas class="center-body" :style="{ height: '100%'}" />
</div>
......@@ -132,6 +132,15 @@ watch(() => refThumbnails.value, () => {
getDomeWH()
},1000)
})
const reloadLoading = ref(true)
const reload = () => {
setTimeout(()=>{
reloadLoading.value = false
},200)
}
// 监听viewportRatio 重新渲染画布
watch(viewportRatio, reload())
const getDomeWH = async () => {
if(refThumbnails.value){
let height = await refThumbnails.value.offsetHeight;
......
......@@ -286,6 +286,7 @@
})
let TemplateType = 0
if(searchData.value.TemplateType) TemplateType = searchData.value.TemplateType
if(model.value==1) TemplateType = 0
if(ConfigId.value>0) TemplateType = 1
const queryObj = reactive({
pageIndex: 1,
......
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