实名认证

This commit is contained in:
墨大叔 2024-09-23 18:01:30 +08:00
parent c6bc16f741
commit d2e28e9419
7 changed files with 507 additions and 8 deletions

View File

@ -61,7 +61,8 @@
"vue-meta": "2.4.0",
"vue-router": "3.4.9",
"vuedraggable": "2.24.3",
"vuex": "3.6.0"
"vuex": "3.6.0",
"weixin-js-sdk": "^1.6.5"
},
"devDependencies": {
"@vue/cli-plugin-babel": "4.4.6",

12
src/api/common.js Normal file
View File

@ -0,0 +1,12 @@
import request from '@/utils/request'
/**
* 获取微信js-sdk签名
*/
export function getWxJsSdkSignature(params) {
return request({
url: '/common/wx/js/sdk',
method: 'get',
params
})
}

44
src/api/ss/realName.js Normal file
View File

@ -0,0 +1,44 @@
import request from '@/utils/request'
// 查询实名认证列表
export function listRealName(query) {
return request({
url: '/ss/realName/list',
method: 'get',
params: query
})
}
// 查询实名认证详细
export function getRealName(id) {
return request({
url: '/ss/realName/' + id,
method: 'get'
})
}
// 新增实名认证
export function addRealName(data) {
return request({
url: '/ss/realName',
method: 'post',
data: data
})
}
// 修改实名认证
export function updateRealName(data) {
return request({
url: '/ss/realName',
method: 'put',
data: data
})
}
// 删除实名认证
export function delRealName(id) {
return request({
url: '/ss/realName/' + id,
method: 'delete'
})
}

View File

@ -1,13 +1,74 @@
<template>
<div class="mobile-container">
<el-result :title="title" :subTitle="subTitle" icon="error">
<template slot="icon" v-if="success">
<i class="el-icon-loading" style="font-size: 48px"/>
</template>
<template slot="extra">
<el-button type="text" size="medium" @click="redirectToWx" >没有反应点我跳转</el-button>
</template>
</el-result>
</div>
</template>
<script>
import wx from 'weixin-js-sdk'
export default {
name: 'Liveness'
name: 'Liveness',
data() {
return {
success: true,
}
},
computed: {
subTitle() {
if (this.success) {
return "正在获取结果中,请稍后"
} else {
return "认证失败,请重新认证"
}
},
title() {
if (this.success) {
return "跳转中"
} else {
return "认证失败"
}
}
},
created() {
this.success = this.$route.query.success === 'true';
this.redirectToWx();
},
methods: {
redirectToWx() {
//
wx.miniProgram.getEnv( (envRes) => {
console.log("getEnv", envRes);
// alert(envRes.miniprogram);
if (envRes.miniprogram) {
// alert('success:' + this.success)
if (this.success) {
wx.miniProgram.redirectTo({
url: '/pages/shuaxin',
})
} else {
wx.miniProgram.navigateBack({
delta: 1
});
}
}
})
}
}
}
</script>
<style scoped lang="scss">
.mobile-container {
position: absolute;
width: 100%;
height: 100vh;
padding-top: 20vh;
}
</style>

View File

@ -0,0 +1,364 @@
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="用户名称" prop="userName">
<el-input
v-model="queryParams.userName"
placeholder="请输入用户名称"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="姓名" prop="name">
<el-input
v-model="queryParams.name"
placeholder="请输入姓名"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="身份证" prop="idCard">
<el-input
v-model="queryParams.idCard"
placeholder="请输入身份证"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="手机号" prop="mobile">
<el-input
v-model="queryParams.mobile"
placeholder="请输入手机号"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
<el-row :gutter="10" class="mb8">
<!-- <el-col :span="1.5">-->
<!-- <el-button-->
<!-- type="primary"-->
<!-- plain-->
<!-- icon="el-icon-plus"-->
<!-- size="mini"-->
<!-- @click="handleAdd"-->
<!-- v-hasPermi="['ss:realName:add']"-->
<!-- >新增</el-button>-->
<!-- </el-col>-->
<!-- <el-col :span="1.5">-->
<!-- <el-button-->
<!-- type="success"-->
<!-- plain-->
<!-- icon="el-icon-edit"-->
<!-- size="mini"-->
<!-- :disabled="single"-->
<!-- @click="handleUpdate"-->
<!-- v-hasPermi="['ss:realName:edit']"-->
<!-- >修改</el-button>-->
<!-- </el-col>-->
<!-- <el-col :span="1.5">-->
<!-- <el-button-->
<!-- type="danger"-->
<!-- plain-->
<!-- icon="el-icon-delete"-->
<!-- size="mini"-->
<!-- :disabled="multiple"-->
<!-- @click="handleDelete"-->
<!-- v-hasPermi="['ss:realName:remove']"-->
<!-- >删除</el-button>-->
<!-- </el-col>-->
<el-col :span="1.5">
<el-button
type="warning"
plain
icon="el-icon-download"
size="mini"
@click="handleExport"
v-hasPermi="['ss:realName:export']"
>导出</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList" :columns="columns"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="realNameList" @selection-change="handleSelectionChange" :default-sort="defaultSort" @sort-change="onSortChange">
<el-table-column type="selection" width="55" align="center" />
<template v-for="column of showColumns">
<el-table-column
:key="column.key"
:label="column.label"
:prop="column.key"
:align="column.align"
:min-width="column.minWidth"
:sort-orders="orderSorts"
:sortable="column.sortable"
:show-overflow-tooltip="column.overflow"
:width="column.width"
>
<template slot-scope="d">
<template v-if="column.key === 'id'">
{{d.row[column.key]}}
</template>
<template v-else-if="column.key === 'faceImage'">
<!-- <image-preview :src="d.row[column.key]" :width="50" :height="50"/>-->
<el-image :src="d.row.faceImage" style="width: 50px;height: 50px"/>
</template>
<template v-else-if="column.key === 'userId'">
<user-link :id="d.row.userId" :name="d.row.userName"/>
</template>
<template v-else>
{{d.row[column.key]}}
</template>
</template>
</el-table-column>
</template>
<!-- <el-table-column label="操作" align="center" class-name="small-padding fixed-width">-->
<!-- <template slot-scope="scope">-->
<!-- <el-button-->
<!-- size="mini"-->
<!-- type="text"-->
<!-- icon="el-icon-edit"-->
<!-- @click="handleUpdate(scope.row)"-->
<!-- v-hasPermi="['ss:realName:edit']"-->
<!-- >修改</el-button>-->
<!-- <el-button-->
<!-- size="mini"-->
<!-- type="text"-->
<!-- icon="el-icon-delete"-->
<!-- @click="handleDelete(scope.row)"-->
<!-- v-hasPermi="['ss:realName:remove']"-->
<!-- >删除</el-button>-->
<!-- </template>-->
<!-- </el-table-column>-->
</el-table>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
<!-- 添加或修改实名认证对话框 -->
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="用户ID" prop="userId">
<el-input v-model="form.userId" placeholder="请输入用户ID" />
</el-form-item>
<el-form-item label="姓名" prop="name">
<el-input v-model="form.name" placeholder="请输入姓名" />
</el-form-item>
<el-form-item label="身份证" prop="idCard">
<el-input v-model="form.idCard" placeholder="请输入身份证" />
</el-form-item>
<el-form-item label="手机号" prop="mobile">
<el-input v-model="form.mobile" placeholder="请输入手机号" />
</el-form-item>
<el-form-item label="比对分数" prop="score">
<el-input v-model="form.score" placeholder="请输入比对分数" />
</el-form-item>
<el-form-item label="人脸图像" prop="faceImage">
<image-upload v-model="form.faceImage"/>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import { listRealName, getRealName, delRealName, addRealName, updateRealName } from "@/api/ss/realName";
import { $showColumns } from '@/utils/mixins';
import UserLink from '@/components/Business/SmUser/UserLink.vue'
//
const defaultSort = {
prop: "createTime",
order: "descending"
}
export default {
name: "RealName",
components: { UserLink },
mixins: [$showColumns],
data() {
return {
//
columns: [
{key: 'id', visible: false, label: 'ID', minWidth: null, sortable: true, overflow: false, align: 'center', width: "100"},
{key: 'createTime', visible: true, label: '认证时间', minWidth: null, sortable: true, overflow: false, align: 'center', width: "180"},
{key: 'userId', visible: true, label: '用户', minWidth: null, sortable: true, overflow: false, align: 'center', width: null},
{key: 'name', visible: true, label: '姓名', minWidth: null, sortable: true, overflow: false, align: 'center', width: null},
{key: 'idCard', visible: true, label: '身份证', minWidth: null, sortable: true, overflow: false, align: 'center', width: null},
{key: 'mobile', visible: true, label: '手机号', minWidth: null, sortable: true, overflow: false, align: 'center', width: null},
{key: 'score', visible: true, label: '比对分数', minWidth: null, sortable: true, overflow: false, align: 'center', width: null},
{key: 'faceImage', visible: false, label: '人脸图像', minWidth: null, sortable: false, overflow: false, align: 'center', width: null},
],
//
orderSorts: ['ascending', 'descending', null],
//
loading: true,
//
ids: [],
//
single: true,
//
multiple: true,
//
showSearch: true,
//
total: 0,
//
realNameList: [],
//
title: "",
//
open: false,
defaultSort,
//
queryParams: {
pageNum: 1,
pageSize: 10,
orderByColumn: defaultSort.prop,
isAsc: defaultSort.order,
id: null,
userId: null,
name: null,
idCard: null,
mobile: null,
},
//
form: {},
//
rules: {
userId: [
{ required: true, message: "用户ID不能为空", trigger: "blur" }
],
createTime: [
{ required: true, message: "创建时间不能为空", trigger: "blur" }
],
}
};
},
created() {
this.getList();
},
methods: {
/** 当排序按钮被点击时触发 **/
onSortChange(column) {
if (column.order == null) {
this.queryParams.orderByColumn = defaultSort.prop;
this.queryParams.isAsc = defaultSort.order;
} else {
this.queryParams.orderByColumn = column.prop;
this.queryParams.isAsc = column.order;
}
this.getList();
},
/** 查询实名认证列表 */
getList() {
this.loading = true;
listRealName(this.queryParams).then(response => {
this.realNameList = response.rows;
this.total = response.total;
this.loading = false;
});
},
//
cancel() {
this.open = false;
this.reset();
},
//
reset() {
this.form = {
id: null,
userId: null,
name: null,
idCard: null,
mobile: null,
createTime: null,
score: null,
faceImage: null
};
this.resetForm("form");
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
//
handleSelectionChange(selection) {
this.ids = selection.map(item => item.id)
this.single = selection.length!==1
this.multiple = !selection.length
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.open = true;
this.title = "添加实名认证";
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
const id = row.id || this.ids
getRealName(id).then(response => {
this.form = response.data;
this.open = true;
this.title = "修改实名认证";
});
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
if (this.form.id != null) {
updateRealName(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
addRealName(this.form).then(response => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
});
}
}
});
},
/** 删除按钮操作 */
handleDelete(row) {
const ids = row.id || this.ids;
this.$modal.confirm('是否确认删除实名认证编号为"' + ids + '"的数据项?').then(function() {
return delRealName(ids);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {});
},
/** 导出按钮操作 */
handleExport() {
this.download('ss/realName/export', {
...this.queryParams
}, `realName_${new Date().getTime()}.xlsx`)
}
}
};
</script>

