You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
52 lines
1.1 KiB
JavaScript
52 lines
1.1 KiB
JavaScript
3 years ago
|
/**
|
||
|
* 上传地址
|
||
|
* @returns {*}
|
||
|
*/
|
||
|
import config from '@/config';
|
||
|
import { Session } from '../utils';
|
||
|
import _ from 'lodash';
|
||
|
|
||
|
/**
|
||
|
* 上传成功返回详情信息
|
||
|
* @returns {string}
|
||
|
*/
|
||
|
export const uploadURLReturnDetail = () => {
|
||
|
return config.get('file/uploadReturnDetail');
|
||
|
};
|
||
|
|
||
|
/**
|
||
|
* 上传成功仅返回fileId
|
||
|
* @returns {string}
|
||
|
*/
|
||
|
export const uploadURLReturnId = () => {
|
||
|
return config.get('file/uploadReturnId');
|
||
|
};
|
||
|
|
||
|
/**
|
||
|
* 文件下载地址
|
||
|
* @param fileId
|
||
|
* @returns {string}
|
||
|
*/
|
||
|
export const downloadURL = (fileId) => {
|
||
|
const token = Session.getAccessToken() || Session.getRefreshToken();
|
||
|
return config.get('file/download') + '/' + fileId + `?access_token=${token}`;
|
||
|
};
|
||
|
|
||
|
/**
|
||
|
* 头像/图片查看地址
|
||
|
* @param fileId
|
||
|
* @returns {string}
|
||
|
*/
|
||
|
export const viewImg = (fileId) => {
|
||
|
const token = Session.getAccessToken() || Session.getRefreshToken();
|
||
|
return config.get('file/viewImg') + '/' + fileId + `?access_token=${token}`;
|
||
|
};
|
||
|
|
||
|
/**
|
||
|
* 获取图片后缀
|
||
|
* @returns {string}
|
||
|
*/
|
||
|
export const getPicSuffix = () => {
|
||
|
return config.get('picSuffix');
|
||
|
};
|