Browse Source

数据回显

lifanagju_citu 7 tháng trước cách đây
mục cha
commit
00b078413b
1 tập tin đã thay đổi với 20 bổ sung23 xóa
  1. 20 23
      src/views/recruit/entRegister/register.vue

+ 20 - 23
src/views/recruit/entRegister/register.vue

@@ -70,8 +70,8 @@
             <TextUI v-model="item.contactName" :item="{...contactNameObj}"></TextUI>
             <TextUI v-model="item.phone" :item="{...phoneObj}"></TextUI>
             <TextUI v-model="item.email" :item="{...emailObj}"></TextUI>
-            <TextUI v-model="item.password" :item="{...passwordObj}" @blur="passwordChange(item)"></TextUI>
-            <TextUI v-model="item.passwordConfirm" :item="{...passwordConfirmObj}" @blur="passwordChange(item)"></TextUI>
+            <TextUI v-model="item.password" :item="{...passwordObj}"></TextUI>
+            <TextUI v-model="item.passwordConfirm" :item="{...passwordConfirmObj}"></TextUI>
             <v-btn v-if="index" style="width: 100%; text-align: center;" variant="text" color="error" @click="delContact(index)">删除</v-btn>
           </div>
         </div>
@@ -116,19 +116,6 @@ onMounted(() => {
 import { useRoute } from 'vue-router'; const route = useRoute()
 const pageType = route?.query?.type || '' // type: noLoginToRegister:->登录页注册企业
 
-// const handleSecondConfirm = (value, item) => {
-//   debugger
-//   // const obj = formItems.value.options.find(e => e.key === 'passwordConfirm')
-//   item.type = item.type === 'password' ? 'text' : 'password'
-//   item.appendInnerIcon = item.type === 'password' ? 'mdi-eye-off-outline' : 'mdi-eye-outline'
-// }
-
-// const handlePassword = (value, item) => {
-//   // const obj = formItems.value.options.find(e => e.key === 'password')
-//   item.type = item.type === 'password' ? 'text' : 'password'
-//   item.appendInnerIcon = item.type === 'password' ? 'mdi-eye-off-outline' : 'mdi-eye-outline'
-// }
-
 const showContactList = ref(false)
 const contactInfo = { contactName: '', phone: '', email: '', password: '', passwordConfirm:'' }
 let contactList = [{ ...contactInfo }]
@@ -147,6 +134,9 @@ const contactSubmit = () => {
         }
       })
     }
+    if (e.password && e.passwordConfirm && e.password !== e.passwordConfirm) 
+    falseValueIndex = index
+    falseKey = 'compareFalse'
   })
   const textList =  {
     contactName: '姓名',
@@ -156,7 +146,13 @@ const contactSubmit = () => {
     passwordConfirm: '登录密码',
   }
   if (falseValueIndex || falseValueIndex === 0) {
-    const text = falseValueIndex ? `请完善联系人${falseValueIndex}的【${textList[falseKey]}】` : `请完善管理员的【${textList[falseKey]}】`
+    //
+    let text = ''
+    if (falseKey === 'compareFalse') {
+      text = falseValueIndex ? `【联系人${falseValueIndex}】两次输入的密码不一致` : `【管理员】两次输入的密码不一致`
+    } else {
+      text = falseValueIndex ? `请完善联系人${falseValueIndex}的【${textList[falseKey]}】` : `请完善管理员的【${textList[falseKey]}】`
+    }
     Confirm(t('common.confirmTitle'), text, { hideCancelBtn: true })
     return
   } 
@@ -176,11 +172,6 @@ const delContact = (index) => {
     contactCopy.value.splice(index, 1)
   })
 }
-const passwordChange = (item) => {
-  if (item.password && item.passwordConfirm && item.password !== item.passwordConfirm) {
-    Snackbar.warning('两次输入的密码不一致')
-  }
-}
 
 // 注册信息保存
 const enterpriseRegisterInfo = ref(localStorage.getItem('enterpriseRegisterInfo') ? JSON.parse(localStorage.getItem('enterpriseRegisterInfo')) : {})
@@ -340,14 +331,20 @@ const handleCommit = async () => {
 // 不通过的企业注册申请 重新发起
 const failureReason = ref('')
 const info = JSON.parse(localStorage.getItem('userApplyInfo'))
+console.log(1, '23456', info)
 // 审核不通过的数据回显
 if (info && Object.keys(info).length && info.status === '2') {
   failureReason.value = info?.reason || ''
   licenseUrl.value = info?.businessLicenseUrl
+  contactList = info?.contacts.map(e => {
+    e.passwordConfirm = e.password
+    return e
+  }) || [{ ...contactInfo }]
   // prepareValue.value = info?.prepare || false
   formItems.value.options.forEach(e => {
-    if (e.key === 'passwordConfirm') e.value = info.password
-    else e.value = info[e.key]
+    // if (e.key === 'passwordConfirm') e.value = info.password
+    // else e.value = info[e.key]
+    e.value = info[e.key]
   })
   isPrepareChange()
 } else {