register.vue 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231
  1. <template>
  2. <div class="my-5">
  3. <div :class="isMobile? 'mobileBox' : 'default-width'">
  4. <v-btn class="my-2" color="primary" variant="text" size="large" @click="router.push('/recruitHome')">{{ `<< 回到首页` }}</v-btn>
  5. </div>
  6. <v-card class="pa-5" :class="isMobile? 'mobileBox' : 'default-width'" :elevation="isMobile? '0' : '3'">
  7. <!-- 标题 -->
  8. <div class="resume-header">
  9. <div class="resume-title">{{ $t('enterprise.registeringNewEnterprise') }}</div>
  10. </div>
  11. <!-- 表单 -->
  12. <div class="CtFormClass" :style="{width: isMobile ? '' : '600px'}">
  13. <CtForm ref="CtFormRef" :items="formItems" style="width: 100%;">
  14. <template #prepare>
  15. <v-checkbox
  16. v-model="isPrepare"
  17. label="筹建中"
  18. color="primary"
  19. class="ml-1"
  20. style="width: 150px; max-height: 38px;"
  21. @change="isPrepareChange"
  22. ></v-checkbox>
  23. </template>
  24. </CtForm>
  25. <!-- 上传照片 -->
  26. <div style="color: var(--color-999);">
  27. <span v-if="!isPrepare" class="mr-1" style="color: var(--v-error-base);">*</span>
  28. <span>上传营业执照</span>
  29. <!-- <span class="mx-3 defaultLink">查看示例</span> -->
  30. <span>支持jpg、jpeg、png格式,图片大小不得超过10M</span>
  31. </div>
  32. <div class="file-box">
  33. <Img class="mt-3" :value="licenseUrl" tips="上传图片" @imgClick="showPreview = !showPreview" :showCursor="true" @success="val => licenseUrl = val" @delete="licenseUrl = ''"></Img>
  34. </div>
  35. <div class="note mt-10">
  36. <h4>注意事项:</h4>
  37. <span>企业名称为对外展示的企业名称,建议填写公司营业执照上的名称,请区分总公司和分公司</span>
  38. <!-- <div>
  39. <span>2.若公司已注册,请上传公司委托证明下载模版</span>
  40. <span class="mx-3 defaultLink">下载模版</span>
  41. </div> -->
  42. </div>
  43. </div>
  44. <div class="text-center">
  45. <!-- 提交 -->
  46. <v-btn
  47. :loading="loginLoading"
  48. color="primary" class="white--text my-8" min-width="350"
  49. @click="handleCommit"
  50. >
  51. {{ $t('common.complete') }}
  52. </v-btn>
  53. </div>
  54. <!-- 底部 个人不能绑定企业 要去后端管理员加 -->
  55. <!-- <div class="text-center">
  56. <v-btn color="primary" variant="text" @click="router.push({ path: '/recruit/enterprise/register/joiningEnterprise' })">{{ $t('enterprise.joiningEnterprise') }}</v-btn>
  57. </div> -->
  58. </v-card>
  59. <PreviewImg v-if="showPreview" :current="current" :list="[licenseUrl]" @close="showPreview = !showPreview"></PreviewImg>
  60. </div>
  61. </template>
  62. <script setup>
  63. import CtForm from '@/components/CtForm'
  64. import Snackbar from '@/plugins/snackbar'
  65. import { useI18n } from '@/hooks/web/useI18n'
  66. import { useRouter } from 'vue-router'; const router = useRouter()
  67. import { enterpriseRegisterApply } from '@/api/personal/user'
  68. import { onMounted, ref } from 'vue';
  69. defineOptions({name: 'enterprise-enterpriseRegister-register'})
  70. const { t } = useI18n()
  71. const CtFormRef = ref()
  72. const loginLoading = ref(false)
  73. // 图片预览
  74. const showPreview = ref(false)
  75. const current = ref(0)
  76. // 组件挂载后添加事件监听器
  77. const isMobile = ref(false)
  78. onMounted(() => {
  79. const userAgent = navigator.userAgent
  80. isMobile.value = /(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i.test(userAgent)
  81. })
  82. // 是否筹建中
  83. const isPrepare = ref(false)
  84. const isPrepareChange = () => {
  85. const code = formItems.value.options.find(e => e.key === 'code')
  86. if (code) {
  87. code.label = isPrepare.value ? '企业统一社会信用代码' : '企业统一社会信用代码 *'
  88. code.rules = isPrepare.value ? [] : [v => !!v || '请输入企业统一社会信用代码']
  89. }
  90. }
  91. const formItems = ref({
  92. options: [
  93. {
  94. type: 'text',
  95. key: 'name',
  96. value: '',
  97. label: '企业名称(需要与营业执照完全一致)*',
  98. counter: 50,
  99. rules: [v => !!v || '请输入企业名称']
  100. },
  101. {
  102. slotName: 'prepare',
  103. type: 'text',
  104. key: 'code',
  105. value: '',
  106. counter: 18,
  107. label: '企业统一社会信用代码 *',
  108. rules: [v => !!v || '请输入企业统一社会信用代码']
  109. },
  110. {
  111. type: 'text',
  112. key: 'contactName',
  113. value: '',
  114. label: '联系人姓名 *',
  115. rules: [v => !!v || '请输入联系人姓名']
  116. },
  117. {
  118. type: 'phoneNumber',
  119. key: 'phone',
  120. value: '',
  121. label: '联系电话 *',
  122. // flexStyle: 'mr-3',
  123. // col: 6,
  124. rules: [v => !!v || '请输入联系电话']
  125. },
  126. {
  127. type: 'text',
  128. key: 'email',
  129. value: '',
  130. label: '联系邮箱 *',
  131. // col: 6,
  132. rules: [v => !!v || '请输入联系邮箱']
  133. },
  134. {
  135. type: 'textarea',
  136. key: 'description',
  137. value: '',
  138. clearable: true,
  139. resize: true,
  140. counter: 500,
  141. rows: 2,
  142. label: '备注/说明 *',
  143. },
  144. ]
  145. })
  146. // 上传
  147. let licenseUrl = ref('')
  148. // 提交 企业注册
  149. const handleCommit = async () => {
  150. const { valid } = await CtFormRef.value.formRef.validate()
  151. if (!valid) return
  152. const businessLicenseUrl = licenseUrl.value;
  153. if (!isPrepare.value && !businessLicenseUrl) return Snackbar.warning('请上传营业执照图片')
  154. const params = {
  155. businessLicenseUrl,
  156. prepare: isPrepare.value,
  157. }
  158. formItems.value.options.forEach(e => { params[e.key] = e.value })
  159. await enterpriseRegisterApply(params)
  160. Snackbar.success(t('common.submittedSuccessfully'))
  161. router.push({ path: '/recruit/enterprise/register/inReview' })
  162. }
  163. // 不通过的企业注册申请 重新发起
  164. const info = JSON.parse(localStorage.getItem('userApplyInfo'))
  165. if (info && Object.keys(info).length) {
  166. licenseUrl.value = info?.businessLicenseUrl
  167. formItems.value.options.forEach(e => { e.value = info[e.key] })
  168. }
  169. </script>
  170. <style lang="scss" scoped>
  171. .CtFormClass {
  172. margin: 0 auto;
  173. }
  174. .note {
  175. color: var(--color-666);
  176. font-size: 14px;
  177. line-height: 32px;
  178. }
  179. .file-box {
  180. display: flex;
  181. flex-wrap: wrap; /* 允许换行 */
  182. width: 100%; /* 设置容器宽度 */
  183. .file-item {
  184. height: 80px;
  185. width: 100px;
  186. border-radius: 5px;
  187. margin-right: 8px;
  188. margin-top: 12px;
  189. // border: 1px solid rgb(188, 188, 188);
  190. border: 1px solid rgba(188, 188, 188, 0.5);
  191. }
  192. .file-input-box {
  193. position: relative;
  194. border: 1px solid rgb(188, 188, 188);
  195. cursor: pointer;
  196. .icon {
  197. position: absolute;
  198. top: 45%;
  199. left: 50%;
  200. transform: translate(-50%, -50%);
  201. color: var(--color-999);
  202. }
  203. }
  204. // 验证是否为空
  205. .verifyAct {
  206. color: var(--v-error-base);
  207. border: 1px solid var(--v-error-base);
  208. .icon { color: var(--v-error-base); }
  209. }
  210. }
  211. .PrepareBox {
  212. margin-top: 74px;
  213. margin-left: 32px;
  214. }
  215. .mobileBox {
  216. width: 100vw;
  217. .resume-header {
  218. margin-bottom: 12px;
  219. }
  220. }
  221. </style>