朱桂飞
2023-03-20 3755d8c086441ce54864121ca4eb6f800fb914a8
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
<!--自定义tabbar首页-->
<template>
    <view>
        <general @ShowNews="ShowNews" v-if="PageCur=='general'"></general>
        <monitor v-if="PageCur=='monitor'"></monitor>
        <formula v-if="PageCur=='formula'"></formula>
        <me v-if="PageCur=='me'"></me>
    
        <view class="box">
            <view class="cu-bar tabbar bg-white shadow foot">
                <view class="action" @click="NavChange" data-cur="general">
                    <view class='cuIcon-cu-image'>
                        <image v-if="PageCur=='general'" src="../../static/tabBar/index_cur.png"></image>
                        <image v-if="PageCur != 'general'" src="../../static/tabBar/index.png"></image>
                    </view>
                    <view :class="PageCur=='general'?'color_main':'text-gray'">首页</view>
                </view>
    
                <view class="action" @click="NavChange" data-cur="monitor">
                    <view class='cuIcon-cu-image'>
                        <view class="cu-tag badge"><!-- 红点 --></view>
                        <image v-if="PageCur=='monitor'" src="../../static/tabBar/shop_cur.png"></image>
                        <image v-if="PageCur != 'monitor'" src="../../static/tabBar/shop.png"></image>
                    </view>
                    <view :class="PageCur=='monitor'?'color_main':'text-gray'">监控</view>
                </view>
    
                <view @click="NavChange" class="action text-gray add-action" data-cur="cases">
                    <image class="logo_btn" mode="widthFix" src="../../static/logo.png"></image>
                    <view :class="PageCur=='cases'?'color_main':'text-gray'">实时</view>
                </view>
    
                <view class="action" @click="NavChange" data-cur="formula">
                    <view class='cuIcon-cu-image'>
                        <view class="cu-tag badge">{{message}}</view>
                        <image v-if="PageCur=='formula'" src="../../static/tabBar/order_cur.png"></image>
                        <image v-if="PageCur != 'formula'" src="../../static/tabBar/order.png"></image>
                    </view>
                    <view :class="PageCur=='formula'?'color_main':'text-gray'">历史</view>
                </view>
    
                <view class="action" @click="NavChange" data-cur="me">
                    <view class='cuIcon-cu-image'>
                        <image v-if="PageCur=='me'" src="../../static/tabBar/me_cur.png"></image>
                        <image v-if="PageCur != 'me'" src="../../static/tabBar/me.png"></image>
                    </view>
                    <view :class="PageCur=='me'?'color_main':'text-gray'">个人中心</view>
                </view>
    
            </view>
        </view>
    
    </view>
</template>
 
<script>
    import general from "./general.vue";    //首页
    import monitor from "./monitor.vue";    //
    import formula from "./formula.vue";    //
    import me from "./me.vue";    //
    export default {
        components: {
            general,
            monitor,
            formula,
            me
        },
        data() {
            return {
                PageCur: 'general',
                message: '0',
            }
        },
        onShow() {
             console.info('onShow')
        },
        methods: {
            ShowNews(e){
                console.log(e)
                this.PageCur = e;
            },
            NavChange: function(e) {
                console.log(e.currentTarget.dataset.cur)
            
                this.PageCur = e.currentTarget.dataset.cur;
            
                if (this.PageCur == 'general') {
                    // document.title = '首页'
                } else if (this.PageCur == 'component') {
                    // document.title = '积分商城'
                } else if (this.PageCur == 'cases') {
                    // document.title = '宅家学'
                } else if (this.PageCur == 'news') {
                    // document.title = '文章资讯'
                } else if (this.PageCur == 'me') {
                    // document.title = '个人中心'
                }
                }
        }
    }
</script>
 
<style lang="scss">
.color_main{
        color: #000000;
        font-weight: 900;
    }
    .box {
        margin: 20upx 0;
    }
    .box view.cu-bar {
        margin-top: 20upx;
    }
    
    .logo_btn{
        width: 38*2rpx;
        height: 38*2rpx;
        position: absolute;
        z-index: 2;
        border-radius: 50%;
        top: -40rpx;
        left: 0rpx;
        right: 0;
        margin: auto;
        padding: 0;
    }
    .cu-bar.tabbar .action.add-action {
        padding-top: 56rpx !important;
    }
</style>