Ver código fonte

更新修改问题

lex 1 ano atrás
pai
commit
e01b70b9d1

+ 23 - 1
src/components/layout/modals/update-password.module.less

@@ -1,3 +1,18 @@
+.no-pwd {
+  font-family: 'dotfont';
+
+  :global {
+    .n-input__input-el {
+      -webkit-text-security: disc !important;
+      -moz-text-security: disc !important;
+    }
+
+    .n-input__placeholder span {
+      margin-top: -5px;
+    }
+  }
+}
+
 .updatePassword {
   padding: 0px 40px 30px;
 
@@ -7,6 +22,13 @@
     color: #777777;
   }
 
+
+  .pwdIcon {
+    width: 24px;
+    height: 24px;
+    cursor: pointer;
+  }
+
   .phoneContainer {
     :global {
       .n-form-item-feedback-wrapper {
@@ -60,4 +82,4 @@
       line-height: 62px;
     }
   }
-}
+}

+ 44 - 9
src/components/layout/modals/update-password.tsx

@@ -13,7 +13,9 @@ import { useRouter } from 'vue-router';
 import { useUserStore } from '/src/store/modules/users';
 import { gradeToCN } from '/src/utils/contants';
 import { sendSms } from '/src/views/login/api';
-import { updatePassword } from '@/views/home/api'
+import { updatePassword } from '@/views/home/api';
+import openEye from '/src/views/login/images/openEye.png';
+import closeEye from '/src/views/login/images/closeEye.png';
 export default defineComponent({
   name: 'train-update',
   emits: ['close', 'submit'],
@@ -28,6 +30,11 @@ export default defineComponent({
       code: null
     });
 
+    const password = reactive({
+      passowrdStatus: false,
+      rePasswordStatus: false
+    });
+
     const validatePass2 = (rule: any, value: any, callback: any): any => {
       const reg = /^(?![0-9]+$)(?![a-zA-Z]+$)[0-9A-Za-z]{6,20}$/;
       if (value === '' || !value) {
@@ -143,10 +150,24 @@ export default defineComponent({
             <NInput
               v-model:value={forms.password}
               clearable
-              type="password"
-              show-password-on="click"
-              placeholder={'请输入新密码'}
-            />
+              type="text"
+              showPasswordOn="click"
+              inputProps={{ autocomplete: 'off' }}
+              class={[password.passowrdStatus ? '' : styles['no-pwd']]}
+              placeholder={'请输入新密码'}>
+              {{
+                suffix: () => (
+                  <img
+                    src={password.passowrdStatus ? openEye : closeEye}
+                    class={styles.pwdIcon}
+                    alt=""
+                    onClick={() => {
+                      password.passowrdStatus = !password.passowrdStatus;
+                    }}
+                  />
+                )
+              }}
+            </NInput>
           </NFormItem>
           <NFormItem
             path="rePassword"
@@ -161,10 +182,24 @@ export default defineComponent({
             <NInput
               v-model:value={forms.rePassword}
               clearable
-              type="password"
-              show-password-on="click"
-              placeholder={'再次输入新密码'}
-            />
+              type="text"
+              showPasswordOn="click"
+              inputProps={{ autocomplete: 'off' }}
+              class={[password.rePasswordStatus ? '' : styles['no-pwd']]}
+              placeholder={'再次输入新密码'}>
+              {{
+                suffix: () => (
+                  <img
+                    src={password.rePasswordStatus ? openEye : closeEye}
+                    class={styles.pwdIcon}
+                    alt=""
+                    onClick={() => {
+                      password.rePasswordStatus = !password.rePasswordStatus;
+                    }}
+                  />
+                )
+              }}
+            </NInput>
           </NFormItem>
           <NFormItem
             path="code"

+ 2 - 1
src/views/attend-class/model/train-settings/index.tsx

@@ -188,7 +188,6 @@ export default defineComponent({
               placeholder="请选择截止日期"
               v-model:formatted-value={trainForms.expireDate}
               type="date"
-              clearable
               valueFormat="yyyy-MM-dd"
               isDateDisabled={(ts: number) => {
                 return ts < trainForms.currentTime;
@@ -267,6 +266,7 @@ export default defineComponent({
             type="homework"
             onClose={() => (trainForms.editStatus = false)}
             onConfirm={(item: any) => {
+              console.log(item, 'update', trainForms);
               const tList = typeFormat(
                 item.trainingType,
                 item.trainingConfigJson
@@ -276,6 +276,7 @@ export default defineComponent({
                 trainForms.trainList.forEach((train: any) => {
                   if (train.id === item.id) {
                     train.trainingType = item.trainingType;
+                    train.trainingConfigJson = item.trainingConfigJson;
                     train.typeList = tList;
                   }
                 });