From 8d1b3ab8d78cdcdd745f931ae6a8cf68173cfe69 Mon Sep 17 00:00:00 2001
From: zhongshujie <2862698242@qq.com>
Date: 星期五, 27 十二月 2024 11:41:49 +0800
Subject: [PATCH] Merge branch 'master' of http://182.92.203.7:2001/r/testbookLayout

---
 src/assets/methods/resources.js |   64 ++++++++++++++++++++++++-------
 1 files changed, 49 insertions(+), 15 deletions(-)

diff --git a/src/assets/methods/resources.js b/src/assets/methods/resources.js
index 83b3237..17a5fbb 100644
--- a/src/assets/methods/resources.js
+++ b/src/assets/methods/resources.js
@@ -1,19 +1,53 @@
-import fileApi from '@/assets/js/middleGround/api/file'
-export const getResourcePath = (md5,appRefCode = "jingshieke") => {
-  fileApi.getAliVod({
-    md5,appRefCode
-  }).then(res => {
-    console.log('path',res);
-    if(res.data) {
-      return res.data
-    } else {
-      return  process.env.VUE_APP_API_URL + '/file/api/ApiDownload?md5=' + md5
-    }
+import fileApi from "@/assets/js/middleGround/api/file";
+import identityApi from "../js/middleGround/api/identity";
+import { tokenKey } from "../js/config";
+export const getResourcePath = async (md5, appRefCode = "jingshieke") => {
+  let path = "";
+  await fileApi
+    .getAliVod({
+      md5,
+      appRefCode,
+    })
+    .then((res) => {
+      if (res != "" && res != undefined) {
+        path = res;
+      } else {
+        path = process.env.VUE_APP_API_URL + "/file/api/ApiDownload?md5=" + md5;
+      }
+    });
+  return path;
+};
+// 鑾峰彇鏀惰棌鐨勮祫婧�
+export const getCollectResource = async (key) => {
+  if(!localStorage.getItem(tokenKey)) return []
+  let list = []
+  await identityApi
+  .getUserKey({
+    domain: "collectResource",
+    keys: [key],
   })
-  
+  .then((res) => {
+    if(res.length) {
+      list = JSON.parse(res[0].value)
+    }
+  });
+  return list
+}
+export const setCollectResource = (key,list) => {
+  identityApi.setUserKey({
+    setKeyRequests: [
+      {
+        domain: "collectResource",
+        key,
+        value: JSON.stringify(list),
+      },
+    ],
+  })
 }
 const MT = {
-  getResourcePath
-}
+  getResourcePath,
+  getCollectResource,
+  setCollectResource
+};
 
-export default MT
\ No newline at end of file
+export default MT;

--
Gitblit v1.9.1