ann0707
2018-08-16 c9bc8ec61cff4076132f6396d99d383a2cdf5a03
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
<template>
    <div>
        <!--注意这里颜色,是颜色是字符串,主题替换时,需要注意-->
        <div class="loan-home-tab">
            <tab class="f-loan-tab" bar-active-color="#fff000">
                <tab-item :selected="activeItem===0" @on-item-click="onItemClick">
                    <span>极速贷款</span>
                </tab-item>
                <tab-item :selected="activeItem===1" @on-item-click="onItemClick">
                    <span>银行贷款</span>
                </tab-item>
                <tab-item :selected="activeItem===2" @on-item-click="onItemClick">
                    <span>信用卡</span>
                </tab-item>
            </tab>
        </div>
        <div class="loan-space"></div>
        <!--贷款的tab的切换,view-->
        <keep-alive>
            <router-view></router-view>
        </keep-alive>
        <FSpace type="large"></FSpace>
        <FFooter :index="1"></FFooter>
    </div>
</template>
 
<script>
/**
 * Created by c.y on 2018/3/22.
 * 贷款的首页
 */
import { Tab, TabItem } from 'vux';
import FFooter from '../../components/common/FFooter.vue';
import FSpace from '../../components/common/FSpace.vue';
export default {
    name: 'f-loan',
    data() {
        return {};
    },
    components: {
        Tab,
        TabItem,
        FFooter,
        FSpace
    },
    computed: {
        activeItem() {
            return this.$store.state.loanActiveTab;
        }
    },
    methods: {
        // 点击tab的切换
        onItemClick(index) {
            this.$store.commit('UPDATE_ACTIVE_TAB', { loanActiveTab: index });
            if (index === 0) {
                this.$router.push({
                    path: '/f-loan/f-speed'
                });
            } else if (index === 1) {
                this.$router.push({
                    path: '/f-loan/f-bank'
                });
            } else if (index === 2) {
                this.$router.push({
                    path: '/f-loan/f-credit'
                });
            }
        }
    },
    activated: function() {
        this.$store.commit('UPDATE_APP_STYLE', {
            overflow: 'initial',
            '-webkit-overflow-scrolling': 'initial'
        });
        this.$store.commit('UPDATE_DIRECTION', {direction: 'none'});
        // 根据首页产品的tab的分类,选中相应的tab
        if (this.$route.query.typeId) {
            let activeTab = this.$route.query.typeId;
            this.$store.commit('UPDATE_ACTIVE_TAB', {
                loanActiveTab: activeTab
            });
        }
    }
};
</script>
 
<style lang="less">
@import '../../style/mixin';
.loan-home-tab {
    position: fixed;
    left: 0;
    top: 0;
    width: 100%;
    height: 44px;
    z-index: 1002;
    .vux-tab {
        .color-linear-gradient(@color-gradient-darkBlue-left, @color-gradient-darkBlue-right);
        .vux-tab-item {
            background: transparent;
            span {
                color: @color-white;
                font-size: @font-size-large;
            }
        }
        .vux-tab-item.vux-tab-selected {
            span {
                color: @color-text-placeholder-yellow;
            }
        }
        .vux-tab-ink-bar {
            height: 1px !important;
        }
    }
}
.loan-space {
    height: 44px;
}
</style>