Forráskód Böngészése

Merge branch 'master' of http://192.168.100.32:3000/fanfan/xt-front

fanfan 2 éve
szülő
commit
0ad243589f

+ 2 - 2
src/api/sys/model/userModel.ts

@@ -5,8 +5,8 @@ export interface LoginParams {
   username: string;
   password: string;
   loginType: string;
-  codeKey?: string;
-  code?: string;
+  captchaKey?: string;
+  captchaCode?: string;
   redirect?: string | string[];
   grant_type?: string;
   client_id?: string;

+ 9 - 0
src/api/sys/sysConfigApi.ts

@@ -7,6 +7,7 @@ enum Api {
   sysConfigExport = '/sys/config/export',
   sysConfigQueryList = '/sys/config/query/list',
   sysConfigRemove = '/sys/config/remove',
+  sysConfigCurrent = '/sys/config/get/current',
 }
 
 /**
@@ -53,3 +54,11 @@ export const sysConfigQueryList = (params?: object) => {
 export const sysConfigRemove = (params?: Array<string | number>) => {
   return defHttp.post({ url: Api.sysConfigRemove, params: params });
 };
+
+/**
+ * @description: 获取系统当前配置
+ * @method: GET
+ */
+export const sysConfigCurrent = () => {
+  return defHttp.get({ url: Api.sysConfigCurrent });
+};

+ 22 - 12
src/views/base/login/LoginForm.vue

@@ -29,7 +29,12 @@
     <Row class="enter-x" v-show="formState.showCaptcha">
       <Col span="16">
         <FormItem class="code-input" name="code" label="验证码">
-          <Input size="large" visibilityToggle v-model:value="formData.code" placeholder="验证码" />
+          <Input
+            size="large"
+            visibilityToggle
+            v-model:value="formData.captchaCode"
+            placeholder="验证码"
+          />
         </FormItem>
       </Col>
       <Col span="8">
@@ -87,20 +92,17 @@
 </template>
 <script lang="ts" setup>
   import { reactive, ref, unref, computed, onMounted } from 'vue';
-
   import { Checkbox, Form, Input, Row, Col, Button } from 'ant-design-vue';
   import LoginFormTitle from './LoginFormTitle.vue';
-
   import { useMessage } from '/@/hooks/web/useMessage';
-
   import { useUserStore } from '/@/store/modules/user';
   import { LoginStateEnum, useLoginState, useFormRules, useFormValid } from './useLogin';
   import { useDesign } from '/@/hooks/web/useDesign';
   import locales from '/@/utils/locales';
   import { buildUUID } from '/@/utils/uuid';
   import Cookies from 'js-cookie';
-
   import { getCaptcha } from '/@/api/sys/oauthApi';
+  import { sysConfigCurrent } from '/@/api/sys/sysConfigApi';
   import { encryptByBase64, decodeByBase64 } from '/@/utils/cipher';
   import { useRoute } from 'vue-router';
   import { useGlobSetting } from '/@/hooks/setting';
@@ -110,6 +112,12 @@
     if (Cookies.get('username') && Cookies.get('password')) {
       formData.username = decodeByBase64(Cookies.get('username')) || '';
     }
+    sysConfigCurrent().then(res => {
+      formState.showCaptcha = res.captchaOpen;
+      if (res.captchaOpen) {
+        formState.captchaSrc = getCaptcha(formData.captchaKey);
+      }
+    });
   });
 
   const FormItem = Form.Item;
@@ -127,11 +135,11 @@
   const formData = reactive<any>({
     username: 'admin',
     password: '123456',
-    codeKey: buildUUID(),
+    captchaKey: buildUUID(),
   });
 
   const formState = reactive({
-    captchaSrc: getCaptcha(formData.codeKey),
+    captchaSrc: getCaptcha(formData.captchaKey),
     showCaptcha: true,
     rememberMe: true,
     loading: false,
@@ -145,8 +153,8 @@
 
   // 加载验证码
   async function loadCaptcha() {
-    formData.codeKey = buildUUID();
-    formState.captchaSrc = getCaptcha(formData.codeKey);
+    formData.captchaKey = buildUUID();
+    formState.captchaSrc = getCaptcha(formData.captchaKey);
   }
 
   async function handleLogin() {
@@ -160,8 +168,8 @@
         password: data.password,
         loginType: 'login', //不要默认的错误提示
         mode: 'none',
-        codeKey: formData.codeKey,
-        code: formData.code,
+        captchaKey: formData.captchaKey,
+        captchaCode: formData.captchaCode,
         grant_type: '',
         redirect,
         client_id: clientId,
@@ -180,7 +188,9 @@
         });
       }
     } catch (error) {
-      loadCaptcha();
+      if (formState.showCaptcha) {
+        loadCaptcha();
+      }
       createErrorModal({
         title: locales.api.errorTip,
         content: (error as unknown as Error).message || locales.api.networkExceptionMsg,

+ 23 - 19
src/views/infra/numStrategy/data.ts

@@ -68,25 +68,6 @@ export const dataFormSchema: FormSchema[] = [
       placeholder: '请输入策略名称',
     },
   },
-  {
-    label: '编号前缀',
-    field: 'prefix',
-    component: 'Input',
-    componentProps: {
-      placeholder: '请输入编号前缀',
-    },
-  },
-  {
-    label: '生成模式',
-    field: 'type',
-    component: 'ApiSelect',
-    componentProps: {
-      api: listDictModel,
-      params: {
-        dictCode: 'sys_numbering_type',
-      },
-    },
-  },
   {
     label: '流水号(递增)',
     field: 'nextNum',
@@ -114,6 +95,25 @@ export const dataFormSchema: FormSchema[] = [
       placeholder: '请输入填充字符',
     },
   },
+  {
+    label: '编号前缀',
+    field: 'prefix',
+    component: 'Input',
+    componentProps: {
+      placeholder: '请输入编号前缀',
+    },
+  },
+  {
+    label: '生成模式',
+    field: 'type',
+    component: 'ApiSelect',
+    componentProps: {
+      api: listDictModel,
+      params: {
+        dictCode: 'sys_numbering_type',
+      },
+    },
+  },
   {
     label: '备注',
     field: 'remark',
@@ -157,4 +157,8 @@ export const viewSchema: DescItem[] = [
     label: '备注',
     field: 'remark',
   },
+  {
+    label: '下一个编号',
+    field: 'nextFormatNum',
+  },
 ];