wujingjing
2024-04-22 f106e4dffb8279cb90726e83e7edd631f4c77699
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
<template>
    <div class="sponsors-container" title="点击前往体验" v-show="state.sponsors.isShow" @click="onSponsorsClick">
        <el-carousel height="240px" indicator-position="none" :arrow="setCarouselShow" @change="onCarouselChange">
            <el-carousel-item v-for="(v, k) in state.sponsors.list" :key="k">
                <img :src="v.url" class="sponsors-img" />
                <div class="sponsors-text" v-html="v.text"></div>
            </el-carousel-item>
        </el-carousel>
        <div class="sponsors-close">
            <SvgIcon name="ele-Close" :size="12" title="关闭赞助商" @click.stop="onCloseSponsors" />
        </div>
    </div>
</template>
 
<script setup lang="ts" name="layoutSponsors">
import { reactive, computed, onMounted } from 'vue';
import sponsorsOne from '/@/assets/ccflowRightNextAdmin.png';
 
// 定义变量内容
const state = reactive({
    sponsors: {
        list: [
            {
                url: sponsorsOne,
                text: `驰骋BPM系统包含表单引擎+流程引擎+权限控制,方便集成,配置灵活,功能强大,适合中国国情的工作流引擎.演示:http://demo.ccflow.org。右上角点star方可加群: 1060674395`,
                link: 'http://www.ccflow.org/',
            },
        ],
        isShow: false,
        index: 0,
    },
});
 
// 设置轮播图箭头显示
const setCarouselShow = computed(() => {
    return state.sponsors.list.length <= 1 ? 'never' : 'hover';
});
// 关闭赞助商
const onCloseSponsors = () => {
    state.sponsors.isShow = false;
};
// 轮播图改变时
const onCarouselChange = (e: number) => {
    state.sponsors.index = e;
};
// 当前项内容点击
const onSponsorsClick = () => {
    window.open(state.sponsors.list[state.sponsors.index].link);
};
// 延迟显示,防止影响其它界面加载
const delayShow = () => {
    setTimeout(() => {
        state.sponsors.isShow = true;
    }, 3000);
};
// 页面加载时
onMounted(() => {
    delayShow();
});
</script>
 
<style scoped lang="scss">
.sponsors-container {
    position: fixed;
    right: 15px;
    bottom: 15px;
    z-index: 3;
    width: 200px;
    background-color: var(--next-bg-main-color);
    box-shadow: var(--el-box-shadow-lighter);
    border-radius: 5px;
    overflow: hidden;
    cursor: pointer;
    .sponsors-img {
        width: 100%;
        height: 80px;
    }
    .sponsors-text {
        padding: 10px;
        color: var(--el-text-color-regular);
        font-size: var(--el-dialog-content-font-size);
    }
    .sponsors-close {
        width: 60px;
        height: 60px;
        border-radius: 100%;
        background: rgba(0, 0, 0, 0.05);
        transition: all 0.3s ease;
        position: absolute;
        right: -35px;
        bottom: -35px;
        :deep(i) {
            position: absolute;
            left: 9px;
            top: 9px;
            color: #afafaf;
            transition: all 0.3s ease;
        }
        &:hover {
            transition: all 0.3s ease;
            :deep(i) {
                color: var(--el-color-primary);
                transition: all 0.3s ease;
            }
        }
    }
}
</style>