mirror of
https://github.com/palxiao/poster-design.git
synced 2025-07-15 16:02:19 +08:00
merge: main branch
This commit is contained in:
commit
9e2e9228a8
6
package-lock.json
generated
6
package-lock.json
generated
@ -21,6 +21,7 @@
|
|||||||
"element-plus": "^2.3.7",
|
"element-plus": "^2.3.7",
|
||||||
"fontfaceobserver": "^2.1.0",
|
"fontfaceobserver": "^2.1.0",
|
||||||
"html2canvas": "^1.4.1",
|
"html2canvas": "^1.4.1",
|
||||||
|
"mitt": "^3.0.1",
|
||||||
"moveable": "^0.26.0",
|
"moveable": "^0.26.0",
|
||||||
"moveable-helper": "^0.4.0",
|
"moveable-helper": "^0.4.0",
|
||||||
"nanoid": "^3.1.23",
|
"nanoid": "^3.1.23",
|
||||||
@ -3014,6 +3015,11 @@
|
|||||||
"url": "https://github.com/sponsors/isaacs"
|
"url": "https://github.com/sponsors/isaacs"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/mitt": {
|
||||||
|
"version": "3.0.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/mitt/-/mitt-3.0.1.tgz",
|
||||||
|
"integrity": "sha512-vKivATfr97l2/QBCYAkXYDbrIWPM2IIKEl7YPhjCvKlG3kE2gm+uBo6nEXK3M5/Ffh/FLpKExzOQ3JJoJGFKBw=="
|
||||||
|
},
|
||||||
"node_modules/moveable": {
|
"node_modules/moveable": {
|
||||||
"version": "0.26.0",
|
"version": "0.26.0",
|
||||||
"resolved": "https://registry.npmjs.org/moveable/-/moveable-0.26.0.tgz",
|
"resolved": "https://registry.npmjs.org/moveable/-/moveable-0.26.0.tgz",
|
||||||
|
@ -24,6 +24,7 @@
|
|||||||
"element-plus": "^2.3.7",
|
"element-plus": "^2.3.7",
|
||||||
"fontfaceobserver": "^2.1.0",
|
"fontfaceobserver": "^2.1.0",
|
||||||
"html2canvas": "^1.4.1",
|
"html2canvas": "^1.4.1",
|
||||||
|
"mitt": "^3.0.1",
|
||||||
"moveable": "^0.26.0",
|
"moveable": "^0.26.0",
|
||||||
"moveable-helper": "^0.4.0",
|
"moveable-helper": "^0.4.0",
|
||||||
"nanoid": "^3.1.23",
|
"nanoid": "^3.1.23",
|
||||||
|
@ -8,14 +8,15 @@
|
|||||||
// import store from '@/store'
|
// import store from '@/store'
|
||||||
// import { getImage } from '../getImgDetail'
|
// import { getImage } from '../getImgDetail'
|
||||||
import setImageData from '@/common/methods/DesignFeatures/setImage'
|
import setImageData from '@/common/methods/DesignFeatures/setImage'
|
||||||
import wText from '@/components/modules/widgets/wText/wText.vue'
|
// import wText from '@/components/modules/widgets/wText/wText.vue'
|
||||||
|
import { wTextSetting } from '@/components/modules/widgets/wText/wTextSetting'
|
||||||
import wImage from '@/components/modules/widgets/wImage/wImage.vue'
|
import wImage from '@/components/modules/widgets/wImage/wImage.vue'
|
||||||
import wSvg from '@/components/modules/widgets/wSvg/wSvg.vue'
|
import wSvg from '@/components/modules/widgets/wSvg/wSvg.vue'
|
||||||
|
|
||||||
export default async function(type: string, item: TCommonItemData, data: Record<string, any>) {
|
export default async function(type: string, item: TCommonItemData, data: Record<string, any>) {
|
||||||
let setting = data
|
let setting = data
|
||||||
if (type === 'text') {
|
if (type === 'text') {
|
||||||
!item.fontFamily && !item.color ? (setting = JSON.parse(JSON.stringify(wText.setting))) : (setting = item)
|
!item.fontFamily && !item.color ? (setting = JSON.parse(JSON.stringify(wTextSetting))) : (setting = item)
|
||||||
!setting.text ? (setting.text = '双击编辑文字') : (setting.text = decodeURIComponent(setting.text)) // item.text
|
!setting.text ? (setting.text = '双击编辑文字') : (setting.text = decodeURIComponent(setting.text)) // item.text
|
||||||
setting.fontSize = item.fontSize
|
setting.fontSize = item.fontSize
|
||||||
setting.width = item.width || item.fontSize * setting.text.length
|
setting.width = item.width || item.fontSize * setting.text.length
|
||||||
|
@ -50,6 +50,7 @@ import photoList from './components/photoList.vue'
|
|||||||
import imgWaterFall from './components/imgWaterFall.vue'
|
import imgWaterFall from './components/imgWaterFall.vue'
|
||||||
import { TUploadDoneData } from '@/components/common/Uploader/index.vue'
|
import { TUploadDoneData } from '@/components/common/Uploader/index.vue'
|
||||||
import { IGetTempListData } from '@/api/home'
|
import { IGetTempListData } from '@/api/home'
|
||||||
|
import eventBus from '@/utils/plugins/eventBus'
|
||||||
|
|
||||||
type TProps = {
|
type TProps = {
|
||||||
active?: number
|
active?: number
|
||||||
@ -238,6 +239,11 @@ const openPSD = () => {
|
|||||||
window.open(router.resolve('/psd').href, '_blank')
|
window.open(router.resolve('/psd').href, '_blank')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
eventBus.on('refreshUserImages', () => {
|
||||||
|
state.imgList = []
|
||||||
|
load(true)
|
||||||
|
})
|
||||||
|
|
||||||
defineExpose({
|
defineExpose({
|
||||||
selectDesign,
|
selectDesign,
|
||||||
loadDesign,
|
loadDesign,
|
||||||
|
@ -17,7 +17,8 @@ import Qiniu from '@/common/methods/QiNiu'
|
|||||||
import _config from '@/config'
|
import _config from '@/config'
|
||||||
import { getImage } from '@/common/methods/getImgDetail'
|
import { getImage } from '@/common/methods/getImgDetail'
|
||||||
import wImage from '@/components/modules/widgets/wImage/wImage.vue'
|
import wImage from '@/components/modules/widgets/wImage/wImage.vue'
|
||||||
import wText from '@/components/modules/widgets/wText/wText.vue'
|
import { wTextSetting } from '@/components/modules/widgets/wText/wTextSetting'
|
||||||
|
import eventBus from '@/utils/plugins/eventBus'
|
||||||
|
|
||||||
export default () => {
|
export default () => {
|
||||||
return new Promise<void>((resolve) => {
|
return new Promise<void>((resolve) => {
|
||||||
@ -38,6 +39,8 @@ export default () => {
|
|||||||
const { width, height }: any = await getImage(file)
|
const { width, height }: any = await getImage(file)
|
||||||
const url = _config.IMG_URL + result.key
|
const url = _config.IMG_URL + result.key
|
||||||
await api.material.addMyPhoto({ width, height, url })
|
await api.material.addMyPhoto({ width, height, url })
|
||||||
|
// 刷新用户列表
|
||||||
|
eventBus.emit('refreshUserImages')
|
||||||
// 添加图片到画布中
|
// 添加图片到画布中
|
||||||
store.commit('setShowMoveable', false) // 清理掉上一次的选择
|
store.commit('setShowMoveable', false) // 清理掉上一次的选择
|
||||||
const setting = JSON.parse(JSON.stringify(wImage.setting))
|
const setting = JSON.parse(JSON.stringify(wImage.setting))
|
||||||
@ -54,10 +57,14 @@ export default () => {
|
|||||||
'text/plain': new Blob([''], {type: 'text/plain'})
|
'text/plain': new Blob([''], {type: 'text/plain'})
|
||||||
})
|
})
|
||||||
])
|
])
|
||||||
|
// 最后尝试复制,将图片替换为图片组件
|
||||||
|
setTimeout(() => {
|
||||||
|
store.dispatch('copyWidget')
|
||||||
|
}, 100)
|
||||||
break
|
break
|
||||||
} else if (item.types.toString().indexOf('text') !== -1) {
|
} else if (item.types.toString().indexOf('text') !== -1) {
|
||||||
store.commit('setShowMoveable', false) // 清理掉上一次的选择
|
store.commit('setShowMoveable', false) // 清理掉上一次的选择
|
||||||
const setting = JSON.parse(JSON.stringify(wText.setting))
|
const setting = JSON.parse(JSON.stringify(wTextSetting))
|
||||||
setting.text = await navigator.clipboard.readText()
|
setting.text = await navigator.clipboard.readText()
|
||||||
store.dispatch('addWidget', setting)
|
store.dispatch('addWidget', setting)
|
||||||
break
|
break
|
||||||
|
@ -291,6 +291,7 @@ export default {
|
|||||||
}
|
}
|
||||||
|
|
||||||
store.dispatch('pushHistory', 'pasteWidget')
|
store.dispatch('pushHistory', 'pasteWidget')
|
||||||
|
store.dispatch('copyWidget')
|
||||||
store.dispatch('reChangeCanvas')
|
store.dispatch('reChangeCanvas')
|
||||||
},
|
},
|
||||||
// TODO: 选中元件与取消选中
|
// TODO: 选中元件与取消选中
|
||||||
|
9
src/utils/plugins/eventBus.ts
Normal file
9
src/utils/plugins/eventBus.ts
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
import mitt from 'mitt';
|
||||||
|
|
||||||
|
type Events = {
|
||||||
|
refreshUserImages: any;
|
||||||
|
};
|
||||||
|
|
||||||
|
const emitter = mitt<Events>();
|
||||||
|
|
||||||
|
export default emitter;
|
@ -12,7 +12,7 @@
|
|||||||
import { StyleValue, onMounted, reactive, nextTick } from 'vue'
|
import { StyleValue, onMounted, reactive, nextTick } from 'vue'
|
||||||
import { useStore } from 'vuex'
|
import { useStore } from 'vuex'
|
||||||
import api from '@/api'
|
import api from '@/api'
|
||||||
import wGroup from '@/components/modules/widgets/wGroup/wGroup.vue'
|
// import wGroup from '@/components/modules/widgets/wGroup/wGroup.vue'
|
||||||
import Preload from '@/utils/plugins/preload'
|
import Preload from '@/utils/plugins/preload'
|
||||||
import FontFaceObserver from 'fontfaceobserver'
|
import FontFaceObserver from 'fontfaceobserver'
|
||||||
import { fontWithDraw, font2style } from '@/utils/widgets/loadFontRule'
|
import { fontWithDraw, font2style } from '@/utils/widgets/loadFontRule'
|
||||||
|
@ -67,7 +67,7 @@ import zoomControl from '@/components/modules/layout/zoomControl/index.vue'
|
|||||||
import lineGuides from '@/components/modules/layout/lineGuides.vue'
|
import lineGuides from '@/components/modules/layout/lineGuides.vue'
|
||||||
|
|
||||||
import shortcuts from '@/mixins/shortcuts'
|
import shortcuts from '@/mixins/shortcuts'
|
||||||
import wGroup from '@/components/modules/widgets/wGroup/wGroup.vue'
|
// import wGroup from '@/components/modules/widgets/wGroup/wGroup.vue'
|
||||||
import HeaderOptions from './components/HeaderOptions.vue'
|
import HeaderOptions from './components/HeaderOptions.vue'
|
||||||
import ProgressLoading from '@/components/common/ProgressLoading/index.vue'
|
import ProgressLoading from '@/components/common/ProgressLoading/index.vue'
|
||||||
import { useSetupMapGetters } from '@/common/hooks/mapGetters'
|
import { useSetupMapGetters } from '@/common/hooks/mapGetters'
|
||||||
|
@ -38,7 +38,7 @@ import { useFontStore } from '@/common/methods/fonts'
|
|||||||
import copyRight from './CopyRight.vue'
|
import copyRight from './CopyRight.vue'
|
||||||
import _config from '@/config'
|
import _config from '@/config'
|
||||||
import useConfirm from '@/common/methods/confirm'
|
import useConfirm from '@/common/methods/confirm'
|
||||||
import wGroup from '@/components/modules/widgets/wGroup/wGroup.vue'
|
// import wGroup from '@/components/modules/widgets/wGroup/wGroup.vue'
|
||||||
import { useSetupMapGetters } from '@/common/hooks/mapGetters'
|
import { useSetupMapGetters } from '@/common/hooks/mapGetters'
|
||||||
import useUserStore from '@/store/modules/base/user'
|
import useUserStore from '@/store/modules/base/user'
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user