###代码修改说明
####1. 增加实名认证功能 在用户余额页面增加实名认证对话框,包括姓名和身份证号输入,取消和确认按钮。实名认证逻辑在`navigateToRecharge`方法中实现,如果用户已实名,则直接跳转至充值页面,否则显示实名认证对话框。 ####2. 重构充值按钮逻辑充值按钮现在会根据用户实名认证状态跳转至相应页面。如果用户未实名,将显示实名认证对话框。 ####3. 更新用户余额获取逻辑优化`fetchUserBalance`方法,处理用户未登录和用户余额获取失败的情况。 #### 4.暂时注释接口列表代码 在`index.vue`文件中,接口列表的表格代码被注释掉,可能是因为接口列表功能尚未实现或暂时禁用。 #### 5. 新增实名认证API调用 增加新的API调用`checkRealNameAuth`,用于实名认证校验。此方法通过POST请求调用第三方服务,传入用户实名和身份证号数据。 以上修改涉及用户余额页面的增强和实名认证流程的引入,同时对现有API进行扩展以支持新的功能需求。master
parent
40d7e928cc
commit
70eb109eb6
|
@ -31,6 +31,16 @@ export function userRecharge(data) {
|
|||
}
|
||||
|
||||
|
||||
|
||||
// 调用第三方实名认证
|
||||
export function checkRealNameAuth(data) {
|
||||
return request({
|
||||
url: '/system/aliyun/pay/doPost',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 充值用户余额记录
|
||||
export function createRechargeRecord(data) {
|
||||
return request({
|
||||
|
|
|
@ -4,6 +4,25 @@
|
|||
<h1>用户余额</h1>
|
||||
<p>余额:{{ userBalanceData.userBalance || '加载中...' }}</p>
|
||||
<el-button type="primary" @click="navigateToRecharge">充值</el-button>
|
||||
<el-dialog
|
||||
title="实名认证"
|
||||
:visible.sync="dialogVisible"
|
||||
width="30%"
|
||||
@close="handleDialogClose"
|
||||
>
|
||||
<el-form :model="authForm">
|
||||
<el-form-item label="姓名" :label-width="formLabelWidth">
|
||||
<el-input v-model="authForm.name"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="身份证号" :label-width="formLabelWidth">
|
||||
<el-input v-model="authForm.idCard"></el-input>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button @click="handleCancel">取消</el-button>
|
||||
<el-button type="primary" @click="handleConfirm">确认</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</el-card>
|
||||
|
||||
|
||||
|
@ -46,17 +65,23 @@
|
|||
<script>
|
||||
import { userBalance } from "@/api/system/user"; //
|
||||
import * as echarts from 'echarts' //引用echarts
|
||||
import {checkRealNameAuth} from "@/api/system/user";
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
charts: "",
|
||||
dialogVisible: false,
|
||||
dialogFormVisible: false,
|
||||
formLabelWidth: '120px',
|
||||
opinionData: ["155", "400", "900", "800", "300", "900", "270","684","165","0","300","150"], // 数据
|
||||
userBalanceData: {
|
||||
userBalance: '加载中...'
|
||||
},
|
||||
authForm: {
|
||||
name: '',
|
||||
idCard: ''
|
||||
},
|
||||
form:{
|
||||
|
||||
}
|
||||
|
@ -69,8 +94,43 @@ export default {
|
|||
this.drawLine();
|
||||
},
|
||||
methods: {
|
||||
navigateToRecharge() {
|
||||
handleCancel() {
|
||||
this.dialogVisible = false;
|
||||
},
|
||||
handleDialogClose() {
|
||||
this.authForm.name = '';
|
||||
this.authForm.idCard = '';
|
||||
},
|
||||
async navigateToRecharge() {
|
||||
try {
|
||||
const response = await checkRealNameAuth(this.authForm);
|
||||
if (response.data && response.data.isAuthenticated) {
|
||||
// 如果已实名认证,直接跳转页面
|
||||
this.$router.push('/money/zfb');
|
||||
} else {
|
||||
// 如果未实名认证,显示对话框
|
||||
this.dialogVisible = true;
|
||||
}
|
||||
} catch (error) {
|
||||
this.$message.error('实名认证检查失败,请稍后再试');
|
||||
console.error('实名认证检查失败:', error);
|
||||
}
|
||||
},
|
||||
async handleConfirm() {
|
||||
try {
|
||||
const { name, idCard } = this.authForm;
|
||||
const authResponse = await checkRealNameAuth(this.authForm);
|
||||
if (authResponse.code ==200 ) {
|
||||
this.$message.success('实名认证成功');
|
||||
this.dialogVisible = false;
|
||||
this.$router.push('/money/zfb');
|
||||
} else {
|
||||
this.$message.error('实名认证失败,请检查您的信息');
|
||||
}
|
||||
} catch (error) {
|
||||
this.$message.error('实名认证验证失败,请稍后再试');
|
||||
console.error('实名认证验证失败:', error);
|
||||
}
|
||||
},
|
||||
async fetchUserBalance() {
|
||||
try {
|
||||
|
|
|
@ -16,15 +16,16 @@
|
|||
<el-card style="margin-top: 50px;">
|
||||
<h3>接口列表</h3>
|
||||
<el-divider></el-divider>
|
||||
<el-table :data="tableData">
|
||||
<el-table-column label="">
|
||||
<template slot-scope="scope">
|
||||
<span style="margin-left: 10px">{{ scope.row.connectorName }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<!-- <el-table :data="tableData">-->
|
||||
<!-- <el-table-column label="">-->
|
||||
<!-- <template slot-scope="scope">-->
|
||||
<!-- <span style="margin-left: 10px">{{ scope.row.connectorName }}</span>-->
|
||||
<!-- </template>-->
|
||||
<!-- </el-table-column>-->
|
||||
<!-- </el-table>-->
|
||||
</el-card>
|
||||
</div>
|
||||
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
|
Loading…
Reference in New Issue