Sfoglia il codice sorgente

提示初始密码

wangwei 3 anni fa
parent
commit
9a77218efa

+ 0 - 1
src/components/Form/src/componentMap.ts

@@ -27,7 +27,6 @@ import { StrengthMeter } from '/@/components/StrengthMeter';
 import { IconPicker } from '/@/components/Icon';
 
 const componentMap = new Map<ComponentType, Component>();
-
 componentMap.set('Input', Input);
 componentMap.set('InputGroup', Input.Group);
 componentMap.set('InputPassword', Input.Password);

+ 59 - 0
src/views/department/department/customCom/member/customCom/CustomInputPassword.vue

@@ -0,0 +1,59 @@
+<template>
+  <div class="wrap">
+    <div class="content">
+      <InputPassword :placeholder="placeholder" :value="value" @change="handleChange" />
+      <span style="color: #ddd; font-size: 13px">{{ tip }}</span>
+    </div>
+  </div>
+</template>
+<script lang="ts">
+  import { defineComponent, onUpdated, reactive, toRefs } from 'vue';
+  import { Input } from 'ant-design-vue';
+
+  const props = {
+    value: { type: Object, default: '123456' },
+    tip: { type: String, default: '' },
+    placeholder: { type: String, default: '' },
+  };
+  interface State {
+    value: object | string;
+    placeholder: string;
+    tip: string;
+  }
+
+  export default defineComponent({
+    name: 'CustomInputPassword',
+    components: { InputPassword: Input.Password },
+    props,
+    emits: ['change'],
+    setup(props, { emit }) {
+      const state = reactive<State>({
+        value: '',
+        placeholder: props.placeholder,
+        tip: props.tip,
+      });
+      // 初始化
+      function init() {
+        state.value = props.value;
+      }
+      onUpdated(() => {
+        init();
+      });
+
+      function handleChange(e) {
+        emit('change', e.target.value);
+      }
+
+      return {
+        handleChange,
+        ...toRefs(state),
+      };
+    },
+  });
+</script>
+<style scoped>
+  .ant-input-password {
+    width: 70%;
+    margin-right: 10px;
+  }
+</style>

+ 24 - 3
src/views/department/department/customCom/member/data.ts

@@ -3,6 +3,7 @@ import { FormSchema } from '/@/components/Form/index';
 import { adapt } from '/@/utils/adapt';
 import { h } from 'vue';
 import CustomInput from './customCom/CustomInput.vue';
+import CustomInputPassword from './customCom/CustomInputPassword.vue';
 import moment from 'moment';
 import { Tag } from 'ant-design-vue';
 
