Commit f08e36cd authored by zhengke's avatar zhengke

优化高清图对比

parent ec51208e
...@@ -48,7 +48,7 @@ ...@@ -48,7 +48,7 @@
const slidesStore = useSlidesStore() const slidesStore = useSlidesStore()
const { handleElement, handleElementId } = storeToRefs(mainStore) const { handleElement, handleElementId } = storeToRefs(mainStore)
const dialogFormVisible = ref(true) const dialogFormVisible = ref(true)
const dialogTitle = ref('原图/清晰图对比') const dialogTitle = ref('原图/高清图对比')
const setLoading = ref(false) const setLoading = ref(false)
const props = defineProps({ const props = defineProps({
width: { type: String, default: "500" }, width: { type: String, default: "500" },
...@@ -147,7 +147,6 @@ ...@@ -147,7 +147,6 @@
position: relative; position: relative;
display: inline-block; display: inline-block;
margin: 0 auto; margin: 0 auto;
min-height: 273px;
overflow: hidden; overflow: hidden;
} }
.before-image { .before-image {
......
...@@ -87,10 +87,11 @@ ...@@ -87,10 +87,11 @@
@success="DefinitionDatas=null"> @success="DefinitionDatas=null">
<template #left> <template #left>
<span style="position: absolute;left: 10px;top:10px;background: #fff;border-radius: 3px;padding:0 5px;width: 38px;">原图</span> <span style="position: absolute;left: 10px;top:10px;background: #fff;border-radius: 3px;padding:0 5px;width: 38px;">原图</span>
<img :src="handleImageElement.src" class="images" :style="{width: imgWidth+'px'}" /> <img :src="handleImageElement.src" class="images" :style="{width: imgWidth+'px',height: imgHeigth+'px'}" />
</template> </template>
<template #right> <template #right>
<img :src="'data:image/png;base64,'+DefinitionDatas" class="images" :style="{width: imgWidth+'px'}" /> <span style="position: absolute;right: 10px;top:10px;background: #fff;border-radius: 3px;padding:0 5px;width: 53px;">高清图</span>
<img :src="'data:image/png;base64,'+DefinitionDatas" class="images" :style="{width: imgWidth+'px',height: imgHeigth+'px'}" />
</template> </template>
</imgArticContr> </imgArticContr>
</div> </div>
...@@ -190,6 +191,7 @@ const imgWidth = ref(500) ...@@ -190,6 +191,7 @@ const imgWidth = ref(500)
const imgHeigth = ref(0) const imgHeigth = ref(0)
const getPictDef = async () =>{ const getPictDef = async () =>{
await getImgSize()
if(handleImageElement.value.src.startsWith("data:image")){ if(handleImageElement.value.src.startsWith("data:image")){
let name = new Date().getTime()+".jpg" let name = new Date().getTime()+".jpg"
const file = dataURLtoFile(handleImageElement.value.src, name) const file = dataURLtoFile(handleImageElement.value.src, name)
...@@ -225,8 +227,9 @@ const getImgSize = async () => { ...@@ -225,8 +227,9 @@ const getImgSize = async () => {
let TempSize = await FileService.getImageSizeWithoutDownloading(handleImageElement.value.src) let TempSize = await FileService.getImageSizeWithoutDownloading(handleImageElement.value.src)
let ratio = TempSize.width/imgWidth.value let ratio = TempSize.width/imgWidth.value
imgHeigth.value = TempSize.height/ratio imgHeigth.value = TempSize.height/ratio
console.log(imgHeigth.value ,'------')
} }
getImgSize()
const getLockCutRatio = () =>{ const getLockCutRatio = () =>{
keyboardStore.setCtrlKeyState(ctrlKeyState.value) keyboardStore.setCtrlKeyState(ctrlKeyState.value)
} }
......
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