|
|
@@ -1,133 +1,230 @@
|
|
1
|
1
|
<script lang="ts" setup>
|
|
2
|
|
-import { computed, PropType } from "vue";
|
|
3
|
|
-import FSearch from "~/components/FSearch/FSearch.vue";
|
|
4
|
|
-import type { UserInfoModel } from "~/apis/model/userInfoModel";
|
|
5
|
|
-import { useUserStore } from "~/stores/userStore";
|
|
6
|
|
-// import {useUserStore} from "~/stores/userStore";
|
|
7
|
|
-const userStore = useUserStore()
|
|
8
|
|
-
|
|
9
|
|
-const systemInfo = uni.getSystemInfoSync()
|
|
10
|
|
-const statusBarHeight = systemInfo.statusBarHeight ?? 0
|
|
11
|
|
-const menuButtonInfo = uni.getMenuButtonBoundingClientRect()
|
|
12
|
|
-
|
|
13
|
|
-const navBarHeight = computed(() => {
|
|
14
|
|
- // const propsHeight = Number(props.height)
|
|
15
|
|
- let defaultHeight = 44
|
|
16
|
|
- // #ifdef MP
|
|
17
|
|
- // if (props.fixed) {
|
|
18
|
|
- const menuButtonInfo = uni.getMenuButtonBoundingClientRect()
|
|
19
|
|
- const menuHeight = menuButtonInfo.height
|
|
20
|
|
- const menuTop = menuButtonInfo.top
|
|
21
|
|
- // console.log(menuButtonInfo)
|
|
22
|
|
- defaultHeight = (menuTop - statusBarHeight) * 2 + menuHeight
|
|
23
|
|
- // }
|
|
24
|
|
- // #endif
|
|
25
|
|
- // return propsHeight || defaultHeight
|
|
26
|
|
- return defaultHeight
|
|
27
|
|
-})
|
|
28
|
|
-
|
|
29
|
|
-const navBarStyle = computed(() => {
|
|
30
|
|
- return {
|
|
31
|
|
- paddingTop: `${statusBarHeight}px`,
|
|
32
|
|
- }
|
|
33
|
|
-})
|
|
34
|
|
-
|
|
35
|
|
-const props = defineProps({
|
|
36
|
|
- exClass: {
|
|
37
|
|
- type: String
|
|
38
|
|
- },
|
|
39
|
|
- // userInfo: {
|
|
40
|
|
- // type: Object as PropType<UserInfoModel>,
|
|
41
|
|
- // required: true
|
|
42
|
|
- // },
|
|
43
|
|
- yanglaojin: {
|
|
44
|
|
- type: Number,
|
|
45
|
|
- default: NaN
|
|
46
|
|
- }
|
|
47
|
|
-})
|
|
48
|
|
-function handleClick() {
|
|
49
|
|
- if (userStore.userInfo && userStore.uid) {
|
|
50
|
|
- uni.navigateTo({
|
|
51
|
|
- url: '/pages/annuity/index'
|
|
52
|
|
- })
|
|
53
|
|
- } else {
|
|
54
|
|
- uni.navigateTo({
|
|
55
|
|
- url: '/pages/user/login/index?key=30'
|
|
56
|
|
- })
|
|
57
|
|
- }
|
|
58
|
|
-}
|
|
59
|
|
-// function handleShowSearchPage() {
|
|
60
|
|
-//
|
|
61
|
|
-// }
|
|
62
|
|
-
|
|
63
|
|
-function handleShowMessage() {
|
|
64
|
|
- uni.navigateTo({
|
|
65
|
|
- url: '/pages/message/index'
|
|
66
|
|
- })
|
|
67
|
|
-}
|
|
68
|
|
-function handleClickser() {
|
|
69
|
|
- uni.navigateTo({
|
|
70
|
|
- url: '/pages/search/index'
|
|
71
|
|
- })
|
|
72
|
|
-}
|
|
|
2
|
+ import { computed, PropType } from "vue";
|
|
|
3
|
+ import FSearch from "~/components/FSearch/FSearch.vue";
|
|
|
4
|
+ import type { UserInfoModel } from "~/apis/model/userInfoModel";
|
|
|
5
|
+ import { useUserStore } from "~/stores/userStore";
|
|
|
6
|
+ import { TOP_LAB_ARR } from '../constants.js';
|
|
|
7
|
+
|
|
|
8
|
+
|
|
|
9
|
+ // import {useUserStore} from "~/stores/userStore";
|
|
|
10
|
+ const userStore = useUserStore()
|
|
|
11
|
+
|
|
|
12
|
+
|
|
|
13
|
+ const systemInfo = uni.getSystemInfoSync()
|
|
|
14
|
+ const statusBarHeight = systemInfo.statusBarHeight ?? 0
|
|
|
15
|
+ const menuButtonInfo = uni.getMenuButtonBoundingClientRect()
|
|
|
16
|
+
|
|
|
17
|
+ const navBarHeight = computed(() => {
|
|
|
18
|
+ // const propsHeight = Number(props.height)
|
|
|
19
|
+ let defaultHeight = 44
|
|
|
20
|
+ // #ifdef MP
|
|
|
21
|
+ // if (props.fixed) {
|
|
|
22
|
+ const menuButtonInfo = uni.getMenuButtonBoundingClientRect()
|
|
|
23
|
+ const menuHeight = menuButtonInfo.height
|
|
|
24
|
+ const menuTop = menuButtonInfo.top
|
|
|
25
|
+ // console.log(menuButtonInfo)
|
|
|
26
|
+ defaultHeight = (menuTop - statusBarHeight) * 2 + menuHeight
|
|
|
27
|
+ // }
|
|
|
28
|
+ // #endif
|
|
|
29
|
+ // return propsHeight || defaultHeight
|
|
|
30
|
+ return defaultHeight
|
|
|
31
|
+ })
|
|
|
32
|
+ const currentIndex=ref(0)
|
|
|
33
|
+
|
|
|
34
|
+ const navBarStyle = computed(() => {
|
|
|
35
|
+ return {
|
|
|
36
|
+ paddingTop: `${statusBarHeight}px`,
|
|
|
37
|
+ }
|
|
|
38
|
+ })
|
|
|
39
|
+
|
|
|
40
|
+ const props = defineProps({
|
|
|
41
|
+ exClass: {
|
|
|
42
|
+ type: String
|
|
|
43
|
+ },
|
|
|
44
|
+ // userInfo: {
|
|
|
45
|
+ // type: Object as PropType<UserInfoModel>,
|
|
|
46
|
+ // required: true
|
|
|
47
|
+ // },
|
|
|
48
|
+ yanglaojin: {
|
|
|
49
|
+ type: Number,
|
|
|
50
|
+ default: NaN
|
|
|
51
|
+ }
|
|
|
52
|
+ })
|
|
|
53
|
+ function handleClick() {
|
|
|
54
|
+ if (userStore.userInfo && userStore.uid) {
|
|
|
55
|
+ uni.navigateTo({
|
|
|
56
|
+ url: '/pages/annuity/index'
|
|
|
57
|
+ })
|
|
|
58
|
+ } else {
|
|
|
59
|
+ uni.navigateTo({
|
|
|
60
|
+ url: '/pages/user/login/index?key=30'
|
|
|
61
|
+ })
|
|
|
62
|
+ }
|
|
|
63
|
+ }
|
|
|
64
|
+ // function handleShowSearchPage() {
|
|
|
65
|
+ //
|
|
|
66
|
+ // }
|
|
|
67
|
+
|
|
|
68
|
+ function handleShowMessage() {
|
|
|
69
|
+ uni.navigateTo({
|
|
|
70
|
+ url: '/pages/message/index'
|
|
|
71
|
+ })
|
|
|
72
|
+ }
|
|
|
73
|
+ function handleClickser() {
|
|
|
74
|
+ uni.navigateTo({
|
|
|
75
|
+ url: '/pages/search/index'
|
|
|
76
|
+ })
|
|
|
77
|
+ }
|
|
|
78
|
+
|
|
|
79
|
+ function onTabClick(position:number){
|
|
|
80
|
+ console.log("===onTabClick",position);
|
|
|
81
|
+ currentIndex.value=position
|
|
|
82
|
+ }
|
|
73
|
83
|
</script>
|
|
74
|
84
|
<template>
|
|
75
|
|
- <div class="home-header fixed w-screen text-white z-10" :style="navBarStyle" :class="exClass">
|
|
76
|
|
- <div class="flex">
|
|
77
|
|
- <div @click="handleClick" class="flex gap-2 mb-2 pl-2 flex-1">
|
|
78
|
|
- <image v-if="userStore && userStore.userInfo && userStore.userInfo.avatar" :src="userStore.userInfo.avatar"
|
|
79
|
|
- style="width:74rpx; height:74rpx;" class="rounded-full" />
|
|
80
|
|
- <image v-else src="https://app.bjtdba.com/uploads/logo.jpg" mode="widthFix" class="w-9 h-9 rounded-full" />
|
|
81
|
|
- <div class="flex flex-col ">
|
|
82
|
|
- <div class="text-sm" v-if="userStore.userInfo && userStore.userInfo.nickname">{{ userStore.userInfo.nickname ?
|
|
|
85
|
+ <div class="home-header-content home-header fixed w-screen text-white z-10" :style="navBarStyle">
|
|
|
86
|
+ <image class="top-bg" src="/static/img/jd_bg.png" mode="widthFix"></image>
|
|
|
87
|
+ <div class="flex user-info">
|
|
|
88
|
+ <div @click="handleClick" class="flex gap-2 mb-2 pl-2 flex-1">
|
|
|
89
|
+ <image v-if="userStore && userStore.userInfo && userStore.userInfo.avatar"
|
|
|
90
|
+ :src="userStore.userInfo.avatar" style="width:74rpx; height:74rpx;" class="rounded-full" />
|
|
|
91
|
+ <image v-else src="https://app.bjtdba.com/uploads/logo.jpg" mode="widthFix"
|
|
|
92
|
+ class="w-9 h-9 rounded-full" />
|
|
|
93
|
+ <div class="flex flex-col ">
|
|
|
94
|
+ <div class="text-sm" v-if="userStore &&userStore.userInfo && userStore.userInfo.nickname">{{ userStore.userInfo.nickname ?
|
|
83
|
95
|
userStore.userInfo.nickname : '登录' }}</div>
|
|
84
|
|
- <div class="text-sm" v-else>登录</div>
|
|
85
|
|
- <div class="text-xs" v-if="!isNaN(yanglaojin) && userStore.userInfo">{{ yanglaojin }}元养老金</div>
|
|
86
|
|
- <div v-else class="text-xs">
|
|
87
|
|
- 领取养老金
|
|
88
|
|
- </div>
|
|
89
|
|
- </div>
|
|
90
|
|
-
|
|
91
|
|
- </div>
|
|
92
|
|
- <div class=" right-26 flex flex-col text-[10px] justify-center items-center " @tap.stop="handleShowMessage"
|
|
93
|
|
- :style="{ marginRight: `${menuButtonInfo.width + 15}px` }">
|
|
94
|
|
- <image src="/static/icon/message-dark.png" mode="widthFix" class="w-4 h-4" v-if="exClass"></image>
|
|
95
|
|
- <image src="/static/icon/message.png" mode="widthFix" class="w-4 h-4" v-else></image>
|
|
96
|
|
- <div>消息</div>
|
|
97
|
|
- </div>
|
|
98
|
|
-
|
|
99
|
|
-
|
|
100
|
|
- </div>
|
|
101
|
|
- <div class="p_3">
|
|
102
|
|
- <!-- 搜索 -->
|
|
103
|
|
- <div @click="handleClickser"
|
|
104
|
|
- class="w-full bg-white rounded-full flex flex-row justify-between items-center border-solid border-1 border-red h-8">
|
|
105
|
|
-
|
|
106
|
|
- <image src="https://cdn.bjtdba.com/vod/image/2023-02-15/20230215112840149.png" mode="widthFix"
|
|
107
|
|
- class="w-5 h-5 pl-2 py-1"></image>
|
|
108
|
|
- <div class="flex flex-1 w-100%">
|
|
109
|
|
- <div class="flex-1 guand ">输入商品关键字</div>
|
|
110
|
|
- <div class="bg-[#D71608] text-white text-xs w-11 rounded-full text-center p-1.5 mr-0.5 ">
|
|
111
|
|
- 搜索
|
|
112
|
|
- </div>
|
|
113
|
|
- </div>
|
|
114
|
|
-
|
|
115
|
|
-
|
|
116
|
|
- </div>
|
|
117
|
|
-
|
|
118
|
|
- </div>
|
|
119
|
|
-
|
|
120
|
|
- </div>
|
|
|
96
|
+ <div class="text-sm" v-else>登录</div>
|
|
|
97
|
+ <div class="text-xs" v-if="!isNaN(yanglaojin) && userStore &&userStore.userInfo">{{ yanglaojin }}元养老金</div>
|
|
|
98
|
+ <div v-else class="text-xs">
|
|
|
99
|
+ 领取养老金
|
|
|
100
|
+ </div>
|
|
|
101
|
+ </div>
|
|
|
102
|
+ </div>
|
|
|
103
|
+ <div class=" right-26 flex flex-col text-[10px] justify-center items-center " @tap.stop="handleShowMessage"
|
|
|
104
|
+ :style="{ marginRight: `${menuButtonInfo.width + 15}px` }">
|
|
|
105
|
+ <image src="/static/icon/message-dark.png" mode="widthFix" class="w-4 h-4" v-if="exClass"></image>
|
|
|
106
|
+ <image src="/static/icon/message.png" mode="widthFix" class="w-4 h-4" v-else></image>
|
|
|
107
|
+ <div>消息</div>
|
|
|
108
|
+ </div>
|
|
|
109
|
+ </div>
|
|
|
110
|
+
|
|
|
111
|
+ <view class="head-conent">
|
|
|
112
|
+ <div class="p_3">
|
|
|
113
|
+ <!-- 搜索 -->
|
|
|
114
|
+ <div @click="handleClickser"
|
|
|
115
|
+ class="w-full bg-white rounded-full flex flex-row justify-between items-center border-solid border-1 border-red h-8">
|
|
|
116
|
+ <image src="https://cdn.bjtdba.com/vod/image/2023-02-15/20230215112840149.png" mode="widthFix"
|
|
|
117
|
+ class="w-5 h-5 pl-2 py-1"></image>
|
|
|
118
|
+ <div class="flex flex-1 w-100%">
|
|
|
119
|
+ <div class="flex-1 guand ">输入商品关键字</div>
|
|
|
120
|
+ <div class="bg-[#D71608] text-white text-xs w-11 rounded-full text-center p-1.5 mr-0.5 ">
|
|
|
121
|
+ 搜索
|
|
|
122
|
+ </div>
|
|
|
123
|
+ </div>
|
|
|
124
|
+ </div>
|
|
|
125
|
+ </div>
|
|
|
126
|
+
|
|
|
127
|
+ <view class="lab-content">
|
|
|
128
|
+ <scroll-view scroll-x="true" class="lab-item">
|
|
|
129
|
+ <view class="lab-item-x" v-for="(item,index) in TOP_LAB_ARR">
|
|
|
130
|
+ <view class="lab-item-small" @click="onTabClick(index)">
|
|
|
131
|
+ <text :class="currentIndex==index?'lab-title':'lab-default-title'" >{{item.title}}</text>
|
|
|
132
|
+ <view :class="currentIndex==index?'lab-line':'lab-default-line'"></view>
|
|
|
133
|
+ </view>
|
|
|
134
|
+ </view>
|
|
|
135
|
+ </scroll-view>
|
|
|
136
|
+ </view>
|
|
|
137
|
+
|
|
|
138
|
+ </view>
|
|
|
139
|
+
|
|
|
140
|
+ </div>
|
|
121
|
141
|
</template>
|
|
122
|
|
-<style scoped>
|
|
123
|
|
-.p_3 {
|
|
124
|
|
- padding-left: 24rpx;
|
|
125
|
|
- padding-right: 24rpx;
|
|
126
|
|
-}
|
|
127
|
|
-
|
|
128
|
|
-.guand {
|
|
129
|
|
- padding-left: 10rpx;
|
|
130
|
|
- line-height: 56rpx;
|
|
131
|
|
- color: #9ca3af
|
|
132
|
|
-}
|
|
|
142
|
+<style scoped lang="scss">
|
|
|
143
|
+ .home-header-content {
|
|
|
144
|
+ display: flex;
|
|
|
145
|
+ flex-direction: column;
|
|
|
146
|
+ }
|
|
|
147
|
+
|
|
|
148
|
+ .p_3 {
|
|
|
149
|
+ padding-left: 24rpx;
|
|
|
150
|
+ padding-right: 24rpx;
|
|
|
151
|
+ }
|
|
|
152
|
+
|
|
|
153
|
+ .guand {
|
|
|
154
|
+ padding-left: 10rpx;
|
|
|
155
|
+ line-height: 56rpx;
|
|
|
156
|
+ color: #9ca3af
|
|
|
157
|
+ }
|
|
|
158
|
+
|
|
|
159
|
+ .user-info {
|
|
|
160
|
+ z-index: 666;
|
|
|
161
|
+ }
|
|
|
162
|
+
|
|
|
163
|
+ .lab-content {
|
|
|
164
|
+ width: 100%;
|
|
|
165
|
+ height: 90rpx;
|
|
|
166
|
+ display: flex;
|
|
|
167
|
+ flex-direction: row;
|
|
|
168
|
+ align-items: center;
|
|
|
169
|
+ margin-top: 20rpx;
|
|
|
170
|
+
|
|
|
171
|
+ .lab-item {
|
|
|
172
|
+ display: flex;
|
|
|
173
|
+ flex-direction: row;
|
|
|
174
|
+ white-space: nowrap;
|
|
|
175
|
+ width: 100%;
|
|
|
176
|
+ }
|
|
|
177
|
+
|
|
|
178
|
+ .lab-item-x {
|
|
|
179
|
+ display: inline-block;
|
|
|
180
|
+ margin-right: 10px;
|
|
|
181
|
+ text-align: center;
|
|
|
182
|
+ }
|
|
|
183
|
+ .lab-item-small{
|
|
|
184
|
+ display: flex;
|
|
|
185
|
+ flex-direction: column;
|
|
|
186
|
+ align-items: center;
|
|
|
187
|
+ width: 124rpx;
|
|
|
188
|
+
|
|
|
189
|
+ .lab-default-title {
|
|
|
190
|
+ font-size: 28rpx;
|
|
|
191
|
+ margin-bottom: 10rpx;
|
|
|
192
|
+ }
|
|
|
193
|
+ .lab-title {
|
|
|
194
|
+ font-size: 32rpx;
|
|
|
195
|
+ margin-bottom: 10rpx;
|
|
|
196
|
+ }
|
|
|
197
|
+ .lab-line{
|
|
|
198
|
+ width: 50rpx;
|
|
|
199
|
+ height: 6rpx;
|
|
|
200
|
+ background-color: #FFF;
|
|
|
201
|
+ border-radius: 4rpx;
|
|
|
202
|
+ }
|
|
|
203
|
+
|
|
|
204
|
+ .lab-default-line{
|
|
|
205
|
+ width: 50rpx;
|
|
|
206
|
+ height: 6rpx;
|
|
|
207
|
+ border-radius: 4rpx;
|
|
|
208
|
+ }
|
|
|
209
|
+
|
|
|
210
|
+ }
|
|
|
211
|
+ }
|
|
|
212
|
+
|
|
|
213
|
+ .user-info {
|
|
|
214
|
+ z-index: 666;
|
|
|
215
|
+ }
|
|
|
216
|
+
|
|
|
217
|
+ .head-conent {
|
|
|
218
|
+ z-index: 666;
|
|
|
219
|
+ display: flex;
|
|
|
220
|
+ flex-direction: column;
|
|
|
221
|
+ }
|
|
|
222
|
+
|
|
|
223
|
+ .top-bg {
|
|
|
224
|
+ width: 100%;
|
|
|
225
|
+ height: 100rpx;
|
|
|
226
|
+ position: absolute;
|
|
|
227
|
+ top: 0;
|
|
|
228
|
+ left: 0;
|
|
|
229
|
+ }
|
|
133
|
230
|
</style>
|