hldy_xcx/pages/addstaff/information.vue

542 lines
13 KiB
Vue

<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>
<view class="white-message">
<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="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" />
</view>
<view class="one" style="position: relative;" @click="showshengao=true">
<view class="one-left">身高</view>
<input disabled class="one-right" type="number" maxlength="10" placeholder="请输入身高"
v-model="form.showheight" />
<!-- <view class="triangle-down-mi">
cm
</view> -->
<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;" @click="showtizhong=true">
<view class="one-left">体重</view>
<input disabled class="one-right" type="number" maxlength="10" placeholder="请输入体重"
v-model="form.showweight" />
<!-- <view class="triangle-down-mi">
kg
</view> -->
<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="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="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="5" placeholder="请输入紧急联系人" v-model="form.contactName" />
</view>
<view class="one">
<view class="one-left">紧急联系人电话</view>
<input class="one-right" maxlength="11" type="number" placeholder="请输入紧急联系人电话"
v-model="form.contactTel" />
</view>
<view class="one">
<view class="one-left">联系人与本人关系</view>
<input class="one-right" maxlength="10" placeholder="请输入联系人与本人关系"
v-model="form.contactRelationship" />
</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="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" />
</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%;">
<view class="finish-button" @click="next">
确认并继续
</view>
</view>
</div>
</template>
<script setup>
import {
ref,
reactive
} from 'vue'
import {
onLoad,
onShow
} from '@dcloudio/uni-app';
import {
base_url
} from '@/request/index.js';
import {
changemessage
} from './api/addjigou.js'
import model from "@/compontent/public/model.vue"
// const showmarry
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: 61
}, (_, i) => {
const v = 140 + i
return {
value: String(v),
label: `${v}cm`
}
})
)
const confirmshowshengao = (item) => {
form.height = item[0].value
form.showheight = item[0].label
}
const showtizhong = ref(false);
const showtizhonglist = reactive(
Array.from({
length: 41
}, (_, 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);
}
const next = () => {
if (!form.maritalStatus) {
uni.showToast({
title: '请填写婚否',
icon: 'error'
})
} else if (!form.tel) {
uni.showToast({
title: '请填写联系电话',
icon: 'error'
})
} else if (!isValid11DigitNumber(form.tel)) {
uni.showToast({
title: '手机号格式错误',
icon: 'error'
})
return
} else if (!form.height) {
uni.showToast({
title: '请填写身高',
icon: 'error'
})
} else if (!form.weight) {
uni.showToast({
title: '请填写体重',
icon: 'error'
})
} else if (!form.healthStatus) {
uni.showToast({
title: '请填写健康状态',
icon: 'error'
})
} else if (!form.politicalAppearance) {
uni.showToast({
title: '请填写政治面貌',
icon: 'error'
})
} 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: 'error'
})
} else {
const data = form
const merged2 = {
...uni.getStorageSync('backhuancun'),
...data
};
uni.setStorageSync("backhuancun", merged2);
uni.navigateTo({
url: "/pages/addstaff/IDcard"
});
}
}
const goBack = () => {
uni.navigateBack()
}
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"
]
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';
} else {
uni.setStorageSync("isstaffchange", false)
}
})
</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: 80%;
height: 90rpx;
margin: 0rpx auto;
margin-bottom: 80rpx;
margin-top: 20rpx;
background: linear-gradient(to bottom, #e7f4ff, #c5e5ff);
border: 2rpx solid #9AD1FF;
color: #007CFF;
border-radius: 35rpx;
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;
justify-content: space-between;
align-items: center;
margin-bottom: 10rpx;
.one-left {
margin-left: 10rpx;
font-size: 30rpx;
}
.one-right {
font-size: 30rpx;
height: 100%;
color: #999999;
overflow: hidden;
/* 隐藏超出内容 */
white-space: nowrap;
/* 不换行 */
// font-size: 25rpx;
text-overflow: ellipsis;
width: 350rpx;
display: flex;
}
.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: 26rpx;
font-size: 30rpx;
color: #999999;
}
.greenbgc {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 700rpx;
}
</style>