index.vue
3.32 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
121
122
123
124
125
126
127
<template>
<div class="home nafmii-head-bg1">
<nafm-header :leftArrow="false" navClass="nafmii-head-bg1">
<div class="head-custom-container">
<SearchInput :placeholder="$t('home.searchPlaceholder')" :readonly="true" @click="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" :datas="item.datas" @clickTop="handleTop(item)" />
</main>
</div>
</template>
<script>
import SearchInput from '@/components/SearchInput'
import HomeBanner from './components/HomeBanner'
import MenuModule from './components/MenuModule'
import DataModule from '@/components/HomeDataListModule'
export default {
name: "Home",
components: { HomeBanner, MenuModule, DataModule, SearchInput },
data () {
const datas = [
{
isRecommend: true,
title: '创新推出碳中和债,助理实现30·60目标创新推出碳中和债,助理实现30·60目标创新推出碳中和债,助理实现30·60目标',
date: '2020-02-02',
dataType: '产品创新'
},
{
isRecommend: false,
title: '创新推出碳中和债,助理实现30·60目标创新推出碳中和60目标',
date: '2020-02-02',
dataType: '产品创新'
},
{
isRecommend: false,
title: '创新推出碳中和债,助理实现30·60目标出',
date: '2020-02-02',
dataType: '产品创新'
}
]
return {
modules: [
{ type: '1', name: this.$t('home.disclosure'), dateText: this.$t('home.disclosureDate'), datas, showTop: false },
{ type: '2', name: this.$t('home.news'), dateText: this.$t('home.updateDate'), datas, showTop: true },
{ type: '3', name: this.$t('home.registered'), dateText: this.$t('home.updateDate'), datas, showTop: true }
]
};
},
methods: {
jumpLogin () {
this.$router.push({
name: "Login",
});
},
handleSearch () {
this.$router.push({ name: 'GlobalSearch' })
},
handleTop (module) {
const modules = []
for (const item of this.modules) {
const showTop = item.type != module.type
!showTop ? modules.unshift(item) : modules.push(item)
Object.assign(item, { showTop })
}
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>