riku
2023-12-20 f58f07875461b7cc8205978cf4f0fac86564df72
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
import { $fytz } from '../index';
 
/**
 * 信用评估API接口
 */
export default {
  /**
   * 下载用户环信码
   * @param {*} userId
   */
  downloadCode(userId) {
    return $fytz
      .get(`credit/ecCode/download?userId=${userId}`, { responseType: 'blob' })
      .then((res) => {
        const url = window.URL.createObjectURL(new Blob([res.data]));
        const link = document.createElement('a');
        link.href = url;
        link.setAttribute('download', 'creditCode.png');
        document.body.appendChild(link);
        link.click();
        document.body.removeChild(link);
        window.URL.revokeObjectURL(url);
      });
  }
};