Browse Source

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

lifanagju_citu 6 months ago
parent
commit
5c70f8667c

+ 7 - 7
.env.development

@@ -3,16 +3,16 @@ NODE_ENV = 'development'
 VITE_APP_TITLE = 门墩儿
 
 # 访问路径
-# VITE_ACCESS_BASE_URL = 'http://menduner.citupro.com:7878'
-VITE_ACCESS_BASE_URL = 'https://www.menduner.com'
-
+# VITE_ACCESS_BASE_URL = 'http://menduner.citupro.com:7878' # 测试环境
+VITE_ACCESS_BASE_URL = 'https://www.menduner.com' # 生产环境
+# 
 # 请求路径
-# VITE_BASE_URL = 'http://menduner.citupro.com:7878'
-VITE_BASE_URL = 'https://www.menduner.com'
+# VITE_BASE_URL = 'http://menduner.citupro.com:7878' # 测试环境
+VITE_BASE_URL = 'https://www.menduner.com' # 生产环境
 
 # 预览路径
-# VITE_PREVIEW_URL = 'http://192.168.3.91:8012'
-VITE_PREVIEW_URL = 'https://kkfileview.menduner.com/'
+# VITE_PREVIEW_URL = 'http://192.168.3.91:8012' # 测试环境
+VITE_PREVIEW_URL = 'https://kkfileview.menduner.com/' # 生产环境
 
 # 租户id
 VITE_TENANTCODE = '155'

+ 3 - 3
src/api/common/index.js

@@ -222,9 +222,9 @@ export const uploadFile = async (data) => {
 }
 
 // 图片上传
