|
@@ -11,6 +11,17 @@
|
|
label-width="86px"
|
|
label-width="86px"
|
|
labelAlign="center"
|
|
labelAlign="center"
|
|
>
|
|
>
|
|
|
|
+ <uni-forms-item label="头像" name="avatar" class="f-straight" required>
|
|
|
|
+ <view style="display: flex;flex-wrap: wrap;">
|
|
|
|
+ <view class="upload-img" v-if="formData?.avatar">
|
|
|
|
+ <uni-icons size="35" type="clear" color="#fe574a" style="position: absolute;right: -15px; top: -15px; z-index: 9" @click="formData.avatar = ''"></uni-icons>
|
|
|
|
+ <image :src="formData?.avatar" mode="contain" style="width: 200rpx;height: 200rpx;" @click="handlePreviewImage"></image>
|
|
|
|
+ </view>
|
|
|
|
+ <view v-else class="upload-file" @click="uploadPhotos">
|
|
|
|
+ <uni-icons type="plusempty" size="50" color="#f1f1f1"></uni-icons>
|
|
|
|
+ </view>
|
|
|
|
+ </view>
|
|
|
|
+ </uni-forms-item>
|
|
<uni-forms-item name="name" label="姓名" required>
|
|
<uni-forms-item name="name" label="姓名" required>
|
|
<uni-easyinput placeholder="请输入姓名" v-model="formData.name" :inputBorder="false" type="text"></uni-easyinput>
|
|
<uni-easyinput placeholder="请输入姓名" v-model="formData.name" :inputBorder="false" type="text"></uni-easyinput>
|
|
</uni-forms-item>
|
|
</uni-forms-item>
|
|
@@ -65,6 +76,7 @@ import { dictObj } from '@/utils/position.js'
|
|
import { savePersonSimpleInfo } from '@/api/user'
|
|
import { savePersonSimpleInfo } from '@/api/user'
|
|
import { showAuthModal } from '@/hooks/useModal'
|
|
import { showAuthModal } from '@/hooks/useModal'
|
|
import { userStore } from '@/store/user'; const useUserStore = userStore()
|
|
import { userStore } from '@/store/user'; const useUserStore = userStore()
|
|
|
|
+import { uploadFile } from '@/api/file'
|
|
|
|
|
|
const baseInfoRef = ref()
|
|
const baseInfoRef = ref()
|
|
const formData = ref({ // 必填项目
|
|
const formData = ref({ // 必填项目
|
|
@@ -94,6 +106,9 @@ onMounted(() => {
|
|
})
|
|
})
|
|
|
|
|
|
const formRules = {
|
|
const formRules = {
|
|
|
|
+ avatar:{
|
|
|
|
+ rules: [{required: true, errorMessage: '请上传头像' }]
|
|
|
|
+ },
|
|
name:{
|
|
name:{
|
|
rules: [{required: true, errorMessage: '请输入姓名' }]
|
|
rules: [{required: true, errorMessage: '请输入姓名' }]
|
|
},
|
|
},
|
|
@@ -135,6 +150,43 @@ const handleLogoutConfirm = async () => {
|
|
showAuthModal()
|
|
showAuthModal()
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+// 图片预览
|
|
|
|
+const handlePreviewImage = () => {
|
|
|
|
+ uni.previewImage({
|
|
|
|
+ current: 0,
|
|
|
|
+ urls: [formData.value.avatar]
|
|
|
|
+ })
|
|
|
|
+}
|
|
|
|
+// 选择头像
|
|
|
|
+const uploadPhotos = () => {
|
|
|
|
+ wx.chooseImage({
|
|
|
|
+ count: 1,
|
|
|
|
+ sizeType: ['original', 'compressed'],
|
|
|
|
+ sourceType: ['album', 'camera'],
|
|
|
|
+ success: function(res){
|
|
|
|
+ const size = res.tempFiles[0]?.size || 0
|
|
|
|
+ if (size >= 31457280) {
|
|
|
|
+ uni.showToast({
|
|
|
|
+ icon: 'none',
|
|
|
|
+ title: '头像上传大小不得超过 20MB !',
|
|
|
|
+ duration: 2000
|
|
|
|
+ })
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ const path = res.tempFilePaths[0]
|
|
|
|
+ uploadFile(path, 'img').then(res => {
|
|
|
|
+ formData.value.avatar = res.data
|
|
|
|
+ }).catch(error => {
|
|
|
|
+ uni.showToast({
|
|
|
|
+ icon: 'error',
|
|
|
|
+ title: '图片上传失败!',
|
|
|
|
+ duration: 2000
|
|
|
|
+ })
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+}
|
|
|
|
+
|
|
const dealQuery = () => {
|
|
const dealQuery = () => {
|
|
const interestedList = [{ positionId: formData.value.interestedPositionId || null }]
|
|
const interestedList = [{ positionId: formData.value.interestedPositionId || null }]
|
|
const workExpList = [{
|
|
const workExpList = [{
|
|
@@ -176,4 +228,21 @@ const submit = async () => {
|
|
line-height: 26px;
|
|
line-height: 26px;
|
|
margin-bottom: 40rpx;
|
|
margin-bottom: 40rpx;
|
|
}
|
|
}
|
|
|
|
+.upload-img{
|
|
|
|
+ position: relative;
|
|
|
|
+ width: 200rpx;
|
|
|
|
+ height: 200rpx;
|
|
|
|
+ border: 1px solid #f1f1f1;
|
|
|
|
+ margin: 10rpx;
|
|
|
|
+}
|
|
|
|
+.upload-file{
|
|
|
|
+ width: 200rpx;
|
|
|
|
+ height: 200rpx;
|
|
|
|
+ border: 1px solid #f1f1f1;
|
|
|
|
+ margin: 10rpx;
|
|
|
|
+ display: flex;
|
|
|
|
+ justify-content: center;
|
|
|
|
+ align-items: center;
|
|
|
|
+ border-radius: 10rpx;
|
|
|
|
+}
|
|
</style>
|
|
</style>
|