register.vue 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197
  1. <template>
  2. <div class="pt-5">
  3. <v-card class="default-width pa-5">
  4. <!-- 标题 -->
  5. <div class="resume-header">
  6. <div class="resume-title">{{ $t('enterprise.registeringNewEnterprise') }}</div>
  7. </div>
  8. <!-- 表单 -->
  9. <div class="CtFormClass" style="width: 600px;">
  10. <CtForm ref="CtFormRef" :items="formItems" style="width: 100%;"></CtForm>
  11. <!-- 上传照片 -->
  12. <div style="color: #999;">
  13. <span class="mr-1" style="color: #fe574a;">*</span>
  14. <span>上传营业执照</span>
  15. <!-- <span class="mx-3 defaultLink">查看示例</span> -->
  16. <span>支持jpg、jpeg、png格式,照片大小不得超过10M</span>
  17. </div>
  18. <div class="file-box">
  19. <div class="file-item" v-if="licenseUrl">
  20. <v-img width="100%" height="100%" :src="licenseUrl"></v-img>
  21. </div>
  22. <div class="file-item file-input-box" :class="{'verifyAct': fileVerify}" @click="openFileInput">
  23. <div class="icon text-center">
  24. <span class="mdi mdi-plus" style="font-size: 20px;"></span>
  25. <div style="font-size: 12px; ">上传照片</div>
  26. </div>
  27. <input
  28. type="file"
  29. ref="fileInput"
  30. accept="image/png, image/jpg, image/jpeg"
  31. style="display: none;"
  32. @change="handleUploadFile"
  33. />
  34. </div>
  35. </div>
  36. <!-- 注意事项 -->
  37. <div class="note mt-5">
  38. <h4>注意事项:</h4>
  39. <span>企业名称为对外展示的企业名称,建议填写公司营业执照上的名称,请区分总公司和分公司</span>
  40. <!-- <div>
  41. <span>2.若公司已注册,请上传公司委托证明下载模版</span>
  42. <span class="mx-3 defaultLink">下载模版</span>
  43. </div> -->
  44. </div>
  45. </div>
  46. <div class="text-center">
  47. <!-- 提交 -->
  48. <v-btn
  49. :loading="loginLoading"
  50. color="primary" class="white--text my-8" min-width="350"
  51. @click="handleCommit"
  52. >
  53. {{ $t('common.complete') }}
  54. </v-btn>
  55. </div>
  56. <!-- 底部 个人不能绑定企业 要去后端管理员加 -->
  57. <!-- <div class="text-center">
  58. <v-btn color="primary" variant="text" @click="router.push({ path: '/recruit/enterprise/register/joiningEnterprise' })">{{ $t('enterprise.joiningEnterprise') }}</v-btn>
  59. </div> -->
  60. </v-card>
  61. </div>
  62. </template>
  63. <script setup>
  64. import CtForm from '@/components/CtForm'
  65. import Snackbar from '@/plugins/snackbar'
  66. import { uploadFile } from '@/api/common'
  67. import { useI18n } from '@/hooks/web/useI18n'
  68. import { useRouter } from 'vue-router'
  69. import { enterpriseRegisterApply } from '@/api/personal/user'
  70. import { ref } from 'vue';
  71. defineOptions({name: 'enterprise-enterpriseRegister-register'})
  72. const { t } = useI18n()
  73. const CtFormRef = ref()
  74. const router = useRouter()
  75. const fileVerify = ref(false)
  76. const loginLoading = ref(false)
  77. const formItems = ref({
  78. options: [
  79. {
  80. type: 'text',
  81. key: 'name',
  82. value: '',
  83. label: '企业名称(需要与营业执照完全一致)*',
  84. counter: 50,
  85. rules: [v => !!v || '请输入企业名称']
  86. },
  87. {
  88. type: 'text',
  89. key: 'code',
  90. value: '',
  91. label: '企业统一社会信用代码 *',
  92. rules: [v => !!v || '请输入企业统一社会信用代码']
  93. },
  94. {
  95. type: 'text',
  96. key: 'phone',
  97. value: '',
  98. label: '联系电话 *',
  99. rules: [v => !!v || '请输入联系电话']
  100. },
  101. {
  102. type: 'text',
  103. key: 'email',
  104. value: '',
  105. label: '联系邮箱 *',
  106. rules: [v => !!v || '请输入联系邮箱']
  107. },
  108. ]
  109. })
  110. // 选择文件
  111. const fileInput = ref()
  112. const clicked = ref(false)
  113. const openFileInput = () => {
  114. if (clicked.value) return
  115. clicked.value = true
  116. fileInput.value.click()
  117. clicked.value = false
  118. }
  119. // 上传
  120. let licenseUrl = ref('')
  121. const handleUploadFile = async (e) => {
  122. const file = e.target.files[0]
  123. const formData = new FormData()
  124. formData.append('file', file)
  125. const { data } = await uploadFile(formData)
  126. if (!data) return
  127. licenseUrl.value = data
  128. fileVerify.value = false
  129. // console.log('uploadFile->data', data)
  130. Snackbar.success(t('common.uploadSucMsg'))
  131. }
  132. // 提交 企业注册
  133. const handleCommit = async () => {
  134. // 广州辞图科技有限公司
  135. const { valid } = await CtFormRef.value.formRef.validate()
  136. const businessLicenseUrl = licenseUrl.value; if (!businessLicenseUrl) fileVerify.value = true
  137. if (!valid || !businessLicenseUrl) return
  138. const baseInfo = {}
  139. formItems.value.options.forEach(e => { baseInfo[e.key] = e.value })
  140. await enterpriseRegisterApply({ ...baseInfo, businessLicenseUrl })
  141. Snackbar.success(t('common.submittedSuccessfully'))
  142. router.push({ path: '/recruit/enterprise/register/inReview' })
  143. }
  144. // 不通过的企业注册申请 重新发起
  145. const info = JSON.parse(localStorage.getItem('userApplyInfo'))
  146. if (info && Object.keys(info).length) {
  147. licenseUrl.value = info?.businessLicenseUrl
  148. formItems.value.options.forEach(e => { e.value = info[e.key] })
  149. }
  150. </script>
  151. <style lang="scss" scoped>
  152. .CtFormClass {
  153. margin: 0 auto;
  154. }
  155. .note {
  156. color: #666;
  157. font-size: 14px;
  158. line-height: 32px;
  159. }
  160. .file-box {
  161. display: flex;
  162. flex-wrap: wrap; /* 允许换行 */
  163. width: 100%; /* 设置容器宽度 */
  164. .file-item {
  165. height: 80px;
  166. width: 100px;
  167. border-radius: 5px;
  168. margin-right: 8px;
  169. margin-top: 12px;
  170. // border: 1px solid rgb(188, 188, 188);
  171. border: 1px solid rgba(188, 188, 188, 0.5);
  172. }
  173. .file-input-box {
  174. position: relative;
  175. border: 1px solid rgb(188, 188, 188);
  176. cursor: pointer;
  177. .icon {
  178. position: absolute;
  179. top: 45%;
  180. left: 50%;
  181. transform: translate(-50%, -50%);
  182. color: #999;
  183. }
  184. }
  185. // 验证是否为空
  186. .verifyAct {
  187. color: #fe574a;
  188. border: 1px solid #fe574a;
  189. .icon { color: #fe574a; }
  190. }
  191. }
  192. </style>