1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
| 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,
| getCollectResource,
| setCollectResource
| };
|
| export default MT;
|
|