Browse Source

Merge branch 'dev' of https://git.citupro.com/zhengnaiwen_citu/menduner into dev

zhengnaiwen_citu 7 months ago
parent
commit
ba707c1efd
3 changed files with 185 additions and 97 deletions
  1. 2 1
      components.d.ts
  2. 8 11
      src/components/FormUI/TextInput/index.vue
  3. 175 85
      src/views/recruit/entRegister/register.vue

+ 2 - 1
components.d.ts

@@ -17,7 +17,6 @@ declare module 'vue' {
     Combobox: typeof import('./src/components/FormUI/combobox/index.vue')['default']
     ComboboxZhAndEn: typeof import('./src/components/FormUI/comboboxZhAndEn/index.vue')['default']
     ConfirmPaymentDialog: typeof import('./src/components/pay/confirmPaymentDialog.vue')['default']
-    copy: typeof import('./src/components/CtForm/index copy.vue')['default']
     CtBtn: typeof import('./src/components/CtVuetify/CtBtn/index.vue')['default']
     CtDialog: typeof import('./src/components/CtDialog/index.vue')['default']
     CtForm: typeof import('./src/components/CtForm/index.vue')['default']
@@ -31,6 +30,8 @@ declare module 'vue' {
     Details: typeof import('./src/components/Enterprise/details.vue')['default']
     Echarts: typeof import('./src/components/Echarts/index.vue')['default']
     ElConfigProvider: typeof import('element-plus/es')['ElConfigProvider']
+    ElDatePicker: typeof import('element-plus/es')['ElDatePicker']
+    ElTimePicker: typeof import('element-plus/es')['ElTimePicker']
     Empty: typeof import('./src/components/Empty/index.vue')['default']
     File: typeof import('./src/components/Upload/file.vue')['default']
     HeadSearch: typeof import('./src/components/headSearch/index.vue')['default']

+ 8 - 11
src/components/FormUI/TextInput/index.vue

@@ -4,7 +4,7 @@
       v-model="value"
       variant="outlined"
       :density="item.dense || 'compact'"
-      :type="item.type === 'phoneNumber' ? 'number' : item.type"
+      :type="inputType"
       :rules="item.rules"
       :disabled="item.disabled"
       :style="{width: item.width}"
@@ -45,21 +45,14 @@ defineOptions({ name:'FormUI-v-text-field'})
 const props = defineProps({item: Object, modelValue: [String, Number]})
 const emit = defineEmits(['update:modelValue', 'change', 'appendClick', 'appendInnerClick', 'enter', 'blur', 'focus'])
 const item = props.item
+const inputType = ref(item.type === 'phoneNumber' ? 'number' : item.type)
 const value = ref(props.modelValue)
 const searchDebouncedTime = item?.searchDebouncedTime === 0 ? ref(0) : ref(500)
-if (item.type === 'number' && item.integer) searchDebouncedTime.value = 0
+if (inputType.value === 'number' && item.integer) searchDebouncedTime.value = 0
 
 const valueDeal = (val) => {
   let dealData = val
-  if (item.type === 'number') {
-    // if (item.max && val > item.max) {
-    //   dealData = (item.max - 0)
-    //   Snackbar.warning(`最大可输入${item.max}`)
-    // }
-    // if (item.min && val < item.min) {
-    //   dealData = (item.min - 0)
-    //   Snackbar.warning(`最小可输入${item.max}`)
-    // }
+  if (inputType.value === 'number') {
     if (item.integer) { // 为true时只能输入整型
       dealData = val.replace(/\D/g,'') - 0
     }
@@ -86,6 +79,10 @@ const appendClick = () => {
   emit('appendClick', value.value)
 }
 const appendInnerClick = () => {
+  if (item.password) {
+    inputType.value = inputType.value === 'password' ? 'text' : 'password'
+    item.appendInnerIcon = inputType.value === 'password' ? 'mdi-eye-off-outline' : 'mdi-eye-outline'
+  }
   if (item.appendInnerClick) item.appendInnerClick(value.value)
   else emit('appendInnerClick', value.value)
 }

+ 175 - 85
src/views/recruit/entRegister/register.vue

@@ -37,6 +37,10 @@
               </div>
             </div>
           </template>
+          <template #contacts>
+            <!-- 联系人 -->
+            <v-btn class="mb-5" style="width: 100%; text-align: center;" variant="text" color="primary" prepend-icon="mdi-plus-box" @click="handleAddContact">添加联系人</v-btn>
+          </template>
         </CtForm>
         <div class="note">
           <h4>注意事项:</h4>
@@ -57,6 +61,26 @@
     <PreviewImg v-if="showPreview" :current="current" :list="[licenseUrl]" @close="showPreview = !showPreview"></PreviewImg>
 
     <Loading :visible="loading"></Loading>
+    
+    <CtDialog :visible="showContactList" title="添加联系人" :footer="true" widthType="3" @close="showContactList = false" @submit="contactSubmit">
+      <div style="min-height: 50vh;">
+        <div>
+          <div v-for="(item, index) in contactCopy" :key="index" class="contactItemCard">
+            <div class="d-flex justify-space-between pb-2">
+              <div class="mb-3 pl-3" style="font-size: 13px; color: 00897B; border-left: 5px solid #00897B;">{{ index ? '联系人' + index : '管理员' }}</div>
+              <v-btn v-if="index" color="error" density="compact" variant="text" @click="delContact(index)">删除</v-btn>
+              <div v-else style="font-size: 12px; color: #999">不可删除</div>
+            </div>
+            <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}"></TextUI>
+            <TextUI v-model="item.passwordConfirm" :item="{...passwordConfirmObj}"></TextUI>
+          </div>
+        </div>
+        <v-btn class="mb-5 mt-3" style="width: 100%; text-align: center;" color="primary" prepend-icon="mdi-plus-box" @click="addMore">继续添加</v-btn>
+      </div>
+    </CtDialog>
   </div>
 </template>
 
@@ -71,6 +95,7 @@ import { onMounted, ref, computed } from 'vue';
 import { checkEmail } from '@/utils/validate'
 import { getBusinessLicenseOCR } from '@/api/common'
 import Confirm from '@/plugins/confirm'
+import TextUI from '@/components/FormUI/TextInput'
 
 const { t } = useI18n()
 const CtFormRef = ref()
@@ -94,16 +119,61 @@ onMounted(() => {
 import { useRoute } from 'vue-router'; const route = useRoute()
 const pageType = route?.query?.type || '' // type: noLoginToRegister:->登录页注册企业
 
-const handleSecondConfirm = () => {
-  const obj = formItems.value.options.find(e => e.key === 'passwordConfirm')
-  obj.type = obj.type === 'password' ? 'text' : 'password'
-  obj.appendInnerIcon = obj.type === 'password' ? 'mdi-eye-off-outline' : 'mdi-eye-outline'
+const showContactList = ref(false)
+const contactInfo = { contactName: '', phone: '', email: '', password: '', passwordConfirm:'' }
+let contactList = [{ ...contactInfo }]
+const contactCopy = ref([])
+const contactSubmit = () => {
+  let falseValueIndex = null
+  let falseKey = null
+  contactCopy.value.forEach((e, index) => {
+    if (falseValueIndex !== null) return
+    if (e && Object.keys(e).length) {
+      Object.keys(e).forEach(key => {
+        if (falseValueIndex !== null) return
+        if (!e[key]) {
+          falseValueIndex = index
+          falseKey = key
+        }
+      })
+    }
+    if (e.password && e.passwordConfirm && e.password !== e.passwordConfirm) 
+    falseValueIndex = index
+    falseKey = 'compareFalse'
+  })
+  const textList =  {
+    contactName: '姓名',
+    phone: '联系电话',
+    email: '企业邮箱',
+    password: '登录密码',
+    passwordConfirm: '登录密码',
+  }
+  if (falseValueIndex || falseValueIndex === 0) {
+    //
+    let text = ''
+    if (falseKey === 'compareFalse') {
+      text = falseValueIndex ? `【联系人${falseValueIndex}】两次输入的密码不一致` : `【管理员】两次输入的密码不一致`
+    } else {
+      text = falseValueIndex ? `请完善联系人${falseValueIndex}的【${textList[falseKey]}】` : `请完善管理员的【${textList[falseKey]}】`
+    }
+    Confirm(t('common.confirmTitle'), text, { hideCancelBtn: true })
+    return
+  } 
+  contactList = [...contactCopy.value]
+  showContactList.value = false
+  saveRegisterInfo()
 }
-
-const handlePassword = () => {
-  const obj = formItems.value.options.find(e => e.key === 'password')
-  obj.type = obj.type === 'password' ? 'text' : 'password'
-  obj.appendInnerIcon = obj.type === 'password' ? 'mdi-eye-off-outline' : 'mdi-eye-outline'
+const handleAddContact = () => {
+  contactCopy.value = [...contactList]
+  showContactList.value = true
+}
+const addMore = () => {
+  contactCopy.value.push({...contactInfo})
+}
+const delContact = (index) => {
+  Confirm('系统提示', `是否确认删除${index ? `联系人${index}` : '管理员'}?`).then(async () => {
+    contactCopy.value.splice(index, 1)
+  })
 }
 
 // 注册信息保存
@@ -116,6 +186,7 @@ const saveRegisterInfo = () => {
   formItems.value.options.forEach(e => {
     if (e.key) obj[e.key] = e.value
   })
+  obj.contactList = contactList
   localStorage.setItem('enterpriseRegisterInfo', JSON.stringify(obj))
 }
 
@@ -160,8 +231,9 @@ const formItems = ref({
       type: 'text',
       key: 'anotherName',
       value: '',
-      label: '企业别名 *',
-      rules: [v => !!v || '请输入企业别名']
+      label: '企业别称',
+      counter: 50,
+      blur: saveRegisterInfo
     },
     {
       type: 'text',
@@ -173,78 +245,7 @@ const formItems = ref({
       blur: saveRegisterInfo
     },
     {
-      type: 'text',
-      key: 'contactName',
-      value: '',
-      label: '联系人姓名 *',
-      rules: [v => !!v || '请输入联系人姓名'],
-      blur: saveRegisterInfo
-    },
-    {
-      type: 'phoneNumber',
-      key: 'phone',
-      value: '',
-      label: '联系电话 *',
-      rules: [v => !!v || '请输入联系电话'],
-      blur: saveRegisterInfo
-    },
-    {
-      type: 'text',
-      key: 'email',
-      value: email ? email : '',
-      label: '企业邮箱 *(此邮箱将用于日后“登录邮箱”)',
-      // label: '企业邮箱 * (此邮箱将作为企业登录的账号)',
-      rules: [
-        value => {
-          if (value) return true
-          return '请输入企业邮箱'
-        },
-        value => {
-          if (checkEmail(value)) return true
-          return '请输入正确的企业邮箱'
-        }
-      ],
-      blur: saveRegisterInfo
-    },
-    {
-      type: 'password',
-      key: 'password',
-      value: '',
-      appendInnerIcon: 'mdi-eye-off-outline',
-      label: '账户登录密码 *',
-      placeholder: '请输入账户登录密码',
-      appendInnerClick: handlePassword,
-      rules: [
-        value => {
-          if (value) return true
-          return '请输入账户登录密码'
-        },
-        value => {
-          if (/^(?=.*[0-9])(?=.*[a-z])(?=.*[A-Z]).{8,16}$/.test(value)) return true
-          return '请输入8-16位数由数字、大小写字母组成的密码'
-        }
-      ],
-      blur: saveRegisterInfo
-    },
-    {
-      type: 'password',
-      key: 'passwordConfirm',
-      value: '',
-      appendInnerIcon: 'mdi-eye-off-outline',
-      label: '请再次输入账户登录密码 *',
-      placeholder: '请再次输入账户登录密码',
-      appendInnerClick: handleSecondConfirm,
-      rules: [
-        value => {
-          if (value) return true
-          return '请再次输入密码'
-        },
-        value => {
-          if (value === formItems.value.options.find(e => e.key === 'password').value) return true
-          return '两次输入密码不一致'
-        }
-      ],
-      blur: saveRegisterInfo
+      slotName: 'contacts'
     },
     {
       type: 'textarea',
@@ -308,6 +309,7 @@ const handleCommit = async () => {
 
   const businessLicenseUrl = licenseUrl.value;
   if (!prepareValue.value && !businessLicenseUrl) return Snackbar.warning('请上传营业执照图片')
+  if (!contactList || !contactList.length || !contactList[0].contactName) return Snackbar.warning('请添加联系人信息')
   const params = {
     businessLicenseUrl,
     prepare: prepareValue.value,
@@ -316,6 +318,11 @@ const handleCommit = async () => {
     if (e.key) params[e.key] = e.value
   })
   if (business.value && Object.keys(business.value).length) params.ocr = business.value
+  // 联系人
+  params.contacts = contactList
+  params.contactName = contactList[0].contactName
+  params.phone = contactList[0].phone
+  params.email = contactList[0].email
 
   await enterpriseRegisterApply(params)
   localStorage.removeItem('loginAccount')
@@ -327,14 +334,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 {
@@ -342,6 +355,7 @@ if (info && Object.keys(info).length && info.status === '2') {
   if (enterpriseRegisterInfo.value && Object.keys(enterpriseRegisterInfo.value).length) {
     licenseUrl.value = enterpriseRegisterInfo.value.licenseUrl
     business.value = enterpriseRegisterInfo.value?.ocr
+    contactList = enterpriseRegisterInfo.value?.contactList || []
     formItems.value.options.forEach(e => {
       if (e.key === 'passwordConfirm') e.value = enterpriseRegisterInfo.value.password
       else e.value = enterpriseRegisterInfo.value[e.key]
@@ -350,6 +364,76 @@ if (info && Object.keys(info).length && info.status === '2') {
   }
 }
 
+const contactNameObj = {
+  type: 'text',
+  key: 'contactName',
+  value: '',
+  label: '联系人姓名 *',
+  rules: [v => !!v || '请输入联系人姓名'],
+}
+const phoneObj = {
+  type: 'phoneNumber',
+  key: 'phone',
+  value: '',
+  label: '联系电话 *',
+  rules: [v => !!v || '请输入联系电话'],
+}
+
+const emailObj = {
+  type: 'text',
+  key: 'email',
+  value: email ? email : '',
+  label: '企业邮箱 *(此邮箱将用于日后“登录邮箱”)',
+  // label: '企业邮箱 * (此邮箱将作为企业登录的账号)',
+  rules: [
+    value => {
+      if (value) return true
+      return '请输入企业邮箱'
+    },
+    value => {
+      if (checkEmail(value)) return true
+      return '请输入正确的企业邮箱'
+    }
+  ],
+}
+
+const passwordObj = {
+  type: 'password',
+  key: 'password',
+  value: '',
+  password: true,
+  appendInnerIcon: 'mdi-eye-off-outline',
+  label: '账户登录密码 *',
+  placeholder: '请输入账户登录密码',
+  // appendInnerClick: handlePassword,
+  rules: [
+    value => {
+      if (value) return true
+      return '请输入账户登录密码'
+    },
+    value => {
+      if (/^(?=.*[0-9])(?=.*[a-z])(?=.*[A-Z]).{8,16}$/.test(value)) return true
+      return '请输入8-16位数由数字、大小写字母组成的密码'
+    }
+  ],
+}
+
+const passwordConfirmObj = {
+  type: 'password',
+  key: 'passwordConfirm',
+  value: '',
+  password: true,
+  appendInnerIcon: 'mdi-eye-off-outline',
+  label: '请再次输入账户登录密码 *',
+  placeholder: '请再次输入账户登录密码',
+  // appendInnerClick: handleSecondConfirm,
+  rules: [
+    value => {
+      if (value) return true
+      return '请再次输入密码'
+    },
+  ],
+}
 </script>
 
 <style lang="scss" scoped>
@@ -411,4 +495,10 @@ if (info && Object.keys(info).length && info.status === '2') {
     margin-bottom: 12px;
   }
 }
+.contactItemCard {
+  background-color: var(--default-bgc);
+  border-radius: 8px;
+  padding: 16px 24px;
+  margin-bottom: 20px;
+}
 </style>