hldy_xcx/pages/addstaff/information.vue

741 lines
20 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<template>
<div class="container">
<!-- <view class="title-back">
<view class="left-father" @click="goBack">
<image class="back-img" src="https://www.focusnu.com/media/directive/index/left.png" />
<view style="font-size: 30rpx;">入职登记表</view>
</view>
</view> -->
<!-- <image class="greenbgc" src="https://www.focusnu.com/media/directive/index/greenbgc.png" /> -->
<view class="title-back" :style="{height:`${uni.getStorageSync('moveHeight')+40}px`}">
<view class="left-father" @click="goBack">
<image class="back-img" src="https://www.focusnu.com/media/directive/index/left.png" />
<view style="font-size: 30rpx;">入职登记表编辑</view>
</view>
</view>
<view :style="{height:`${uni.getStorageSync('moveHeight') + 40}px`}"></view>
<view class="white-content">
<view class="content-title">
<view class="shu"></view>
<view class="content-weight">个人信息</view>
<view class="content-img"
style="display: flex;align-items: center;justify-content: flex-end;color: red;">
<view class="applying" v-if="form.applyStatus===`1`&&form.applyType =='0'">
待确认
</view>
<view class="applysuccess" v-if="form.applyStatus===`2`&&form.applyType =='0'">
已接受
</view>
<view class="applyfail" v-if="form.applyStatus===`3`&&form.applyType =='0'">
已拒绝
</view>
</view>
</view>
<view class="white-message">
<view>
<view class="one" style="justify-content: space-between;position: relative;" @click="selectphoto(4)">
<view class="one-left">头像(选填)</view>
<image class="photo" style="width: 80rpx;height: 80rpx;border-radius: 50%;border: 1px solid #666;"
:src="headPath ? `${media_base_url}${headPath}` :
(sex=='女'?'https://www.focusnu.com/media/directive/index/nv.png':
'https://www.focusnu.com/media/directive/index/nan.png'
)" />
<!-- <image class="triangle-down" src="https://www.focusnu.com/media/directive/login/xia.png" /> -->
</view>
<view class="one" style="position: relative;" @click="showmarry = true">
<view class="one-left">婚否</view>
<input disabled style="cursor: not-allowed;pointer-events: none; " class="one-right" type="text"
placeholder="请选择婚否" v-model="form.maritalStatus" />
<image class="one-left-imge" src="https://www.focusnu.com/media/directive/index/canread.png" v-if="form.maritalStatus"/>
<!-- <image class="triangle-down" src="https://www.focusnu.com/media/directive/login/xia.png" /> -->
</view>
<u-select style="font-size: 35rpx;" v-model="showmarry" :list="showmarrylist"
@confirm="confirmmarry"></u-select>
<view class="one">
<view class="one-left">联系电话</view>
<input class="one-right" type="number" maxlength="11" placeholder="请输入联系电话"
v-model="form.tel" />
<image class="one-left-imge" src="https://www.focusnu.com/media/directive/index/canread.png" />
</view>
<view class="one" style="position: relative;">
<view class="one-left">身高 (CM)</view>
<input class="one-right" type="number" maxlength="3" placeholder="请输入身高"
v-model="form.height" />
<image class="one-left-imge" src="https://www.focusnu.com/media/directive/index/canread.png" />
<!-- <image class="triangle-down" src="https://www.focusnu.com/media/directive/login/xia.png" /> -->
</view>
<u-select style="font-size: 35rpx;" v-model="showshengao" :list="showshengaolist"
:default-value="[showshengaolist.findIndex(item => item.value == form.height)]"
@confirm="confirmshowshengao"></u-select>
<view class="one" style="position: relative;">
<view class="one-left">体重 (KG)</view>
<input class="one-right" type="number" maxlength="3" placeholder="请输入体重"
v-model="form.weight" />
<image class="one-left-imge" src="https://www.focusnu.com/media/directive/index/canread.png" />
<!-- <image class="triangle-down" src="https://www.focusnu.com/media/directive/login/xia.png" /> -->
</view>
<u-select style="font-size: 35rpx;" v-model="showtizhong" :list="showtizhonglist"
:default-value="[showtizhonglist.findIndex(item => item.value == form.weight)]"
@confirm="confirmshowtizhong"></u-select>
<view class="one" style="position: relative;" @click="showhealth = true">
<view class="one-left">健康状况</view>
<input disabled style="cursor: not-allowed;pointer-events: none;" class="one-right" type="text"
placeholder="请选择健康状况" v-model="form.healthStatus" />
<image class="one-left-imge" src="https://www.focusnu.com/media/directive/index/canread.png" v-if="form.healthStatus"/>
<!-- <image class="triangle-down" src="https://www.focusnu.com/media/directive/login/xia.png" /> -->
</view>
<u-select style="font-size: 35rpx;" v-model="showhealth" :list="showhealthlist"
@confirm="confirmshowhealth"></u-select>
<view class="one" style="position: relative;" @click="showface = true">
<view class="one-left">政治面貌</view>
<input disabled style="cursor: not-allowed;pointer-events: none;" class="one-right" type="text"
placeholder="请选择政治面貌" v-model="form.politicalAppearance" />
<image class="one-left-imge" src="https://www.focusnu.com/media/directive/index/canread.png" v-if="form.politicalAppearance"/>
<!-- <image class="triangle-down" src="https://www.focusnu.com/media/directive/login/xia.png" /> -->
</view>
<u-select style="font-size: 35rpx;" v-model="showface" :list="showfacelist"
@confirm="confirmshowface"></u-select>
<view class="one">
<view class="one-left">紧急联系人</view>
<input class="one-right" :maxlength="jjlxrmax" placeholder="请输入紧急联系人" @focus="jjlxrmax = 50" @blur="jjlxrmax = 8" v-model="form.contactName" />
<image class="one-left-imge" src="https://www.focusnu.com/media/directive/index/canread.png" />
</view>
<view class="one">
<view class="one-left">紧急联系人电话</view>
<input class="one-right" maxlength="11" type="number" placeholder="请输入紧急联系人电话"
v-model="form.contactTel" />
<image class="one-left-imge" src="https://www.focusnu.com/media/directive/index/canread.png" />
</view>
<view class="one">
<view class="one-left">联系人与本人关系</view>
<input class="one-right" maxlength="10" placeholder="请输入联系人与本人关系"
v-model="form.contactRelationship" />
<image class="one-left-imge" src="https://www.focusnu.com/media/directive/index/canread.png" />
</view>
<view class="one" style="position: relative;" @click="showform = true">
<view class="one-left">户口性质</view>
<input disabled style="cursor: not-allowed;pointer-events: none;" class="one-right" type="text"
placeholder="请选择户口性质" v-model="form.hukouType" />
<image class="one-left-imge" src="https://www.focusnu.com/media/directive/index/canread.png" v-if="form.hukouType"/>
<!-- <image class="triangle-down" src="https://www.focusnu.com/media/directive/login/xia.png" /> -->
</view>
<view class="one">
<view class="one-left">现住址</view>
<input class="one-right" maxlength="30" placeholder="请输入现住址" v-model="form.currentAddress" />
<image class="one-left-imge" src="https://www.focusnu.com/media/directive/index/canread.png" />
</view>
<u-select style="font-size: 35rpx;" v-model="showform" :list="showformlist"
@confirm="confirmshowform"></u-select>
</view>
</view>
</view>
<view style="display: flex;width: 100%;padding: 0 10%;justify-content: space-between;">
<view class="back-button" @click="goBack">
上一步
</view>
<view class="finish-button" @click="next">
下一步
</view>
</view>
<u-action-sheet :list="bottomlist" @click="photoclick" v-model="bottomshow" borderRadius="20"></u-action-sheet>
</div>
</template>
<script setup>
import {
ref,
reactive
} from 'vue'
import {
onLoad,
onShow
} from '@dcloudio/uni-app';
import {
media_base_url,
base_url
} from '@/request/index.js';
import {
changemessage
} from './api/addjigou.js'
import model from "@/compontent/public/model.vue"
const bottomlist = [{
text: '拍照',
fontSize: 40
}, {
text: '从相册选择',
fontSize: 40
}, {
text: '图片预览',
fontSize: 40
}]
// const showmarry
const jjlxrmax = ref(8)
const nameArray = ["姓名", "性别", "身份证号码", "民族", "出生日期", "住址", "签发机关", "有效期限"];
const textArray = reactive(["", "", "", "", "", "", "", ""]);
const states = ["审核中", "审核未通过", "审核通过"];
const showmarry = ref(false);
const showmarrylist = reactive(
[{
value: '已婚',
label: '已婚',
},
{
value: '未婚',
label: '未婚',
},
]
)
const showhealth = ref(false);
const showhealthlist = reactive(
[{
value: '健康',
label: '健康',
},
{
value: '患病',
label: '患病',
},
]
)
const showshengao = ref(false);
const showshengaolist = reactive(
Array.from({
length: 110
}, (_, i) => {
const v = 130 + i
return {
value: String(v),
label: `${v}cm`
}
})
)
onShow(() => {
const img = uni.getStorageSync('imgkey0')
console.log(img,1111111111111)
if (img) {
// uploadImage(img)
savephoto(img)
uni.removeStorageSync('imgkey0')
}
})
const headPath = ref("")
const bottomshow = ref(false)
const selectphoto = (number) => {
if (!uping.value) {
return
}
if (headPath.value) {
bottomshow.value = true;
} else {
getMessage()
}
}
const tempImagePath = ref('')
function getMessage() {
uni.chooseImage({
count: 1,
sourceType: ['album', 'camera'],
success: chooseRes => {
tempImagePath.value = chooseRes.tempFilePaths[0]
uni.navigateTo({
url: `/compontent/public/camera?url=${chooseRes.tempFilePaths[0]}&type=0&size=1&height=1500&width=1500`
});
},
fail: err => {
console.error('拍照失败:', err)
}
})
}
const photoclick = (element) => {
if (element==2) {
uni.previewImage({
urls: [`${media_base_url}${headPath.value}`], // 必填,所有要预览的图片地址数组
// current: headImge.value, // 可选,当前显示图片的地址,默认是 urls[0]
indicator: 'default', // 可选指示器样式H5/App 有效,值为 'default'(圆点)或 'number'(数字)
longPressActions: { // 可选,仅 App 支持,长按图片时弹出的操作项
itemList: ['保存图片到相册'],
},
});
} else {
uni.chooseImage({
count: 1,
sourceType: element == 0 ? ['camera'] : ['album'],
success: chooseRes => {
tempImagePath.value = chooseRes.tempFilePaths[0]
uni.navigateTo({
url: `/compontent/public/camera?url=${chooseRes.tempFilePaths[0]}&type=0&size=1&height=1500&width=1500`
});
},
fail: err => {
console.error('拍照失败:', err)
}
})
}
}
const uping = ref(true);
const savephoto = (filePath) => {
uping.value = false;
// category: 'jg' | 'yg' | 'zz' | 'jhr'
const now = new Date();
const yyyy = now.getFullYear();
const mm = String(now.getMonth() + 1).padStart(2, '0'); // 补0
let path = '';
switch ('yg') {
case 'jg': // 机构
path = `${yyyy}/${mm}/jgxx/jg`;
break;
case 'yg': // 员工
path = `${yyyy}/${mm}/ygxx/yg`;
break;
case 'zz': // 长者
path = `${yyyy}/${mm}/zzxx/zz`;
break;
case 'jhr': // 监护人
path = `${yyyy}/${mm}/zzxx/jhr`;
break;
default:
path = `${yyyy}/${mm}/temp`;
}
console.log(filePath)
uni.uploadFile({
url: `${base_url}/sys/common/upload`, // 替换为您的POST接口地址
filePath,
name: 'file', // 后端接收时的字段名
header: {
'X-Access-Token': uni.getStorageSync('token') || '',
},
formData: {
biz: path
},
success: uploadRes => {
headPath.value = JSON.parse(uploadRes.data).message
console.log(headPath.value,JSON.parse(uploadRes.data))
uping.value = true;
uni.hideLoading()
},
fail: err => {
uni.showToast({
title: '上传出错',
icon: 'none'
})
uni.hideLoading()
}
})
}
const confirmshowshengao = (item) => {
form.height = item[0].value
form.showheight = item[0].label
}
const showtizhong = ref(false);
const showtizhonglist = reactive(
Array.from({
length: 110
}, (_, i) => {
const v = 40 + i
return {
value: String(v),
label: `${v}kg`
}
})
)
const confirmshowtizhong = (item) => {
form.weight = item[0].value
form.showweight = item[0].label
}
const showface = ref(false);
const showfacelist = reactive(
[{
value: '共产党员',
label: '共产党员',
},
{
value: '国民党',
label: '国民党',
},
{
value: '民主党',
label: '民主党',
},
{
value: '无党派',
label: '无党派',
},
]
)
const showform = ref(false);
const showformlist = reactive(
[{
value: '非农业',
label: '非农业',
},
{
value: '农业',
label: '农业',
},
]
)
const confirmmarry = (item) => {
form.maritalStatus = item[0].value
}
const confirmshowhealth = (item) => {
form.healthStatus = item[0].value
}
const confirmshowface = (item) => {
form.politicalAppearance = item[0].value
}
const confirmshowform = (item) => {
form.hukouType = item[0].value
}
const form = reactive({
maritalStatus: "",
tel: "",
height: "",
weight: "",
healthStatus: "",
politicalAppearance: "",
contactName: "",
contactTel: "",
contactRelationship: "",
hukouType: "",
openId: uni.getStorageSync('openid'),
})
function isValid11DigitNumber(val) {
// return /^(\d{11})$/.test(val);
return /^1[3-9]\d{9}$/.test(val);
}
const next = () => {
if (!form.maritalStatus) {
uni.showToast({
title: '请选择婚否',
icon: 'none'
})
} else if (!form.tel) {
uni.showToast({
title: '请输入联系电话',
icon: 'none'
})
} else if (!isValid11DigitNumber(form.tel)) {
uni.showToast({
title: '手机号格式错误',
icon: 'none'
})
return
} else if (!form.height) {
uni.showToast({
title: '请输入身高',
icon: 'none'
})
} else if (!form.weight) {
uni.showToast({
title: '请输入体重',
icon: 'none'
})
} else if (!form.healthStatus) {
uni.showToast({
title: '请选择健康状况',
icon: 'none'
})
} else if (!form.politicalAppearance) {
uni.showToast({
title: '请选择政治面貌',
icon: 'none'
})
} else if (!form.contactName) {
uni.showToast({
title: '请输入紧急联系人',
icon: 'none'
})
} else if (!form.contactTel) {
uni.showToast({
title: '请输入紧急联系人电话',
icon: 'none'
})
} else if (!isValid11DigitNumber(form.contactTel)) {
uni.showToast({
title: '紧急联系人手机号格式错误',
icon: 'none'
})
return
} else if (!form.contactRelationship) {
uni.showToast({
title: '请输入联系人和本人的关系',
icon: 'none'
})
} else if (!form.hukouType) {
uni.showToast({
title: '请选择户口性质',
icon: 'none'
})
} else if (!form.currentAddress) {
uni.showToast({
title: '请输入现住址',
icon: 'none'
})
} else {
form.headPath = headPath.value;
const data = form
const merged2 = {
...uni.getStorageSync('backhuancun'),
...data
};
uni.setStorageSync("backhuancun", merged2);
uni.navigateTo({
url: "/pages/addstaff/bankcard"
});
}
}
const goBack = () => {
if (!uping.value) {
return
}
form.headPath = headPath.value;
const data = form
const merged2 = {
...uni.getStorageSync('backhuancun'),
...data
};
uni.navigateBack()
}
// const goBack = () => {
// uni.navigateBack()
// }
const sex = ref("")
onLoad(() => {
if (uni.getStorageSync('baddata')) {
uni.setStorageSync("isstaffchange", true)
let data = uni.getStorageSync('baddata');
const keys = [
"maritalStatus",
"tel",
"height",
"weight",
"healthStatus",
"politicalAppearance",
"contactName",
"contactTel",
"contactRelationship",
"hukouType",
"currentAddress",
'auditContent',
"applyStatus",
"modifyStatus",
"headPath"
]
keys.forEach(key => {
form[key] = data[key] || ""
})
form.height = Number(form.height)
form.weight = Number(form.weight)
form.showheight = form.height + 'cm';
form.showweight = form.weight + 'kg';
sex.value = data.sex
headPath.value = data.headPath
} else {
uni.setStorageSync("isstaffchange", false)
form.tel = uni.getStorageSync('tel')
}
})
</script>
<style lang="scss" scoped>
.container {
display: flex;
flex-direction: column;
min-height: 100vh;
width: 100%;
background-color: #F7F7F7;
position: relative;
.white-content {
width: 90%;
margin-left: 5%;
border-radius: 35rpx;
.content-title {
display: flex;
align-items: center;
height: 100rpx;
position: relative;
font-weight: 600;
.content-weight {
font-size: 32rpx;
}
.content-img {
position: absolute;
right: 0;
top: 0;
width: 400rpx;
height: 100%;
}
}
}
}
.finish-button {
display: flex;
justify-content: center;
align-items: center;
width: 44%;
height: 90rpx;
margin-bottom: 80rpx;
background: linear-gradient(to bottom, #e7f4ff, #c5e5ff);
border: 2rpx solid #9AD1FF;
color: #007CFF;
border-radius: 35rpx;
font-size: 33rpx;
}
.back-button {
display: flex;
justify-content: center;
align-items: center;
width: 44%;
height: 90rpx;
margin-bottom: 80rpx;
border: 2rpx solid #c3cacd;
background: linear-gradient(to bottom, #f3f3f5, #dee4e9);
border-radius: 37rpx;
font-size: 33rpx;
}
.title-back {
background-color: #F7F7F7;
width: 100%;
height: 70rpx;
display: flex;
justify-content: space-between;
align-items: flex-end;
padding-bottom: 20rpx;
border-bottom: 1rpx solid #cbd1d2;
position: fixed;
top: 0;
left: 0;
z-index: 9999;
}
.left-father {
display: flex;
align-items: center;
.back-img {
width: 45rpx;
height: 40rpx;
margin-left: 40rpx;
margin-right: 15rpx;
}
}
.shu {
width: 14rpx;
height: 36rpx;
background-color: #0097FF;
border-radius: 10rpx;
margin: 3rpx 20rpx 0 30rpx;
}
.line {
margin: 10rpx 0;
}
.white-message {
width: 100%;
margin-top: 20rpx;
padding-top: 20rpx;
padding-bottom: 20rpx;
margin-bottom: 30rpx;
border-radius: 35rpx;
background-color: #fff;
justify-content: space-around;
display: flex;
flex-direction: column;
}
.one {
width: 90%;
margin-left: 5%;
height: 100rpx;
display: flex;
align-items: center;
margin-bottom: 10rpx;
position: relative;
.one-left {
margin-left: 10rpx;
font-size: 30rpx;
width: 250rpx;
}
.one-right {
font-size: 30rpx;
height: 100%;
color: #999999;
overflow: hidden;
/* 隐藏超出内容 */
white-space: nowrap;
/* 不换行 */
// font-size: 25rpx;
text-overflow: ellipsis;
width: 300rpx;
display: flex;
}
.one-left-imge {
width: 35rpx;
height: 35rpx;
position: absolute;
top: 50%;
right: 8rpx;
transform: translateY(-50%);
}
.triangle-down {
position: absolute;
top: 50%;
transform: translateY(-50%);
right: 26rpx;
width: 20rpx;
height: 20rpx;
}
}
.triangle-down-mi {
position: absolute;
top: 50%;
transform: translateY(-50%);
right: 55rpx;
font-size: 30rpx;
color: #999999;
}
.greenbgc {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 700rpx;
}
</style>