1
zhongshujie
昨天 dc1bfd1969528b411398a1a6b9963baa0404d850
src/assets/methods/resources.js
@@ -2,13 +2,33 @@
import identityApi from "../js/middleGround/api/identity";
import { tokenKey } from "../js/config";
export const getResourcePath = async (md5, appRefCode = "jingshieke") => {
  const res = fileApi.getAliVod({
  // const res = fileApi.getAliVod({
  //   md5,
  //   appRefCode,
  // });
  // return res.data != "" && res.data != undefined
  //   ? res.data
  //   : process.env.VUE_APP_API_URL + "/file/api/ApiDownload?md5=" + md5;
  // 直接去阿里云获取
  const res = await fileApi.getAliVod({
    md5,
    appRefCode,
  });
  return res.data != "" && res.data != undefined
    ? res.data
    : process.env.VUE_APP_API_URL + "/file/api/ApiDownload?md5=" + md5;
  if (typeof res === "string" && res.includes("http")) {
    return res;
  } else if (typeof res === "object" && res.data != "") {
    return res.data;
  } else {
    return process.env.VUE_APP_API_URL + "/file/api/ApiDownload?md5=" + md5;
  }
};
//上传资源
export const uploadFilePath = async (fileData) => {
  const res = fileApi.upload(fileData);
  return res;
};
// 获取收藏的资源
export const getCollectResource = async (key) => {
@@ -34,6 +54,7 @@
  getResourcePath,
  getCollectResource,
  setCollectResource,
  uploadFilePath,
};
export default MT;