迁移实名认证应用到产品库

This commit is contained in:
aixianling
2022-03-02 11:22:24 +08:00
parent b9152917ce
commit 6f8d1de072
10 changed files with 744 additions and 7 deletions

View File

@@ -142,7 +142,7 @@ export default {
if (!this.user.phone) {//判断已经绑定手机
this.$linkTo('/pages/phone/bingPhoneNumber?from=auth')
} else {
this.$linkTo('/pages/auth/authenticationInfo')
this.$linkTo('/mods/AppAuth/AppAuth')
}
} else {
this.$linkTo(url)

View File

@@ -0,0 +1,145 @@
<template>
<div class="wrapper">
<div class="top">
<img src="https://cdn.cunwuyun.cn/AppAuth/security.png" alt="">
<span class="toast">请验证你的个人信息</span>
</div>
<div class="form">
<u-input placeholder="请输入姓名" trim placeholder-style="color:#ccc;font-size:17px"
:custom-style="{height:'72px',borderBottom:'1px solid #ddd'}" v-model="name"/>
<u-input placeholder="请输入身份证号码" trim placeholder-style="color:#ccc;font-size:17px"
:custom-style="{height:'72px'}" v-model="idNumber" maxlength="18"/>
</div>
<div class="btn" @click="confirm()">提交</div>
<div class="promise">以上信息将为你严格保密</div>
</div>
</template>
<script>
import {mapState} from 'vuex';
export default {
name: "AppAuth",
appName: "实名认证",
computed: {
...mapState(['user']),
},
data() {
return {
name: '',
idNumber: '',
};
},
onLoad() {
let {status} = this.user
if (status == 2) {
uni.redirectTo({url: "./authInfo"})
} else if (status == 0) {
//停留此页
} else {
uni.redirectTo({url: "./authSuccess"})
}
},
methods: {
confirm() {
let {name, idNumber} = this
if (!name) {
return this.$toast('请填写姓名')
}
if (!idNumber) {
return this.$toast('请填写身份证号码')
}
if (!this.$idCardNoUtil.checkIdCardNo(idNumber)) {
return this.$toast('请输入正确的身份证号码')
}
this.$instance.post(`/app/appwechatuser/idNumberAttestation`, {
idNumber, name
}).then(res => {
if (res.code == 0) {
if (res.data == 2 || res.data == 0) {
this.$store.commit('getUserInfo')
uni.redirectTo({
url: `./authSuccess?status=${res.data}`, success: () => {
if (res.data == 0) {
uni.setStorageSync("authForm", {idNumber, name})
}
}
})
}
} else {
this.$toast(res.msg);
setTimeout(() => {
uni.navigateBack();
}, 500)
}
}).catch(err => {
this.$toast(err)
})
},
}
};
</script>
<style lang="scss" scope>
@import "../../common/common.scss";
.top {
height: 480px;
background: #4181FF;
display: flex;
flex-direction: column;
align-items: center;
padding-top: 48px;
& > img {
width: 160px;
height: 160px;
}
.toast {
margin-top: 32px;
font-size: 44px;
font-weight: 600;
color: #D9E5FF;
line-height: 60px;
}
}
.form {
width: 686px;
background: #FFFFFF;
margin: -132px auto 0;
box-shadow: 0 0 8px 0 rgba(0, 0, 0, 0.02);
border-radius: 16px;
box-sizing: border-box;
padding: 0 48px;
.input {
width: 590px;
height: 144px;
border-bottom: 2px solid #DDDDDD;
}
}
.btn {
width: 686px;
height: 88px;
margin: 80px auto 0;
background: #4181FF;
border-radius: 16px;
display: flex;
align-items: center;
justify-content: center;
font-size: 34px;
font-weight: 500;
color: #FFFFFF;
}
.promise {
font-size: 28px;
font-weight: 400;
color: #999999;
line-height: 40px;
text-align: center;
margin-top: 48px;
}
</style>

View File

@@ -0,0 +1,241 @@
<template>
<section class="authApply">
<div class="card">
<div class="item">
<div class="label required" v-text="`是否户主`"/>
<div class="flex">
<div class="radioBtn" v-for="op in $dict.getDict('yesOrNo')" :key="op.dictValue" v-text="op.dictName"
:class="{current:op.dictValue==form.householdName}" @click="form.householdName=op.dictValue"/>
</div>
</div>
<template v-if="form.householdName==0">
<div class="flex item">
<div class="label required" required v-text="`户主身份证号`"/>
<u-input v-model="form.householdIdNumber" input-align="right" maxlength="18"/>
</div>
<div class="flex item">
<div class="label required" required v-text="`与户主关系`"/>
<AiSelect v-model="form.householdRelation" dict="householdRelation"/>
</div>
</template>
</div>
<div class="card">
<view class="item flex spb" v-for="row in baseInfo" :key="row.prop">
<span class="label" :class="{required:row.required}" v-text="row.label"/>
<AiSelect v-if="row.dict" v-model="form[row.prop]" :dict="row.dict" :disabled="row.disabled"/>
<AiDate v-else-if="row.type=='time'" @change="v=>$set(form,row.prop,v)" :value="form[row.prop]"/>
<u-input v-else-if="row.type=='idNumber'" v-model="form[row.prop]" input-align="right" maxlength="18"/>
<u-input v-else-if="row.type=='phone'" v-model="form[row.prop]" input-align="right" maxlength="11"/>
<u-input v-else v-model="form[row.prop]" input-align="right"/>
</view>
</div>
<div class="card">
<view class="item" :class="{spb:!row.topLabel,flex:!row.topLabel}" v-for="row in contract" :key="row.prop">
<span class="label" :class="{required:row.required}" v-text="row.label"/>
<AiAreaPicker v-if="row.type=='area'" @select="v=>$set(form,row.prop,v)" :areaId="$areaId">
<u-icon name="arrow-right" :label="form.currentAreaName||'请选择'" label-pos="left" color="#ddd"/>
</AiAreaPicker>
<textarea v-else v-model="form[row.prop]" input-align="right" placeholder="请输入" placeholder-style="color:#999"/>
</view>
</div>
<div class="card">
<view class="item" :class="{spb:!row.topLabel,flex:!row.topLabel}" v-for="row in household" :key="row.prop">
<span class="label" :class="{required:row.required}" v-text="row.label"/>
<AiAreaPicker v-if="row.prop=='householdAreaId'" all @select="v=>$set(form,row.prop,v)"
:fullName.sync="form.householdAreaName" valueLevel="5">
<u-icon name="arrow-right" :label="form.householdAreaName||'请选择'" label-pos="left" color="#ddd"/>
</AiAreaPicker>
<textarea v-else v-model="form[row.prop]" input-align="right" placeholder="请输入" placeholder-style="color:#999"/>
</view>
</div>
<div class="card">
<view class="item flex spb" v-for="row in extra" :key="row.prop">
<span class="label" :class="{required:row.required}" v-text="row.label"/>
<AiSelect v-if="row.dict" v-model="form[row.prop]" :dict="row.dict"/>
<AiDate v-else-if="row.type=='time'" v-model="form[row.prop]"/>
<AiAreaPicker v-else-if="row.type=='area'" @select="v=>$set(form,row.prop,v)" all>
<u-icon name="arrow-right" :label="form.birthplaceAreaName||'请选择'" label-pos="left" color="#ddd"/>
</AiAreaPicker>
<u-input v-else v-model="form[row.prop]" input-align="right"/>
</view>
</div>
<div class="fixed-bottom">
<u-button type="primary" @click="submit">
<text style="font-size: 16px" v-text="`提交`"/>
</u-button>
</div>
</section>
</template>
<script>
import {mapState} from "vuex";
export default {
name: "authApply",
appName: "居民档案申请",
computed: {
...mapState(['user']),
},
data() {
let required = true
return {
form: {
householdName: "1",
currentAreaName: "",
householdAreaName: "",
birthplaceAreaName: ""
},
baseInfo: [
{label: "姓名", prop: "name", required},
{label: "身份证号", prop: "idNumber", required, type: "idNumber"},
{label: "性别", prop: "sex", required, dict: "sex", disabled: true},
{label: "出生日期", prop: "birthDate", required, type: "time", disabled: true},
{label: "联系方式", prop: "phone", type: "phone"},
],
contract: [
{label: "现住址", prop: "currentAreaId", type: "area", required},
{label: "详细住址", prop: "currentAddress", type: 'textarea', topLabel: true},
],
household: [
{label: "户籍地址", prop: "householdAreaId", type: "area", required},
{label: "详细地址", prop: "householdAddress", type: 'textarea', topLabel: true},
],
extra: [
{label: "籍贯", prop: "birthplaceAreaId", type: "area"},
{label: "民族", prop: "nation", dict: "nation"},
{label: "文化程度", prop: "education", dict: "education"},
{label: "婚姻状况", prop: "maritalStatus", dict: "maritalStatus"},
{label: "政治面貌", prop: "politicsStatus", dict: "politicsStatus"},
{label: "兵役状况", prop: "militaryStatus", dict: "militaryStatus"},
{label: "宗教信仰", prop: "faithType", dict: "faithType"},
{label: "职业", prop: "job", dict: "job"},
]
}
},
onLoad() {
this.$dict.load("yesOrNo", "householdRelation")
this.getResident()
},
watch: {
'form.idNumber'(v) {
let {birthday: birthDate, sex} = this.$idCardNoUtil.getIdCardInfo(v),
age = this.$calcAge(v)
this.form = {...this.form, birthDate, sex, age}
}
},
methods: {
getResident() {
let {residentId: id} = this.user
if (id) {
this.$instance.post("/app/appresident/detailForWx", null, {
params: {id}
}).then(res => {
if (res?.data) {
this.form = res.data.resident
}
})
} else if (uni.getStorageSync("authForm")) {
let info = uni.getStorageSync("authForm"),
{birthday: birthDate, sex} = this.$idCardNoUtil.getIdCardInfo(info.idNumber)
uni.removeStorageSync("authForm")
this.form = {...this.form, ...info, birthDate, sex}
}
},
submit() {
let {baseInfo, contract, household, extra, form: {householdName, householdIdNumber, householdRelation}} = this
if (householdName == 0) {
if (!householdIdNumber) return this.$u.toast("请输入户主身份证号")
else if (!this.$idCardNoUtil.checkIdCardNo(householdIdNumber)) return this.$u.toast("请输入正确的身份证号")
if (!householdRelation) return this.$u.toast("请输入与户主关系")
}
let flag = [baseInfo, contract, household, extra].flat().reverse().some(e => {
if (e.required && !this.form[e.prop]) {
if (!e.dict && (['textarea', 'idNumber'].includes(e.type) || !e.type)) return this.$u.toast("请输入" + e.label)
else return this.$u.toast("请选择" + e.label)
} else if (e.type == 'idNumber' && !this.$idCardNoUtil.checkIdCardNo(this.form[e.prop])) {
return this.$u.toast("请输入正确的身份证号")
}
})
if (!flag) {
this.$instance.post("/app/appresident/addOrUpdate", this.form).then(res => {
if (res?.code == 0) {
uni.redirectTo({url: "./authSuccess"})
}
})
}
}
}
}
</script>
<style lang="scss" scoped>
.authApply {
background: #F3F6F9;
min-height: 100vh;
padding-bottom: 280px;
.card {
background: #fff;
padding-left: 32px;
margin-bottom: 24px;
.label {
font-size: 34px;
font-family: PingFangSC-Medium, PingFang SC;
color: #666;
font-weight: bold;
line-height: 112px;
position: relative;
&.required:before {
content: "*";
color: #FF4466;
position: absolute;
left: 0;
transform: translateX(-100%);
}
}
.item {
width: 100%;
min-height: 128px;
color: #333;
box-shadow: inset 0px -1px 0px 0px #DDDDDD;
padding-right: 32px;
box-sizing: border-box;
justify-content: space-between;
}
}
.radioBtn {
width: 218px;
height: 80px;
background: #FFFFFF;
border-radius: 16px;
border: 1px solid #CCC;
margin-right: 16px;
text-align: center;
line-height: 80px;
margin-bottom: 48px;
&.current {
background: #4181FF;
color: #fff;
border-color: #4181ff;
}
}
.fixed-bottom {
width: 100vw;
height: 120px;
padding: 16px 32px;
box-sizing: border-box;
background: inherit;
}
textarea {
width: 100%;
}
}
</style>

View File

@@ -0,0 +1,153 @@
<template>
<section class="authInfo">
<div class="headerCard flex card">
<div class="avatar">
<open-data type="userAvatarUrl" lang="zh_CN" class="user-img"/>
</div>
<div class="flex fill">
<div class="fill">
<b v-text="user.realName"/>
<div class="color-999" v-text="sexAge"/>
</div>
<div class="blue" v-if="isOwner">户主</div>
</div>
</div>
<div class="card">
<b class="title" v-text="`基本信息`"/>
<view class="item flex spb" v-for="row in baseInfo" :key="row.prop">
<span class="color-999" v-text="row.label"/>
<div v-if="row.dict" v-text="$dict.getLabel(row.dict,detail[row.prop])||'-'"/>
<div v-else v-text="detail[row.prop]||'-'"/>
</view>
</div>
<div class="card">
<b class="title" v-text="`联络方式`"/>
<view class="item flex spb" v-for="row in contract" :key="row.prop">
<span class="color-999" v-text="row.label"/>
<div v-text="detail[row.prop]||'-'"/>
</view>
</div>
<div class="fixed-bottom">
<u-button type="primary" @click="apply">
<text style="font-size: 16px" v-text="`申请修改`"/>
</u-button>
</div>
</section>
</template>
<script>
import {mapState} from "vuex";
export default {
name: "authInfo",
appName:"我的档案",
data() {
return {
detail: {},
baseInfo: [
{label: "身份证号", prop: "idNumber"},
{label: "籍贯", prop: "birthplaceAreaName"},
{label: "民族", prop: "nation", dict: "nation"},
{label: "文化程度", prop: "education", dict: "education"},
{label: "政治面貌", prop: "politicsStatus", dict: "politicsStatus"},
{label: "兵役状况", prop: "militaryStatus", dict: "militaryStatus"},
{label: "宗教信仰", prop: "faithType", dict: "faithType"},
{label: "职业", prop: "job", dict: "job"},
],
contract: [
{label: "联系方式", prop: "phone"},
{label: "现住址", prop: "currentAreaName"},
{label: "详细住址", prop: "currentAddress"},
{label: "户籍地址", prop: "householdAreaName"},
{label: "详细地址", prop: "householdAddress"},
]
}
},
computed: {
...mapState(['user']),
sexAge() {
let {idNumber, gender} = this.$idCardNoUtil.getIdCardInfo(this.user.idNumber), age = this.$calcAge(idNumber)
return `${this.$dict.getLabel("sex", gender) || ""} ${age ? age + "岁" : ""}`
},
isOwner() {
return this.detail.householdName == 1
}
},
onLoad() {
this.$dict.load("sex", "nation", "education", "politicsStatus", "militaryStatus", "faithType", "job")
this.getResident()
},
methods: {
getResident() {
this.$instance.post("/app/appresident/detailForWx", null, {
params: {id: this.user.residentId}
}).then(res => {
if (res?.data) {
this.detail = res.data.resident
}
})
},
apply() {
uni.navigateTo({url: "./authApply"})
}
}
}
</script>
<style lang="scss" scoped>
.authInfo {
background: #F3F6F9;
min-height: 100vh;
padding-bottom: 280px;
.avatar {
display: inline-block;
width: 96px;
height: 96px;
border-radius: 50%;
overflow: hidden;
border: 4px solid #FFFFFF;
flex-shrink: 0;
margin-right: 16px;
}
.card {
background: #fff;
padding-left: 32px;
margin-bottom: 24px;
.title {
width: 100%;
height: 116px;
line-height: 116px;
font-weight: bold;
}
.item {
width: 100%;
height: 112px;
color: #333;
box-shadow: inset 0px -1px 0px 0px #DDDDDD;
padding-right: 32px;
box-sizing: border-box;
}
}
.headerCard {
height: 160px;
padding-right: 32px;
}
.blue {
color: #4181FF;
}
.fixed-bottom {
width: 100vw;
height: 120px;
padding: 16px 32px;
box-sizing: border-box;
}
}
</style>

View File

@@ -0,0 +1,198 @@
<template>
<div class="success">
<template v-if="isSuccess">
<image src="https://cdn.cunwuyun.cn/img/authSuccess.png"/>
<h2 v-text="`认证成功!`"/>
<div class="btn" @click="gotoInfo" v-text="`前往查看`"/>
</template>
<template v-else-if="isFail">
<image src="https://cdn.cunwuyun.cn/img/authFail.png"/>
<h2 v-text="`认证失败!`"/>
<span class="flex">请先填写<div class="blue" v-text="`居民档案`"/> 进行申请</span>
<div class="btn" @click="apply">居民档案申请</div>
<div class="btn plain" @click="backToHome">返回</div>
</template>
<div class="authing" v-else>
<div class="result" v-text="`你发起的申请/修改`"/>
<div class="result" v-text="authingResult"/>
<div class="failReason" v-if="authFail">
<div class="title flex spb">
<b v-text="`审核结果`"/>
<b class="red" v-text="`未通过`"/>
</div>
<b v-text="`原因`"/>
<div v-html="info.resident.auditOpinion"/>
</div>
<div class="fixed-bottom">
<u-button type="primary" @click="$linkTo('./authInfo')">
<text style="font-size: 16px" v-text="`查看填报内容`"/>
</u-button>
</div>
</div>
</div>
</template>
<script>
import {mapState} from "vuex";
export default {
appName: "实名身份认证",
data() {
return {
status: '',
info: {}
}
},
computed: {
...mapState(['user']),
isSuccess() {
return this.status == 2
},
isFail() {
return this.status?.toString() == "0"
},
authFail() {
return this.user.status == -1
},
authingResult() {
return this.authFail ? "审核未通过" : "正在审核中"
}
},
onLoad(options) {
if (options.status) {
this.status = options.status
}
if (!this.isSuccess && !this.isFail) this.getAuthResult()
},
methods: {
backToHome() {
uni.navigateBack({})
},
apply() {
uni.redirectTo({url: "./authApply"})
},
gotoInfo() {
uni.redirectTo({url: "./authInfo"})
},
getAuthResult() {
this.$instance.post(`/app/appresident/detailForWx`, null, {
params: {id: this.user.residentId}
}).then(res => {
if (res?.data) {
this.info = res.data
}
})
}
}
}
</script>
<style lang="scss">
@import "../../common/common";
.success {
height: 100vh;
padding-top: 96px;
box-sizing: border-box;
text-align: center;
background-color: #fff;
overflow: hidden;
image {
width: 240px;
height: 240px;
margin-bottom: 16px;
}
h2 {
margin-bottom: 16px;
color: #333333;
font-size: 40px;
font-weight: 700;
}
span {
font-size: 28px;
font-family: PingFangSC-Medium, PingFang SC;
font-weight: bold;
color: #333;
margin-bottom: 40px;
justify-content: center;
.blue {
color: #4181FF;
}
}
.btn {
width: 320px;
height: 88px;
line-height: 88px;
margin: 48px auto 0;
color: #fff;
font-size: 34px;
background: #4181FF;
box-shadow: 0 8px 16px 0 rgba(0, 0, 0, 0.02);
border-radius: 16px;
&.plain {
background: #fff;
color: #4181FF;
border: 2px solid #4181FF;
}
}
.authing {
margin-top: -272px;
padding: 224px 32px 0;
box-sizing: border-box;
height: calc(100vh + 272px);
background-image: url("https://cdn.cunwuyun.cn/shandong10086/authInfoHbg.png");
background-size: 100vw;
background-repeat: no-repeat;
background-color: #f3f6f9;
.result {
font-size: 56px;
font-family: PingFangSC-Semibold, PingFang SC;
font-weight: bold;
color: #000;
line-height: 88px;
text-align: left;
}
.failReason {
margin-top: 160px;
background: #FFFFFF;
box-shadow: 0 0 8px 0 rgba(0, 0, 0, 0.02);
border-radius: 16px;
padding: 0 32px 34px;
font-size: 32px;
text-align: left;
.title {
height: 112px;
box-shadow: inset 0px -1px 0px 0px #DDDDDD;
}
b {
font-size: inherit;
color: #999;
line-height: 112px;
&.red {
color: #f46;
}
}
}
.fixed-bottom {
position: fixed;
bottom: 16px;
width: 100vw;
height: 120px;
padding: 16px 32px;
box-sizing: border-box;
background-color: inherit;
}
}
}
</style>

View File

@@ -137,7 +137,7 @@ export default {
if (!this.user.phone) {
return this.$linkTo('/pages/phone/bingPhoneNumber?from=auth')
} else {
return this.$linkTo('/pages/auth/authenticationInfo')
return this.$linkTo('/mods/AppAuth/AppAuth')
}
}

View File

@@ -96,7 +96,7 @@
// confirmText: '去认证',
// content: '您还未进行实名认证'
// }).then(() => {
// this.$linkTo('/pages/auth/authenticationInfo')
// this.$linkTo('/mods/AppAuth/AppAuth')
// })
// return false

View File

@@ -73,7 +73,7 @@ export default {
//判断已经绑定手机
this.$linkTo('/pages/phone/bingPhoneNumber?from=auth')
} else {
this.$linkTo('/pages/auth/authenticationInfo')
this.$linkTo('/mods/AppAuth/AppAuth')
}
} else {
this.$linkTo(url)

View File

@@ -70,7 +70,7 @@ export default {
// if (!this.user.phone) {
// this.$linkTo('/pages/phone/bingPhoneNumber?from=auth')
// } else {
// this.$linkTo('/pages/auth/authenticationInfo')
// this.$linkTo('/mods/AppAuth/AppAuth')
// }
// } else {
// this.$linkTo(url)

View File

@@ -169,7 +169,7 @@
}
if (!this.user.residentId) {
this.$linkTo('/pages/auth/authenticationInfo')
this.$linkTo('/mods/AppAuth/AppAuth')
return false
}
@@ -197,7 +197,7 @@
}
if (!this.user.residentId) {
this.$linkTo('/pages/auth/authenticationInfo')
this.$linkTo('/mods/AppAuth/AppAuth')
return false
}