From fcd0fc9d65ca1f68e5005daa9c8b468bd5f10001 Mon Sep 17 00:00:00 2001 From: hb0730 <1278032416@qq.com> Date: Wed, 3 Apr 2024 12:23:16 +0800 Subject: [PATCH 1/3] workflow: update node-version (#1051) --- .github/workflows/linter.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/linter.yml b/.github/workflows/linter.yml index 0014f4c51..614b8cf41 100644 --- a/.github/workflows/linter.yml +++ b/.github/workflows/linter.yml @@ -13,14 +13,14 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Install Node.js - uses: actions/setup-node@v3 + uses: actions/setup-node@v4 with: - node-version: 18 + node-version: 20 - - uses: pnpm/action-setup@v2 + - uses: pnpm/action-setup@v3 name: Install pnpm id: pnpm-install with: @@ -33,7 +33,7 @@ jobs: run: | echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT - - uses: actions/cache@v3 + - uses: actions/cache@v4 name: Setup pnpm cache with: path: ${{ steps.pnpm-cache.outputs.STORE_PATH }} From 8d2ef1f644f1a45b710efc2610b92fbb012cbc86 Mon Sep 17 00:00:00 2001 From: xiaoxian521 <1923740402@qq.com> Date: Thu, 4 Apr 2024 15:23:02 +0800 Subject: [PATCH 2/3] =?UTF-8?q?perf:=20=E4=BC=98=E5=8C=96=E7=99=BB?= =?UTF-8?q?=E5=BD=95=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/store/modules/user.ts | 6 ++---- src/views/login/index.vue | 2 ++ 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/store/modules/user.ts b/src/store/modules/user.ts index f2ecab4c1..e4a78e7c2 100644 --- a/src/store/modules/user.ts +++ b/src/store/modules/user.ts @@ -55,10 +55,8 @@ export const useUserStore = defineStore({ return new Promise((resolve, reject) => { getLogin(data) .then(data => { - if (data) { - setToken(data.data); - resolve(data); - } + if (data?.success) setToken(data.data); + resolve(data); }) .catch(error => { reject(error); diff --git a/src/views/login/index.vue b/src/views/login/index.vue index 5979c903d..6eb5db3e8 100644 --- a/src/views/login/index.vue +++ b/src/views/login/index.vue @@ -81,6 +81,8 @@ const onLogin = async (formEl: FormInstance | undefined) => { }) .finally(() => (disabled.value = false)); }); + } else { + message("登录失败", { type: "error" }); } }) .finally(() => (loading.value = false)); From f120467fc87bc0bcb2eb84198cc6caa6407d1b0b Mon Sep 17 00:00:00 2001 From: hb0730 <1278032416@qq.com> Date: Thu, 4 Apr 2024 22:14:24 +0800 Subject: [PATCH 3/3] =?UTF-8?q?feat:=20=E5=87=BD=E6=95=B0=E5=BC=8F?= =?UTF-8?q?=E5=BC=B9=E6=A1=86`ReDialog`=E6=B7=BB=E5=8A=A0`Popconfirm`?= =?UTF-8?q?=E6=B0=94=E6=B3=A1=E7=A1=AE=E8=AE=A4=E6=A1=86=20(#1046)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/ReDialog/index.vue | 42 ++++++++++++++++++--------- src/components/ReDialog/type.ts | 39 +++++++++++++++++++++++++ src/views/components/dialog/index.vue | 11 +++++++ 3 files changed, 79 insertions(+), 13 deletions(-) diff --git a/src/components/ReDialog/index.vue b/src/components/ReDialog/index.vue index e7fb2f108..ba9ba1d00 100644 --- a/src/components/ReDialog/index.vue +++ b/src/components/ReDialog/index.vue @@ -37,6 +37,7 @@ const footerButtons = computed(() => { type: "primary", text: true, bg: true, + popconfirm: options?.popconfirm, btnClick: ({ dialog: { options, index } }) => { const done = () => closeDialog(options, index, { command: "sure" }); @@ -149,19 +150,34 @@ function handleClose( - - {{ btn?.label }} - + diff --git a/src/components/ReDialog/type.ts b/src/components/ReDialog/type.ts index 827e8c7df..4cc747688 100644 --- a/src/components/ReDialog/type.ts +++ b/src/components/ReDialog/type.ts @@ -11,6 +11,13 @@ type ArgsType = { /** `cancel` 点击取消按钮、`sure` 点击确定按钮、`close` 点击右上角关闭按钮或空白页或按下了esc键 */ command: "cancel" | "sure" | "close"; }; +type ButtonType = + | "primary" + | "success" + | "warning" + | "danger" + | "info" + | "text"; /** https://element-plus.org/zh-CN/component/dialog.html#attributes */ type DialogProps = { @@ -58,6 +65,34 @@ type DialogProps = { destroyOnClose?: boolean; }; +//element-plus.org/zh-CN/component/popconfirm.html#attributes +type Popconfirm = { + /** 标题 */ + title?: string; + /** 确认按钮文字 */ + confirmButtonText?: string; + /** 取消按钮文字 */ + cancelButtonText?: string; + /** 确认按钮类型,默认 `primary` */ + confirmButtonType?: ButtonType; + /** 取消按钮类型,默认 `text` */ + cancelButtonType?: ButtonType; + /** 自定义图标,默认 `QuestionFilled` */ + icon?: string | Component; + /** `Icon` 颜色,默认 `#f90` */ + iconColor?: string; + /** 是否隐藏 `Icon`,默认 `false` */ + hideIcon?: boolean; + /** 关闭时的延迟,默认 `200` */ + hideAfter?: number; + /** 是否将 `popover` 的下拉列表插入至 `body` 元素,默认 `true` */ + teleported?: boolean; + /** 当 `popover` 组件长时间不触发且 `persistent` 属性设置为 `false` 时, `popover` 将会被删除,默认 `false` */ + persistent?: boolean; + /** 弹层宽度,最小宽度 `150px`,默认 `150` */ + width?: string | number; +}; + type BtnClickDialog = { options?: DialogOptions; index?: number; @@ -86,6 +121,8 @@ type ButtonProps = { round?: boolean; /** 是否为圆形按钮,默认 `false` */ circle?: boolean; + /** 确认按钮的 `Popconfirm` 气泡确认框相关配置 */ + popconfirm?: Popconfirm; /** 是否为加载中状态,默认 `false` */ loading?: boolean; /** 自定义加载中状态图标组件 */ @@ -123,6 +160,8 @@ interface DialogOptions extends DialogProps { props?: any; /** 是否隐藏 `Dialog` 按钮操作区的内容 */ hideFooter?: boolean; + /** 确认按钮的 `Popconfirm` 气泡确认框相关配置 */ + popconfirm?: Popconfirm; /** * @description 自定义对话框标题的内容渲染器 * @see {@link https://element-plus.org/zh-CN/component/dialog.html#%E8%87%AA%E5%AE%9A%E4%B9%89%E5%A4%B4%E9%83%A8} diff --git a/src/views/components/dialog/index.vue b/src/views/components/dialog/index.vue index 1a3be82b1..dda1a57c1 100644 --- a/src/views/components/dialog/index.vue +++ b/src/views/components/dialog/index.vue @@ -280,6 +280,16 @@ function onUpdateClick() { }); } +// popconfirm 确认框 +function onPopconfirmClick() { + addDialog({ + width: "30%", + title: "popconfirm确认框示例", + popconfirm: { title: "是否确认修改当前数据" }, + contentRenderer: () =>

点击右下方确定按钮看看效果吧

+ }); +} + // 结合Form表单(第一种方式,弹框关闭立刻恢复初始值)通过 props 属性接收子组件的 prop 并赋值 function onFormOneClick() { addDialog({ @@ -496,6 +506,7 @@ function onBeforeSureClick() { 关闭后的回调 嵌套的弹框 更改弹框自身属性值 + popconfirm确认框