Commit 98c8b50b authored by zhengke's avatar zhengke

修复 替换本地图 的比例

parent 54d70992
......@@ -21,10 +21,17 @@ class ConfigService{
/**
* 新增修改模版数据
*/
static async SetSetTripConfig(params : any):Promise<HttpResponse>{
static async SetTripConfig(params : any):Promise<HttpResponse>{
return Api.Post("triptemplate_SetTripConfig",params)
}
/**
* 删除模版
*/
static async SetDeleteTripTemplate(params : any):Promise<HttpResponse>{
return Api.Post("triptemplate_RemoveTripTemplate",params)
}
/**
* 新增修改模版
*/
......
......@@ -199,7 +199,9 @@ const setImgs = async () => {
maxWidth = VIEWPORT_VER_SIZE
maxHeight = VIEWPORT_SIZE
}
let tempSize = await FileService.getImageSizeWithoutDownloading(propsDatas.value.src)
let tempSize = null
if(activeName.value==1||activeName.value==3){
tempSize = await FileService.getImageSizeWithoutDownloading(propsDatas.value.src)
if(tempSize.width>maxWidth){
let ratio = maxWidth/tempSize.width
tempSize.width = maxWidth
......@@ -214,11 +216,32 @@ const setImgs = async () => {
if(y.top<0)y.top=0
y.width = tempSize.width
y.height = tempSize.height
}else{
var img = new Image()
img.src = propsDatas.value.src
img.onload = () => {
if(img.width>maxWidth){
let ratio = maxWidth/img.width
img.width = maxWidth
img.height = img.height*ratio
}
if(img.height>maxHeight){
let ratio = maxHeight/img.height
img.height = maxHeight
img.width = img.width*ratio
}
if(y.left<0)y.left=0
if(y.top<0)y.top=0
y.width = img.width
y.height = img.height
}
y.src = propsDatas.value.src
y.fixedRatio = true
}
}
}
}
slidesStore.updateElement({ id: handleElementId.value, props:propsDatas.value })
addHistorySnapshot()
close()
......
......@@ -312,7 +312,7 @@ const SetTripTemplateConfig = async () => {
TempId: queryObj.value.TempId,
TempData: queryObj.value.TempData,
}
let TemplateRes = await ConfigService.SetSetTripConfig(queryMsg);
let TemplateRes = await ConfigService.SetTripConfig(queryMsg);
if (TemplateRes.data.resultCode == 1) {
if(!ConfigId.value){
ConfigIdStore.value = TemplateRes.data.data.ConfigId
......
......@@ -71,15 +71,17 @@
<div class="MarketIndexListBox bg-white rounded">
<div class="MarketIndexList-Hover">
<div>
<el-button type="primary"
style="color: #ffff;"
@click="getTemplate(item)">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;详情&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</el-button>
<el-button class="MarketIndexButtom" type="primary"
@click="getTemplate(item)">详情</el-button>
</div>
<div class="q-mt-lg">
<el-button type="primary"
style="color: #ffff;"
<el-button class="MarketIndexButtom" type="primary"
@click="goToTemplate(item)">选择该模版</el-button>
</div>
<div class="q-mt-lg" v-if="model==1">
<el-button class="MarketIndexButtom" type="primary"
@click="deleteTemplate(item)">删除</el-button>
</div>
</div>
<div class="MarketIndexList-img">
<img :src="item.CoverImg" class="rounded" />
......@@ -122,7 +124,7 @@
import { injectKeyTemplate } from '@/types/injectKey'
import LayoutPool from './LayoutPool.vue'
import { ElMessage } from "element-plus";
import { ElLoading, ElMessage, ElMessageBox } from "element-plus";
const {
userInfo
......@@ -136,6 +138,7 @@ import { ElMessage } from "element-plus";
const currentPage = ref(1 as Number);
const showCurrentTemplate = ref<any>()
const deleteLoading = ref<any>(null)
const datas = reactive({
TemplateRow: {},
DetailsVisible: false,
......@@ -166,6 +169,39 @@ import { ElMessage } from "element-plus";
searchData.value.TempId = 0
}
// 删除模版
const deleteTemplate = (item:any) => {
ElMessageBox.confirm(
'此操作将删除该模版,是否确定?',
'提示',
{
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
}
).then(() => {
try {
let queryMsg = {
TempId: item.TempId
}
deleteLoading.value = ElLoading.service()
let dataRes = ConfigService.SetDeleteTripTemplate(queryMsg);
if (dataRes.data.resultCode == 1) {
queryObj.pageIndex == 1
deleteLoading.value.close()
deleteLoading.value = null
ElMessage({
showClose: true,
message: '删除模版成功',
type: 'success',
})
queryTemplateBySearchHandler()
}
} catch (error) {}
}).catch(() => {})
}
// 查看所有子模版
const getTemplate = async (item:any) => {
......@@ -396,6 +432,10 @@ import { ElMessage } from "element-plus";
margin-right: 30px;
margin-top: 5px;
}
.MarketIndexButtom{
color: #ffff;
width: 92px;
}
.layout-item{
width: 180px;
}
......
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