Browse Source

问题

master
wenlele 2 years ago
parent
commit
10bf219820
  1. 4
      api/app/lib/controllers/projectRegime/projectSituation.js
  2. 13
      web/client/src/sections/projectRegime/containers/qrCode.js

4
api/app/lib/controllers/projectRegime/projectSituation.js

@ -8,9 +8,9 @@ async function projectList (ctx, next) {
const { limit, page, name, justStructure } = ctx.query;
let options = {
// where: {
where: {
// },
},
// include: [{
// as: 'company',
// model: models.Company,

13
web/client/src/sections/projectRegime/containers/qrCode.js

@ -6,6 +6,8 @@ import '../style.less';
import ProjectAddModel from '../components/projectAddModel'
import { Model } from 'echarts';
import { login } from '../../auth/actions/auth';
import { createCanvas, loadImage, registerFont } from 'canvas'
const QrCode = (props) => {
const { dispatch, actions, user, loading } = props
@ -23,6 +25,7 @@ const QrCode = (props) => {
useEffect(() => {
dispatch(projectRegime.getProjectList({ justStructure: true })).then(res => {
if (res.success) {
@ -92,20 +95,20 @@ const QrCode = (props) => {
<Button type="primary" onClick={() => {
const aa = (v) => {
const img = new Image(),
canvas = $('.canas'),
ctx = canvas[0].getContext('2d')
canvas = createCanvas(460, 490),
ctx = canvas.getContext('2d')
img.crossOrigin = 'anonymous'
img.onload = function () {
const w = 460, h = 490
canvas.attr({ width: w, height: h })
ctx.drawImage(img, 0, 0)
ctx.drawImage(img, 0, 0,460,490)
ctx.beginPath()
ctx.font = 'dcscsdcsd'
ctx.fillStyle = '#000'
ctx.fillText('5315', w, h)
ctx.closePath()
const save_link = document.createElement('a')
save_link.href = canvas[0].toDataURl('image/png')
save_link.href = canvas.toDataURl('image/png')
save_link.download = 'dcscds.png'
document.body.appendChild(save_link)
save_link.click()

Loading…
Cancel
Save