2025-06-27 08:56:14 +08:00
|
|
|
<template>
|
|
|
|
|
<div class="container">
|
2025-09-15 17:23:33 +08:00
|
|
|
<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>
|
2025-06-27 08:56:14 +08:00
|
|
|
<view class="white-content">
|
|
|
|
|
<view class="content-title">
|
2025-09-15 17:23:33 +08:00
|
|
|
<view class="shu"></view>
|
|
|
|
|
<view class="content-weight">监护人基本信息</view>
|
2025-06-27 08:56:14 +08:00
|
|
|
</view>
|
2025-07-01 17:29:13 +08:00
|
|
|
|
2025-09-15 17:23:33 +08:00
|
|
|
<view class="one">
|
|
|
|
|
<view class="one-left">姓名</view>
|
|
|
|
|
<input class="one-right" maxlength="11" placeholder="请输入姓名" v-model="form.name" />
|
2025-06-27 08:56:14 +08:00
|
|
|
</view>
|
2025-09-26 16:46:17 +08:00
|
|
|
|
2025-09-15 17:23:33 +08:00
|
|
|
<view class="one">
|
|
|
|
|
<view class="one-left">电话</view>
|
|
|
|
|
<input class="one-right" type="number" maxlength="11" placeholder="请输入电话" v-model="form.tel" />
|
2025-06-27 08:56:14 +08:00
|
|
|
</view>
|
2025-09-15 17:23:33 +08:00
|
|
|
<view class="one">
|
|
|
|
|
<view class="one-left">身份证号</view>
|
|
|
|
|
<input class="one-right" type="number" maxlength="18" placeholder="请输入身份证号" v-model="form.idCard" />
|
|
|
|
|
</view>
|
|
|
|
|
<view class="one">
|
|
|
|
|
<view class="one-left">家庭住址</view>
|
2025-09-26 16:46:17 +08:00
|
|
|
<input class="one-right" placeholder="请输入家庭住址" v-model="form.homeAddress" />
|
2025-09-15 17:23:33 +08:00
|
|
|
</view>
|
|
|
|
|
<view class="one">
|
|
|
|
|
<view class="one-left">工作单位</view>
|
2025-09-26 16:46:17 +08:00
|
|
|
<input class="one-right" placeholder="请输入工作单位" v-model="form.workUnit" />
|
2025-06-27 08:56:14 +08:00
|
|
|
</view>
|
|
|
|
|
</view>
|
2025-09-15 17:23:33 +08:00
|
|
|
<view style="display: flex;width: 100%;position: fixed;bottom: 20rpx;left: 0;">
|
|
|
|
|
<view class="finish-button" @click="next">
|
2025-09-19 17:12:59 +08:00
|
|
|
提交
|
2025-09-15 17:23:33 +08:00
|
|
|
</view>
|
2025-06-27 08:56:14 +08:00
|
|
|
</view>
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script setup>
|
|
|
|
|
import {
|
|
|
|
|
ref,
|
|
|
|
|
reactive
|
|
|
|
|
} from 'vue'
|
2025-09-15 17:23:33 +08:00
|
|
|
import {
|
|
|
|
|
onLoad,
|
|
|
|
|
onShow
|
|
|
|
|
} from '@dcloudio/uni-app';
|
|
|
|
|
import {
|
|
|
|
|
base_url
|
|
|
|
|
} from '@/request/index.js';
|
2025-09-26 16:46:17 +08:00
|
|
|
import {
|
|
|
|
|
savePayer,
|
|
|
|
|
changePayer
|
|
|
|
|
} from './api/api.js'
|
2025-09-15 17:23:33 +08:00
|
|
|
import {
|
|
|
|
|
getMessage
|
|
|
|
|
} from '@/api/loginApi.js'
|
2025-06-27 08:56:14 +08:00
|
|
|
|
2025-09-15 17:23:33 +08:00
|
|
|
const form = reactive({
|
|
|
|
|
name: "",
|
|
|
|
|
tel: "",
|
|
|
|
|
advisoryType: 1,
|
|
|
|
|
status: 2,
|
|
|
|
|
idCard: "",
|
|
|
|
|
homeAddress: "",
|
|
|
|
|
workUnit: "",
|
2025-09-26 16:46:17 +08:00
|
|
|
izJs: 1,
|
2025-09-15 17:23:33 +08:00
|
|
|
openId: uni.getStorageSync('openid'),
|
2025-09-26 16:46:17 +08:00
|
|
|
|
2025-09-15 17:23:33 +08:00
|
|
|
})
|
2025-07-01 17:29:13 +08:00
|
|
|
|
2025-09-15 17:23:33 +08:00
|
|
|
function isValid11DigitNumber(val) {
|
|
|
|
|
return /^(\d{11})$/.test(val);
|
2025-06-27 08:56:14 +08:00
|
|
|
}
|
2025-09-26 16:46:17 +08:00
|
|
|
|
2025-09-15 17:23:33 +08:00
|
|
|
function isValid18DigitNumber(val) {
|
|
|
|
|
return /^(\d{18})$/.test(val);
|
|
|
|
|
}
|
|
|
|
|
const next = () => {
|
2025-07-01 17:29:13 +08:00
|
|
|
|
2025-09-15 17:23:33 +08:00
|
|
|
if (!form.name) {
|
|
|
|
|
uni.showToast({
|
|
|
|
|
title: '请填写姓名',
|
|
|
|
|
icon: 'error'
|
|
|
|
|
})
|
|
|
|
|
} else if (!form.tel) {
|
|
|
|
|
uni.showToast({
|
|
|
|
|
title: '请填写电话',
|
|
|
|
|
icon: 'error'
|
|
|
|
|
})
|
2025-09-26 16:46:17 +08:00
|
|
|
} else if (!isValid11DigitNumber(form.tel)) {
|
2025-09-15 17:23:33 +08:00
|
|
|
uni.showToast({
|
|
|
|
|
title: '电话格式错误',
|
|
|
|
|
icon: 'none'
|
|
|
|
|
})
|
|
|
|
|
return
|
2025-09-26 16:46:17 +08:00
|
|
|
} else if (!form.idCard) {
|
2025-09-15 17:23:33 +08:00
|
|
|
uni.showToast({
|
|
|
|
|
title: '请填写身份证号',
|
|
|
|
|
icon: 'error'
|
|
|
|
|
})
|
2025-09-26 16:46:17 +08:00
|
|
|
} else if (!isValid18DigitNumber(form.idCard)) {
|
2025-09-15 17:23:33 +08:00
|
|
|
uni.showToast({
|
|
|
|
|
title: '身份证号格式错误',
|
|
|
|
|
icon: 'none'
|
|
|
|
|
})
|
|
|
|
|
return
|
|
|
|
|
} else if (!form.homeAddress) {
|
|
|
|
|
uni.showToast({
|
|
|
|
|
title: '请填写家庭住址',
|
|
|
|
|
icon: 'error'
|
|
|
|
|
})
|
|
|
|
|
} else if (!form.workUnit) {
|
|
|
|
|
uni.showToast({
|
|
|
|
|
title: '请填写工作单位',
|
|
|
|
|
icon: 'error'
|
|
|
|
|
})
|
2025-09-26 16:46:17 +08:00
|
|
|
} else {
|
|
|
|
|
if (uni.getStorageSync('allinfo').name) {
|
|
|
|
|
let data = uni.getStorageSync('allinfo');
|
2025-09-28 10:58:31 +08:00
|
|
|
data.guardianName = form.name
|
|
|
|
|
data.guardianPhone = form.tel
|
|
|
|
|
data.guardianIdCard = form.idCard
|
|
|
|
|
data.guardianHomeAddress = form.homeAddress
|
|
|
|
|
data.guardianWorkUnit = form.workUnit
|
2025-09-28 11:18:34 +08:00
|
|
|
data.modifyType = "jhr"
|
2025-09-28 10:58:31 +08:00
|
|
|
const urlpost = `${base_url}/api/elderInfo/updateElderInfo`;
|
2025-09-26 16:46:17 +08:00
|
|
|
uni.request({
|
|
|
|
|
url: urlpost,
|
|
|
|
|
method: 'POST',
|
|
|
|
|
header: {
|
|
|
|
|
'Content-Type': 'application/json',
|
|
|
|
|
'X-Access-Token': uni.getStorageSync('token') || '',
|
|
|
|
|
},
|
|
|
|
|
data: data,
|
|
|
|
|
success: (res) => {
|
2025-09-28 10:58:31 +08:00
|
|
|
// console.log("?????",res)
|
|
|
|
|
if (res.data.success) {
|
2025-09-26 16:46:17 +08:00
|
|
|
getMessage(uni.getStorageSync('openid')).then(res => {
|
|
|
|
|
uni.setStorageSync('allinfo', res.result);
|
|
|
|
|
uni.reLaunch({
|
2025-09-28 10:58:31 +08:00
|
|
|
url: '/pages/oldmanindex/oldmansuccess?type=1&jianhu=1'
|
|
|
|
|
})
|
2025-09-26 16:46:17 +08:00
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
fail: (e) => {
|
|
|
|
|
console.log("????", e)
|
2025-09-15 17:23:33 +08:00
|
|
|
}
|
2025-09-26 16:46:17 +08:00
|
|
|
});
|
|
|
|
|
} else {
|
2025-09-28 10:58:31 +08:00
|
|
|
let data = {}
|
|
|
|
|
data.guardianName = form.name
|
|
|
|
|
data.guardianPhone = form.tel
|
|
|
|
|
data.guardianIdCard = form.idCard
|
|
|
|
|
data.guardianHomeAddress = form.homeAddress
|
|
|
|
|
data.guardianWorkUnit = form.workUnit
|
|
|
|
|
const urlpost = `${payurl.value}/api/elderInfo/addElder`;
|
|
|
|
|
uni.request({
|
|
|
|
|
url: urlpost,
|
|
|
|
|
method: 'POST',
|
|
|
|
|
header: {
|
|
|
|
|
'Content-Type': 'application/json',
|
|
|
|
|
'X-Access-Token': uni.getStorageSync('token') || '',
|
|
|
|
|
},
|
|
|
|
|
data: data,
|
|
|
|
|
success: (r) => {
|
|
|
|
|
|
|
|
|
|
console.log("r", r)
|
|
|
|
|
if (r.data.code != 200) {
|
|
|
|
|
uni.showToast({
|
|
|
|
|
title: r.data.message,
|
|
|
|
|
icon: 'none', // 'success' 成功图标,'none' 无图标
|
|
|
|
|
duration: 2000 // 显示时长 ms
|
|
|
|
|
})
|
|
|
|
|
return
|
|
|
|
|
}else{
|
|
|
|
|
uni.reLaunch({
|
|
|
|
|
url: '/pages/oldmanindex/oldmansuccess?type=1&jianhu=1'
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// return
|
|
|
|
|
// const connectinon = {
|
|
|
|
|
// nuId: data.nuId,
|
|
|
|
|
// openId: uni.getStorageSync('openid'),
|
|
|
|
|
// elderId: r.data.result,
|
|
|
|
|
// sysOrgCode: data.sysOrgCode,
|
|
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
// const urlpost = `${payurl.value}/api/nuBaseInfo/bindNu`;
|
|
|
|
|
// uni.request({
|
|
|
|
|
// url: urlpost,
|
|
|
|
|
// method: 'POST',
|
|
|
|
|
// header: {
|
|
|
|
|
// 'Content-Type': 'application/json',
|
|
|
|
|
// 'X-Access-Token': uni.getStorageSync('token') || '',
|
|
|
|
|
// },
|
|
|
|
|
// data: connectinon,
|
|
|
|
|
// success: (r) => {
|
|
|
|
|
// uni.reLaunch({
|
|
|
|
|
// url: '/pages/oldmanindex/oldmansuccess'
|
|
|
|
|
// })
|
|
|
|
|
|
|
|
|
|
// // console.log("????", r)
|
|
|
|
|
// },
|
|
|
|
|
// fail: (e) => {
|
|
|
|
|
// // console.log("????", e)
|
|
|
|
|
// }
|
|
|
|
|
// });
|
|
|
|
|
|
|
|
|
|
// console.log("????", r)
|
|
|
|
|
},
|
|
|
|
|
fail: (e) => {
|
|
|
|
|
// console.log("????", e)
|
2025-09-19 17:12:59 +08:00
|
|
|
}
|
2025-09-28 10:58:31 +08:00
|
|
|
});
|
|
|
|
|
/* savePayer(form).then((res) => {
|
|
|
|
|
// if (res.code == 401) {
|
|
|
|
|
// savePayer(form).then((res) => {
|
|
|
|
|
// if (res.success) {
|
|
|
|
|
// getMessage(uni.getStorageSync('openid')).then(res => {
|
|
|
|
|
// uni.setStorageSync('allinfo', res.result);
|
|
|
|
|
// uni.reLaunch({
|
|
|
|
|
// url: "/pages/login/callback",
|
|
|
|
|
// })
|
|
|
|
|
// })
|
|
|
|
|
// }
|
|
|
|
|
// })
|
|
|
|
|
// }
|
2025-09-26 16:46:17 +08:00
|
|
|
if (res.success) {
|
|
|
|
|
getMessage(uni.getStorageSync('openid')).then(res => {
|
2025-09-15 17:23:33 +08:00
|
|
|
uni.setStorageSync('allinfo', res.result);
|
2025-09-19 17:12:59 +08:00
|
|
|
uni.reLaunch({
|
|
|
|
|
url: "/pages/login/callback",
|
|
|
|
|
})
|
2025-09-15 17:23:33 +08:00
|
|
|
})
|
|
|
|
|
}
|
2025-09-28 10:58:31 +08:00
|
|
|
}) */
|
2025-06-27 08:56:14 +08:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2025-09-15 17:23:33 +08:00
|
|
|
const goBack = () => {
|
|
|
|
|
uni.navigateBack()
|
2025-06-27 08:56:14 +08:00
|
|
|
}
|
2025-09-15 17:23:33 +08:00
|
|
|
|
|
|
|
|
onLoad(() => {
|
|
|
|
|
if (uni.getStorageSync('allinfo').name) {
|
|
|
|
|
let data = uni.getStorageSync('allinfo');
|
|
|
|
|
const keys = [
|
|
|
|
|
"openId",
|
|
|
|
|
"name",
|
|
|
|
|
"tel",
|
|
|
|
|
"advisoryType",
|
|
|
|
|
"status",
|
|
|
|
|
"idCard",
|
|
|
|
|
"homeAddress",
|
|
|
|
|
"workUnit",
|
|
|
|
|
"izJs",
|
|
|
|
|
]
|
|
|
|
|
|
|
|
|
|
keys.forEach(key => {
|
|
|
|
|
form[key] = data[key] || ""
|
|
|
|
|
})
|
2025-09-28 10:58:31 +08:00
|
|
|
console.log("????",uni.getStorageSync('allinfo'))
|
2025-09-15 17:23:33 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
})
|
2025-06-27 08:56:14 +08:00
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
|
|
.container {
|
|
|
|
|
display: flex;
|
|
|
|
|
flex-direction: column;
|
|
|
|
|
min-height: 100vh;
|
|
|
|
|
width: 100%;
|
2025-09-15 17:23:33 +08:00
|
|
|
background-color: #F7F7F7;
|
2025-06-27 08:56:14 +08:00
|
|
|
position: relative;
|
|
|
|
|
|
|
|
|
|
.white-content {
|
|
|
|
|
width: 90%;
|
|
|
|
|
margin-left: 5%;
|
|
|
|
|
border-radius: 35rpx;
|
|
|
|
|
|
|
|
|
|
.content-title {
|
|
|
|
|
display: flex;
|
2025-09-15 17:23:33 +08:00
|
|
|
align-items: center;
|
2025-06-27 08:56:14 +08:00
|
|
|
height: 100rpx;
|
|
|
|
|
position: relative;
|
2025-09-15 17:23:33 +08:00
|
|
|
font-weight: 600;
|
2025-06-27 08:56:14 +08:00
|
|
|
|
|
|
|
|
.content-weight {
|
2025-09-15 17:23:33 +08:00
|
|
|
font-size: 32rpx;
|
2025-06-27 08:56:14 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.content-img {
|
|
|
|
|
position: absolute;
|
|
|
|
|
right: 0;
|
|
|
|
|
top: 0;
|
|
|
|
|
width: 400rpx;
|
|
|
|
|
height: 100%;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
.finish-button {
|
|
|
|
|
display: flex;
|
|
|
|
|
justify-content: center;
|
|
|
|
|
align-items: center;
|
2025-07-23 17:37:27 +08:00
|
|
|
width: 80%;
|
2025-09-15 17:23:33 +08:00
|
|
|
height: 90rpx;
|
2025-06-27 08:56:14 +08:00
|
|
|
margin: 0rpx auto;
|
|
|
|
|
margin-bottom: 80rpx;
|
2025-09-15 17:23:33 +08:00
|
|
|
margin-top: 20rpx;
|
2025-06-27 08:56:14 +08:00
|
|
|
color: #fff;
|
2025-09-15 17:23:33 +08:00
|
|
|
background: linear-gradient(to left, #00C9FF, #0076FF);
|
2025-07-23 17:37:27 +08:00
|
|
|
border-radius: 35rpx;
|
|
|
|
|
font-size: 33rpx;
|
2025-06-27 08:56:14 +08:00
|
|
|
}
|
2025-09-15 17:23:33 +08:00
|
|
|
|
|
|
|
|
.title-back {
|
|
|
|
|
margin-top: 100rpx;
|
|
|
|
|
width: 100%;
|
|
|
|
|
height: 100rpx;
|
|
|
|
|
display: flex;
|
|
|
|
|
justify-content: space-between;
|
|
|
|
|
align-items: center;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.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;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.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;
|
|
|
|
|
text-overflow: ellipsis;
|
|
|
|
|
width: 350rpx;
|
|
|
|
|
display: flex;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
2025-06-27 08:56:14 +08:00
|
|
|
</style>
|