Browse Source

RUN npm install --production --force --registry http://10.8.30.22:7000

master
wenlele 2 years ago
parent
commit
59385d8aa5
  1. 2
      web/Dockerfile
  2. 69
      web/client/src/sections/projectRegime/containers/qrCode.js

2
web/Dockerfile

@ -37,7 +37,7 @@ RUN npm install --registry http://10.8.30.22:7000
RUN npm run build RUN npm run build
RUN rm -rf client/src RUN rm -rf client/src
RUN rm -rf node_modules RUN rm -rf node_modules
RUN npm install --production --registry http://10.8.30.22:7000 RUN npm install --production --force --registry http://10.8.30.22:7000
FROM registry.cn-hangzhou.aliyuncs.com/fs-devops/node:12 FROM registry.cn-hangzhou.aliyuncs.com/fs-devops/node:12
COPY --from=builder --chown=node /var/app /home/node/app COPY --from=builder --chown=node /var/app /home/node/app

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

@ -93,30 +93,55 @@ const QrCode = (props) => {
}}> }}>
{/* <a href={`${v.qrCode + '?filename=' + encodeURIComponent(v.name)}.png`}> */} {/* <a href={`${v.qrCode + '?filename=' + encodeURIComponent(v.name)}.png`}> */}
<Button type="primary" onClick={() => { <Button type="primary" onClick={() => {
const aa = (v) => { // const aa = (v) => {
const img = new Image(), // const img = new Image(),
canvas = createCanvas(460, 490), // canvas = createCanvas(460, 490),
ctx = canvas.getContext('2d') // ctx = canvas.getContext('2d')
img.crossOrigin = 'anonymous' // img.crossOrigin = 'anonymous'
img.onload = function () { // img.onload = function () {
const w = 460, h = 490 // const w = 460, h = 490
ctx.drawImage(img, 0, 0,460,490) // ctx.drawImage(img, 0, 0,460,490)
ctx.beginPath() // ctx.beginPath()
ctx.font = 'dcscsdcsd' // ctx.font = 'dcscsdcsd'
ctx.fillStyle = '#000' // ctx.fillStyle = '#000'
ctx.fillText('5315', w, h) // ctx.fillText('5315', w, h)
ctx.closePath() // ctx.closePath()
const save_link = document.createElement('a') // const save_link = document.createElement('a')
save_link.href = canvas.toDataURl('image/png') // save_link.href = canvas.toDataURl('image/png')
save_link.download = 'dcscds.png' // save_link.download = 'dcscds.png'
document.body.appendChild(save_link) // document.body.appendChild(save_link)
save_link.click() // save_link.click()
save_link.remove() // save_link.remove()
// }
// img.src = v
// }
// aa(v.qrCode)
// console.log(v.qrCode.replace('/[\r\n]/g',""));
function base64ToFile (url, name) {
let mime = name.substring(name.lastIndexOf('.') + 1)
let bstr = atob(url);
let n = bstr.length;
let u8arr = new Uint8Array(n);
while (n--) {
u8arr[n] = bstr.charCodeAt(n);
} }
img.src = v return new Blob([u8arr], { type: mime });
}
function downloadFile(url,name='15313'){
let a=document.createElement('a');
a.setAttribute('href',url)
a.setAttribute('download',name)
a.setAttribute('target','_blank')
let b=document.createEvent('MouseEvents')
b.initEvent('click',true,true)
a.dispatchEvent
} }
aa(v.qrCode)
}}>下载二维码</Button> }}>下载二维码</Button>
{/* </a> */} {/* </a> */}

Loading…
Cancel
Save