|
@@ -13,8 +13,17 @@
|
|
|
offset-y="33"
|
|
|
:color="baseInfo?.sex ? (baseInfo?.sex === '1' ? '#1867c0' : 'error') : 'error'"
|
|
|
:icon="baseInfo?.sex ? (baseInfo?.sex === '1' ? 'mdi-gender-male' : 'mdi-gender-female') : 'mdi-gender-female'">
|
|
|
- <v-avatar size=80 :image="baseInfo.avatar || 'https://minio.citupro.com/dev/menduner/7.png'"></v-avatar>
|
|
|
- <div v-show="showIcon" class="mdi mdi-camera-outline"></div>
|
|
|
+ <v-avatar size=80 :image="baseInfo.avatar || 'https://minio.citupro.com/dev/menduner/7.png'">
|
|
|
+ </v-avatar>
|
|
|
+ <div v-show="showIcon" @click="openFileInput" v-bind="$attrs" class="mdi mdi-camera-outline">
|
|
|
+ <input
|
|
|
+ type="file"
|
|
|
+ ref="fileInput"
|
|
|
+ accept="image/png, image/jpg, image/jpeg"
|
|
|
+ style="display: none;"
|
|
|
+ @change="handleUploadFile"
|
|
|
+ />
|
|
|
+ </div>
|
|
|
</v-badge>
|
|
|
</div>
|
|
|
<!-- 基础信息 -->
|
|
@@ -114,9 +123,12 @@ import { getDict } from '@/hooks/web/useDictionaries'
|
|
|
import { getTimeStamp, timesTampChange } from '@/utils/date'
|
|
|
import { saveResumeBasicInfo } from '@/api/resume'
|
|
|
import { useUserStore } from '@/store/user'
|
|
|
+import { uploadFile } from '@/api/common'
|
|
|
+import { useI18n } from '@/hooks/web/useI18n'
|
|
|
import { ref } from 'vue';
|
|
|
|
|
|
defineOptions({name: 'resume-components-basicInfo'})
|
|
|
+const { t } = useI18n()
|
|
|
const userStore = useUserStore()
|
|
|
const CtFormRef = ref()
|
|
|
const isEdit = ref(false)
|
|
@@ -130,6 +142,30 @@ const getBasicInfo = () => { // 获取基础信息
|
|
|
}
|
|
|
getBasicInfo()
|
|
|
|
|
|
+// 选择文件
|
|
|
+const fileInput = ref()
|
|
|
+const clicked = ref(false)
|
|
|
+const openFileInput = () => {
|
|
|
+ if (clicked.value) return
|
|
|
+ clicked.value = true
|
|
|
+ fileInput.value.click()
|
|
|
+ clicked.value = false
|
|
|
+}
|
|
|
+
|
|
|
+// 上传头像
|
|
|
+const handleUploadFile = async (e) => {
|
|
|
+ const file = e.target.files[0]
|
|
|
+ const formData = new FormData()
|
|
|
+ formData.append('file', file)
|
|
|
+ const { data } = await uploadFile(formData)
|
|
|
+ if (!data) return
|
|
|
+ Snackbar.success(t('common.uploadSucMsg'))
|
|
|
+ // 保存信息
|
|
|
+ await saveResumeBasicInfo({ ...baseInfo.value, avatar: data })
|
|
|
+ await userStore.getUserBaseInfos(baseInfo.value.userId)
|
|
|
+ getBasicInfo()
|
|
|
+}
|
|
|
+
|
|
|
const formItems = ref({
|
|
|
options: [
|
|
|
{
|
|
@@ -315,7 +351,7 @@ const handleSave = async () => {
|
|
|
else obj[e.key] = e.value
|
|
|
})
|
|
|
await saveResumeBasicInfo(obj)
|
|
|
- Snackbar.success('保存成功!')
|
|
|
+ Snackbar.success(t('common.saveMsg'))
|
|
|
isEdit.value = false
|
|
|
// 获取当前登录账户信息
|
|
|
await userStore.getUserBaseInfos(baseInfo.value.userId)
|