diff --git a/src/router/index.js b/src/router/index.js index 8aa15d6..c8f0058 100755 --- a/src/router/index.js +++ b/src/router/index.js @@ -19,6 +19,7 @@ const blackHeaderList = [ ]; const blackFooterList = [ '/', '/franchise', '/register', '/agent/siteAdd', '/agent/payInfoSetting','/agent/siteServiceEdit','/agent/siteAddFinally','/agent/siteServiceAdd', + '/agent/siteTemplate' ]; // const whiteSlideList = ['/', '/ui', // '/agent/siteList', diff --git a/src/utils/icoConverter.js b/src/utils/icoConverter.js new file mode 100644 index 0000000..1b03eaf --- /dev/null +++ b/src/utils/icoConverter.js @@ -0,0 +1,29 @@ +export async function convertIcoToPng(file) { + // 1. 创建ICO的Blob URL + const icoUrl = URL.createObjectURL(file) + + // 2. 加载到Image对象 + const img = await new Promise((resolve, reject) => { + const img = new Image() + img.onload = () => resolve(img) + img.onerror = reject + img.src = icoUrl + }) + + // 3. 绘制到Canvas + const canvas = document.createElement('canvas') + canvas.width = img.width + canvas.height = img.height + const ctx = canvas.getContext('2d') + ctx.drawImage(img, 0, 0) + + // 4. 转换为PNG + const pngDataUrl = canvas.toDataURL('image/png') + URL.revokeObjectURL(icoUrl) // 释放内存 + + return { + dataUrl: pngDataUrl, + width: img.width, + height: img.height + } + } \ No newline at end of file diff --git a/src/views/agent/siteTemplate.vue b/src/views/agent/siteTemplate.vue index 7b54885..b1130e6 100644 --- a/src/views/agent/siteTemplate.vue +++ b/src/views/agent/siteTemplate.vue @@ -1,102 +1,440 @@