Skip to content

Commit

Permalink
更新模板解压
Browse files Browse the repository at this point in the history
  • Loading branch information
more-strive committed Aug 1, 2024
1 parent e8a3aa3 commit bc178dd
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/utils/crypto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,5 @@ export const unzip = (b64Data: string) => {
const binData = new Uint8Array(charData);
const data = pako.inflate(binData);
strData = new TextDecoder("utf-8").decode(data);
return decodeURIComponent(strData);
return JSON.parse(strData);
};
4 changes: 2 additions & 2 deletions src/views/Editor/CanvasCenter/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ const getTemplateDetail = async (pk: number) => {
const result = await getTemplateData(pk)
if (result.data && result.data.code === 200 && result.data.data) {
try {
const templateData = unzip(result.data.data.data)
const data = JSON.parse(templateData)
const data = unzip(result.data.data.data)
// const data = JSON.parse(templateData)
console.log('data:', data)
await templatesStore.changeTemplate(data)
}
Expand Down
4 changes: 2 additions & 2 deletions src/views/Editor/CanvasLeft/Menu/components/TemplatePool.vue
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,8 @@ const handleChangeTemplate = (item: TemplateItem) => {
}
)
.then(async () => {
const templateData = unzip(item.data)
const data = JSON.parse(templateData)
const data = unzip(item.data)
// const data = JSON.parse(templateData)
console.log('data:', data)
const loadingInstance = ElLoading.service({ fullscreen: true, background: 'rgba(122, 122, 122, 0.5)' })
await templatesStore.changeTemplate(data)
Expand Down

0 comments on commit bc178dd

Please sign in to comment.