Merge pull request #160 from JeremyYu-cn/main

Fix: some type problems
This commit is contained in:
Jeremy Yu 2024-09-25 12:40:23 +08:00 committed by GitHub
commit 84a93e4344
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
12 changed files with 39 additions and 2213 deletions

1
.gitignore vendored
View File

@ -3,6 +3,7 @@ node_modules
/dist
config.json
/.vite
yarn.lock
screenshot/node_modules/
screenshot/dist/

1
service/.gitignore vendored
View File

@ -11,6 +11,7 @@ yarn-error.log*
static
config.json
config.js
yarn.lock
# Runtime data
pids

View File

@ -55,7 +55,9 @@ module.exports = {
try {
const detail = fs.readFileSync(path.resolve(__dirname, `../mock/materials/${cate}.json`), 'utf8')
send.success(res, { list: JSON.parse(detail) })
} catch (error) {}
} catch (error) {
console.log(error)
}
},
// design/imgs 获取照片素材(虚拟)
async getPhotos(req: any, res: any) {

File diff suppressed because it is too large Load Diff

View File

@ -96,7 +96,7 @@ type TGetCompListParam = {
search?: string
page?: number
type?: number
pageSize: number
pageSize?: number
cate?: number | string
}
@ -109,6 +109,7 @@ export type TGetCompListResult = {
title: string
width: number
name?: string
cate?: string
}
type getCompListReturn = TPageRequestResult<TGetCompListResult[]>

View File

@ -1,9 +1,9 @@
/*
* @Author: ShawnPhang
* @Author: ShawnPhang <https://m.palxp.cn>
* @Date: 2021-08-27 14:42:15
* @Description:
* @LastEditors: ShawnPhang <https://m.palxp.cn>
* @LastEditTime: 2024-08-11 19:27:41
* @LastEditors: Jeremy Yu <https://github.com/JeremyYu-cn>
* @LastEditTime: 2024-09-25 00:39:00
*/
import fetch from '@/utils/axios'
import _config from '@/config'
@ -15,7 +15,7 @@ export const getKinds = (params: Type.Object = {}) => fetch('design/cate', param
type TGetListParam = {
first_id?: number
second_id?: string
cate?: number
cate?: string | number
pageSize?: number
}

View File

@ -13,7 +13,7 @@
<!-- <div class="el-upload__text">在此拖入或选择<em>上传图片</em></div> -->
<div class="el-upload__text">自动抠图目前依赖后端服务需自行部署</div>
</div>
<div class="el-upload__tip el-upload__text"><em>体验前端效果演示以及修补编辑器随便上传一张图片即可触发</em></div>
<div class="el-upload__tip el-upload__text"><em>体验前端效果演示以及修补编辑器任意上传一张图片即可触发</em></div>
</uploader>
<el-progress v-if="!state.cutImage && state.progressText" :percentage="state.progress">
<el-button text>

View File

@ -55,7 +55,7 @@ type TState = {
list: TGetCompListResult[]
searchValue: string
currentCategory: TGetCompListResult | null
types: []
types: {cate: string, name: string}[]
showList: TGetCompListResult[][]
}
@ -129,7 +129,7 @@ const load = async (init: boolean = false) => {
const res = await api.home.getCompList({
...pageOptions,
cate: state.currentCategory?.id,
cate: state.currentCategory?.id || state.currentCategory?.cate,
})
if (init) {
state.list = res?.list

View File

@ -1,9 +1,9 @@
<!--
* @Author: ShawnPhang
* @Author: ShawnPhang <https://m.palxp.cn>
* @Date: 2021-08-27 15:16:07
* @Description: 素材列表
* @LastEditors: ShawnPhang <https://m.palxp.cn>
* @LastEditTime: 2024-08-14 18:48:34
* @LastEditors: Jeremy Yu <https://github.com/JeremyYu-cn>
* @LastEditTime: 2024-09-25 00:39:00
-->
<template>
<div class="wrap">
@ -65,13 +65,14 @@ type TState = {
currentCheck: number
colors: string[]
currentCategory: TCurrentCategory | null
types: []
types: { cate: string, name: string }[]
showList: TGetListData[][]
searchKeyword: string
}
type TCurrentCategory = {
name: string
cate?: string | number
id?: number
}
@ -149,7 +150,7 @@ const load = async (init: boolean = false) => {
state.loading = true
pageOptions.page += 1
const list = await api.material.getList({
...{ cate: state.currentCategory?.id, search: state.searchKeyword, ...pageOptions },
...{ cate: state.currentCategory?.id || state.currentCategory?.cate, search: state.searchKeyword, ...pageOptions },
})
if (init) {
state.list = list?.list
@ -168,6 +169,7 @@ const searchChange = (_: Event) => {
}
const selectTypes = (item: TCurrentCategory) => {
console.log(item)
state.currentCategory = item
load(true)
}

View File

@ -1,9 +1,9 @@
/*
* @Author: ShawnPhang
* @Author: ShawnPhang <https://m.palxp.cn>
* @Date: 2024-04-05 06:23:23
* @Description:
* @LastEditors: ShawnPhang <https://m.palxp.cn>
* @LastEditTime: 2024-08-12 09:27:06
* @LastEditors: Jeremy Yu <https://github.com/JeremyYu-cn>
* @LastEditTime: 2024-09-25 00:39:00
*/
export type TScreeData = {
/** 记录编辑界面的宽度 */
@ -53,13 +53,15 @@ export type TStoreAction = {
value: TPageState[T]
// pushHistory?: boolean
}): void
getDPage(data: TPageState): () => TPageState
getDPage(data: TPageState): TPageState
/** 设置dPage */
setDPage(data: TPageState): void
/** 更新 Page从layouts获取*/
updateDPage(): void
/** 设置底部工具栏高度 */
setBottomHeight(h: number): void
/** 更新当前页面下标 */
setDCurrentPage(n: number): void
}
export type TPageState = {

View File

@ -1,10 +1,10 @@
/*
* @Author: Jeremy Yu
* @Author: Jeremy Yu <https://github.com/JeremyYu-cn>
* @Date: 2024-03-18 21:00:00
* @Description:
* @LastEditors: ShawnPhang <https://m.palxp.cn>
* @LastEditTime: 2024-08-12 09:27:22
* @LastEditTime: 2024-09-25 00:39:00
*/
import { Store, defineStore } from 'pinia'
@ -95,6 +95,10 @@ const CanvasStore = defineStore<"canvasStore", TCanvasState, {}, TStoreAction>("
/** 设置底部工具栏高度 */
setBottomHeight(h: number) {
this.dBottomHeight = h
},
/** 更新当前页面下标 */
setDCurrentPage(n: number) {
this.dCurrentPage = n
}
}
})

View File

@ -20,6 +20,7 @@ import { TUpdateAlignData, updateAlign } from "./actions/align";
// import { TWidgetJsonData, widgetJsonData } from "./getter";
import { TupdateLayerIndexData, ungroup, updateLayerIndex } from "./actions/layer";
import pageDefault from "../canvas/page-default";
import { TCanvasStore } from "../canvas";
export type TdWidgetData = TPageState & Partial<TCommonItemData> & {
parent?: string
@ -125,7 +126,7 @@ type TAction = {
resize: (data: TSize) => void
setWidgetStyle: (data: TsetWidgetStyleData) => void
setDWidgets: (data: TdWidgetData[]) => void
setDLayouts: (data: TdLayout) => void
setDLayouts: (data: TdLayout[]) => void
updateDWidgets: () => void
lockWidgets: () => void
setMouseEvent: (e: MouseEvent | null) => void
@ -201,8 +202,10 @@ const WidgetStore = defineStore<"widgetStore", TWidgetState, TGetter, TAction>("
autoResizeAll(data) { autoResizeAll(this, data) },
setDLayouts(data) { setDLayouts(this, data) },
getWidgets() {
const pageStore = useCanvasStore()
!this.dLayouts[pageStore.dCurrentPage] && pageStore.dCurrentPage--
const pageStore = useCanvasStore() as TCanvasStore
!this.dLayouts[pageStore.dCurrentPage] && pageStore.setDCurrentPage(pageStore.dCurrentPage - 1)
// !this.dLayouts[pageStore.dCurrentPage] && pageStore.dCurrentPage--
return this.dLayouts[pageStore.dCurrentPage].layers
}
}