mirror of
https://github.com/palxiao/poster-design.git
synced 2025-07-15 16:02:19 +08:00
fix: mask image load
This commit is contained in:
parent
5546174bc0
commit
1248258537
@ -35,5 +35,3 @@ export const getWorks = (params: Type.Object = {}) => fetch('design/poster', par
|
||||
|
||||
// 作品列表
|
||||
export const getMyDesign = (params: Type.Object = {}) => fetch('design/my', params, 'get')
|
||||
|
||||
export const test = (params: Type.Object = {}) => fetch('https://res.palxp.com/api/upload', params, 'post')
|
||||
|
@ -48,7 +48,6 @@ export default defineComponent({
|
||||
const { data } = await api.home[id ? 'getWorks' : 'getTempDetail']({ id: id || tempid })
|
||||
const content = JSON.parse(data)
|
||||
|
||||
content.page.backgroundImage && content.page.backgroundImage.split('.')[1] === 'palxp' && (content.page.backgroundImage += '@small')
|
||||
this.$store.commit('setDPage', content.page)
|
||||
id ? this.$store.commit('setDWidgets', content.widgets) : this.setTemplate(content.widgets)
|
||||
await this.$nextTick()
|
||||
@ -75,7 +74,7 @@ export default defineComponent({
|
||||
if (item.imgUrl && !item.isNinePatch) {
|
||||
const cNodes: any = (window as any).document.getElementById(item.uuid).childNodes
|
||||
for (const el of cNodes) {
|
||||
if (el.className === 'img__box') {
|
||||
if (el.className && el.className.includes('img__box')) {
|
||||
imgsData.push(el.firstChild)
|
||||
}
|
||||
}
|
||||
@ -85,7 +84,11 @@ export default defineComponent({
|
||||
}
|
||||
} catch (e) {}
|
||||
})
|
||||
|
||||
// TODO: 背景图无法检测是否加载完毕,考虑应该将设置背景作为独立事件
|
||||
if (content.page.backgroundImage) {
|
||||
const preloadBg = new Preload([content.page.backgroundImage])
|
||||
await preloadBg.imgs()
|
||||
}
|
||||
try {
|
||||
const { list } = await api.material.getFonts({ ids: fontData.map((x: any) => x.id) })
|
||||
fontData.forEach((item: any) => {
|
||||
@ -124,7 +127,7 @@ export default defineComponent({
|
||||
async font2style(fontContent: any, fontData: any = []) {
|
||||
return new Promise((resolve: Function) => {
|
||||
Promise.all(
|
||||
// 拿到字体子集,只有ttf这种原始字体支持提取,如没有则只能加载整个字体文件
|
||||
// 拿到字体子集,只有ttf/otf这种原始字体支持提取,如没有则不能实现此步,只能加载整个字体文件
|
||||
Object.keys(fontContent).map(async (key) => {
|
||||
const font = fontData.find((font: any) => font.value === key) as any
|
||||
if (font.id) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user