import config from '@/common/api/config'
let tools = {
    // 图片地址返回
    getIotFileUrl(importUrl) {
		// console.log(importUrl, 'importUrl');
        if (!importUrl) {
            return importUrl;
        }
        if (importUrl.indexOf('http') === 0) {
            return importUrl;
        } else if (importUrl.indexOf('upload/') === 0 || importUrl.indexOf('upload\\') === 0 || importUrl.indexOf('/profile') === 0 ) {
            return config.imgUrl + importUrl;
        } else if (importUrl.indexOf('data:image/') === 0) {
            return importUrl;
        }else if (importUrl.indexOf('/static') === 0) {
            return importUrl;
        }
        return 'data:image/jpg;base64,' + importUrl;
    }
}

export default tools;