View File

@ -2,11 +2,12 @@
<el-form :model="config" inline ref="form" size="medium" v-if="hasPermission">
<el-form-item :label="config.configName" :label-width="(config.configName.length + 1) + 'em'" prop="configValue">
<slot :row="config">
<el-input v-model="config.configValue" :placeholder="`请输入${config.configName}`"/>
<el-switch v-if="type === 'switch'" v-model="switchValue" @change="handleSubmit" v-loading="loading"/>
<el-input v-else v-model="config.configValue" :placeholder="`请输入${config.configName}`"/>
</slot>
</el-form-item>
<el-form-item>
<el-button @click="handleSubmit" type="primary" :loading="loading" icon="el-icon-check" size="small">修改</el-button>
<el-button v-if="type === 'input'" @click="handleSubmit" type="primary" :loading="loading" icon="el-icon-check" size="small">修改</el-button>
<slot name="remark">
<span v-if="config.remark" style="font-size: 12px;color: #606060;margin-left: 1em;">{{config.remark}}</span>
</slot>
@ -29,6 +30,13 @@ export default {
rules: {
type: Object,
default: () => {}
},
type: {
type: String,
default: 'input',
validator(val) {
return ['input', 'switch'].includes(val);
}
}
},
computed: {
@ -38,6 +46,15 @@ export default {
return true;
}
return checkPermi([this.config.permission]);
},
//
switchValue: {
set(val) {
this.config.configValue = val ? 'true' : 'false';
},
get() {
return this.config != null && this.config.configValue === 'true';
}
}
},
data() {

View File

@ -28,7 +28,7 @@
</config-item>
</el-tab-pane>
<el-tab-pane label="其他" lazy>
<config-item :config="getConfig(ConfigKey.WECHAT_APPROVAL)"/>
<config-item :config="getConfig(ConfigKey.WECHAT_APPROVAL)" type="switch"/>
</el-tab-pane>
</el-tabs>
</div>