| | |
| | | <fui-upload immediate :url="`${apiBaseUrl}/api/UpFile/UploadIdCord?PageName=FRONT`" ref="uploadF" |
| | | max='1' background='#fff' @success="success('FRONT',$event)" @error="errorFront" |
| | | @complete="completeFront" width="300" height="150"> |
| | | <image :src="userInfo.idCardFace?userInfo.idCardFace:'/static/positive.png'" mode="aspectFill" |
| | | style="width: 300rpx;height: 150rpx;"></image> |
| | | <image src="/static/positive.png" mode="widthFix" style="width: 300rpx;height: 150rpx;"></image> |
| | | </fui-upload> |
| | | <!-- <template #right> |
| | | <up-icon name="arrow-right"></up-icon> |
| | |
| | | <fui-upload immediate :url="`${apiBaseUrl}/api/UpFile/UploadIdCord?PageName=Back`" ref="uploadB" |
| | | max='1' background='#fff' @success="success('Back',$event)" @error="error" @complete="complete" |
| | | width="300" height="150"> |
| | | <image :src="userInfo.idCardBack?userInfo.idCardBack:'/static/negative.png'" mode="aspectFill" |
| | | style="width: 300rpx;height: 150rpx;"></image> |
| | | <image src="/static/negative.png" mode="widthFix" style="width: 300rpx;height: 150rpx;"></image> |
| | | </fui-upload> |
| | | </up-form-item> |
| | | <up-form-item label="姓名" required prop="name" ref="item1"> |
| | |
| | | <!-- <tem-session/> --> |
| | | <!-- </up-popup> --> |
| | | <view class="tabbtns"> |
| | | <up-button color='#fece01' class="text-69" text="保存" :loading='isLoading' loadingText="保存中" |
| | | <up-button color='#fece01' text="保存" :loading='isLoading' loadingText="保存中" |
| | | @click='saveUserWorker'></up-button> |
| | | </view> |
| | | </up-form> |
| | |
| | | } from '@/common/setting/constVarsHelper.js'; |
| | | import { |
| | | onMounted, |
| | | getCurrentInstance |
| | | getCurrentInstance, |
| | | computed |
| | | } from 'vue' |
| | | import { |
| | | useStore |
| | | } from 'vuex' |
| | | const store = useStore() |
| | | const { |
| | | $upload, |
| | | $api, |
| | |
| | | } |
| | | }); |
| | | } |
| | | let data = $db.get('userInfo') ? JSON.parse($db.get('userInfo')) : null |
| | | let data = $db.get('userInfo') || null |
| | | if (data && data.userWorker) { |
| | | userInfo.idCardFace = data.userWorker ? data.userWorker.idCardFace : '' //身份证正面路径 |
| | | userInfo.idCardBack = data.userWorker ? data.userWorker.idCardBack : '' //身份证反面路径 |
| | |
| | | userInfo.address = data.userWorker.address //联系地址 |
| | | userInfo.resume = data.userWorker.resume //简历描述 |
| | | userInfo.id = data.userWorker.id |
| | | |
| | | } |
| | | console.log(userInfo, data && data.userWorker, 'data && data.userWorker'); |
| | | }) |
| | |
| | | message: '简历描述不能为空', |
| | | trigger: ['blur', 'change'] |
| | | }, //公司简介 |
| | | phone: { |
| | | phone: [{ |
| | | required: true, |
| | | message: '电话号码不能为空', |
| | | message: '联系电话不能为空', |
| | | trigger: ['blur', 'change'] |
| | | } |
| | | // , |
| | | // { |
| | | // // 自定义验证函数,见上说明 |
| | | // validator: (rule, value, callback) => { |
| | | // // 上面有说,返回true表示校验通过,返回false表示不通过 |
| | | // // uni.$u.test.mobile()就是返回true或者false的 |
| | | // return uni.$u.test.mobile(value); |
| | | // }, |
| | | // message: '联系电话不正确', |
| | | // // 触发器可以同时用blur和change |
| | | // trigger: ['change','blur'], |
| | | // }, |
| | | ] |
| | | } |
| | | let status = ref(false) |
| | | const formRef = ref() |
| | | onReady(() => { |
| | | formRef.value.setRules(rules); |
| | | if (userInfo.idCardBack) { |
| | | uploadB.value.urls = [userInfo.idCardBack] |
| | | uploadB.value.status = ['success'] |
| | | } |
| | | if (userInfo.idCardFace) { |
| | | uploadF.value.urls = [userInfo.idCardFace] |
| | | uploadF.value.status = ['success'] |
| | | } |
| | | |
| | | }) |
| | | onMounted(() => { |
| | | formRef.value.setRules(rules); |
| | |
| | | resume: '', //简历描述 |
| | | id: 0 |
| | | }) |
| | | |
| | | const IaiAddPerso = (e) => { |
| | | |
| | | const getUserInfo = () => { |
| | | store.dispatch('getUserInfo') |
| | | } |
| | | |
| | | const saveUserWorkerApi = () => { |
| | | $api.saveUserWorker(userInfo).then(res => { |
| | | if (res.code == 1) { |
| | | getUserInfo() |
| | | uni.navigateBack() |
| | | $util.showToast({ |
| | | title: "保存成功!", |
| | | icon: "success" |
| | | }) |
| | | } |
| | | isLoading.value = false |
| | | }) |
| | | } |
| | | const saveUserWorker = (e) => { |
| | | formRef.value.validate().then(res => { |
| | | isLoading.value = true |
| | | let obj = { |
| | | imgBase64: idCardFaceBase64, |
| | | cordId: userInfo.idCode, //身份证号码 |
| | | name: userInfo.name, //姓名 |
| | | gender: gender.value == '男' ? 1 : 2 //性别 |
| | | } |
| | | $api.IaiAddPersoBase64(obj).then(res => { |
| | | if (res.data.isOK == true) { |
| | | $api.saveUserWorker(userInfo).then(res => { |
| | | if (res.code == 1) { |
| | | $util.showToast({ |
| | | title: "保存成功!", |
| | | icon: "success" |
| | | }) |
| | | $api.getUser().then(res => { |
| | | $db.set('userInfo', JSON.stringify(res.data)) |
| | | }) |
| | | uni.navigateBack() |
| | | } |
| | | isLoading.value = false |
| | | }) |
| | | } else { |
| | | $util.showToast({ |
| | | title: res.msg |
| | | }) |
| | | isLoading.value = false |
| | | console.log(idCardFaceBase64.value, 'idCardFaceBase64.value’'); |
| | | if (idCardFaceBase64.value) { |
| | | let obj = { |
| | | imgBase64: idCardFaceBase64.value, |
| | | cordId: userInfo.idCode, //身份证号码 |
| | | name: userInfo.name, //姓名 |
| | | gender: gender.value == '男' ? 1 : 2 //性别 |
| | | } |
| | | }) |
| | | $api.IaiAddPersoBase64(obj).then(res => { |
| | | if (res.data && res.data.isOK == true) { |
| | | saveUserWorkerApi() |
| | | } else { |
| | | $util.showToast({ |
| | | title: res.error |
| | | }) |
| | | isLoading.value = false |
| | | } |
| | | }) |
| | | } else { |
| | | saveUserWorkerApi() |
| | | } |
| | | |
| | | }).catch(errors => { |
| | | console.log(errors) |
| | | uni.$u.toast(errors[0].message) |
| | |
| | | } |
| | | console.log(e, '删除') |
| | | $util.pathToBase64(e.urls[0]).then(res => { |
| | | idCardFaceBase64 = res |
| | | idCardFaceBase64.value = res |
| | | console.log(idCardFaceBase64, idCardFaceBase64.value); |
| | | }) |
| | | } |
| | | const complete = (e) => { |
| | |
| | | .fui-upload__item { |
| | | margin-top: 20rpx !important; |
| | | } |
| | | .u-form-item__body { |
| | | padding: 5px 0 !important; |
| | | } |
| | | </style> |