index.vue
2.54 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
<template>
<div class="home nafmii-head-bg1">
<nafm-header :leftArrow="false" navClass="nafmii-head-bg1">
<div class="head-custom-container">
<SearchFirst :placeholder="$t('home.searchPlaceholder')" @jumpPage="handleSearch" />
<div class="head-message-box">
<img src="@/assets/icon/message.png" alt="">
</div>
</div>
</nafm-header>
<main>
<HomeBanner />
<MenuModule />
<DataModule v-for="item in modules" :key="item.type" v-bind="item" @clickTop="handleTop(item)" />
</main>
</div>
</template>
<script>
import SearchFirst from '@/components/SearchFirst'
import HomeBanner from './components/HomeBanner'
import MenuModule from './components/MenuModule'
import DataModule from './components/DataModule'
export default {
name: "Home",
components: { HomeBanner, MenuModule, DataModule, SearchFirst },
data () {
console.log();
return {
modules: [
{ type: '1', name: this.$t('home.disclosure'), dateText: this.$t('home.disclosureDate'), isTop: true },
{ type: '2', name: this.$t('home.news'), dateText: this.$t('home.updateDate'), isTop: false },
{ type: '3', name: this.$t('home.registered'), dateText: this.$t('home.updateDate'), isTop: false }
]
};
},
methods: {
jumpLogin () {
this.$router.push({
name: "Login",
});
},
handleSearch () { },
handleTop (module) {
const modules = []
for (const item of this.modules) {
const isTop = item.type == module.type
isTop ? modules.unshift(item) : modules.push(item)
Object.assign(item, { isTop })
}
this.modules = modules
}
},
};
</script>
<style lang="less" scoped>
.home {
@PaddingSize: 15px;
main {
padding: 0 @PaddingSize;
}
}
@PaddingSize: 15px;
@HeadHeight: 50px;
.head-custom-container {
width: 100%;
height: @HeadHeight;
display: flex;
align-items: center;
@InputHeight: 33px;
.search-input-box {
width: 100%;
height: @InputHeight;
border-radius: calc(@InputHeight / 2);
background-color: rgba(255, 255, 255, 0.2);
padding: 0 @PaddingSize;
display: flex;
align-items: center;
@SearchIconSize: 12px;
.search-icon {
background: white;
width: @SearchIconSize;
height: @SearchIconSize;
}
.search-placeholder {
color: white;
font-size: 12px;
padding-left: 22px;
}
}
@MessageBoxSize: 23px;
.head-message-box {
width: @MessageBoxSize;
height: @MessageBoxSize;
margin-left: @PaddingSize;
}
}
</style>