@@ -308,7 +309,20 @@ export const schemas: FormSchema[] = [
     componentProps: {
       placeholder: '用户名',
     },
-    required: true,
+    rules: [
+      {
+        required: true,
+        validator: async (_, value: any) => {
+          if (!value) {
+            return Promise.reject('请输入用户名');
+          }
+          if (value.length < 3 || value.lenght > 30) {
+            return Promise.reject('用户名:请填写3-12位数字、字母、下划线');
+          }
+        },
+        trigger: 'blur',
+      },
+    ],
   },
   {
     field: 'password',
@@ -319,8 +333,15 @@ export const schemas: FormSchema[] = [
     colProps: {
       span: adaptWidth.elContainer,
     },
-    componentProps: {
-      placeholder: '密码(初始密码123456)',
+    render: ({ model, field }) => {
+      return h(CustomInputPassword, {
+        value: model.password,
+        tip: '初始密码为123456',
+        placeholder: '密码',
+        onChange(value) {
+          model[field] = value;
+        },
+      });
     },
     required: true,
   },

+ 59 - 0
src/views/event/activity/customCom/member/customCom/CustomInputPassword.vue

@@ -0,0 +1,59 @@
+<template>
+  <div class="wrap">
+    <div class="content">
+      <InputPassword :placeholder="placeholder" :value="value" @change="handleChange" />
+      <span style="color: #ddd; font-size: 13px">{{ tip }}</span>
+    </div>
+  </div>
+</template>
+<script lang="ts">
+  import { defineComponent, onUpdated, reactive, toRefs } from 'vue';
+  import { Input } from 'ant-design-vue';
+
+  const props = {
+    value: { type: Object, default: '123456' },
+    tip: { type: String, default: '' },
+    placeholder: { type: String, default: '' },
+  };
+  interface State {
+    value: object | string;
+    placeholder: string;
+    tip: string;
+  }
+
+  export default defineComponent({
+    name: 'CustomInputPassword',
+    components: { InputPassword: Input.Password },
+    props,
+    emits: ['change'],
+    setup(props, { emit }) {
+      const state = reactive<State>({
+        value: '',
+        placeholder: props.placeholder,
+        tip: props.tip,
+      });
+      // 初始化
+      function init() {
+        state.value = props.value;
+      }
+      onUpdated(() => {
+        init();
+      });
+
+      function handleChange(e) {
+        emit('change', e.target.value);
+      }
+
+      return {
+        handleChange,
+        ...toRefs(state),
+      };
+    },
+  });
+</script>
+<style scoped>
+  .ant-input-password {
+    width: 70%;
+    margin-right: 10px;
+  }
+</style>

+ 24 - 3
src/views/event/activity/customCom/member/data.ts

@@ -3,6 +3,7 @@ import { FormSchema } from '/@/components/Form/index';
 import { adapt } from '/@/utils/adapt';
 import { h } from 'vue';
 import CustomInput from './customCom/CustomInput.vue';
+import CustomInputPassword from './customCom/CustomInputPassword.vue';
 import moment from 'moment';
 import { Tag } from 'ant-design-vue';
 
@@ -308,7 +309,20 @@ export const schemas: FormSchema[] = [
     componentProps: {
       placeholder: '用户名',
     },
-    required: true,
+    rules: [
+      {
+        required: true,
+        validator: async (_, value: any) => {
+          if (!value) {
+            return Promise.reject('请输入用户名');
+          }
+          if (value.length < 3 || value.lenght > 30) {
+            return Promise.reject('用户名:请填写3-12位数字、字母、下划线');
+          }
+        },
+        trigger: 'blur',
+      },
+    ],
   },
   {
     field: 'password',
@@ -319,8 +333,15 @@ export const schemas: FormSchema[] = [
     colProps: {
       span: adaptWidth.elContainer,
     },
-    componentProps: {
-      placeholder: '密码(初始密码123456)',
+    render: ({ model, field }) => {
+      return h(CustomInputPassword, {
+        value: model.password,
+        tip: '初始密码为123456',
+        placeholder: '密码',
+        onChange(value) {
+          model[field] = value;
+        },
+      });
     },
     required: true,
   },

+ 59 - 0
src/views/event/meeting/customCom/member/customCom/CustomInputPassword.vue

@@ -0,0 +1,59 @@
+<template>
+  <div class="wrap">
+    <div class="content">
+      <InputPassword :placeholder="placeholder" :value="value" @change="handleChange" />
+      <span style="color: #ddd; font-size: 13px">{{ tip }}</span>
+    </div>
+  </div>
+</template>
+<script lang="ts">
+  import { defineComponent, onUpdated, reactive, toRefs } from 'vue';
+  import { Input } from 'ant-design-vue';
+
+  const props = {
+    value: { type: Object, default: '123456' },
+    tip: { type: String, default: '' },
+    placeholder: { type: String, default: '' },
+  };
+  interface State {
+    value: object | string;
+    placeholder: string;
+    tip: string;
+  }
+
+  export default defineComponent({
+    name: 'CustomInputPassword',
+    components: { InputPassword: Input.Password },
+    props,
+    emits: ['change'],
+    setup(props, { emit }) {
+      const state = reactive<State>({
+        value: '',
+        placeholder: props.placeholder,
+        tip: props.tip,
+      });
+      // 初始化
+      function init() {
+        state.value = props.value;
+      }
+      onUpdated(() => {
+        init();
+      });
+
+      function handleChange(e) {
+        emit('change', e.target.value);
+      }
+
+      return {
+        handleChange,
+        ...toRefs(state),
+      };
+    },
+  });
+</script>
+<style scoped>
+  .ant-input-password {
+    width: 70%;
+    margin-right: 10px;
+  }
+</style>

+ 24 - 3
src/views/event/meeting/customCom/member/data.ts

@@ -3,6 +3,7 @@ import { FormSchema } from '/@/components/Form/index';
 import { adapt } from '/@/utils/adapt';
 import { h } from 'vue';
 import CustomInput from './customCom/CustomInput.vue';
+import CustomInputPassword from './customCom/CustomInputPassword.vue';
 import moment from 'moment';
 import { Tag } from 'ant-design-vue';
 
@@ -308,7 +309,20 @@ export const schemas: FormSchema[] = [
     componentProps: {
       placeholder: '用户名',
     },
-    required: true,
+    rules: [
+      {
+        required: true,
+        validator: async (_, value: any) => {
+          if (!value) {
+            return Promise.reject('请输入用户名');
+          }
+          if (value.length < 3 || value.lenght > 30) {
+            return Promise.reject('用户名:请填写3-12位数字、字母、下划线');
+          }
+        },
+        trigger: 'blur',
+      },
+    ],
   },
   {
     field: 'password',
@@ -319,8 +333,15 @@ export const schemas: FormSchema[] = [
     colProps: {
       span: adaptWidth.elContainer,
     },
-    componentProps: {
-      placeholder: '密码(初始密码123456)',
+    render: ({ model, field }) => {
+      return h(CustomInputPassword, {
+        value: model.password,
+        tip: '初始密码为123456',
+        placeholder: '密码',
+        onChange(value) {
+          model[field] = value;
+        },
+      });
     },
     required: true,
   },

+ 59 - 0
src/views/member/member/customCom/CustomInputPassword.vue

@@ -0,0 +1,59 @@
+<template>
+  <div class="wrap">
+    <div class="content">
+      <InputPassword :placeholder="placeholder" :value="value" @change="handleChange" />
+      <span style="color: #ddd; font-size: 13px">{{ tip }}</span>
+    </div>
+  </div>
+</template>
+<script lang="ts">
+  import { defineComponent, onUpdated, reactive, toRefs } from 'vue';
+  import { Input } from 'ant-design-vue';
+
+  const props = {
+    value: { type: Object, default: '123456' },
+    tip: { type: String, default: '' },
+    placeholder: { type: String, default: '' },
+  };
+  interface State {
+    value: object | string;
+    placeholder: string;
+    tip: string;
+  }
+
+  export default defineComponent({
+    name: 'CustomInputPassword',
+    components: { InputPassword: Input.Password },
+    props,
+    emits: ['change'],
+    setup(props, { emit }) {
+      const state = reactive<State>({
+        value: '',
+        placeholder: props.placeholder,
+        tip: props.tip,
+      });
+      // 初始化
+      function init() {
+        state.value = props.value;
+      }
+      onUpdated(() => {
+        init();
+      });
+
+      function handleChange(e) {
+        emit('change', e.target.value);
+      }
+
+      return {
+        handleChange,
+        ...toRefs(state),
+      };
+    },
+  });
+</script>
+<style scoped>
+  .ant-input-password {
+    width: 70%;
+    margin-right: 10px;
+  }
+</style>

+ 24 - 3
src/views/member/member/data.ts

@@ -3,6 +3,7 @@ import { FormSchema } from '/@/components/Form/index';
 import { adapt } from '/@/utils/adapt';
 import { h } from 'vue';
 import CustomInput from './customCom/CustomInput.vue';
+import CustomInputPassword from './customCom/CustomInputPassword.vue';
 import moment from 'moment';
 import { Tag } from 'ant-design-vue';
 
@@ -308,7 +309,20 @@ export const schemas: FormSchema[] = [
     componentProps: {
       placeholder: '用户名',
     },
-    required: true,
+    rules: [
+      {
+        required: true,
+        validator: async (_, value: any) => {
+          if (!value) {
+            return Promise.reject('请输入用户名');
+          }
+          if (value.length < 3 || value.lenght > 30) {
+            return Promise.reject('用户名:请填写3-12位数字、字母、下划线');
+          }
+        },
+        trigger: 'blur',
+      },
+    ],
   },
   {
     field: 'password',
@@ -319,8 +333,15 @@ export const schemas: FormSchema[] = [
     colProps: {
       span: adaptWidth.elContainer,
     },
-    componentProps: {
-      placeholder: '密码(初始密码123456)',
+    render: ({ model, field }) => {
+      return h(CustomInputPassword, {
+        value: model.password,
+        tip: '初始密码为123456',
+        placeholder: '密码',
+        onChange(value) {
+          model[field] = value;
+        },
+      });
     },
     required: true,
   },

+ 59 - 0
src/views/money/bill/customCom/member/customCom/CustomInputPassword.vue

@@ -0,0 +1,59 @@
+<template>
+  <div class="wrap">
+    <div class="content">
+      <InputPassword :placeholder="placeholder" :value="value" @change="handleChange" />
+      <span style="color: #ddd; font-size: 13px">{{ tip }}</span>
+    </div>
+  </div>
+</template>
+<script lang="ts">
+  import { defineComponent, onUpdated, reactive, toRefs } from 'vue';
+  import { Input } from 'ant-design-vue';
+
+  const props = {
+    value: { type: Object, default: '123456' },
+    tip: { type: String, default: '' },
+    placeholder: { type: String, default: '' },
+  };
+  interface State {
+    value: object | string;
+    placeholder: string;
+    tip: string;
+  }
+
+  export default defineComponent({
+    name: 'CustomInputPassword',
+    components: { InputPassword: Input.Password },
+    props,
+    emits: ['change'],
+    setup(props, { emit }) {
+      const state = reactive<State>({
+        value: '',
+        placeholder: props.placeholder,
+        tip: props.tip,
+      });
+      // 初始化
+      function init() {
+        state.value = props.value;
+      }
+      onUpdated(() => {
+        init();
+      });
+
+      function handleChange(e) {
+        emit('change', e.target.value);
+      }
+
+      return {
+        handleChange,
+        ...toRefs(state),
+      };
+    },
+  });
+</script>
+<style scoped>
+  .ant-input-password {
+    width: 70%;
+    margin-right: 10px;
+  }
+</style>

+ 24 - 4
src/views/money/bill/customCom/member/data.ts

@@ -3,6 +3,7 @@ import { FormSchema } from '/@/components/Form/index';
 import { adapt } from '/@/utils/adapt';
 import { h } from 'vue';
 import CustomInput from './customCom/CustomInput.vue';
+import CustomInputPassword from './customCom/CustomInputPassword.vue';
 import moment from 'moment';
 import { Tag } from 'ant-design-vue';
 
@@ -285,7 +286,6 @@ export const schemas: FormSchema[] = [
       span: adaptWidth.elContainer,
     },
     render: ({ model, field }) => {
-      console.log(`model.type`, model.type);
       return h(CustomInput, {
         value: model.name,
         type: model.type,
@@ -309,7 +309,20 @@ export const schemas: FormSchema[] = [
     componentProps: {
       placeholder: '用户名',
     },
-    required: true,
+    rules: [
+      {
+        required: true,
+        validator: async (_, value: any) => {
+          if (!value) {
+            return Promise.reject('请输入用户名');
+          }
+          if (value.length < 3 || value.lenght > 30) {
+            return Promise.reject('用户名:请填写3-12位数字、字母、下划线');
+          }
+        },
+        trigger: 'blur',
+      },
+    ],
   },
   {
     field: 'password',
@@ -320,8 +333,15 @@ export const schemas: FormSchema[] = [
     colProps: {
       span: adaptWidth.elContainer,
     },
-    componentProps: {
-      placeholder: '密码(初始密码123456)',
+    render: ({ model, field }) => {
+      return h(CustomInputPassword, {
+        value: model.password,
+        tip: '初始密码为123456',
+        placeholder: '密码',
+        onChange(value) {
+          model[field] = value;
+        },
+      });
     },
     required: true,
   },