临时 处理图片加载问题
This commit is contained in:
parent
87414ee9a8
commit
2a5390752c
|
|
@ -1,8 +1,8 @@
|
|||
# 标题
|
||||
VITE_APP_TITLE=嘉晋OMS后台管理系统
|
||||
VITE_APP_TITLE=嘉晋OMS系统
|
||||
|
||||
# 项目本地运行端口号
|
||||
VITE_PORT=80
|
||||
VITE_PORT=3001
|
||||
|
||||
# open 运行 npm run dev 时自动打开浏览器
|
||||
VITE_OPEN=true
|
||||
|
|
|
|||
|
|
@ -4,12 +4,12 @@ NODE_ENV=production
|
|||
VITE_DEV=true
|
||||
|
||||
# 请求路径
|
||||
VITE_BASE_URL='http://localhost:8080'
|
||||
VITE_BASE_URL='http://127.0.0.1:48080'
|
||||
|
||||
# 文件上传类型:server - 后端上传, client - 前端直连上传,仅支持S3服务
|
||||
VITE_UPLOAD_TYPE=server
|
||||
# 上传路径
|
||||
VITE_UPLOAD_URL='http://localhost:8080/admin-api/infra/file/upload'
|
||||
VITE_UPLOAD_URL='http://api-dashboard.yudao.iocoder.cn/admin-api/infra/file/upload'
|
||||
|
||||
# 接口地址
|
||||
VITE_API_URL=/admin-api
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
<!-- eslint-disable vue/this-in-template -->
|
||||
<template>
|
||||
<div style="max-height: 90vh; overflow:auto;">
|
||||
<div style="max-height: 90vh; overflow:auto;" v-loading="loading">
|
||||
<span>
|
||||
仅供参考(for reference only),绿色边框属于边界
|
||||
</span>
|
||||
|
|
@ -240,7 +240,8 @@ const that = reactive({
|
|||
propOrderByList: [],
|
||||
draftDesignList: [],
|
||||
draftDesignId: '',
|
||||
currentZoom: 6,
|
||||
reView: false,
|
||||
currentZoom: 1,
|
||||
changeCount: 0,
|
||||
previewUrl: "",
|
||||
ingredientInfoList: [],
|
||||
|
|
@ -394,6 +395,7 @@ const formData = ref({
|
|||
// 预览 图稿id
|
||||
const previewByDraftDesignId = async (id: string | number, propData = {}) => {
|
||||
if (id) {
|
||||
loading.value = true
|
||||
that.draftDesignId = +id;
|
||||
const res = await DraftDesignDataApi.getDraftDesignData(id)
|
||||
if (res) {
|
||||
|
|
@ -431,9 +433,13 @@ const loadConfig = (config: object, propData = {}) => {
|
|||
that.sizeInfo = that.pageConfig.editArea
|
||||
// true, conf.pageConfig, conf.data, test
|
||||
draftDesignEditRef.value.init(false, that.pageConfig, that.data, that.propInfo)
|
||||
|
||||
showPng();
|
||||
queryUseLabel();
|
||||
// 延时加载图片
|
||||
setTimeout(()=>{
|
||||
that.currentZoom = 6;
|
||||
loading.value = false
|
||||
},800)
|
||||
|
||||
}
|
||||
const queryUseLabel = (label) => {
|
||||
FileApi.getDomain().then(domain => {
|
||||
|
|
@ -448,7 +454,7 @@ const queryUseLabel = (label) => {
|
|||
}).then((data) => {
|
||||
that.ingredientInfoList = [];
|
||||
if (data.list) {
|
||||
showPng();
|
||||
|
||||
that.ingredientInfoList = data.list.map((item) => {
|
||||
return {
|
||||
value: item.value,
|
||||
|
|
@ -471,7 +477,7 @@ const queryUseLabel = (label) => {
|
|||
type: '2'
|
||||
}).then((data) => {
|
||||
that.washingInfoList = [];
|
||||
showPng();
|
||||
|
||||
if (data.list) {
|
||||
that.washingInfoList = data.list.map((item) => {
|
||||
return {
|
||||
|
|
@ -503,7 +509,7 @@ const showPng = () => {
|
|||
that.propOrderByList = info.propOrderByList;
|
||||
setTimeout(() => {
|
||||
submit();
|
||||
}, 300)
|
||||
}, 100)
|
||||
loading.value = false;
|
||||
}, {
|
||||
widthScale: that.currentZoom,
|
||||
|
|
|
|||
|
|
@ -365,10 +365,14 @@
|
|||
<div :title="item.value">
|
||||
<svg width="120" height="20">
|
||||
<!-- 使用路径绘制一条虚线 -->
|
||||
<line x1="10" y1="10" x2="190" y2="10"
|
||||
stroke="black"
|
||||
stroke-width="2"
|
||||
:stroke-dasharray="item.value"/>
|
||||
<line
|
||||
x1="10"
|
||||
y1="10"
|
||||
x2="190"
|
||||
y2="10"
|
||||
stroke="black"
|
||||
stroke-width="2"
|
||||
:stroke-dasharray="item.value"/>
|
||||
</svg>
|
||||
</div>
|
||||
</template>
|
||||
|
|
|
|||
|
|
@ -37,26 +37,22 @@ export function calcDpiFromSize( screenSize=16,opt = 'd'){
|
|||
return calcDpi(widthValue, heightValue, screenSize, opt);
|
||||
}
|
||||
const tmpImage = {}
|
||||
export function convertImageToBase64(url) {
|
||||
export function convertImageToBase64(url:string) {
|
||||
return new Promise(async (resolve)=>{
|
||||
FileApi.getDomain().then(async (domain) => {
|
||||
url = replaceDomain(domain, url)
|
||||
if(tmpImage[url]){
|
||||
resolve(tmpImage[url]);
|
||||
console.log('缓存')
|
||||
return;
|
||||
}
|
||||
try {
|
||||
const response = await fetch(url);
|
||||
const blob = await response.blob();
|
||||
const base = `data:${response.headers.get('content-type')};base64,${btoa(String.fromCharCode(...new Uint8Array(await blob.arrayBuffer())))}`
|
||||
tmpImage[url] = base
|
||||
resolve(base)
|
||||
}catch (e) {
|
||||
resolve(url);
|
||||
}
|
||||
})
|
||||
|
||||
if(tmpImage[url]){
|
||||
resolve(tmpImage[url]);
|
||||
console.log('缓存')
|
||||
return;
|
||||
}
|
||||
try {
|
||||
const response = await fetch(url);
|
||||
const blob = await response.blob();
|
||||
const base = `data:${response.headers.get('content-type')};base64,${btoa(String.fromCharCode(...new Uint8Array(await blob.arrayBuffer())))}`
|
||||
tmpImage[url] = base
|
||||
resolve(base)
|
||||
}catch (e) {
|
||||
resolve(url);
|
||||
}
|
||||
})
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue