Authored by TaoHuang

fix image url

1 import * as Types from './types'; 1 import * as Types from './types';
2 2
  3 +function getUploadImgAbsoluteUrl(url, bucket = 'goodsimg') {
  4 + if (!url) {
  5 + return null;
  6 + }
  7 +
  8 + let urlArr = url.split('/'),
  9 + stag = urlArr[urlArr.length - 1].substr(0, 2),
  10 + domain = `static.yhbimg.com/${bucket}`;
  11 +
  12 + url = domain + url;
  13 + if (stag === '01') {
  14 + return `//img11.${url}`;
  15 + } else if (stag === '03') {
  16 + return `//flv01.${url}`;
  17 + } else {
  18 + return `//img12.${url}`;
  19 + }
  20 +}
  21 +
3 function _url({ name }) { 22 function _url({ name }) {
4 - return `//img01.yohoboys.com/${name}`; 23 + return getUploadImgAbsoluteUrl(name);
5 } 24 }
6 25
7 function _handleData(data) { 26 function _handleData(data) {