wupengfei
6 小时以前 3a6f47aae0ca4566a7f39c98c30bcc5545dd1216
feat: 实名
7个文件已修改
631 ■■■■■ 已修改文件
apps/cMiniApp/src/subpackages/authentication/authenticationRealName/InnerPage.vue 26 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
packages/constants/apiEnum.ts 34 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
packages/hooks/identify.ts 41 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
packages/services/apiV2/electronSign.ts 99 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
packages/services/apiV2/index.ts 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
packages/services/apiV2/ocrUtils.ts 43 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
packages/services/apiV2/typings.d.ts 384 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
apps/cMiniApp/src/subpackages/authentication/authenticationRealName/InnerPage.vue
@@ -10,6 +10,7 @@
              :limitFileSize="10"
              class="bole-uploader nopaddingtop"
              @my-success="handleFrontImgUrlChange"
              @delete="handleFrontImgUrlDelete"
            >
              <template #upload-icon>
                <div class="photograph-wrapper">
@@ -99,6 +100,8 @@
import { FormRules } from '@nutui/nutui-taro/dist/types/__VUE/form/types';
import { FormValidator } from '@12333/utils';
import Taro from '@tarojs/taro';
import { userCredentialVerifyOcrIDCard } from '@12333/hooks';
import { EnumOcrAccess } from '@12333/constants';
defineOptions({
  name: 'InnerPage',
@@ -150,16 +153,18 @@
}
function handleFrontImgUrlChange(response: FileItem) {
  // userCredentialVerifyOcrIDCard(response, {
  //   onSuccess(res) {
  //     if (res.realName) form.legalPersonName = res.realName;
  //     if (res.idcardNum) form.legalPersonIdNumber = res.idcardNum;
  //   },
  // });
  userCredentialVerifyOcrIDCard({
    response: response,
    access: EnumOcrAccess.Baidu,
    isOssUrl: true,
    onSuccess(res) {
      if (res.model?.name) form.name = res.model?.name;
      if (res.model?.identity) form.identity = res.model?.identity;
    },
  });
}
function handleSubmit() {
  console.log('type: ', type);
  if (!formRef.value) return;
  formRef.value.validate().then(({ valid, errors }: any) => {
    if (valid) {
@@ -209,6 +214,13 @@
    }
  } catch (error) {}
}
function handleFrontImgUrlDelete({ files, fileList, index }) {
  if (fileList?.length === 0) {
    form.name = '';
    form.identity = '';
  }
}
</script>
<style lang="scss">
packages/constants/apiEnum.ts
@@ -21,6 +21,32 @@
  Wxmp = 20,
}
/** 合同制版状态 */
export enum EnumContractTemplateStatus {
  /**待制版 */
  Wait = 10,
  /**已完成 */
  Completed = 20,
}
/** 合同模板变量 */
export enum EnumContractTemplateValueRecorder {
  /**发件人 */
  Creator = 10,
  /**签署人 */
  Signer = 20,
}
/** 合同模板变量类型 */
export enum EnumContractTemplateValueType {
  /**文本 */
  Text = 10,
  /**签署 */
  Sign = 20,
  /**日期 */
  Date = 30,
}
/** 数据来源 */
export enum EnumDataSource {
  /**818 */
@@ -37,6 +63,14 @@
  Deleted = 30,
}
/** 电子签 */
export enum EnumElectronSignAccess {
  /**上上签 */
  BestSign = 10,
  /**支付宝信任签 */
  AlipaySign = 20,
}
/** 企业实名方式 */
export enum EnumEnterpriseRealMethod {
  /**企业三要素 */
packages/hooks/identify.ts
@@ -1,4 +1,6 @@
import { EnumOcrAccess } from '@12333/constants';
import * as accountServices from '@12333/services/api/Account';
import * as ocrUtilsServices from '@12333/services/apiV2/ocrUtils';
import { FileItem } from '@nutui/nutui-taro/dist/types/__VUE/uploader/type';
import _ from 'lodash';
@@ -23,21 +25,26 @@
  } catch (error) {}
}
// type UserCredentialVerifyOcrIDCardOptions = {
//   onSuccess?: (res: API.UserCredentialVerifyOcrIDCardResponse) => any;
// };
type UserCredentialVerifyOcrIDCardOptions = {
  access?: EnumOcrAccess;
  scene?: string;
  isOssUrl?: boolean;
  response?: FileItem;
  onSuccess?: (res: API.GetIdentityFrontOcrCommandResult) => any;
};
// export async function userCredentialVerifyOcrIDCard(
//   response: FileItem,
//   options: UserCredentialVerifyOcrIDCardOptions = {}
// ) {
//   try {
//     if (response?.url) {
//       const { onSuccess } = options;
//       let res = await commonServices.userCredentialVerifyOcrIDCard({
//         identityImageUrl: response.url,
//       });
//       onSuccess?.(res);
//     }
//   } catch (error) {}
// }
export async function userCredentialVerifyOcrIDCard(
  options: UserCredentialVerifyOcrIDCardOptions = {}
) {
  try {
    const { onSuccess, access, isOssUrl, response, scene } = options;
    if (response?.path) {
      let res = await ocrUtilsServices.getIdentityFrontOcr({
        access: access,
        url: response.path,
        isOssUrl: isOssUrl,
      });
      onSuccess?.(res);
    }
  } catch (error) {}
}
packages/services/apiV2/electronSign.ts
@@ -17,6 +17,75 @@
  });
}
/** 查询合同模板详情 GET /api/user/electronSign/getContractTemplate */
export async function getContractTemplate(
  // 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
  params: API.APIgetContractTemplateParams,
  options?: API.RequestConfig
) {
  return request<API.GetContractTemplateQueryResult>('/api/user/electronSign/getContractTemplate', {
    method: 'GET',
    params: {
      ...params,
    },
    ...(options || {}),
  });
}
/** 查询运营端协议管理分页列表数据 POST /api/user/electronSign/getContractTemplateEnterprises */
export async function getContractTemplateEnterprises(
  body: API.GetContractTemplateEnterprisesQuery,
  options?: API.RequestConfig
) {
  return request<API.GetContractTemplateEnterprisesQueryResult>(
    '/api/user/electronSign/getContractTemplateEnterprises',
    {
      method: 'POST',
      headers: {
        'Content-Type': 'application/json-patch+json',
      },
      data: body,
      ...(options || {}),
    }
  );
}
/** 查询企业合同模板日志分页列表数据 POST /api/user/electronSign/getEnterpriseContractTemplateLogs */
export async function getEnterpriseContractTemplateLogs(
  body: API.GetEnterpriseContractTemplateLogsQuery,
  options?: API.RequestConfig
) {
  return request<API.GetEnterpriseContractTemplateLogsQueryResult>(
    '/api/user/electronSign/getEnterpriseContractTemplateLogs',
    {
      method: 'POST',
      headers: {
        'Content-Type': 'application/json-patch+json',
      },
      data: body,
      ...(options || {}),
    }
  );
}
/** 查询企业合同模板分页列表数据 POST /api/user/electronSign/getEnterpriseContractTemplates */
export async function getEnterpriseContractTemplates(
  body: API.GetEnterpriseContractTemplatesQuery,
  options?: API.RequestConfig
) {
  return request<API.GetEnterpriseContractTemplatesQueryResult>(
    '/api/user/electronSign/getEnterpriseContractTemplates',
    {
      method: 'POST',
      headers: {
        'Content-Type': 'application/json-patch+json',
      },
      data: body,
      ...(options || {}),
    }
  );
}
/** 个人人脸实名认证 POST /api/user/electronSign/personalUserFaceReal */
export async function personalUserFaceReal(
  body: API.PersonalUserFaceRealCommand,
@@ -47,6 +116,21 @@
  });
}
/** 保存合同模板 POST /api/user/electronSign/saveContractTemplate */
export async function saveContractTemplate(
  body: API.SaveContractTemplateCommand,
  options?: API.RequestConfig
) {
  return request<string>('/api/user/electronSign/saveContractTemplate', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json-patch+json',
    },
    data: body,
    ...(options || {}),
  });
}
/** 发送个人三要素实名短信 POST /api/user/electronSign/sendPersonalUserIdentity3RealSms */
export async function sendPersonalUserIdentity3RealSms(
  body: API.SendPersonalUserIdentity3RealSmsCommand,
@@ -61,3 +145,18 @@
    ...(options || {}),
  });
}
/** 禁用合同模板 PUT /api/user/electronSign/setIsDisabledContractTemplate */
export async function setIsDisabledContractTemplate(
  body: API.SetIsDisabledContractTemplateCommand,
  options?: API.RequestConfig
) {
  return request<number>('/api/user/electronSign/setIsDisabledContractTemplate', {
    method: 'PUT',
    headers: {
      'Content-Type': 'application/json-patch+json',
    },
    data: body,
    ...(options || {}),
  });
}
packages/services/apiV2/index.ts
@@ -8,13 +8,13 @@
import * as enterprise from './enterprise';
import * as resource from './resource';
import * as task from './task';
import * as ocrUtils from './ocrUtils';
import * as dictionary from './dictionary';
import * as userResume from './userResume';
import * as auth from './auth';
import * as taskCheckReceive from './taskCheckReceive';
import * as electronSign from './electronSign';
import * as taskUser from './taskUser';
import * as ocrUtils from './ocrUtils';
import * as menu from './menu';
import * as logRecords from './logRecords';
import * as fileUtils from './fileUtils';
@@ -25,13 +25,13 @@
  enterprise,
  resource,
  task,
  ocrUtils,
  dictionary,
  userResume,
  auth,
  taskCheckReceive,
  electronSign,
  taskUser,
  ocrUtils,
  menu,
  logRecords,
  fileUtils,
