username@email.com
2024-09-09 626943b5ba84ce44bc19f4c3b8e8e94638bec733
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
<template>
    <view class="adbrathing" v-show="adbshow" v-bind:class="['adbrathing'+coreshopData.parameters.style.align,!hideanimation?'pc':hideanimation?'hc':'']" :style="{top:coreshopData.parameters.style.top+'%'}">
        <view class="adbrathing-c coreshop-flex-direction-row">
            <view class="adbrathing-l">
                <image class="user-head-img" :src="log.avatar" mode="aspectFill"></image>
                <view class="user-name">
                    {{log.nickname}}
                </view>
            </view>
            <view class="adbrathing-r">
                {{log.createTime}}{{log.desc}}
            </view>
        </view>
    </view>
</template>
 
<script>
    export default {
        name: "coreshopRecord",
        props: {
            coreshopData: {
                // type: Object,
                required: true,
            },
            //记录显示的位置类型
            ltype: {
                type: String,
                required: false,
                default: 'home',
            },
            //记录显示的位置的值
            lvalue: {
                type: String,
                required: false,
                default: '0',
            }
        },
        data() {
            return {
                adbshow: false,
                hideanimation: true,
                log: {
                    avatar: '/static/images/common/user_black.png',
                    nickname: '',
                    desc: '',
                    ctime: '',
                },
                times: {},//定时器
            };
        },
        methods: {
            //隐藏
            hideLog() {
                var _this = this;
                _this.times = setInterval(function () {
                    _this.adbshow = !_this.adbshow;
                    _this.hideanimation = !_this.hideanimation;
                    clearInterval(_this.times);
                    _this.times = setInterval(function () {
                        _this.getRecord();
                    }, 5000);
                }, 3000)
            },
            //获取日志
            getRecord() {
                var _this = this;
                if (_this.times != {}) {
                    clearInterval(_this.times);
                }
                var data = {
                    type: _this.ltype,
                    value: _this.lvalue,
                };
                uni.request({
                    url: this.$globalConstVars.apiBaseUrl + '/Api/Page/GetRecord',
                    data: data,
                    header: {
                        'Accept': 'application/json',
                        'Content-Type': 'application/json',
                    },
                    method: 'POST',
                    success: (response) => {
                        var res = response.data;
                        if (res.status == true) {
                            if (res.data) {
                                _this.log = res.data;
                                _this.adbshow = true;
                                _this.hideanimation = false;
                                _this.hideLog();
                            }
                        }
                    }
                });
            }
        },
        created() {
            this.getRecord();
        }
    }
</script>
 
<style lang="scss" scoped>
    .adbrathing { position: fixed; height: 35px; background-color: rgba(0,0,0,.5); border-radius: 5px; padding: 5px; z-index: 666;
        .adbrathing-c { width: 100%; height: 100%; overflow: hidden; color: #fff; font-size: 12px;
            .adbrathing-l { display: inline-block; height: 100%; float: left; overflow: hidden;
                .user-head-img { width: 25px; height: 25px; border-radius: 50%; float: left; }
                .user-name { float: left; display: inline-block; height: 100%; line-height: 25px; margin: 0 2px 0 5px; max-width: 60px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
            }
            .adbrathing-r { float: left; height: 100%; display: inline-block; line-height: 25px; }
        }
    }
    .pc { animation: showcenter .55s; }
    .hc { animation: hidecenter .55s; }
 
    @keyframes showcenter {
        0% { opacity: 0; }
        100% { opacity: 1; }
    }
 
    @keyframes hidecenter {
        0% { opacity: 1; }
        100% { opacity: 0; }
    }
</style>