From e773936369bff192a576c231d378c2253ec7abb9 Mon Sep 17 00:00:00 2001 From: liweijie0812 <674416404@qq.com> Date: Fri, 19 May 2023 10:47:10 +0800 Subject: [PATCH 1/7] chore: lint-staged remove git add (#515) --- package.json | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index 9952028..94b6ce9 100644 --- a/package.json +++ b/package.json @@ -83,12 +83,10 @@ "lint-staged": { "*.{js,jsx,vue,ts,tsx}": [ "prettier --write", - "npm run lint:fix", - "git add ." + "npm run lint:fix" ], "*.{html,vue,vss,sass,less}": [ - "npm run stylelint:fix", - "git add ." + "npm run stylelint:fix" ] } } From f84e348ad1a016f47903dbf1631157e08a7ef229 Mon Sep 17 00:00:00 2001 From: yuyang Date: Fri, 19 May 2023 11:39:50 +0800 Subject: [PATCH 2/7] chore: update package.json for security (#516) --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 94b6ce9..daa0924 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "name": "tdesign-vue-next-starter", + "name": "@tencent/tdesign-vue-next-starter", "version": "0.7.5", "scripts": { "dev:mock": "vite --open --mode mock", From 09fdbb3465223ff7f443049479a400c1cbd64588 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=82=A0=E9=9D=99=E8=90=9D=E8=8E=89?= Date: Tue, 23 May 2023 13:04:45 +0800 Subject: [PATCH 3/7] feat: upgrade tdesign set (#518) --- package.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index daa0924..b258bc6 100644 --- a/package.json +++ b/package.json @@ -28,9 +28,9 @@ "pinia-plugin-persistedstate": "^3.1.0", "qrcode.vue": "^3.3.4", "qs": "^6.11.1", - "tdesign-icons-vue-next": "^0.1.8", - "tdesign-vue-next": "^1.2.2", - "tvision-color": "^1.5.0", + "tdesign-icons-vue-next": "^0.1.11", + "tdesign-vue-next": "^1.3.4", + "tvision-color": "^1.6.0", "vue": "^3.2.47", "vue-clipboard3": "^2.0.0", "vue-router": "~4.1.6" From f9f9e9143822546e6cd129d361dcd63d76b0afab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=82=A0=E9=9D=99=E8=90=9D=E8=8E=89?= Date: Wed, 24 May 2023 10:40:06 +0800 Subject: [PATCH 4/7] =?UTF-8?q?feat:=20=E5=B0=86=E7=8E=B0=E6=9C=89?= =?UTF-8?q?=E4=BB=A3=E7=A0=81=E8=BF=81=E7=A7=BB=E8=87=B3TS=E4=B8=A5?= =?UTF-8?q?=E6=A0=BC=E6=A8=A1=E5=BC=8F=20-=20=E7=A6=81=E6=AD=A2any?= =?UTF-8?q?=E7=B1=BB=E5=9E=8B=20(#519)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * feat: 新增type enum类型 * feat: 开启禁止any类型规则 * types: 优化通知标签类型 * types: 补充标签页移除方法类型 * types: 补充请求工具类型 * types: 补充store相关类型 * types: 补充路由相关类型 * types: 补充钩子类型 * types: 补充页面组件类型 * types: 补充布局类型 * fix: 修复编译问题 --- commitlint.config.js | 11 ++++++++- src/constants/index.ts | 14 +++++++----- src/hooks/index.ts | 2 +- src/layouts/components/Header.vue | 2 +- src/layouts/components/LayoutContent.vue | 15 ++++++------ src/layouts/components/LayoutSideNav.vue | 3 ++- src/layouts/setting.vue | 2 +- src/pages/dashboard/base/index.ts | 3 ++- src/pages/detail/advanced/constants.ts | 8 +++---- src/pages/detail/advanced/index.vue | 6 ++--- src/pages/detail/deploy/constants.ts | 4 ++-- src/pages/detail/deploy/index.vue | 9 +++----- src/pages/detail/secondary/index.vue | 2 +- src/pages/form/base/constants.ts | 4 ++-- src/pages/form/base/index.vue | 13 ++++++----- src/pages/form/step/index.vue | 10 ++++---- src/pages/list/base/index.vue | 4 ++-- src/pages/list/card/index.vue | 28 +++++++++++++++++++---- src/pages/list/components/CommonTable.vue | 20 ++++++++-------- src/pages/list/tree/index.vue | 6 ++--- src/pages/login/components/Login.vue | 6 ++--- src/pages/login/components/Register.vue | 9 ++++---- src/pages/user/constants.ts | 8 ++++++- src/pages/user/index.vue | 14 ++++++++---- src/router/index.ts | 2 +- src/store/modules/permission-fe.ts | 8 +++---- src/store/modules/setting.ts | 5 ++-- src/store/modules/tabs-router.ts | 6 ++--- src/store/modules/user.ts | 3 ++- src/types/interface.d.ts | 12 ++++++++++ src/utils/request/utils.ts | 2 +- tsconfig.json | 3 ++- 32 files changed, 151 insertions(+), 93 deletions(-) diff --git a/commitlint.config.js b/commitlint.config.js index 405e185..20116c9 100644 --- a/commitlint.config.js +++ b/commitlint.config.js @@ -1,2 +1,11 @@ // commit-lint config -module.exports = { extends: ['@commitlint/config-conventional'] }; +module.exports = { + extends: ['@commitlint/config-conventional'], + rules: { + 'type-enum': [ + 2, + 'always', + ['build', 'chore', 'ci', 'docs', 'feat', 'fix', 'perf', 'refactor', 'revert', 'style', 'test', 'types'], + ], + }, +}; diff --git a/src/constants/index.ts b/src/constants/index.ts index 7c822ce..4438b88 100644 --- a/src/constants/index.ts +++ b/src/constants/index.ts @@ -34,12 +34,14 @@ export const CONTRACT_PAYMENT_TYPES = { RECEIPT: 1, }; -// 通知的优先级对应的TAG类型 -export const NOTIFICATION_TYPES = { - low: 'primary', - middle: 'warning', - high: 'danger', -}; +// 标签类型 +type TagTheme = 'default' | 'success' | 'primary' | 'warning' | 'danger'; +// 通知的优先级对应的标签类型 +export const NOTIFICATION_TYPES: Map = new Map([ + ['low', 'primary'], + ['middle', 'warning'], + ['high', 'danger'], +]); // 通用请求头 export enum ContentTypeEnum { diff --git a/src/hooks/index.ts b/src/hooks/index.ts index fe47d70..3c26653 100644 --- a/src/hooks/index.ts +++ b/src/hooks/index.ts @@ -39,7 +39,7 @@ export const useChart = (domId: string): Ref => { * @returns */ export const useCounter = (duration = 60): [Ref, () => void] => { - let intervalTimer; + let intervalTimer: ReturnType; onUnmounted(() => { clearInterval(intervalTimer); }); diff --git a/src/layouts/components/Header.vue b/src/layouts/components/Header.vue index c74bce7..69bf443 100644 --- a/src/layouts/components/Header.vue +++ b/src/layouts/components/Header.vue @@ -141,7 +141,7 @@ const changeCollapsed = () => { }); }; -const handleNav = (url) => { +const handleNav = (url: string) => { router.push(url); }; diff --git a/src/layouts/components/LayoutContent.vue b/src/layouts/components/LayoutContent.vue index 32c1c57..c0bf5ad 100644 --- a/src/layouts/components/LayoutContent.vue +++ b/src/layouts/components/LayoutContent.vue @@ -24,7 +24,7 @@ :min-column-width="128" :popup-props="{ overlayClassName: 'route-tabs-dropdown', - onVisibleChange: (visible, ctx) => handleTabMenuClick(visible, ctx, routeItem.path), + onVisibleChange: (visible: boolean, ctx: PopupVisibleChangeContext) => handleTabMenuClick(visible, ctx, routeItem.path), visible: activeTabPath === routeItem.path, }" > @@ -70,12 +70,13 @@ diff --git a/src/pages/detail/secondary/index.vue b/src/pages/detail/secondary/index.vue index cde49dc..04b336f 100644 --- a/src/pages/detail/secondary/index.vue +++ b/src/pages/detail/secondary/index.vue @@ -6,7 +6,7 @@

- + {{ item.type }} {{ item.content }} diff --git a/src/pages/form/base/constants.ts b/src/pages/form/base/constants.ts index e321b9d..e8503a0 100644 --- a/src/pages/form/base/constants.ts +++ b/src/pages/form/base/constants.ts @@ -1,4 +1,4 @@ -import { FormRule } from 'tdesign-vue-next'; +import type { FormRule, UploadFile } from 'tdesign-vue-next'; export const FORM_RULES: Record = { name: [{ required: true, message: '请输入合同名称', type: 'error' }], @@ -23,7 +23,7 @@ export const INITIAL_DATA = { payment: '1', amount: 0, comment: '', - files: [], + files: [] as Array, }; export const TYPE_OPTIONS = [ diff --git a/src/pages/form/base/index.vue b/src/pages/form/base/index.vue index 267fdd2..514876d 100644 --- a/src/pages/form/base/index.vue +++ b/src/pages/form/base/index.vue @@ -164,6 +164,7 @@ export default { diff --git a/src/pages/form/step/index.vue b/src/pages/form/step/index.vue index 7d446be..0f0736a 100644 --- a/src/pages/form/step/index.vue +++ b/src/pages/form/step/index.vue @@ -29,7 +29,7 @@ :data="formData1" :rules="FORM_RULES" label-align="right" - @submit="(result) => onSubmit(result, 1)" + @submit="(result: SubmitContext) => onSubmit(result, 1)" > @@ -59,7 +59,7 @@ :rules="FORM_RULES" label-align="left" @reset="onReset(0)" - @submit="(result) => onSubmit(result, 2)" + @submit="(result: SubmitContext) => onSubmit(result, 2)" > @@ -96,7 +96,7 @@ :rules="FORM_RULES" label-align="left" @reset="onReset(1)" - @submit="(result) => onSubmit(result, 6)" + @submit="(result: SubmitContext) => onSubmit(result, 6)" > @@ -147,7 +147,7 @@ export default { diff --git a/src/pages/list/components/CommonTable.vue b/src/pages/list/components/CommonTable.vue index 0323863..8df81d0 100644 --- a/src/pages/list/components/CommonTable.vue +++ b/src/pages/list/components/CommonTable.vue @@ -122,7 +122,7 @@ import { useSettingStore } from '@/store'; const store = useSettingStore(); -const COLUMNS: PrimaryTableCol[] = [ +const COLUMNS: PrimaryTableCol[] = [ { title: '合同名称', fixed: 'left', @@ -167,8 +167,8 @@ const COLUMNS: PrimaryTableCol[] = [ const searchForm = { name: '', - no: undefined, - status: undefined, + no: '', + status: typeof CONTRACT_STATUS, type: '', }; @@ -233,24 +233,24 @@ onMounted(() => { fetchData(); }); -const handleClickDelete = ({ row }) => { - deleteIdx.value = row.rowIndex; +const handleClickDelete = (slot: { row: { rowIndex: number } }) => { + deleteIdx.value = slot.row.rowIndex; confirmVisible.value = true; }; -const onReset = (val) => { +const onReset = (val: unknown) => { console.log(val); }; -const onSubmit = (val) => { +const onSubmit = (val: unknown) => { console.log(val); }; const rehandlePageChange = (pageInfo: PageInfo, newDataSource: TableRowData[]) => { console.log('分页变化', pageInfo, newDataSource); }; -const rehandleChange = (changeParams, triggerAndData) => { +const rehandleChange = (changeParams: unknown, triggerAndData: unknown) => { console.log('统一Change', changeParams, triggerAndData); }; -const rehandleClickOp = ({ text, row }) => { - console.log(text, row); +const rehandleClickOp = (ctx: unknown) => { + console.log(ctx); }; const headerAffixedTop = computed( diff --git a/src/pages/list/tree/index.vue b/src/pages/list/tree/index.vue index 7101634..16b73c0 100644 --- a/src/pages/list/tree/index.vue +++ b/src/pages/list/tree/index.vue @@ -24,6 +24,7 @@ export default { diff --git a/src/pages/login/components/Login.vue b/src/pages/login/components/Login.vue index 24ba884..43339c7 100644 --- a/src/pages/login/components/Login.vue +++ b/src/pages/login/components/Login.vue @@ -80,7 +80,7 @@