1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
| let blob = new Blob(['后台给的字符串'],{type:'各种需要的格式'});
let url = window.URL.windowCreateURL();
getImgCode() { let that = this; var xhr = new XMLHttpRequest(); xhr.open("get", 'http://servicetest.changan.com.cn/changan-trade-application/api/v1/changan/trade/member/verify/code/image', true); xhr.responseType = "blob"; xhr.setRequestHeader("openid", util.getLocalCache('openid')); xhr.onload = function () { if (this.status == 200) { var blob = this.response; that.setState({imgCode:window.URL.createObjectURL(blob)}); } } xhr.send(); }
|