avatar.js 425 B

123456789101112131415
  1. /**
  2. * 头像地址帮助类
  3. */
  4. import { getImage, getPhoto } from '@/api/platform/file/attachment'
  5. import utils from './util'
  6. export function getFile(photo) {
  7. if (utils.isEmpty(photo)) return ''
  8. if (photo.indexOf('getImage')) {
  9. return getPhoto(photo)
  10. } else {
  11. // 兼容旧版本格式,如:/platform/file/attachment/getFileById.htm?fileId=489034166378168320
  12. return getImage(photo.split('=')[1])
  13. }
  14. }