Skip to content

Commit

Permalink
chore: update
Browse files Browse the repository at this point in the history
  • Loading branch information
ntnyq committed Oct 25, 2024
1 parent 93e2fdc commit 6ef49d0
Show file tree
Hide file tree
Showing 10 changed files with 1,379 additions and 1,211 deletions.
2 changes: 1 addition & 1 deletion config/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export default defineConfig({
compiler: {
type: 'webpack5',
prebundle: {
enable: true,
enable: false,
exclude: ['@nutui/nutui-taro', '@nutui/icons-vue-taro'],
},
},
Expand Down
32 changes: 16 additions & 16 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,42 +25,42 @@
"typecheck": "vue-tsc --noEmit"
},
"dependencies": {
"@babel/runtime": "^7.25.7",
"@babel/runtime": "^7.26.0",
"@nutui/icons-vue-taro": "^0.0.9",
"@nutui/nutui-taro": "^4.3.13",
"@tarojs/components": "^4.0.6",
"@tarojs/plugin-framework-vue3": "^4.0.6",
"@tarojs/plugin-html": "^4.0.6",
"@tarojs/runtime": "^4.0.6",
"@tarojs/taro": "^4.0.6",
"@tarojs/components": "^4.0.7",
"@tarojs/plugin-framework-vue3": "^4.0.7",
"@tarojs/plugin-html": "^4.0.7",
"@tarojs/runtime": "^4.0.7",
"@tarojs/taro": "^4.0.7",
"dayjs": "^1.11.13",
"pinia": "^2.2.4",
"taro-plugin-pinia": "^1.0.0",
"vue": "^3.5.12"
},
"devDependencies": {
"@babel/core": "^7.25.8",
"@babel/core": "^7.26.0",
"@babel/plugin-proposal-class-properties": "^7.18.6",
"@ntnyq/eslint-config": "^3.1.0",
"@ntnyq/eslint-config": "^3.1.1",
"@ntnyq/prettier-config": "^1.21.3",
"@tarojs/cli": "^4.0.6",
"@tarojs/helper": "^4.0.6",
"@tarojs/plugin-platform-weapp": "^4.0.6",
"@tarojs/router": "^4.0.6",
"@tarojs/shared": "^4.0.6",
"@tarojs/webpack5-runner": "^4.0.6",
"@tarojs/cli": "^4.0.7",
"@tarojs/helper": "^4.0.7",
"@tarojs/plugin-platform-weapp": "^4.0.7",
"@tarojs/router": "^4.0.7",
"@tarojs/shared": "^4.0.7",
"@tarojs/webpack5-runner": "^4.0.7",
"@types/webpack-env": "^1.18.5",
"@vue/babel-plugin-jsx": "^1.2.5",
"@vue/compiler-sfc": "^3.5.12",
"babel-preset-taro": "^4.0.6",
"babel-preset-taro": "^4.0.7",
"bumpp": "^9.7.1",
"eslint": "^9.13.0",
"husky": "^9.1.6",
"nano-staged": "^0.8.0",
"pnpm": "^9.12.2",
"postcss": "^8.4.47",
"prettier": "^3.3.3",
"taro-define-config": "^0.8.0",
"taro-define-config": "^0.9.0",
"tsconfig-paths-webpack-plugin": "^4.1.0",
"typescript": "^5.6.3",
"unplugin-vue-components": "^0.27.4",
Expand Down
1,777 changes: 937 additions & 840 deletions pnpm-lock.yaml

Large diffs are not rendered by default.

15 changes: 9 additions & 6 deletions src/components/PosterBuilder/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { defineComponent, onMounted, ref } from 'vue'
import { drawBlock, drawImage, drawLine, drawText } from './utils/draw'
import { getImageInfo, getLinearColor, getRandomId, toPx, toRpx } from './utils/tools'
import type { PropType } from 'vue'
import type { DrawConfig, Image } from './types'
import type { DrawConfig, Image } from './utils/types'
export default defineComponent({
name: 'PosterBuilder',
Expand Down Expand Up @@ -39,8 +39,8 @@ export default defineComponent({
* @return downloadImagePromise
*/
const initImages = (images: Image[]) => {
const imagesTemp = images.filter(item => item.url)
const drawList = imagesTemp.map((item, index) => getImageInfo(item, index))
const imageList = images.filter(item => item.url)
const drawList = imageList.map((item, index) => getImageInfo(item, index))
return Promise.all(drawList)
}
Expand Down Expand Up @@ -99,9 +99,9 @@ export default defineComponent({
/**
* step2: 开始绘制任务
* @param { Array } drawTasks 待绘制任务
* @param drawTasks 待绘制任务
*/
const startDrawing = async drawTasks => {
const startDrawing = async (drawTasks: any[]) => {
// TODO: check
// const configHeight = getHeight(config)
const { ctx, canvas } = (await initCanvas()) as any
Expand Down Expand Up @@ -142,6 +142,7 @@ export default defineComponent({
)
queue.sort((a, b) => a.zIndex - b.zIndex) // 按照层叠顺序由低至高排序, 先画低的,再画高的
for (const element of queue) {
const drawOptions = {
canvas,
Expand Down Expand Up @@ -177,13 +178,15 @@ export default defineComponent({
startDrawing(result)
})
.catch(err => {
Taro.hideLoading()
Taro.showToast({
icon: 'none',
title: err.errMsg || '下载图片失败',
})
context.emit('fail', err)
})
.finally(() => {
Taro.hideLoading()
})
} else {
startDrawing([])
}
Expand Down
78 changes: 0 additions & 78 deletions src/components/PosterBuilder/types.d.ts

This file was deleted.

Loading

0 comments on commit 6ef49d0

Please sign in to comment.