Commit bd6b6235 authored by 罗超's avatar 罗超

新增是否裁剪内容的提示

parent 68170b9a
......@@ -65,7 +65,7 @@ import ThumbnailSlide from '@/views/components/ThumbnailSlide/index.vue'
import LayoutPool from './LayoutPool.vue'
import Popover from '@/components/Popover.vue'
import Draggable from 'vuedraggable'
import { ElLoading } from 'element-plus'
import { ElLoading, ElMessageBox } from 'element-plus'
import FileService from '@/services/FileService'
import { VIEWPORT_SIZE, VIEWPORT_VER_SIZE } from '@/configs/canvas'
......@@ -175,6 +175,16 @@ const GetTripFiledData = async () =>{
text:'正在渲染团队数据',
lock:true
})
let isHideOverflowText = false
try {
await ElMessageBox.confirm('行程数据可能会超出模板预设宽度或高度,是否自动裁剪','提示',{
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
closeOnClickModal:false
})
isHideOverflowText = true
} catch (error) {}
let maxWidth = VIEWPORT_SIZE,maxHeight = VIEWPORT_VER_SIZE, viewportRatio = slidesStore.viewportRatio
if(viewportRatio<1){
maxWidth = VIEWPORT_VER_SIZE
......@@ -223,11 +233,18 @@ const GetTripFiledData = async () =>{
}
if(value && typeof(value) == 'string'){
//替换
y.content= y.content.replace(getHtmlPlainText(y.content),value)
if(isHideOverflowText){
const maxLength = getHtmlPlainText(y.content).length
const newValue = maxLength<value.length?value.substring(0,maxLength):value
console.log(newValue,value,maxLength)
y.content= y.content.replace(getHtmlPlainText(y.content),newValue)
}else{
y.content= y.content.replace(getHtmlPlainText(y.content),value)
}
}else if(value && Array.isArray(value)){
//替换
if(y.type=='image'&&value[0]!=''){
console.log('下载图片开始',new Date().getSeconds())
try {
let tempSize = await FileService.getImageSizeWithoutDownloading(value[0])
if(tempSize.width>maxWidth){
......@@ -324,7 +341,10 @@ const GetTripTemplate = async () =>{
queryObj.value.TempType = dataRes.data.data.TempType
slidesStore.updateSlideIndex(0)
datas.DataSource.pageType = newSlides[0].pageType
if(TempId.value&&!searchData.value.TempId) await GetTripConfig()
if(TempId.value&&!searchData.value.TempId){
await GetTripConfig()
return
}
if(ConfigId.value==0) return
await GetTripFiledData()
}
......
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