import { loadImg } from './util' import { parseTime } from './index' export async function card(QRCode: string) { const scale = 2; const bg = await loadImg('https://chrivc.obs.cn-north-4.myhuaweicloud.com/cab0fd6a9335480bbc882968f5a356f4:组 1 拷贝 6.png') return { width: `${429 * scale}rpx`, height: `${546 * scale}rpx`, views: [ // 背景 { type: 'image', url: bg.path, css: { width: `${429 * scale}rpx`, height: `${546 * scale}rpx`, left: '0rpx', top: '0rpx' } }, // logo // { // type: 'image', // url: '/assets/images/logo.png', // css: { // width: `${42 * scale}rpx`, // height: `${43 * scale}rpx`, // top: `${70 * scale}rpx`, // left: `${82 * scale}rpx`, // } // }, // { // type: 'text', // text: '溯源优才', // css: { // color: '#3A61B1', // fontSize: `${48 * scale}rpx`, // fontWeight: 'bold', // top: `${59 * scale}rpx`, // left: `${142 * scale}rpx`, // } // }, // { // type: 'text', // text: '全国人力资源信息数据验证平台', // css: { // color: '#3A61B1', // fontSize: `${23 * scale}rpx`, // fontWeight: 400, // top: `${128 * scale}rpx`, // left: `${61 * scale}rpx`, // } // }, { type: 'rect', css: { top: `${187 * scale}rpx`, left: `${71 * scale}rpx`, width: `${293 * scale}rpx`, height: `${293 * scale}rpx`, borderRadius: `${10 * scale}rpx`, color: "#FFFFFF" }, }, // 二维码 { type: 'image', url: QRCode, css: { width: `${253 * scale}rpx`, height: `${253 * scale}rpx`, top: `${207 * scale}rpx`, left: `${91 * scale}rpx`, } } ] } } export async function certifivate(QRCode: string, certificateInfo = {}, noIdcard: boolean) { const scale = 3; const bg = await loadImg('https://chrivc.obs.cn-north-4.myhuaweicloud.com/a1a71dad25764d2fb8dad47a27d49b30:电子证书@2x.png') return { width: `${690 * scale}rpx`, height: `${985 * scale}rpx`, views: noIdcard ? [ // 背景 { type: 'image', url: bg.path, css: { width: `${690 * scale}rpx`, height: `${985 * scale}rpx`, left: '0rpx', top: '0rpx' } }, // { // type: 'text', // text: '溯源优才人才证书', // css: { // color: '#393939', // fontSize: `${48 * scale}rpx`, // fontWeight: 'bold', // top: `${233 * scale}rpx`, // left: `${145 * scale}rpx`, // } // }, { type: 'text', text: `姓名:${certificateInfo.username}`, css: { color: '#6E6E6E', fontSize: `${19 * scale}rpx`, fontWeight: 400, top: `${355 * scale}rpx`, left: `${114 * scale}rpx`, } }, // { // type: 'text', // text: `身份证号:${certificateInfo.idCard}`, // css: { // color: '#6E6E6E', // fontSize: `${19 * scale}rpx`, // fontWeight: 400, // top: `${358 * scale}rpx`, // left: `${114 * scale}rpx`, // } // }, { type: 'text', text: `该人才数据档案由溯源优才-全国人力资源信息数据验证平台全程溯源和验证,由${certificateInfo.username}本人发起数据档案数据报告申请。凭证书可在官方指定平台查询其数据档案数据报告。本证书的最终解释权归发证机构所有。`, css: { color: '#393939', fontSize: `${19 * scale}rpx`, fontWeight: 500, lineHeight: `${34 * scale}rpx`, width: `${472 * scale}rpx`, // textAlign: 'center', top: `${434 * scale}rpx`, left: `${112 * scale}rpx`, } }, { type: 'text', text: `发证日期:${parseTime(certificateInfo.createDate, '{y}年{m}月{d}日')}`, css: { color: '#6E6E6E', fontSize: `${15 * scale}rpx`, fontWeight: 400, lineHeight: `${28 * scale}rpx`, width: `${472 * scale}rpx`, // textAlign: 'center', top: `${583 * scale}rpx`, left: `${112 * scale}rpx`, } }, { type: 'text', text: `有效期至:${certificateInfo.endDate ? parseTime(certificateInfo.endDate, '{y}年{m}月{d}日') : '不限时间'}`, css: { color: '#6E6E6E', fontSize: `${15 * scale}rpx`, fontWeight: 400, lineHeight: `${28 * scale}rpx`, width: `${472 * scale}rpx`, textAlign: 'right', top: `${583 * scale}rpx`, left: `${112 * scale}rpx`, } }, { type: 'text', text: `区块链存证信息:\n${certificateInfo.blockchain}`, css: { color: '#6E6E6E', fontSize: `${15 * scale}rpx`, fontWeight: 400, lineHeight: `${28 * scale}rpx`, width: `${400 * scale}rpx`, // textAlign: 'center', top: `${615 * scale}rpx`, left: `${112 * scale}rpx`, } }, // 二维码 { type: 'image', url: QRCode, css: { width: `${150 * scale}rpx`, height: `${150 * scale}rpx`, top: `${725 * scale}rpx`, left: `${116 * scale}rpx`, } }, { type: 'text', text: '请扫描二维码\n查验个人信息报告', css: { color: '#6E6E6E', fontSize: `${13 * scale}rpx`, fontWeight: 400, lineHeight: `${20 * scale}rpx`, width: `${112 * scale}rpx`, top: `${858 * scale}rpx`, left: `${278 * scale}rpx`, } }, // 章 { type: 'image', url: '/assets/images/reportPreview/icon_zhang.png', css: { width: `${172 * scale}rpx`, height: `${172 * scale}rpx`, top: `${723 * scale}rpx`, left: `${416 * scale}rpx`, } }, ] : [ // 背景 { type: 'image', url: bg.path, css: { width: `${690 * scale}rpx`, height: `${985 * scale}rpx`, left: '0rpx', top: '0rpx' } }, // { // type: 'text', // text: '溯源优才人才证书', // css: { // color: '#393939', // fontSize: `${48 * scale}rpx`, // fontWeight: 'bold', // top: `${233 * scale}rpx`, // left: `${145 * scale}rpx`, // } // }, { type: 'text', text: `姓名:${certificateInfo.username}`, css: { color: '#6E6E6E', fontSize: `${19 * scale}rpx`, fontWeight: 400, top: `${355 * scale}rpx`, left: `${114 * scale}rpx`, } }, { type: 'text', text: `身份证号:${certificateInfo.idCard}`, css: { color: '#6E6E6E', fontSize: `${19 * scale}rpx`, fontWeight: 400, top: `${388 * scale}rpx`, left: `${114 * scale}rpx`, } }, { type: 'text', text: `该人才数据档案由溯源优才-全国人力资源信息数据验证平台全程溯源和验证,由${certificateInfo.username}本人发起数据档案数据报告申请。凭证书可在官方指定平台查询其数据档案数据报告。本证书的最终解释权归发证机构所有。`, css: { color: '#393939', fontSize: `${19 * scale}rpx`, fontWeight: 500, lineHeight: `${34 * scale}rpx`, width: `${472 * scale}rpx`, // textAlign: 'center', top: `${433 * scale}rpx`, left: `${112 * scale}rpx`, } }, { type: 'text', text: `发证日期:${parseTime(certificateInfo.createDate, '{y}年{m}月{d}日')}`, css: { color: '#6E6E6E', fontSize: `${15 * scale}rpx`, fontWeight: 400, lineHeight: `${28 * scale}rpx`, width: `${472 * scale}rpx`, // textAlign: 'center', top: `${583 * scale}rpx`, left: `${112 * scale}rpx`, } }, { type: 'text', text: `有效期至:${certificateInfo.endDate ? parseTime(certificateInfo.endDate, '{y}年{m}月{d}日') : '不限时间'}`, css: { color: '#6E6E6E', fontSize: `${15 * scale}rpx`, fontWeight: 400, lineHeight: `${28 * scale}rpx`, width: `${472 * scale}rpx`, textAlign: 'right', top: `${583 * scale}rpx`, left: `${112 * scale}rpx`, } }, { type: 'text', text: `区块链存证信息:\n${certificateInfo.blockchain}`, css: { color: '#6E6E6E', fontSize: `${15 * scale}rpx`, fontWeight: 400, lineHeight: `${28 * scale}rpx`, width: `${400 * scale}rpx`, // textAlign: 'center', top: `${615 * scale}rpx`, left: `${112 * scale}rpx`, } }, // 二维码 { type: 'image', url: QRCode, css: { width: `${150 * scale}rpx`, height: `${150 * scale}rpx`, top: `${745 * scale}rpx`, left: `${116 * scale}rpx`, } }, { type: 'text', text: '请扫描二维码\n查验个人信息报告', css: { color: '#6E6E6E', fontSize: `${13 * scale}rpx`, fontWeight: 400, lineHeight: `${20 * scale}rpx`, width: `${112 * scale}rpx`, top: `${858 * scale}rpx`, left: `${278 * scale}rpx`, } }, // 章 { type: 'image', url: '/assets/images/reportPreview/icon_zhang.png', css: { width: `${172 * scale}rpx`, height: `${172 * scale}rpx`, top: `${723 * scale}rpx`, left: `${416 * scale}rpx`, } }, ] } }