
import { message } from 'antd';
//测试封装
export default function PictureQRcode(res, title) {
  if (res.qrCode === null || res.qrCode == 'null') {
    message.error(`保存失败${res.qrCode}`);

  } else {
    const x = new XMLHttpRequest();
    const resourceUrl = res.qrCode;
    x.open('GET', resourceUrl, true);
    x.responseType = 'blob';
    x.onload = function (e) {
      const url = window.URL.createObjectURL(x.response);
      const a = document.createElement('a');
      a.href = url;
      a.style.display = 'none';
      a.download = `${title}.png`;
      a.click();
    };
    x.send();
    message.info(`保存成功`);


  }


}

