mirror of
https://github.com/palxiao/poster-design.git
synced 2025-07-15 16:02:19 +08:00
update: res data
This commit is contained in:
parent
2d3b7a808f
commit
0af432a8d0
@ -1,13 +0,0 @@
|
|||||||
|
|
||||||
import axios from 'axios'
|
|
||||||
|
|
||||||
const httpRequest = axios.create({
|
|
||||||
maxContentLength: Infinity,
|
|
||||||
maxBodyLength: Infinity,
|
|
||||||
})
|
|
||||||
|
|
||||||
httpRequest.interceptors.response.use((config) => {
|
|
||||||
return config.data
|
|
||||||
})
|
|
||||||
|
|
||||||
export default httpRequest
|
|
@ -74,24 +74,5 @@ export const rndNum = (n: number, m: number) => {
|
|||||||
const random = Math.floor(Math.random() * (m - n + 1) + n)
|
const random = Math.floor(Math.random() * (m - n + 1) + n)
|
||||||
return random
|
return random
|
||||||
}
|
}
|
||||||
/** 检测苹果手机 */
|
|
||||||
// export const isIOS = () => {
|
|
||||||
// const u = navigator.userAgent
|
|
||||||
// // var isAndroid = u.indexOf('Android') > -1 || u.indexOf('Adr') > -1; // android终端
|
|
||||||
// const isiOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/) // ios终端
|
|
||||||
// return isiOS
|
|
||||||
// }
|
|
||||||
/**
|
|
||||||
* 判断是否微信客户端
|
|
||||||
*/
|
|
||||||
// export const isWX = () => {
|
|
||||||
// const ua = window.navigator.userAgent.toLowerCase()
|
|
||||||
// const match = String(ua.match(/MicroMessenger/i)) || ''
|
|
||||||
// if (match === 'micromessenger') {
|
|
||||||
// return true
|
|
||||||
// } else {
|
|
||||||
// return false
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
export default {}
|
export default {}
|
||||||
|
@ -84,7 +84,7 @@ export default defineComponent({
|
|||||||
}
|
}
|
||||||
} catch (e) {}
|
} catch (e) {}
|
||||||
})
|
})
|
||||||
// TODO: 背景图无法检测是否加载完毕,考虑应该将设置背景作为独立事件
|
// TODO优化: 背景图无法检测是否加载完毕,考虑应该将设置背景作为独立事件
|
||||||
if (content.page.backgroundImage) {
|
if (content.page.backgroundImage) {
|
||||||
const preloadBg = new Preload([content.page.backgroundImage])
|
const preloadBg = new Preload([content.page.backgroundImage])
|
||||||
await preloadBg.imgs()
|
await preloadBg.imgs()
|
||||||
@ -127,7 +127,7 @@ export default defineComponent({
|
|||||||
async font2style(fontContent: any, fontData: any = []) {
|
async font2style(fontContent: any, fontData: any = []) {
|
||||||
return new Promise((resolve: Function) => {
|
return new Promise((resolve: Function) => {
|
||||||
Promise.all(
|
Promise.all(
|
||||||
// 拿到字体子集,只有ttf/otf这种原始字体支持提取,如没有则不能实现此步,只能加载整个字体文件
|
// 拿到字体子集。只有ttf/otf这种原始字体支持提取,如服务端不具备该功能则没有此步骤,在页面加载整个字体。
|
||||||
Object.keys(fontContent).map(async (key) => {
|
Object.keys(fontContent).map(async (key) => {
|
||||||
const font = fontData.find((font: any) => font.value === key) as any
|
const font = fontData.find((font: any) => font.value === key) as any
|
||||||
if (font.id) {
|
if (font.id) {
|
||||||
|
@ -52,7 +52,7 @@ import HeaderOptions from './components/HeaderOptions.vue'
|
|||||||
import ProgressLoading from '@/components/common/ProgressLoading/index.vue'
|
import ProgressLoading from '@/components/common/ProgressLoading/index.vue'
|
||||||
|
|
||||||
const beforeUnload = function (e: any) {
|
const beforeUnload = function (e: any) {
|
||||||
const confirmationMessage = '系统可能不会保存您修改的内容'
|
const confirmationMessage = '系统不会自动保存您未修改的内容'
|
||||||
;(e || window.event).returnValue = confirmationMessage // Gecko and Trident
|
;(e || window.event).returnValue = confirmationMessage // Gecko and Trident
|
||||||
return confirmationMessage // Gecko and WebKit
|
return confirmationMessage // Gecko and WebKit
|
||||||
}
|
}
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
* @Date: 2022-01-10 14:57:53
|
* @Date: 2022-01-10 14:57:53
|
||||||
* @Description: Psd文件解析
|
* @Description: Psd文件解析
|
||||||
* @LastEditors: ShawnPhang <site: book.palxp.com>
|
* @LastEditors: ShawnPhang <site: book.palxp.com>
|
||||||
* @LastEditTime: 2023-07-14 00:51:19
|
* @LastEditTime: 2023-07-25 15:56:22
|
||||||
-->
|
-->
|
||||||
<template>
|
<template>
|
||||||
<div id="page-design-index" ref="pageDesignIndex">
|
<div id="page-design-index" ref="pageDesignIndex">
|
||||||
@ -12,8 +12,8 @@
|
|||||||
<div class="top-left">
|
<div class="top-left">
|
||||||
<div class="name" style="font-size: 15px">在线PSD解析</div>
|
<div class="name" style="font-size: 15px">在线PSD解析</div>
|
||||||
</div>
|
</div>
|
||||||
<div style="flex: 1"><el-button plain type="primary" @click="jump2word">说明及PSD规范文档</el-button></div>
|
<div style="flex: 1"><el-button plain type="primary" @click="jump2word">说明文档及PSD规范</el-button></div>
|
||||||
<el-button v-show="isDone" @click="clear">清空模板内容</el-button>
|
<el-button v-show="isDone" @click="clear">清空模板</el-button>
|
||||||
<div class="v-tips">
|
<div class="v-tips">
|
||||||
<HeaderOptions :isDone="isDone" @change="optionsChange" />
|
<HeaderOptions :isDone="isDone" @change="optionsChange" />
|
||||||
</div>
|
</div>
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
* @Date: 2022-01-12 11:26:53
|
* @Date: 2022-01-12 11:26:53
|
||||||
* @Description: 顶部操作按钮组
|
* @Description: 顶部操作按钮组
|
||||||
* @LastEditors: ShawnPhang <site: book.palxp.com>
|
* @LastEditors: ShawnPhang <site: book.palxp.com>
|
||||||
* @LastEditTime: 2023-07-17 10:45:09
|
* @LastEditTime: 2023-07-25 16:02:13
|
||||||
-->
|
-->
|
||||||
<template>
|
<template>
|
||||||
<div class="top-title"><el-input v-model="title" placeholder="未命名的设计" class="input-wrap" /></div>
|
<div class="top-title"><el-input v-model="title" placeholder="未命名的设计" class="input-wrap" /></div>
|
||||||
@ -74,36 +74,6 @@ export default defineComponent({
|
|||||||
const { stat } = await api.home.saveTemp({ id: tempid, title: proxy.title || '未命名模板', content: JSON.stringify({ page: proxy.dPage, widgets: proxy.dWidgets }), width: proxy.dPage.width, height: proxy.dPage.height })
|
const { stat } = await api.home.saveTemp({ id: tempid, title: proxy.title || '未命名模板', content: JSON.stringify({ page: proxy.dPage, widgets: proxy.dWidgets }), width: proxy.dPage.width, height: proxy.dPage.height })
|
||||||
stat != 0 && useNotification('保存成功', '模板内容已变更')
|
stat != 0 && useNotification('保存成功', '模板内容已变更')
|
||||||
}
|
}
|
||||||
// 保存前处理数据校正
|
|
||||||
// function reviseData() {
|
|
||||||
// const data = JSON.parse(JSON.stringify(proxy.dWidgets))
|
|
||||||
// for (let i = 0; i < data.length; i++) {
|
|
||||||
// if (!data[i].cache) {
|
|
||||||
// continue
|
|
||||||
// }
|
|
||||||
// const valueLeft = data[i].cache.left
|
|
||||||
// const valueTop = data[i].cache.top
|
|
||||||
// const widget = data[i]
|
|
||||||
// if (widget.isContainer) {
|
|
||||||
// let dL = widget.left - valueLeft
|
|
||||||
// let dT = widget.top - valueTop
|
|
||||||
// const len = data.length
|
|
||||||
// for (let i = 0; i < len; ++i) {
|
|
||||||
// const child = data[i]
|
|
||||||
// if (child.parent === widget.uuid) {
|
|
||||||
// const t = child['left']
|
|
||||||
// child.left -= dL
|
|
||||||
// child.top -= dT
|
|
||||||
// console.log(child.left, t, dL)
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// data[i].left = valueLeft
|
|
||||||
// data[i].top = valueTop
|
|
||||||
// delete data[i].cache
|
|
||||||
// }
|
|
||||||
// return data
|
|
||||||
// }
|
|
||||||
// 停用启用
|
// 停用启用
|
||||||
async function stateChange(e: any) {
|
async function stateChange(e: any) {
|
||||||
const { tempid } = route.query
|
const { tempid } = route.query
|
||||||
@ -161,11 +131,6 @@ export default defineComponent({
|
|||||||
computed: {
|
computed: {
|
||||||
...mapGetters(['dPage', 'dWidgets', 'tempEditing', 'dHistory', 'dPageHistory']),
|
...mapGetters(['dPage', 'dWidgets', 'tempEditing', 'dHistory', 'dPageHistory']),
|
||||||
},
|
},
|
||||||
// watch: {
|
|
||||||
// tempEditing(val) {
|
|
||||||
// console.log(val)
|
|
||||||
// },
|
|
||||||
// },
|
|
||||||
methods: {
|
methods: {
|
||||||
...mapActions(['pushHistory']),
|
...mapActions(['pushHistory']),
|
||||||
async load(id: any, tempId: any, cb: Function) {
|
async load(id: any, tempId: any, cb: Function) {
|
||||||
@ -202,9 +167,6 @@ export default defineComponent({
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="less" scoped>
|
<style lang="less" scoped>
|
||||||
// .wrap {
|
|
||||||
// padding: 0 1rem;
|
|
||||||
// }
|
|
||||||
.top-icon-wrap {
|
.top-icon-wrap {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user