From c27af154afe4d182af1eed7be0bbbfadd5fe1140 Mon Sep 17 00:00:00 2001
From: litian <2804272236@qq.com>
Date: 星期五, 24 一月 2025 10:27:40 +0800
Subject: [PATCH] Merge branch 'master' of http://182.92.203.7:2001/r/testbookLayout

---
 src/assets/methods/resources.js |   43 +++++++++++++++++++++++++++++++++++++++----
 1 files changed, 39 insertions(+), 4 deletions(-)

diff --git a/src/assets/methods/resources.js b/src/assets/methods/resources.js
index bd860ff..c67ba2f 100644
--- a/src/assets/methods/resources.js
+++ b/src/assets/methods/resources.js
@@ -1,4 +1,6 @@
 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
@@ -7,16 +9,49 @@
       appRefCode,
     })
     .then((res) => {
-      if (res?.data != "" && res?.data != undefined) {
-        path = res.data;
-      } else {
+      if (res) {
+        if (res && res.data == '') {
+          path = process.env.VUE_APP_API_URL + "/file/api/ApiDownload?md5=" + md5;
+        } else {
+          path = res;
+        }
+      } else if (md5) {
         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,
+  getCollectResource,
+  setCollectResource
 };
 
 export default MT;

--
Gitblit v1.9.1