Commit 5fe29047 authored by zhengke's avatar zhengke

优化导入跟新模版是 横版竖版,优化首页模版选项

parent 62edb4e2
...@@ -121,11 +121,11 @@ const handleChange: UploadProps['onChange'] = (uploadFile, uploadFiles) => { ...@@ -121,11 +121,11 @@ const handleChange: UploadProps['onChange'] = (uploadFile, uploadFiles) => {
PSD.fromURL(url).then(async (psd:any) => { PSD.fromURL(url).then(async (psd:any) => {
thumbnails.value= await toThumbnails(psd) thumbnails.value= await toThumbnails(psd)
sliders.value = await toSlider(psd) sliders.value = await toSlider(psd)
let DrawingBoardSize = await getDrawingBoardSize(psd)
queryObj.value.TempType = DrawingBoardSize.Width>DrawingBoardSize.Height?1:2
if(searchData.value.TemplateType==2) { if(searchData.value.TemplateType==2) {
let DrawingBoardSize = await getDrawingBoardSize(psd)
queryObj.value.Width = DrawingBoardSize.Width queryObj.value.Width = DrawingBoardSize.Width
queryObj.value.Height = DrawingBoardSize.Height queryObj.value.Height = DrawingBoardSize.Height
queryObj.value.TempType = queryObj.value.Width>queryObj.value.Height?1:2
VIEWPORT_SIZE.Value = queryObj.value.Height VIEWPORT_SIZE.Value = queryObj.value.Height
VIEWPORT_VER_SIZE.Value = queryObj.value.Width VIEWPORT_VER_SIZE.Value = queryObj.value.Width
let viewportRatio = queryObj.value.Height/queryObj.value.Width let viewportRatio = queryObj.value.Height/queryObj.value.Width
...@@ -133,6 +133,9 @@ const handleChange: UploadProps['onChange'] = (uploadFile, uploadFiles) => { ...@@ -133,6 +133,9 @@ const handleChange: UploadProps['onChange'] = (uploadFile, uploadFiles) => {
}else { }else {
VIEWPORT_SIZE.Value = 1754 VIEWPORT_SIZE.Value = 1754
VIEWPORT_VER_SIZE.Value = 1240 VIEWPORT_VER_SIZE.Value = 1240
let viewportRatio = 1.414
if(queryObj.value.TempType==1) viewportRatio = 0.7069
useSlidesStore().setViewportRatio(viewportRatio)
} }
fonts.value = getFonts(psd) fonts.value = getFonts(psd)
if(fonts.value){ if(fonts.value){
......
...@@ -65,21 +65,24 @@ export const ResolvePsdToSliderHandler = async (psd:any) => { ...@@ -65,21 +65,24 @@ export const ResolvePsdToSliderHandler = async (psd:any) => {
export const ResolvePsdDrawingBoardSize= async (psd:any) => { export const ResolvePsdDrawingBoardSize= async (psd:any) => {
let items:Array<any> = psd.tree().children().filter((x:any)=>x.layer.visible) let items:Array<any> = psd.tree().children().filter((x:any)=>x.layer.visible)
let DrawingBoardSize = {
Width: 0,
Height: 0
}
if(items && items.length>0){ if(items && items.length>0){
for (let i = 0; i < items.length; i++) { for (let i = 0; i < items.length; i++) {
const x = items[i]; const x = items[i];
const {_children} = x const {_children} = x
if(_children && _children.length>0){ if(_children && _children.length>0){
let DrawingBoardSize = { DrawingBoardSize = {
Width: x.layer.artboard().export().coords.right-x.layer.artboard().export().coords.left, Width: x.layer.artboard().export().coords.right-x.layer.artboard().export().coords.left,
Height: x.layer.artboard().export().coords.bottom-x.layer.artboard().export().coords.top Height: x.layer.artboard().export().coords.bottom-x.layer.artboard().export().coords.top
} }
return DrawingBoardSize
} }
} }
} }
return DrawingBoardSize
} }
export const ResolveSliderFonts = (psd:any) => { export const ResolveSliderFonts = (psd:any) => {
......
...@@ -286,7 +286,7 @@ ...@@ -286,7 +286,7 @@
}) })
let TemplateType = 0 let TemplateType = 0
if(searchData.value.TemplateType) TemplateType = searchData.value.TemplateType if(searchData.value.TemplateType) TemplateType = searchData.value.TemplateType
if(model.value==1) TemplateType = 0 if(model.value==1) TemplateType = searchData.value.MarketTemplateType
if(ConfigId.value>0) TemplateType = 1 if(ConfigId.value>0) TemplateType = 1
const queryObj = reactive({ const queryObj = reactive({
pageIndex: 1, pageIndex: 1,
...@@ -320,7 +320,7 @@ ...@@ -320,7 +320,7 @@
// 删除模版 // 删除模版
const deleteTemplate = (item:any) => { const deleteTemplate = (item:any) => {
ElMessageBox.confirm( ElMessageBox.confirm(
'此操作将删除该模版,是否确定?', `此操作将删除该${item.TemplateType==2?'广告':'模版'},是否确定?`,
'提示', '提示',
{ {
confirmButtonText: '确定', confirmButtonText: '确定',
...@@ -368,7 +368,7 @@ ...@@ -368,7 +368,7 @@
}else{ }else{
ElMessage.warning({ ElMessage.warning({
showClose: true, showClose: true,
message: '当前模板没有预览信息,请选择其他操作', message: `当前${item.TemplateType==2?'广告':'模版'}没有预览信息,请选择其他操作`,
}) })
} }
} }
...@@ -429,6 +429,7 @@ ...@@ -429,6 +429,7 @@
//类型切换 //类型切换
const onTypeChangeHandler = (Type: string) => { const onTypeChangeHandler = (Type: string) => {
searchData.value.MarketTemplateType = Type
queryObj.TemplateType = Type; queryObj.TemplateType = Type;
queryObj.pageIndex = 1 queryObj.pageIndex = 1
queryTemplateBySearchHandler(); queryTemplateBySearchHandler();
......
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