招聘网页
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

index.vue 2.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. <template>
  2. <div>
  3. <template v-if="state">
  4. <a-form :model="createForm" layout="vertical" class="resume-form">
  5. <a-row :gutter="20">
  6. <a-form-item label="上传企业图片" name="photo">
  7. <upload upload_txt="上传企业图片" @uploadSuccess="uploadPhotoSuccess"
  8. :success_image="addOtherForm.photo_img" images_length="1" image_type="3"></upload>
  9. </a-form-item>
  10. <a-col span="24">
  11. <a-flex justify="flex-end">
  12. <a-space>
  13. <a-button @click="resetForm" size="large">取消</a-button>
  14. <a-button type="primary" @click="saveForm" size="large">保存</a-button>
  15. </a-space>
  16. </a-flex>
  17. </a-col>
  18. </a-row>
  19. </a-form>
  20. </template>
  21. <template v-else>
  22. <div v-if="createForm.photo">
  23. <image-container :imgObj="{src:createForm.photo? imageprefix + createForm.photo : '/images/gongzhonghao.png',width: '200px',height:'280px', mode: 'fill'}"></image-container>
  24. </div>
  25. </template>
  26. </div>
  27. </template>
  28. <script setup lang="ts">
  29. import { ref, onMounted, computed, defineProps, watch, defineEmits, createVNode } from 'vue';
  30. import { PostCompanyDetailInfo, PostCompanyPhotoUpload } from '@/apis/models';
  31. import Upload from '@/components/form/upload.vue';
  32. import { warnToast, successToast } from '@/utils/toastHelper';
  33. import { dataForm, otherDataForm, reset } from '@/components/company/information/image/data.ts';
  34. import { useCommon } from '@/hooks/useCommon';
  35. let { imageprefix } = useCommon();
  36. let props = defineProps(['form_state']);
  37. const emit = defineEmits();
  38. let state = ref<Boolean>(false)
  39. let createForm = ref<CompanyBasicType.BasicFormType>(dataForm)
  40. let addOtherForm = ref<CompanyBasicType.OtherFormType>(otherDataForm)
  41. onMounted(async () => {
  42. getBasic()
  43. })
  44. const getBasic = () => {
  45. PostCompanyDetailInfo().then(res => {
  46. createForm.value.photo = res.data.photo ? res.data.photo : ''
  47. addOtherForm.value = {
  48. photo_img: res.data.photo ? imageprefix + res.data.photo : '',
  49. }
  50. })
  51. }
  52. // 营业执照
  53. const uploadPhotoSuccess = (data : Object) => {
  54. addOtherForm.value.photo_img = imageprefix + data
  55. createForm.value.photo = data
  56. }
  57. const saveForm = () => {
  58. PostCompanyPhotoUpload(createForm.value).then(res => {
  59. successToast('保存成功')
  60. resetForm();
  61. getBasic();
  62. })
  63. }
  64. const resetForm = () => {
  65. createForm.value = reset().dataForm as CompanyBasicType.BasicFormType;
  66. addOtherForm.value = reset().otherDataForm as CompanyBasicType.OtherFormType;
  67. state.value = false;
  68. emit("quitEdit")
  69. }
  70. watch(() => [props.form_state], (newVal) => {
  71. state.value = newVal[0];
  72. getBasic();
  73. })
  74. </script>
  75. <style>
  76. </style>