import { loadImg } from './util' import { parseTime } from './index' export async function card() { const scale = 2; const bg = await loadImg('https://chrivc.obs.cn-north-4.myhuaweicloud.com/09f36e4cf9474682b194f3c0694d239d:card_bg.png') const tags = [{ type: 'text', text: '特别靠谱', css: { width: `${124 * scale}rpx`, height: `${34.86 * scale}rpx`, display: 'inline-block', textAlign: 'center', padding: `${11 * scale}rpx 0 ${11 * scale}rpx 0`, background: '#2235B6', borderRadius: `${22 * scale}rpx`, color: '#ffffff', fontSize: `${22 * scale}rpx`, // fontWeight: 'bold', top: `${150 * scale}rpx`, left: `${391 * scale}rpx`, } }, { type: 'text', text: '才华横溢', css: { width: `${124 * scale}rpx`, height: `${43 * scale}rpx`, textAlign: 'center', padding: `${11 * scale}rpx`, boxSizing: 'border-box', background: '#2235B6', borderRadius: `${22 * scale}rpx`, color: '#ffffff', fontSize: `${22 * scale}rpx`, top: `${150 * scale}rpx`, left: `${559 * scale}rpx`, } }] const tagNums = [{ type: 'text', text: 'x50', css: { width: `${36 * scale}rpx`, height: `${19 * scale}rpx`, textAlign: 'center', padding: `${4 * scale}rpx ${6 * scale}rpx ${5 * scale}rpx ${3 * scale}rpx`, fontWeight: 'bold', fontStyle: 'italic', background: '#FF662A', borderRadius: `${9 * scale}rpx ${8 * scale}rpx ${8 * scale}rpx ${4 * scale}rpx`, color: '#ffffff', fontSize: `${14 * scale}rpx`, top: `${145 * scale}rpx`, left: `${508 * scale}rpx`, } }, { type: 'text', text: 'x99', css: { textAlign: 'center', padding: `${4 * scale}rpx ${6 * scale}rpx ${5 * scale}rpx ${3 * scale}rpx`, fontWeight: 'bold', fontStyle: 'italic', background: '#FF662A', boxSizing: 'border-box', borderRadius: `${9 * scale}rpx ${8 * scale}rpx ${8 * scale}rpx ${4 * scale}rpx`, color: '#ffffff', fontSize: `${14 * scale}rpx`, top: `${145 * scale}rpx`, left: `${665 * scale}rpx`, } }, ] return { width: `${719 * scale}rpx`, height: `${382 * scale}rpx`, views: [ // 背景 { type: 'image', url: bg.path, css: { width: `${719 * scale}rpx`, height: `${382 * 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: '#ffffff', fontSize: `${48 * scale}rpx`, fontWeight: 'bold', top: `${59 * scale}rpx`, left: `${60 * scale}rpx`, } }, { type: 'text', text: '4.5', css: { color: '#ffffff', fontSize: `${78 * scale}rpx`, fontWeight: 'bold', top: `${56 * scale}rpx`, left: `${509 * scale}rpx`, } }, { type: 'text', text: '分', css: { color: '#ffffff', fontSize: `${48 * scale}rpx`, fontWeight: 'bold', top: `${78 * scale}rpx`, left: `${632 * scale}rpx`, } }, ...tags, ...tagNums, // { // type: 'text', // text: '特别靠谱', // css: { // width: `${124 * scale}rpx`, // height: `${34.86 * scale}rpx`, // display: 'inline-block', // textAlign: 'center', // padding: `${11 * scale}rpx 0 ${11 * scale}rpx 0`, // background: '#2235B6', // borderRadius: `${22 * scale}rpx`, // color: '#ffffff', // fontSize: `${22 * scale}rpx`, // // fontWeight: 'bold', // top: `${150 * scale}rpx`, // left: `${391 * scale}rpx`, // } // }, // { // type: 'text', // text: 'x50', // css: { // width: `${36 * scale}rpx`, // height: `${19 * scale}rpx`, // textAlign: 'center', // padding: `${4 * scale}rpx`, // fontWeight: 'bold', // fontStyle: 'italic', // background: '#FF662A', // borderRadius: `${9 * scale}rpx ${8 * scale}rpx ${8 * scale}rpx ${4 * scale}rpx`, // color: '#ffffff', // fontSize: `${14 * scale}rpx`, // top: `${145 * scale}rpx`, // left: `${504 * scale}rpx`, // } // }, // { // type: 'text', // text: '才华横溢', // css: { // width: `${124 * scale}rpx`, // height: `${43 * scale}rpx`, // textAlign: 'center', // padding: `${11 * scale}rpx`, // boxSizing: 'border-box', // background: '#2235B6', // borderRadius: `${22 * scale}rpx`, // color: '#ffffff', // fontSize: `${22 * scale}rpx`, // top: `${150 * scale}rpx`, // left: `${559 * scale}rpx`, // } // }, // { // type: 'text', // text: 'x99', // css: { // textAlign: 'center', // padding: `${4 * scale}rpx ${6 * scale}rpx ${5 * scale}rpx ${3 * scale}rpx`, // fontWeight: 'bold', // fontStyle: 'italic', // background: '#FF662A', // boxSizing: 'border-box', // borderRadius: `${9 * scale}rpx ${8 * scale}rpx ${8 * scale}rpx ${4 * scale}rpx`, // color: '#ffffff', // fontSize: `${14 * scale}rpx`, // top: `${145 * scale}rpx`, // left: `${665 * scale}rpx`, // } // }, { type: 'text', text: '暂无职位信息', css: { color: '#ffffff', fontSize: `${32 * scale}rpx`, top: `${143 * scale}rpx`, left: `${60 * scale}rpx`, } }, { type: 'text', text: '暂无公司信息', css: { color: '#ffffff', fontSize: `${24 * scale}rpx`, fontWeight: 'bold', top: `${184 * scale}rpx`, left: `${60 * scale}rpx`, } }, { type: 'image', url: '/assets/images/card/icon_phone.png', text: '暂无公司信息', css: { color: '#ffffff', top: `${268 * scale}rpx`, left: `${61 * scale}rpx`, } }, { type: 'text', text: '18702872377', css: { color: '#ffffff', fontSize: `${24 * scale}rpx`, fontWeight: 'bold', top: `${258 * scale}rpx`, left: `${92 * scale}rpx`, } }, { type: 'image', url: '/assets/images/card/icon_email.png', text: '暂无公司信息', css: { color: '#ffffff', // fontSize: `${48 * scale}rpx`, // fontWeight: 'bold', top: `${268 * scale}rpx`, left: `${289 * scale}rpx`, } }, { type: 'text', text: '暂未添加邮箱', css: { color: '#ffffff', fontSize: `${24 * scale}rpx`, fontWeight: 'bold', top: `${258 * scale}rpx`, left: `${324 * scale}rpx`, } }, { type: 'text', text: '自我介绍 : 暂未添加自我介绍', css: { color: 'rgba(255,255,255,.43)', fontSize: `${24 * scale}rpx`, // fontWeight: 'bold', maxLines: "1", top: `${301 * scale}rpx`, left: `${63 * 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`, } }, ] } }