index-page.vue
2.17 KB
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
<template>
<LayoutApp :show-back="false" :title="title">
<div class="body">
<div class="content">
<router-view></router-view>
</div>
<div class="footer">
<Tabs :value="tabIndex" @click="onClick"></Tabs>
</div>
</div>
</LayoutApp>
</template>
<script>
import Tabs from './components/tabs';
import { mapState, mapMutations } from 'vuex';
export default {
name: 'IndexPage',
props: ['tabIndex', 'title'],
components: {
Tabs
},
computed: {
...mapState(['yoho'])
},
mounted() {
this.SET_QUERY(this.$route.query ? this.$route.query : {});
},
methods: {
...mapMutations(['SET_QUERY']),
onClick(index) {
this.$store.dispatch('reportYas', {
params: {
param: { TAB_ID: index + 1 },
appop: 'XY_UFO_MAIN_TAB'
}
});
switch (index) {
case 0: {
this.go('ChannelPage');
break;
}
case 1: {
this.go('CategoryPage');
break;
}
case 2: {
this.$yoho.auth({
refer: '/xianyu/index/news'
}).then((res) => {
if (res) {
this.go('NewsPage');
}
});
break;
}
case 3: {
this.$yoho.auth({
refer: '/xianyu/index/mine'
}).then((res) => {
if (res) {
this.go('MinePage');
}
});
break;
}
case 4: {
this.go('ArticlePage');
break;
}
default: {
this.go('ChannelPage');
}
}
},
go(name) {
this.$router.replace({
name,
query: {
...this.yoho.context.query
}
});
}
}
};
</script>
<style lang="scss" scoped>
* {
transition: none !important;
transform: none !important;
}
.body {
display: flex;
flex-direction: column;
position: absolute;
left: 0;
right: 0;
top: 0;
bottom: 0;
}
.content {
flex: 1;
overflow: hidden;
background-color: white;
position: relative;
}
.footer {
border-top: 1px solid #eee;
height: 100px;
width: 100%;
background-color: white;
}
</style>