zhongshujie
2 天以前 d41648827f2d21c7884ac8d00e8d8a9ac1cd2715
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
<template>
    <div class="knowledgeExpansion theme-color">
        <div class="questionBank-video">
            <svgIcon icon-file-name="sanJiao"></svgIcon>
            <span>视频</span>
        </div>
        <div class="knowledgeExpansion-video">
            <p class="center text td-0">
                <video :src="videoPathSrc" webkit-playsinline="true" x-webkit-airplay="true" playsinline="true"
                    x5-video-orientation="h5" x5-video-player-fullscreen="true" x5-playsinline="" controls
                    controlslist="nodownload" class="w100 video"></video>
            </p>
            <p class="center videoname">
                <span>{{ videoName }}</span>
                <el-tooltip class="item" effect="dark" :content="localIsCollectVideo ? '点击取消' : '点击收藏'"
                    placement="top-start">
                    <svgIcon class="collect-btn " :icon-file-name="collectResourceList.findIndex(
                        (item) => item.id == videoPath
                    ) > -1
                        ? collectCheck
                        : collectImg
                        " @click="handleCollect()"></svgIcon>
                </el-tooltip>
            </p>
        </div>
    </div>
</template>
 
<script>
import { getResourcePath } from "@/assets/methods/resources";
import { getCollectResource, setCollectResource } from "@/assets/methods/resources";
import svgIcon from "@/components/svgIcon";
export default {
    components: {
        svgIcon
    },
    data() {
        return {
            collectImg: "heart",
            collectCheck: "heart-check",
            videoPathSrc: "",
            collectResourceList: [],
            localIsCollectVideo: false,
            isDisplay: true,
            videoName: this.videoInfo.resourceName
        };
    },
    props: {
        videoInfo: {
            type: Object,
        },
        BookId: {
            type: String,
            required: "",// 默认值
        },
    },
    async mounted() {
        await this.getVidoePath();
        this.collectResourceList = await getCollectResource(
            this.BookId
        );
    },
    methods: {
        async getVidoePath() {
            console.log(this.videoInfo, "this.videoInfo.md5");
            this.videoPathSrc = await getResourcePath(
                this.videoInfo.md5
            );
        },
 
        handleCollect() {
            debugger
            this.handleCollectResource(
                this.videoPath,
                this.videoPath,
                "",
                "视频",
                "bits",
                "视频:" + this.videoName
            );
            this.localIsCollectVideo = !this.localIsCollectVideo;
        },
        //资源收藏事件
        // resourcePath 文件路径,
        // resourceType 文件类型
        // source 文件来源
        handleCollectResource(
            id,
            md5,
            resourcePath,
            resourceType,
            source,
            resourceName
        ) {
 
            let list = this.collectResourceList;
            if (list.findIndex((item) => item.id == id) > -1) {
                list = list.filter((item) => item.id != id);
            } else {
                list.push({
                    id,
                    md5,
                    resourcePath,
                    resourceType,
                    source,
                    resourceName,
                });
            }
            this.collectResourceList = list;
            setCollectResource(
                this.BookId,
                this.collectResourceList
            );
        },
    },
};
</script>
 
<style lang="less" scoped>
.knowledgeExpansionVideo {
    margin: 30px 0;
    padding: 10px 0;
    /* 使用新的 --logo-color-rgb 变量 */
    border-top: 10px solid rgba(var(--logo-color-rgb), 0.6);
    border-bottom: 10px solid rgba(var(--logo-color-rgb), 0.6);
    position: relative;
}
 
 
 
.questionBank-video {
    position: relative;
    line-height: 0px;
    display: flex;
    align-items: center;
    top: -29px;
    left: 30px;
 
    svgIcon {
        width: 13px;
    }
 
    span {
        font-size: 14px;
        font-weight: 600;
        margin-left: 1px;
    }
 
}
 
.knowledgeExpansion-video {
    padding: 0 8%;
}
</style>