packages/services/apiV2/ocrUtils.ts
@@ -2,17 +2,44 @@
// @ts-ignore
import { request } from '@/utils/request';
/** 文字识别营业执照 GET /api/common/ocrUtils/getLicenseOcr */
export async function getLicenseOcr(
  // 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
  params: API.APIgetLicenseOcrParams,
/** 文字识别身份证背面 POST /api/common/ocrUtils/getIdentityBackOcr */
export async function getIdentityBackOcr(
  body: API.GetIdentityBackOcrCommand,
  options?: API.RequestConfig
) {
  return request<API.GetLicenseOcrCommandResult>('/api/common/ocrUtils/getLicenseOcr', {
    method: 'GET',
    params: {
      ...params,
  return request<API.GetIdentityBackOcrCommandResult>('/api/common/ocrUtils/getIdentityBackOcr', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json-patch+json',
    },
    data: body,
    ...(options || {}),
  });
}
/** 文字识别身份证正面 POST /api/common/ocrUtils/getIdentityFrontOcr */
export async function getIdentityFrontOcr(
  body: API.GetIdentityFrontOcrCommand,
  options?: API.RequestConfig
) {
  return request<API.GetIdentityFrontOcrCommandResult>('/api/common/ocrUtils/getIdentityFrontOcr', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json-patch+json',
    },
    data: body,
    ...(options || {}),
  });
}
/** 文字识别营业执照 POST /api/common/ocrUtils/getLicenseOcr */
export async function getLicenseOcr(body: API.GetLicenseOcrCommand, options?: API.RequestConfig) {
  return request<API.GetLicenseOcrCommandResult>('/api/common/ocrUtils/getLicenseOcr', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json-patch+json',
    },
    data: body,
    ...(options || {}),
  });
}
packages/services/apiV2/typings.d.ts
@@ -29,6 +29,11 @@
    date?: string;
  }
  interface APIgetContractTemplateParams {
    /** 模板Id */
    id?: string;
  }
  interface APIgetCurrentLogierMenuParams {
    /** Id */
    id?: string;
@@ -91,17 +96,6 @@
  interface APIgetFileUrlParams {
    /** 地址 */
    url?: string;
  }
  interface APIgetLicenseOcrParams {
    /** 通道 */
    access?: EnumOcrAccess;
    /** 场景 */
    scene?: string;
    /** 链接地址 */
    url?: string;
    /** 是否为云存储相对地址 */
    isOssUrl?: boolean;
  }
  interface APIgetMenuParams {
@@ -239,6 +233,28 @@
    mainBusiness?: string;
  }
  interface BaiduOcrIdentityBackResultModel {
    /** 失效日期 */
    expiryDate?: string;
    /** 签发机关 */
    issueAuthority?: string;
    /** 签发日期 */
    issueDate?: string;
  }
  interface BaiduOcrIdentityFrontResultModel {
    name?: string;
    /** 身份证号 */
    identity?: string;
    gender?: EnumUserGender;
    /** 生日 */
    birthday?: string;
    /** 民族 */
    nation?: string;
    /** 住址 */
    address?: string;
  }
  interface BindWxmpUserInfoCommand {
    /** 访问令牌 */
    accessToken: string;
@@ -359,6 +375,29 @@
    Wxmp = 20,
  }
  enum EnumContractTemplateStatus {
    /**待制版 */
    Wait = 10,
    /**已完成 */
    Completed = 20,
  }
  enum EnumContractTemplateValueRecorder {
    /**发件人 */
    Creator = 10,
    /**签署人 */
    Signer = 20,
  }
  enum EnumContractTemplateValueType {
    /**文本 */
    Text = 10,
    /**签署 */
    Sign = 20,
    /**日期 */
    Date = 30,
  }
  enum EnumDataSource {
    /**818 */
    HumanResources = 10,
@@ -371,6 +410,13 @@
    Modified = 20,
    /**删除 */
    Deleted = 30,
  }
  enum EnumElectronSignAccess {
    /**上上签 */
    BestSign = 10,
    /**支付宝信任签 */
    AlipaySign = 20,
  }
  enum EnumEnterpriseRealMethod {
@@ -775,6 +821,42 @@
    timestamp?: number;
  }
  interface FriendlyResultGetContractTemplateEnterprisesQueryResult {
    /** 跟踪Id */
    traceId?: string;
    /** 状态码 */
    code?: number;
    /** 错误码 */
    errorCode?: string;
    data?: GetContractTemplateEnterprisesQueryResult;
    /** 执行成功 */
    success?: boolean;
    /** 错误信息 */
    msg?: any;
    /** 附加数据 */
    extras?: any;
    /** 时间戳 */
    timestamp?: number;
  }
  interface FriendlyResultGetContractTemplateQueryResult {
    /** 跟踪Id */
    traceId?: string;
    /** 状态码 */
    code?: number;
    /** 错误码 */
    errorCode?: string;
    data?: GetContractTemplateQueryResult;
    /** 执行成功 */
    success?: boolean;
    /** 错误信息 */
    msg?: any;
    /** 附加数据 */
    extras?: any;
    /** 时间戳 */
    timestamp?: number;
  }
  interface FriendlyResultGetDbAuditLogsQueryResult {
    /** 跟踪Id */
    traceId?: string;
@@ -783,6 +865,42 @@
    /** 错误码 */
    errorCode?: string;
    data?: GetDbAuditLogsQueryResult;
    /** 执行成功 */
    success?: boolean;
    /** 错误信息 */
    msg?: any;
    /** 附加数据 */
    extras?: any;
    /** 时间戳 */
    timestamp?: number;
  }
  interface FriendlyResultGetEnterpriseContractTemplateLogsQueryResult {
    /** 跟踪Id */
    traceId?: string;
    /** 状态码 */
    code?: number;
    /** 错误码 */
    errorCode?: string;
    data?: GetEnterpriseContractTemplateLogsQueryResult;
    /** 执行成功 */
    success?: boolean;
    /** 错误信息 */
    msg?: any;
    /** 附加数据 */
    extras?: any;
    /** 时间戳 */
    timestamp?: number;
  }
  interface FriendlyResultGetEnterpriseContractTemplatesQueryResult {
    /** 跟踪Id */
    traceId?: string;
    /** 状态码 */
    code?: number;
    /** 错误码 */
    errorCode?: string;
    data?: GetEnterpriseContractTemplatesQueryResult;
    /** 执行成功 */
    success?: boolean;
    /** 错误信息 */
@@ -909,6 +1027,42 @@
    /** 错误码 */
    errorCode?: string;
    data?: GetExceptionLogsQueryResult;
    /** 执行成功 */
    success?: boolean;
    /** 错误信息 */
    msg?: any;
    /** 附加数据 */
    extras?: any;
    /** 时间戳 */
    timestamp?: number;
  }
  interface FriendlyResultGetIdentityBackOcrCommandResult {
    /** 跟踪Id */
    traceId?: string;
    /** 状态码 */
    code?: number;
    /** 错误码 */
    errorCode?: string;
    data?: GetIdentityBackOcrCommandResult;
    /** 执行成功 */
    success?: boolean;
    /** 错误信息 */
    msg?: any;
    /** 附加数据 */
    extras?: any;
    /** 时间戳 */
    timestamp?: number;
  }
  interface FriendlyResultGetIdentityFrontOcrCommandResult {
    /** 跟踪Id */
    traceId?: string;
    /** 状态码 */
    code?: number;
    /** 错误码 */
    errorCode?: string;
    data?: GetIdentityFrontOcrCommandResult;
    /** 执行成功 */
    success?: boolean;
    /** 错误信息 */
@@ -1959,6 +2113,66 @@
    addressName?: string;
  }
  interface GetContractTemplateEnterprisesQuery {
    /** 关键字 */
    keywords?: string;
    status?: EnumContractTemplateStatus;
    pageModel?: PagedListQueryPageModel;
  }
  interface GetContractTemplateEnterprisesQueryResult {
    pageModel?: PagedListQueryResultPageModel;
    /** 数据 */
    data?: GetContractTemplateEnterprisesQueryResultItem[];
  }
  interface GetContractTemplateEnterprisesQueryResultItem {
    /** 企业Id */
    id?: string;
    /** 企业全称 */
    enterpriseName?: string;
    /** 联系人 */
    contacts?: string;
    /** 联系电话 */
    contactPhoneNumber?: string;
    /** 合同数 */
    total?: number;
    /** 待制版 */
    waitCount?: number;
  }
  interface GetContractTemplateQueryResult {
    /** 模板Id */
    id?: string;
    /** 企业Id */
    enterpriseId?: string;
    /** 模板名称 */
    name?: string;
    /** 模板 */
    file?: string;
    /** 业务编码 */
    code?: string;
    access?: EnumElectronSignAccess;
    /** 模板Id */
    templateId?: string;
    /** 变量 */
    values?: GetContractTemplateQueryResultValue[];
  }
  interface GetContractTemplateQueryResultValue {
    /** 变量Id */
    id?: string;
    type?: EnumContractTemplateValueType;
    recorder?: EnumContractTemplateValueRecorder;
    userType?: EnumUserType;
    /** 变量名称 */
    label?: string;
    /** 变量代码 */
    name?: string;
    /** 是否必填 */
    required?: boolean;
  }
  type GetCurrentLogierMenusQuery = Record<string, any>;
  interface GetDbAuditLogsQuery {
@@ -2102,6 +2316,74 @@
    sort?: number;
    /** 是否禁用 */
    isDisabled?: boolean;
  }
  interface GetEnterpriseContractTemplateLogsQuery {
    /** 模板Id */
    id?: string;
    pageModel?: PagedListQueryPageModel;
  }
  interface GetEnterpriseContractTemplateLogsQueryResult {
    pageModel?: PagedListQueryResultPageModel;
    /** 数据 */
    data?: GetEnterpriseContractTemplateLogsQueryResultItem[];
  }
  interface GetEnterpriseContractTemplateLogsQueryResultItem {
    /** 跟踪Id */
    traceId?: string;
    /** 操作人 */
    createdUser?: string;
    /** 操作时间 */
    createdTime?: string;
    operate?: EnumDbAuditOperate;
    /** 操作内容 */
    content?: string[];
  }
  interface GetEnterpriseContractTemplatesQuery {
    /** 企业Id */
    enterpriseId?: string;
    /** 关键字 */
    keywords?: string;
    status?: EnumContractTemplateStatus;
    /** 客户上传时间-起始 */
    createdTimeBegin?: string;
    /** 客户上传时间-截止 */
    createdTimeEnd?: string;
    /** 制版时间-起始 */
    completedTimeBegin?: string;
    /** 制版时间-截止 */
    completedTimeEnd?: string;
    pageModel?: PagedListQueryPageModel;
  }
  interface GetEnterpriseContractTemplatesQueryResult {
    pageModel?: PagedListQueryResultPageModel;
    /** 数据 */
    data?: GetEnterpriseContractTemplatesQueryResultItem[];
  }
  interface GetEnterpriseContractTemplatesQueryResultItem {
    /** 模板Id */
    id?: string;
    /** 模板名称 */
    name?: string;
    /** 客户上传时间 */
    createdTime?: string;
    /** 模板Id */
    templateId?: string;
    access?: EnumElectronSignAccess;
    /** 业务编码 */
    code?: string;
    /** 模板 */
    file?: string;
    status?: EnumContractTemplateStatus;
    /** 制版时间 */
    completedTime?: string;
    /** 操作人 */
    operator?: string;
  }
  interface GetEnterpriseElectronSignSettingQueryResult {
@@ -2345,6 +2627,48 @@
    createdUser?: GetResourceLogsQueryResultItemCreatedUser;
    /** 创建时间 */
    createdTime?: string;
  }
  interface GetIdentityBackOcrCommand {
    access?: EnumOcrAccess;
    /** 场景 */
    scene?: string;
    /** 链接地址 */
    url?: string;
    /** 是否为云存储相对地址 */
    isOssUrl?: boolean;
  }
  interface GetIdentityBackOcrCommandResult {
    /** 地址 */
    url?: string;
    model?: BaiduOcrIdentityBackResultModel;
  }
  interface GetIdentityFrontOcrCommand {
    access?: EnumOcrAccess;
    /** 场景 */
    scene?: string;
    /** 链接地址 */
    url?: string;
    /** 是否为云存储相对地址 */
    isOssUrl?: boolean;
  }
  interface GetIdentityFrontOcrCommandResult {
    /** 地址 */
    url?: string;
    model?: BaiduOcrIdentityFrontResultModel;
  }
  interface GetLicenseOcrCommand {
    access?: EnumOcrAccess;
    /** 场景 */
    scene?: string;
    /** 链接地址 */
    url?: string;
    /** 是否为云存储相对地址 */
    isOssUrl?: boolean;
  }
  interface GetLicenseOcrCommandResult {
@@ -3608,6 +3932,38 @@
    id?: string;
  }
  interface SaveContractTemplateCommand {
    /** 企业Id(运营端保存时) */
    enterpriseId?: string;
    /** 模板名称 */
    name: string;
    /** 模板 */
    file: string;
    /** 业务编码 */
    code?: string;
    access?: EnumElectronSignAccess;
    /** 模板Id */
    templateId?: string;
    /** 变量 */
    values?: SaveContractTemplateCommandValue[];
    /** Id */
    id?: string;
  }
  interface SaveContractTemplateCommandValue {
    /** Id */
    id?: string;
    type?: EnumContractTemplateValueType;
    recorder?: EnumContractTemplateValueRecorder;
    userType?: EnumUserType;
    /** 变量名称 */
    label?: string;
    /** 变量代码 */
    name?: string;
    /** 是否必填 */
    required?: boolean;
  }
  interface SaveDictionaryCategoryCommand {
    /** 编号 */
    code: string;
@@ -3975,6 +4331,12 @@
    smsCost?: number;
  }
  interface SetIsDisabledContractTemplateCommand {
    ids?: string[];
    /** 是否已禁用 */
    isDisabled?: boolean;
  }
  interface SetMenuSwitchCommand {
    /** Id */
    ids?: string[];