-export const uploadImage = async (data) => {
-  return await request.upload({ url: '/app-api/infra/file/upload', data })
-}
+// export const uploadImage = async (data) => {
+//   return await request.upload({ url: '/app-api/infra/file/upload', data })
+// }
 
 // 获取当前登录的企业用户信息
 export const getEnterprisingUserInfo = async (params) => {

+ 12 - 1
src/components/Upload/file.vue

@@ -13,7 +13,7 @@ const emits = defineEmits(['success'])
 const props = defineProps({
   accept: {
     type: String,
-    default: '.pdf, .doc, .docx'
+    default: '.pdf,.doc,.docx'
   },
   custom: {
     type: Boolean,
@@ -22,6 +22,10 @@ const props = defineProps({
   customName: {
     type: String,
     default: ''
+  },
+  path: {
+    type: String,
+    default: 'attachment' // attachment附件, img, video
   }
 })
 
@@ -47,8 +51,15 @@ const handleUploadFile = async (e) => {
     return
   }
   const arr = file.name.split('.')
+
+  // 效验文件格式是否正确
+  const fileType = arr[arr.length - 1]
+  const acceptArr = props.accept.split(',')
+  if (!acceptArr.includes(`.${fileType}`)) return Snackbar.warning('请上传指定格式的文件')
+
   const formData = new FormData()
   formData.append(props.customName || 'file', file)
+  formData.append('path', props.path)
   if (props.custom) return emits('success', formData)
   const { data } = await uploadFile(formData)
   if (!data) return

+ 8 - 2
src/components/Upload/img.vue

@@ -21,7 +21,7 @@
 // 图片上传
 defineOptions({ name: 'upload-img'})
 import { ref, watch } from 'vue'
-import { uploadImage } from '@/api/common'
+import { uploadFile } from '@/api/common'
 import { useI18n } from '@/hooks/web/useI18n'
 import Snackbar from '@/plugins/snackbar'
 
@@ -54,6 +54,7 @@ const openFileInput = () => {
 }
 
 // 文件上传
+const accept = ['jpg', 'png', 'webp', 'jpeg']
 const handleUploadFile = async (e) => {
   const file = e.target.files[0]
   const size = file.size
@@ -61,9 +62,14 @@ const handleUploadFile = async (e) => {
     Snackbar.warning(t('common.fileSizeExceed'))
     return
   }
+
+  const fileType = file.name.split('.')[1]
+  if (!accept.includes(fileType)) return Snackbar.warning('请上传图片格式')
+
   const formData = new FormData()
   formData.append('file', file)
-  const { data } = await uploadImage(formData)
+  formData.append('path', 'img')
+  const { data } = await uploadFile(formData)
   if (!data) return Snackbar.error('上传失败')
   src.value = data
   if (props.showSnackbar) Snackbar.success(t('common.uploadSucMsg'))

+ 0 - 2
src/views/recruit/components/message/index.vue

@@ -339,7 +339,6 @@ if (route.query.id) {
       handleChange(items)
     })
   }
-  
 }
 
 const {
@@ -361,7 +360,6 @@ const {
   chatRef.value.scrollBottom()
 })
 
-
 const getInterviewInviteList = async () => {
   if (!info.value.userId) return
   const data = await getInterviewInviteListByInviteUserId(info.value.userId)

+ 1 - 1
src/views/recruit/entRegister/register.vue

@@ -33,7 +33,7 @@
               <div style="color: var(--color-999);">
                 <span v-if="!prepareValue" class="mr-1" style="color: var(--v-error-base);">*</span>
                 <span>上传营业执照</span>
-                <span>支持jpg、jpeg、png格式,图片大小不得超过10M</span>
+                <span>支持jpg、jpeg、png格式,图片大小不得超过20M</span>
               </div>
               <div class="file-box">
                 <Img 

+ 1 - 1
src/views/recruit/enterprise/entInfoSetting/informationSettingsComponents/businessInformation.vue

@@ -8,7 +8,7 @@
           <div style="color: var(--color-999);">
             <!-- <span class="mr-1" style="color: var(--v-error-base);">*</span> -->
             <span>上传营业执照</span>
-            <span>支持jpg、jpeg、png格式,图片大小不得超过10M</span>
+            <span>支持jpg、jpeg、png格式,图片大小不得超过20M</span>
           </div>
           <div class="file-box">
             <Img 

+ 11 - 4
src/views/recruit/enterprise/entInfoSetting/informationSettingsComponents/enterpriseAlbum.vue

@@ -42,7 +42,7 @@
 defineOptions({name: 'informationSettingsComponents-enterpriseAlbum'})
 import { ref } from 'vue'
 import { checkIsImage } from '@/utils'
-import { uploadImage } from '@/api/common'
+import { uploadFile } from '@/api/common'
 import { useI18n } from '@/hooks/web/useI18n'
 import { getEnterpriseBaseInfo, updateEnterpriseAlbum } from '@/api/enterprise'
 import Snackbar from '@/plugins/snackbar'
@@ -101,17 +101,24 @@ const openFileInput = () => {
 }
 
 // 上传
+const accept = ['jpg', 'png', 'jpeg', 'mp4', 'wmv', 'avi', 'mov']
 const handleUploadFile = async (e) => {
   if (!e.target.files.length) return
   const file = e.target.files[0]
   const size = file.size
-  if (size / (1024*1024) > 10) {
-    Snackbar.warning(t('common.fileSizeExceed10'))
+  if (size / (1024*1024) > 20) {
+    Snackbar.warning('文件大小不能超过20MB')
     return
   }
+
+  const fileType = file.name.split('.')[1]
+  if (!accept.includes(fileType)) return Snackbar.warning('文件格式不正确')
+  const isImage = ['jpg', 'png', 'jpeg'].includes(fileType)
+
   const formData = new FormData()
   formData.append('file', file)
-  const { data } = await uploadImage(formData)
+  formData.append('path', isImage ? 'img' : 'video')
+  const { data } = await uploadFile(formData)
   if (!data) return
   Snackbar.success(t('common.uploadSucMsg'))
   imgList.value.push(data)

+ 6 - 4
src/views/recruit/enterprise/entInfoSetting/informationSettingsComponents/enterpriseLogo.vue

@@ -45,7 +45,7 @@
 defineOptions({name: 'informationSettingsComponents-enterpriseLogo'})
 import { useUserStore } from '@/store/user'; const userStore = useUserStore()
 import { ref } from 'vue'
-import { uploadImage } from '@/api/common'
+import { uploadFile } from '@/api/common'
 import { useI18n } from '@/hooks/web/useI18n'
 import { updateEnterpriseLogo, getEnterpriseBaseInfo } from '@/api/enterprise'
 import Snackbar from '@/plugins/snackbar'
@@ -90,7 +90,8 @@ const handleHideCopper = (data) => {
 
     const formData = new FormData()
     formData.append('file', file)
-    uploadImage(formData).then(async ({ data }) => {
+    formData.append('path', 'img')
+    uploadFile(formData).then(async ({ data }) => {
       if (!data) return
       Snackbar.success(t('common.uploadSucMsg'))
       await updateEnterpriseLogo(data)
@@ -100,7 +101,7 @@ const handleHideCopper = (data) => {
 }
 
 // 上传
-const typeList = ['png', 'jpg', 'jpeg']
+const typeList = ['jpg', 'png', 'jpeg']
 const handleUploadFile = async (e) => {
   if (!e.target.files.length) return
   const file = e.target.files[0]
@@ -128,7 +129,8 @@ const handleUploadFile = async (e) => {
       // 大小符合直接上传logo
       const formData = new FormData()
       formData.append('file', file)
-      const { data } = await uploadImage(formData)
+      formData.append('path', 'img')
+      const { data } = await uploadFile(formData)
       if (!data) return
       Snackbar.success(t('common.uploadSucMsg'))
       await updateEnterpriseLogo(data)

+ 9 - 13
src/views/recruit/enterprise/staffInfoSetting/index.vue

@@ -15,7 +15,7 @@
             />
           </div>
         </div>
-        <div style="font-size: 14px; color: var(--color-999);">只支持JPG、JPEG、PNG类型的图片,大小不超过10M</div>
+        <div style="font-size: 14px; color: var(--color-999);">只支持JPG、JPEG、PNG类型的图片,大小不超过20M</div>
       </template>
     </CtForm>
     <v-btn class="buttons mt-5" color="primary" @click.stop="handleSubmit">{{ $t('common.save') }}</v-btn>
@@ -30,7 +30,7 @@
 defineOptions({ name: 'information-setting'})
 import { ref } from 'vue'
 import { saveUserInfo } from '@/api/enterprise'
-import { uploadImage } from '@/api/common'
+import { uploadFile } from '@/api/common'
 import { useI18n } from '@/hooks/web/useI18n'
 // import { getDict } from '@/hooks/web/useDictionaries'
 import { useUserStore } from '@/store/user'
@@ -111,20 +111,10 @@ const baseInfo = ref(JSON.parse(localStorage.getItem('entBaseInfo')) || {})
 const query = ref({})
 // 获取字典数据以及字段回显
 formItems.value.options.forEach(item => {
-  // if (item.dictTypeName) {
-  //   getDict(item.dictTypeName).then(({ data }) => {
-  //     data = data?.length && data || []
-  //     item.items = data
-  //   })
-  // }
   if (Object.keys(baseInfo).length) {
     item.value = baseInfo.value[item.key]
     query.value.id = baseInfo.value.id
   }
-  // if (item.key === 'email') {
-  //   item.disabled = checkEmail(item.value)
-  //   emailChange = !item.disabled
-  // }
 })
 // 监听store变化
 userStore.$subscribe((mutation, state) => {
@@ -142,9 +132,14 @@ const openFileInput = () => {
 }
 
 // 上传头像
+const accept = ['jpg', 'png', 'jpeg']
 const handleUploadFile = async (e) => {
   const file = e.target.files[0]
   if (!file) return
+
+  const fileType = file.name.split('.')[1]
+  if (!accept.includes(fileType)) return Snackbar.warning('请上传图片格式文件')
+
   const reader = new FileReader()
   reader.readAsDataURL(file)
   reader.onload = () => {
@@ -161,7 +156,8 @@ const handleHideCopper = (data) => {
 
     const formData = new FormData()
     formData.append('file', file)
-    uploadImage(formData).then(async ({ data }) => {
+    formData.append('path', 'img')
+    uploadFile(formData).then(async ({ data }) => {
       if (!data) return
       formItems.value.options.find(e => e.key === 'avatar').value = data
     })

+ 8 - 2
src/views/recruit/enterprise/systemManagement/groupAccount/index.vue

@@ -109,7 +109,7 @@ import { checkEmail } from '@/utils/validate'
 import { updateGroupUserAccount } from '@/api/enterprise'
 import { getDict } from '@/hooks/web/useDictionaries'
 import { getUserAvatar } from '@/utils/avatar'
-import { uploadImage } from '@/api/common'
+import { uploadFile } from '@/api/common'
 import { getToken } from '@/utils/auth'
 
 const { t } = useI18n()
@@ -293,9 +293,14 @@ const openFileInput = () => {
 }
 
 // 上传头像
+const accept = ['jpg', 'png', 'jpeg']
 const handleUploadFile = async (e) => {
   const file = e.target.files[0]
   if (!file) return
+
+  const fileType = file.name.split('.')[1]
+  if (!accept.includes(fileType)) return Snackbar.warning('请上传图片格式文件')
+
   const reader = new FileReader()
   reader.readAsDataURL(file)
   reader.onload = () => {
@@ -312,7 +317,8 @@ const handleHideCopper = (data) => {
 
     const formData = new FormData()
     formData.append('file', file)
-    uploadImage(formData).then(async ({ data }) => {
+    formData.append('path', 'img')
+    uploadFile(formData).then(async ({ data }) => {
       if (!data) return
       formItems.value.options.find(e => e.key === 'avatar').value = data
     })

+ 8 - 2
src/views/recruit/personal/PersonalCenter/resume/online/components/basicInfo.vue

@@ -118,7 +118,7 @@ import { getDict } from '@/hooks/web/useDictionaries'
 // import { timesTampChange } from '@/utils/date'
 import { updatePersonAvatar, saveResumeBasicInfo } from '@/api/recruit/personal/resume'
 import { useUserStore } from '@/store/user'
-import { uploadImage } from '@/api/common'
+import { uploadFile } from '@/api/common'
 import { getUserAvatar } from '@/utils/avatar'
 import { useI18n } from '@/hooks/web/useI18n'
 import portrait from './portrait.vue'
@@ -161,8 +161,11 @@ const openFileInput = () => {
 // 上传头像
 const selectPic = ref('')
 const isShowCopper = ref(false)
+const accept = ['jpg', 'png', 'jpeg']
 const handleUploadFile = async (e) => {
   const file = e.target.files[0]
+  const fileType = file.name.split('.')[1]
+  if (!accept.includes(fileType)) return Snackbar.warning('请上传图片格式')
   const reader = new FileReader()
   reader.readAsDataURL(file)
   reader.onload = () => {
@@ -179,8 +182,9 @@ const handleHideCopper = (data) => {
     if (!file) return
     const formData = new FormData()
     formData.append('file', file)
+    formData.append('path', 'img')
     overlay.value = true
-    uploadImage(formData).then(async ({data}) => {
+    uploadFile(formData).then(async ({data}) => {
       if (!data) return
       await updatePersonAvatar(data)
       setTimeout(async () => {
@@ -189,6 +193,8 @@ const handleHideCopper = (data) => {
         overlay.value = false
         Snackbar.success(t('common.uploadSucMsg'))
       }, 1000)
+    }).catch(err => {
+      overlay.value = false
     })
   }
 }

+ 1 - 0
src/views/recruit/personal/shareJob/form/upload.vue

@@ -32,6 +32,7 @@ const handleUpload = async (e) => {
   }
   const formData = new FormData()
   formData.append('file', file)
+  formData.append('path', 'attachment')
   const { data } = await uploadFile(formData)
   if (!data) return
   const urlItem = items.value.options.find(e => e.key === 'url')