From e81cd0f265a66384cd7c0c2dcb2254ab26f5186f Mon Sep 17 00:00:00 2001 From: wanggang <76527413@qq.com> Date: Tue, 11 Jul 2023 17:43:27 +0800 Subject: [PATCH] =?UTF-8?q?1.=E5=BC=82=E6=AD=A5=E7=AD=96=E7=95=A5=E8=B0=83?= =?UTF-8?q?=E6=95=B4=EF=BC=9A=20async=20setup=20=3D>=20onMounted=20async?= =?UTF-8?q?=202.json=E9=85=8D=E7=BD=AE=E5=8A=A8=E6=80=81=E6=96=B9=E6=B3=95?= =?UTF-8?q?=E7=A6=81=E7=94=A8=E6=8C=89=E9=92=AE=20disabled=20string=20=3D>?= =?UTF-8?q?=20function=203.Auth=E9=A1=B9=E7=9B=AE=E9=85=8D=E7=BD=AE?= =?UTF-8?q?=E6=96=87=E4=BB=B6=E4=BF=AE=E5=A4=8D=EF=BC=8CSwagger=20Token?= =?UTF-8?q?=E8=AE=A4=E8=AF=81=E8=B0=83=E6=95=B4=204.=E7=99=BB=E5=BD=95?= =?UTF-8?q?=E6=96=B9=E6=B3=95=E5=8C=85=E8=A3=85=EF=BC=8C=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E7=94=A8=E6=88=B7=E8=AF=A6=E6=83=85=E7=BC=BA=E5=A4=B1=E7=9A=84?= =?UTF-8?q?=E7=9A=84=E8=A7=92=E8=89=B2=E5=88=97=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- code/.gitignore | 4 +- code/WebApp/vanilla/app.js | 5 +- .../vanilla/components/form/form-input.js | 45 +- .../vanilla/components/form/form-item.js | 20 +- code/WebApp/vanilla/components/icon/index.js | 2 +- code/WebApp/vanilla/components/list/index.js | 119 +- code/WebApp/vanilla/config/settings.js | 1 + code/WebApp/vanilla/models/login.js | 2 +- code/WebApp/vanilla/models/user.js | 53 +- code/WebApp/vanilla/request/index.js | 23 +- code/WebApp/vanilla/router/routes.js | 3 + code/WebApp/vanilla/utils/index.js | 25 +- code/WebApp/vanilla/utils/validation.js | 113 ++ code/WebApp/vanilla/views/login.js | 15 +- .../Systems/UserManagement/IUserAppService.cs | 14 +- .../BaseService.Application.csproj | 2 + .../UserManagement/TokenAppService.cs | 55 + .../UserManagement/UserAppService.cs | 21 +- .../.config/dotnet-tools.json | 12 + .../BaseService.Host/BaseServiceHostModule.cs | 72 +- .../BaseService.Host/appsettings.json | 20 +- docs/20230711-151906.jpg | Bin 0 -> 314061 bytes docs/SqlSchemaCompare2.scmp | 1021 +++++++++++++++++ 23 files changed, 1456 insertions(+), 191 deletions(-) create mode 100644 code/WebApp/vanilla/utils/validation.js create mode 100644 code/src/Modules/BaseService/BaseService.Application/UserManagement/TokenAppService.cs create mode 100644 code/src/Modules/BaseService/BaseService.Host/.config/dotnet-tools.json create mode 100644 docs/20230711-151906.jpg create mode 100644 docs/SqlSchemaCompare2.scmp diff --git a/code/.gitignore b/code/.gitignore index 07d8289e..70a3f6dd 100644 --- a/code/.gitignore +++ b/code/.gitignore @@ -26,8 +26,8 @@ dist/ #be .vs/ -bin/ -obj/ +bin +obj *.suo *.user *.db diff --git a/code/WebApp/vanilla/app.js b/code/WebApp/vanilla/app.js index 9f35eb2c..34b69c72 100644 --- a/code/WebApp/vanilla/app.js +++ b/code/WebApp/vanilla/app.js @@ -6,12 +6,11 @@ import { Suspense, reactive, onMounted } from "vue"; export default { components: { ElConfigProvider, Suspense }, - template: html` + template: html` - - `, + `, setup() { const localeMap = reactive( new Map([ diff --git a/code/WebApp/vanilla/components/form/form-input.js b/code/WebApp/vanilla/components/form/form-input.js index a99cc6c0..6d133fc6 100644 --- a/code/WebApp/vanilla/components/form/form-input.js +++ b/code/WebApp/vanilla/components/form/form-input.js @@ -1,7 +1,7 @@ import html from "html"; -import { ref, reactive, watch } from "vue"; +import { ref, reactive, watch, onMounted } from "vue"; import { dayjs } from "element-plus"; -import { post } from "../../request/index.js"; +import request, { post } from "../../request/index.js"; export default { template: html` @@ -55,28 +55,25 @@ export default { v-model="model[prop]" type="password" show-password - v-if="schema.format==='password'" + v-if="schema.input==='password'" /> `, - props: ["modelValue", "schema", "prop", "isReadOnly"], + props: ["modelValue", "schema", "prop", "isReadOnly", "mode"], emit: ["update:modelValue"], - async setup(props, context) { + setup(props, context) { const model = reactive(props.modelValue); watch(model, (value) => { context.emit("update:modelValue", value); }); /*start*/ const getDisabled = () => { - if (props.isReadOnly && props.isReadOnly === true) { + if (props.mode==='details') { return true; } - if (props.schema.displayOnly) { - return true; - } - if (props.mode === "update" && props.schema.addOnly) { + if (props.mode === "update" && props.schema.readOnly) { return true; } return false; @@ -89,20 +86,22 @@ export default { const selectProps = ref({}); const selectValues = ref([]); const options = ref([]); - if (props.schema.options) { - options.value = props.schema.options; - } else if (props.schema.url) { - try { - const url = `${props.schema.url}`; - const result = await post(url, { queryAll: true, query: { isReadonly: null, isDisabled: null, order: null } }); - options.value = result.data?.items.map((o) => ({ - value: o[props.schema.value], - label: o[props.schema.label], - })); - } catch (error) { - console.log(error); + onMounted(async () => { + if (props.schema.options) { + options.value = props.schema.options; + } else if (props.schema.url) { + try { + const url = `${props.schema.url}`; + const result = await request(url, null, { method: "get" }); + options.value = result.data?.items.map((o) => ({ + value: o[props.schema.value], + label: o[props.schema.label], + })); + } catch (error) { + console.log(error); + } } - } + }); return { model, getDisabled, diff --git a/code/WebApp/vanilla/components/form/form-item.js b/code/WebApp/vanilla/components/form/form-item.js index ae49e013..1616337b 100644 --- a/code/WebApp/vanilla/components/form/form-item.js +++ b/code/WebApp/vanilla/components/form/form-item.js @@ -1,11 +1,13 @@ import html from "html"; import { defineAsyncComponent, ref, reactive, watch } from "vue"; +import { format } from "../../utils/index.js"; +import { messages } from "../../utils/validation.js"; export default { name: "formItem", components: { AppFormInput: defineAsyncComponent(() => import("./form-input.js")) }, template: html` -