@tplc/business 0.4.6 → 0.4.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +10 -0
- package/components/lcb-list/components/FilterList/index.vue +1 -1
- package/components/lcb-map/lcb-map.vue +1 -1
- package/components/lcb-search/api.ts +26 -0
- package/components/lcb-search/components/SearchHistory/index.vue +121 -0
- package/components/lcb-search/components/SearchList/index.vue +157 -0
- package/components/lcb-search/lcb-search.vue +52 -2
- package/components/lcb-search/types.ts +4 -0
- package/hooks/useAutoHeight.ts +3 -1
- package/package.json +1 -1
- package/types/components/lcb-search/api.d.ts +23 -0
- package/types/components/lcb-search/components/SearchHistory/index.vue.d.ts +48 -0
- package/types/components/lcb-search/components/SearchList/index.vue.d.ts +36 -0
- package/types/components/lcb-search/lcb-search.vue.d.ts +65 -0
- package/types/components/lcb-search/types.d.ts +2 -0
- package/types/hooks/useAutoHeight.d.ts +4 -1
- package/types/utils/utils.d.ts +1 -0
- package/utils/utils.ts +10 -0
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,16 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
|
4
4
|
|
|
5
|
+
### [0.4.7](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/compare/v0.4.6...v0.4.7) (2025-03-25)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### ✨ Features | 新功能
|
|
9
|
+
|
|
10
|
+
* 修改字段 ([659d081](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/659d081b746f63f4502abd03b7137d1247419453))
|
|
11
|
+
* 新增historuy ([7a2fd5d](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/7a2fd5d467365d068080ff8affc01d8d0124ccbd))
|
|
12
|
+
* 新增search list ([d3aef1e](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/d3aef1ef5a024280946071d17e54b2c70057e56a))
|
|
13
|
+
* 新增数据 ([79f5a41](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/79f5a4134e246fa22f6f01b99b6e1de78dc1581e))
|
|
14
|
+
|
|
5
15
|
### [0.4.6](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/compare/v0.4.5...v0.4.6) (2025-03-24)
|
|
6
16
|
|
|
7
17
|
|
|
@@ -36,7 +36,7 @@ const emits = defineEmits(['refresh'])
|
|
|
36
36
|
const props = defineProps<LcbFilterListProps>()
|
|
37
37
|
const dataList = ref<unknown[]>([])
|
|
38
38
|
const paging = ref()
|
|
39
|
-
const height = useAutoHeight()
|
|
39
|
+
const { height } = useAutoHeight()
|
|
40
40
|
const form = inject<Ref<Record<string, any>>>(FORM_KEY)
|
|
41
41
|
const refreshed = ref(false)
|
|
42
42
|
useZPaging(paging)
|
|
@@ -69,7 +69,7 @@ import { LcbListProps } from '@tplc/business/components/lcb-list/types'
|
|
|
69
69
|
import { LcbListInfo } from '@tplc/business/components/lcb-list/api'
|
|
70
70
|
import { debounce } from '@tplc/wot/components/common/util'
|
|
71
71
|
import useLocation from '../../hooks/useLocation'
|
|
72
|
-
const height = useAutoHeight()
|
|
72
|
+
const { height } = useAutoHeight()
|
|
73
73
|
defineOptions({
|
|
74
74
|
name: 'LcbMap',
|
|
75
75
|
options: {
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export interface ProductInfo {
|
|
2
|
+
productImg: string
|
|
3
|
+
productName: string
|
|
4
|
+
address: string
|
|
5
|
+
tags: string
|
|
6
|
+
price: number
|
|
7
|
+
priceSuffix: string
|
|
8
|
+
addressIntro: string
|
|
9
|
+
scoreAvg: number
|
|
10
|
+
productType: string
|
|
11
|
+
titleIcon: string
|
|
12
|
+
distanceTips: string
|
|
13
|
+
productTypeIcon: string
|
|
14
|
+
searchResultTips: string
|
|
15
|
+
link: {
|
|
16
|
+
jumpUrl: string
|
|
17
|
+
}
|
|
18
|
+
productInfoId: string
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export const getProductInfoFilteredPage = (params: {
|
|
22
|
+
keywords?: string
|
|
23
|
+
productTypeList?: string[]
|
|
24
|
+
}) => {
|
|
25
|
+
return uni.$lcb.http.post<ProductInfo[]>('/productInfo/filteredPage', params)
|
|
26
|
+
}
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<view class="search-history p-3" v-if="historyList.length">
|
|
3
|
+
<view class="header flex justify-between items-center">
|
|
4
|
+
<text class="text-3.5 font-500">{{ translate('历史搜索') }}</text>
|
|
5
|
+
<wd-icon
|
|
6
|
+
name="delete1"
|
|
7
|
+
size="32rpx"
|
|
8
|
+
@click="clearHistory"
|
|
9
|
+
color="#969696"
|
|
10
|
+
custom-class="pl-3"
|
|
11
|
+
/>
|
|
12
|
+
</view>
|
|
13
|
+
<view class="history-list flex flex-wrap gap-2 mt-3">
|
|
14
|
+
<view
|
|
15
|
+
v-for="(item, index) in historyList"
|
|
16
|
+
:key="index"
|
|
17
|
+
class="history-item bg-#F5F5F5 rounded-full px-2 py-1 text-3"
|
|
18
|
+
@click="handleSelect(item)"
|
|
19
|
+
>
|
|
20
|
+
{{ item.productName }}
|
|
21
|
+
</view>
|
|
22
|
+
</view>
|
|
23
|
+
</view>
|
|
24
|
+
</template>
|
|
25
|
+
|
|
26
|
+
<script lang="ts" setup>
|
|
27
|
+
import { useTranslate } from '@tplc/wot'
|
|
28
|
+
import { ProductInfo } from '../../api'
|
|
29
|
+
import { ref, onMounted } from 'vue'
|
|
30
|
+
|
|
31
|
+
defineOptions({
|
|
32
|
+
name: 'LcbSearchHistory',
|
|
33
|
+
options: {
|
|
34
|
+
addGlobalClass: true,
|
|
35
|
+
virtualHost: true,
|
|
36
|
+
styleIsolation: 'shared',
|
|
37
|
+
},
|
|
38
|
+
})
|
|
39
|
+
|
|
40
|
+
const { translate } = useTranslate()
|
|
41
|
+
const props = defineProps({
|
|
42
|
+
storageKey: {
|
|
43
|
+
type: String,
|
|
44
|
+
required: true,
|
|
45
|
+
default: 'default-search-history',
|
|
46
|
+
},
|
|
47
|
+
maxLength: {
|
|
48
|
+
type: Number,
|
|
49
|
+
default: 10,
|
|
50
|
+
},
|
|
51
|
+
})
|
|
52
|
+
|
|
53
|
+
const emit = defineEmits(['select'])
|
|
54
|
+
|
|
55
|
+
const historyList = ref<ProductInfo[]>([])
|
|
56
|
+
|
|
57
|
+
// 从本地存储获取历史记录
|
|
58
|
+
const getHistory = () => {
|
|
59
|
+
try {
|
|
60
|
+
const history = uni.getStorageSync(props.storageKey)
|
|
61
|
+
historyList.value = history || []
|
|
62
|
+
} catch (error) {
|
|
63
|
+
historyList.value = []
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
// 保存历史记录
|
|
68
|
+
const saveHistory = (keyword: ProductInfo) => {
|
|
69
|
+
try {
|
|
70
|
+
const list = historyList.value
|
|
71
|
+
// 删除已存在的相同记录
|
|
72
|
+
const index = list.findIndex((item) => item.productInfoId === keyword.productInfoId)
|
|
73
|
+
if (index !== -1) {
|
|
74
|
+
list.splice(index, 1)
|
|
75
|
+
}
|
|
76
|
+
// 将新记录添加到开头
|
|
77
|
+
list.unshift(keyword)
|
|
78
|
+
// 限制最大长度
|
|
79
|
+
if (list.length > props.maxLength) {
|
|
80
|
+
list.pop()
|
|
81
|
+
}
|
|
82
|
+
// 保存到本地存储
|
|
83
|
+
uni.setStorageSync(props.storageKey, list)
|
|
84
|
+
historyList.value = list
|
|
85
|
+
} catch (error) {
|
|
86
|
+
console.error('保存搜索历史失败:', error)
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
// 清空历史记录
|
|
91
|
+
const clearHistory = () => {
|
|
92
|
+
try {
|
|
93
|
+
uni.removeStorageSync(props.storageKey)
|
|
94
|
+
historyList.value = []
|
|
95
|
+
} catch (error) {
|
|
96
|
+
console.error('清空搜索历史失败:', error)
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
// 选择历史记录
|
|
101
|
+
const handleSelect = (keyword: ProductInfo) => {
|
|
102
|
+
emit('select', keyword)
|
|
103
|
+
}
|
|
104
|
+
defineExpose({
|
|
105
|
+
saveHistory,
|
|
106
|
+
})
|
|
107
|
+
onMounted(() => {
|
|
108
|
+
getHistory()
|
|
109
|
+
})
|
|
110
|
+
</script>
|
|
111
|
+
|
|
112
|
+
<style lang="scss" scoped>
|
|
113
|
+
.search-history {
|
|
114
|
+
.history-item {
|
|
115
|
+
max-width: 150rpx;
|
|
116
|
+
overflow: hidden;
|
|
117
|
+
text-overflow: ellipsis;
|
|
118
|
+
white-space: nowrap;
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
</style>
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<z-paging
|
|
3
|
+
ref="paging"
|
|
4
|
+
:auto="true"
|
|
5
|
+
v-model="dataList"
|
|
6
|
+
@query="queryList"
|
|
7
|
+
:height="height"
|
|
8
|
+
:fixed="false"
|
|
9
|
+
:use-page-scroll="false"
|
|
10
|
+
>
|
|
11
|
+
<template #top>
|
|
12
|
+
<view class="p-2 box-border bg-[#f5f5f5] text-left text-#969696 text-3 mt-2">
|
|
13
|
+
当前目的地及周边查询结果(酒店起价为参考价)
|
|
14
|
+
</view>
|
|
15
|
+
</template>
|
|
16
|
+
<view
|
|
17
|
+
class="flex border-b p-2 text-3 box-border"
|
|
18
|
+
v-for="(item, index) in dataList"
|
|
19
|
+
:key="index"
|
|
20
|
+
@click="handleSelect(item)"
|
|
21
|
+
>
|
|
22
|
+
<img
|
|
23
|
+
:src="item.productTypeIcon"
|
|
24
|
+
v-if="item.productTypeIcon"
|
|
25
|
+
class="mt-0.5 mr-2 w-3.5 h-3.5 object-cover"
|
|
26
|
+
/>
|
|
27
|
+
<view class="w-full">
|
|
28
|
+
<view class="flex items-center">
|
|
29
|
+
<view class="flex-1 flex items-center">
|
|
30
|
+
<view class="text-3.5 font-500">
|
|
31
|
+
<text
|
|
32
|
+
v-for="(textPart, i) in highlightText(item.productName)"
|
|
33
|
+
:key="i"
|
|
34
|
+
:class="textPart.highlight ? 'text-primary' : ''"
|
|
35
|
+
>
|
|
36
|
+
{{ textPart.text }}
|
|
37
|
+
</text>
|
|
38
|
+
</view>
|
|
39
|
+
<img :src="item.titleIcon" v-if="item.titleIcon" class="ml-1 w-3 h-3 object-cover" />
|
|
40
|
+
</view>
|
|
41
|
+
<view v-if="item.price">
|
|
42
|
+
<text class="font-600 text-primary text-3.5">¥{{ item.price }}</text>
|
|
43
|
+
<text>{{ item.priceSuffix }}</text>
|
|
44
|
+
</view>
|
|
45
|
+
<view v-else-if="item.tags">
|
|
46
|
+
{{ getJsonStrFirstUrl(item.tags) }}
|
|
47
|
+
</view>
|
|
48
|
+
</view>
|
|
49
|
+
<view class="text-#333 mt-1 truncate w-75vw" v-if="item.searchResultTips">
|
|
50
|
+
{{ item.searchResultTips }}
|
|
51
|
+
</view>
|
|
52
|
+
</view>
|
|
53
|
+
</view>
|
|
54
|
+
</z-paging>
|
|
55
|
+
</template>
|
|
56
|
+
|
|
57
|
+
<script lang="ts" setup>
|
|
58
|
+
import { ref, watch, inject, Ref } from 'vue'
|
|
59
|
+
import { getProductInfoFilteredPage, ProductInfo } from '../../api'
|
|
60
|
+
import { FORM_KEY } from '../../../../constants'
|
|
61
|
+
import { getJsonStrFirstUrl } from '../../../../utils/transform'
|
|
62
|
+
|
|
63
|
+
defineOptions({
|
|
64
|
+
name: 'LcbSearchList',
|
|
65
|
+
options: {
|
|
66
|
+
addGlobalClass: true,
|
|
67
|
+
virtualHost: true,
|
|
68
|
+
styleIsolation: 'shared',
|
|
69
|
+
},
|
|
70
|
+
})
|
|
71
|
+
const emit = defineEmits(['select'])
|
|
72
|
+
const props = defineProps({
|
|
73
|
+
productTypeList: {
|
|
74
|
+
type: Array as () => string[],
|
|
75
|
+
},
|
|
76
|
+
height: {
|
|
77
|
+
type: String,
|
|
78
|
+
},
|
|
79
|
+
})
|
|
80
|
+
const dataList = ref<ProductInfo[]>([])
|
|
81
|
+
const paging = ref()
|
|
82
|
+
const form = inject<Ref<Record<string, any>>>(FORM_KEY)
|
|
83
|
+
|
|
84
|
+
// 监听表单关键词变化
|
|
85
|
+
watch(
|
|
86
|
+
() => form?.value?.keywords,
|
|
87
|
+
() => {
|
|
88
|
+
paging.value?.reload()
|
|
89
|
+
},
|
|
90
|
+
)
|
|
91
|
+
|
|
92
|
+
// 获取搜索结果
|
|
93
|
+
const queryList = async () => {
|
|
94
|
+
try {
|
|
95
|
+
const { data } = await getProductInfoFilteredPage({
|
|
96
|
+
keywords: form?.value?.keywords,
|
|
97
|
+
productTypeList: props.productTypeList,
|
|
98
|
+
})
|
|
99
|
+
paging.value.complete(data)
|
|
100
|
+
} catch (error) {
|
|
101
|
+
paging.value.complete(false)
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
// 处理选择搜索结果
|
|
106
|
+
const handleSelect = (item: ProductInfo) => {
|
|
107
|
+
emit('select', item)
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
// 高亮匹配的关键词
|
|
111
|
+
const highlightText = (text: string) => {
|
|
112
|
+
const keywords = form?.value?.keywords || ''
|
|
113
|
+
if (!keywords || !text) {
|
|
114
|
+
return [{ text, highlight: false }]
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
const parts: { text: string; highlight: boolean }[] = []
|
|
118
|
+
let lastIndex = 0
|
|
119
|
+
const lowerText = text.toLowerCase()
|
|
120
|
+
const lowerKeyword = keywords.toLowerCase()
|
|
121
|
+
|
|
122
|
+
let index = lowerText.indexOf(lowerKeyword, lastIndex)
|
|
123
|
+
while (index !== -1) {
|
|
124
|
+
// 添加前面不匹配的部分
|
|
125
|
+
if (index > lastIndex) {
|
|
126
|
+
parts.push({
|
|
127
|
+
text: text.substring(lastIndex, index),
|
|
128
|
+
highlight: false,
|
|
129
|
+
})
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
// 添加匹配的部分
|
|
133
|
+
parts.push({
|
|
134
|
+
text: text.substring(index, index + keywords.length),
|
|
135
|
+
highlight: true,
|
|
136
|
+
})
|
|
137
|
+
|
|
138
|
+
lastIndex = index + keywords.length
|
|
139
|
+
index = lowerText.indexOf(lowerKeyword, lastIndex)
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
// 添加最后不匹配的部分
|
|
143
|
+
if (lastIndex < text.length) {
|
|
144
|
+
parts.push({
|
|
145
|
+
text: text.substring(lastIndex),
|
|
146
|
+
highlight: false,
|
|
147
|
+
})
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
return parts
|
|
151
|
+
}
|
|
152
|
+
</script>
|
|
153
|
+
<style lang="scss" scoped>
|
|
154
|
+
.border-b {
|
|
155
|
+
border-bottom: 1px solid #eeeeee;
|
|
156
|
+
}
|
|
157
|
+
</style>
|
|
@@ -64,6 +64,20 @@
|
|
|
64
64
|
</lcb-action-view>
|
|
65
65
|
</view>
|
|
66
66
|
</lcb-block>
|
|
67
|
+
<view id="searchPagingTop"></view>
|
|
68
|
+
<view
|
|
69
|
+
class="fixed left-0 w-full z-1 bg-white"
|
|
70
|
+
:style="{ height: height, top: top }"
|
|
71
|
+
v-if="form?.keywords && productTypeList"
|
|
72
|
+
>
|
|
73
|
+
<lcb-search-list :productTypeList="productTypeList" @select="onSelect" :height="height" />
|
|
74
|
+
</view>
|
|
75
|
+
<lcb-search-history
|
|
76
|
+
:historyKey="historyKey"
|
|
77
|
+
v-if="historyKey"
|
|
78
|
+
ref="searchHistoryRef"
|
|
79
|
+
@select="onSelect"
|
|
80
|
+
/>
|
|
67
81
|
</template>
|
|
68
82
|
|
|
69
83
|
<script setup lang="ts">
|
|
@@ -72,9 +86,14 @@ import { transformValueUnit } from '../../utils/transform'
|
|
|
72
86
|
import { ChildHotAddress } from '../lcb-city-select/api'
|
|
73
87
|
import useLocation from '../../hooks/useLocation'
|
|
74
88
|
import { getHistoryCity } from '../../utils/history'
|
|
75
|
-
import { stringify } from 'qs'
|
|
89
|
+
import { parse, stringify } from 'qs'
|
|
76
90
|
import { inject, Ref, ref } from 'vue'
|
|
77
91
|
import { FORM_KEY } from '../../constants'
|
|
92
|
+
import LcbSearchHistory from './components/SearchHistory/index.vue'
|
|
93
|
+
import LcbSearchList from './components/SearchList/index.vue'
|
|
94
|
+
import { ProductInfo } from './api'
|
|
95
|
+
import useAutoHeight from '../../hooks/useAutoHeight'
|
|
96
|
+
import { getCurrentPage, getPreviousPageId } from '../../utils/utils'
|
|
78
97
|
defineOptions({
|
|
79
98
|
name: 'LcbSearch',
|
|
80
99
|
options: {
|
|
@@ -90,9 +109,14 @@ withDefaults(defineProps<LcbSearchProps>(), {
|
|
|
90
109
|
color: '#000',
|
|
91
110
|
iconColor: '#000',
|
|
92
111
|
gap: 16,
|
|
112
|
+
paddingVertical: 12,
|
|
113
|
+
marginHorizontal: 24,
|
|
93
114
|
cityColor: '#000',
|
|
94
115
|
citySize: 24,
|
|
95
116
|
cityIconSize: 24,
|
|
117
|
+
radius: 48,
|
|
118
|
+
paddingHorizontal: 24,
|
|
119
|
+
borderColor: '#969696',
|
|
96
120
|
cityIconColor: '#000',
|
|
97
121
|
lineColor: '#000',
|
|
98
122
|
lineWidth: 2,
|
|
@@ -102,15 +126,41 @@ withDefaults(defineProps<LcbSearchProps>(), {
|
|
|
102
126
|
mode: 'link',
|
|
103
127
|
fontSize: 24,
|
|
104
128
|
})
|
|
129
|
+
const searchHistoryRef = ref<InstanceType<typeof LcbSearchHistory>>()
|
|
130
|
+
const { height, top } = useAutoHeight('searchPagingTop')
|
|
105
131
|
const { getLocation, userLocation } = useLocation()
|
|
106
132
|
const addressCity = ref<ChildHotAddress | undefined>(getHistoryCity())
|
|
107
133
|
getLocation()
|
|
108
134
|
const form = inject<Ref<Record<string, any>>>(FORM_KEY)
|
|
109
|
-
const onSearch = (e: { detail: { value: string } }) => {
|
|
135
|
+
const onSearch = async (e: { detail: { value: string } }) => {
|
|
110
136
|
if (form) {
|
|
111
137
|
form.value.keywords = e.detail.value
|
|
112
138
|
}
|
|
113
139
|
}
|
|
140
|
+
const onSelect = (keyword: ProductInfo) => {
|
|
141
|
+
searchHistoryRef.value?.saveHistory(keyword)
|
|
142
|
+
const [path, query] = keyword.link.jumpUrl.split('?')
|
|
143
|
+
let queryParams = query ? parse(query) : {}
|
|
144
|
+
const options = getCurrentPage().options
|
|
145
|
+
queryParams = {
|
|
146
|
+
keywords: form?.value?.keywords,
|
|
147
|
+
endDate: options.endDate,
|
|
148
|
+
startDate: options.startDate,
|
|
149
|
+
cityName: options.cityName,
|
|
150
|
+
addressName: options.addressName,
|
|
151
|
+
areaId: options.areaId,
|
|
152
|
+
cityId: options.cityId,
|
|
153
|
+
...queryParams,
|
|
154
|
+
}
|
|
155
|
+
if (options.jumpType !== 'jump') {
|
|
156
|
+
uni.$emit(`${getPreviousPageId()}_filter_change`, queryParams)
|
|
157
|
+
uni.navigateBack()
|
|
158
|
+
} else {
|
|
159
|
+
uni.navigateTo({
|
|
160
|
+
url: path + '?' + stringify(queryParams),
|
|
161
|
+
})
|
|
162
|
+
}
|
|
163
|
+
}
|
|
114
164
|
</script>
|
|
115
165
|
|
|
116
166
|
<style lang="scss" scoped>
|
|
@@ -15,6 +15,8 @@ export type LcbSearchProps = {
|
|
|
15
15
|
|
|
16
16
|
mode?: 'search' | 'link'
|
|
17
17
|
|
|
18
|
+
productTypeList?: string[]
|
|
19
|
+
|
|
18
20
|
city?: boolean
|
|
19
21
|
cityColor?: string
|
|
20
22
|
citySize?: number
|
|
@@ -24,5 +26,7 @@ export type LcbSearchProps = {
|
|
|
24
26
|
lineWidth?: number
|
|
25
27
|
linePadding?: number
|
|
26
28
|
lineHeight?: number
|
|
29
|
+
|
|
30
|
+
historyKey?: string
|
|
27
31
|
} & LcbActionViewProps &
|
|
28
32
|
LcbBlockProps
|
package/hooks/useAutoHeight.ts
CHANGED
|
@@ -6,9 +6,11 @@ const useAutoHeight = (id = 'pagingTop') => {
|
|
|
6
6
|
const isTabBar = uni.$lcb.getIsTabbar()
|
|
7
7
|
const viewPageHeight = isH5 ? window.innerHeight : uni.getWindowInfo().screenHeight
|
|
8
8
|
const height = ref('')
|
|
9
|
+
const top = ref(0)
|
|
9
10
|
onMounted(() => {
|
|
10
11
|
setTimeout(() => {
|
|
11
12
|
getRect(`#${id}`, false, proxy).then((res) => {
|
|
13
|
+
top.value = res.top || 0
|
|
12
14
|
if (!isTabBar) {
|
|
13
15
|
height.value = `${viewPageHeight - (res.top || 0)}px`
|
|
14
16
|
} else {
|
|
@@ -17,6 +19,6 @@ const useAutoHeight = (id = 'pagingTop') => {
|
|
|
17
19
|
})
|
|
18
20
|
}, 200)
|
|
19
21
|
})
|
|
20
|
-
return height
|
|
22
|
+
return { height, top }
|
|
21
23
|
}
|
|
22
24
|
export default useAutoHeight
|
package/package.json
CHANGED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export interface ProductInfo {
|
|
2
|
+
productImg: string
|
|
3
|
+
productName: string
|
|
4
|
+
address: string
|
|
5
|
+
tags: string
|
|
6
|
+
price: number
|
|
7
|
+
priceSuffix: string
|
|
8
|
+
addressIntro: string
|
|
9
|
+
scoreAvg: number
|
|
10
|
+
productType: string
|
|
11
|
+
titleIcon: string
|
|
12
|
+
distanceTips: string
|
|
13
|
+
productTypeIcon: string
|
|
14
|
+
searchResultTips: string
|
|
15
|
+
link: {
|
|
16
|
+
jumpUrl: string
|
|
17
|
+
}
|
|
18
|
+
productInfoId: string
|
|
19
|
+
}
|
|
20
|
+
export declare const getProductInfoFilteredPage: (params: {
|
|
21
|
+
keywords?: string
|
|
22
|
+
productTypeList?: string[]
|
|
23
|
+
}) => Promise<import('../../action').IResData<ProductInfo[]>>
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { ProductInfo } from '../../api'
|
|
2
|
+
declare const _default: import('vue').DefineComponent<
|
|
3
|
+
{
|
|
4
|
+
storageKey: {
|
|
5
|
+
type: StringConstructor
|
|
6
|
+
required: true
|
|
7
|
+
default: string
|
|
8
|
+
}
|
|
9
|
+
maxLength: {
|
|
10
|
+
type: NumberConstructor
|
|
11
|
+
default: number
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
saveHistory: (keyword: ProductInfo) => void
|
|
16
|
+
},
|
|
17
|
+
unknown,
|
|
18
|
+
{},
|
|
19
|
+
{},
|
|
20
|
+
import('vue').ComponentOptionsMixin,
|
|
21
|
+
import('vue').ComponentOptionsMixin,
|
|
22
|
+
{
|
|
23
|
+
select: (...args: any[]) => void
|
|
24
|
+
},
|
|
25
|
+
string,
|
|
26
|
+
import('vue').PublicProps,
|
|
27
|
+
Readonly<
|
|
28
|
+
import('vue').ExtractPropTypes<{
|
|
29
|
+
storageKey: {
|
|
30
|
+
type: StringConstructor
|
|
31
|
+
required: true
|
|
32
|
+
default: string
|
|
33
|
+
}
|
|
34
|
+
maxLength: {
|
|
35
|
+
type: NumberConstructor
|
|
36
|
+
default: number
|
|
37
|
+
}
|
|
38
|
+
}>
|
|
39
|
+
> & {
|
|
40
|
+
onSelect?: ((...args: any[]) => any) | undefined
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
storageKey: string
|
|
44
|
+
maxLength: number
|
|
45
|
+
},
|
|
46
|
+
{}
|
|
47
|
+
>
|
|
48
|
+
export default _default
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
declare const _default: import('vue').DefineComponent<
|
|
2
|
+
{
|
|
3
|
+
productTypeList: {
|
|
4
|
+
type: () => string[]
|
|
5
|
+
}
|
|
6
|
+
height: {
|
|
7
|
+
type: StringConstructor
|
|
8
|
+
}
|
|
9
|
+
},
|
|
10
|
+
{},
|
|
11
|
+
unknown,
|
|
12
|
+
{},
|
|
13
|
+
{},
|
|
14
|
+
import('vue').ComponentOptionsMixin,
|
|
15
|
+
import('vue').ComponentOptionsMixin,
|
|
16
|
+
{
|
|
17
|
+
select: (...args: any[]) => void
|
|
18
|
+
},
|
|
19
|
+
string,
|
|
20
|
+
import('vue').PublicProps,
|
|
21
|
+
Readonly<
|
|
22
|
+
import('vue').ExtractPropTypes<{
|
|
23
|
+
productTypeList: {
|
|
24
|
+
type: () => string[]
|
|
25
|
+
}
|
|
26
|
+
height: {
|
|
27
|
+
type: StringConstructor
|
|
28
|
+
}
|
|
29
|
+
}>
|
|
30
|
+
> & {
|
|
31
|
+
onSelect?: ((...args: any[]) => any) | undefined
|
|
32
|
+
},
|
|
33
|
+
{},
|
|
34
|
+
{}
|
|
35
|
+
>
|
|
36
|
+
export default _default
|
|
@@ -9,9 +9,14 @@ declare const _default: import('vue').DefineComponent<
|
|
|
9
9
|
color: string
|
|
10
10
|
iconColor: string
|
|
11
11
|
gap: number
|
|
12
|
+
paddingVertical: number
|
|
13
|
+
marginHorizontal: number
|
|
12
14
|
cityColor: string
|
|
13
15
|
citySize: number
|
|
14
16
|
cityIconSize: number
|
|
17
|
+
radius: number
|
|
18
|
+
paddingHorizontal: number
|
|
19
|
+
borderColor: string
|
|
15
20
|
cityIconColor: string
|
|
16
21
|
lineColor: string
|
|
17
22
|
lineWidth: number
|
|
@@ -46,6 +51,7 @@ declare const _default: import('vue').DefineComponent<
|
|
|
46
51
|
link?: import('../lcb-action-view/types').LcbActionViewProps
|
|
47
52
|
iconType?: 'icon' | 'img'
|
|
48
53
|
mode?: 'search' | 'link'
|
|
54
|
+
productTypeList?: string[]
|
|
49
55
|
city?: boolean
|
|
50
56
|
cityColor?: string
|
|
51
57
|
citySize?: number
|
|
@@ -55,6 +61,7 @@ declare const _default: import('vue').DefineComponent<
|
|
|
55
61
|
lineWidth?: number
|
|
56
62
|
linePadding?: number
|
|
57
63
|
lineHeight?: number
|
|
64
|
+
historyKey?: string
|
|
58
65
|
} & {
|
|
59
66
|
jumpUrl?: string
|
|
60
67
|
urlParams?: string
|
|
@@ -97,9 +104,14 @@ declare const _default: import('vue').DefineComponent<
|
|
|
97
104
|
color: string
|
|
98
105
|
iconColor: string
|
|
99
106
|
gap: number
|
|
107
|
+
paddingVertical: number
|
|
108
|
+
marginHorizontal: number
|
|
100
109
|
cityColor: string
|
|
101
110
|
citySize: number
|
|
102
111
|
cityIconSize: number
|
|
112
|
+
radius: number
|
|
113
|
+
paddingHorizontal: number
|
|
114
|
+
borderColor: string
|
|
103
115
|
cityIconColor: string
|
|
104
116
|
lineColor: string
|
|
105
117
|
lineWidth: number
|
|
@@ -127,6 +139,7 @@ declare const _default: import('vue').DefineComponent<
|
|
|
127
139
|
link?: import('../lcb-action-view/types').LcbActionViewProps
|
|
128
140
|
iconType?: 'icon' | 'img'
|
|
129
141
|
mode?: 'search' | 'link'
|
|
142
|
+
productTypeList?: string[]
|
|
130
143
|
city?: boolean
|
|
131
144
|
cityColor?: string
|
|
132
145
|
citySize?: number
|
|
@@ -136,6 +149,7 @@ declare const _default: import('vue').DefineComponent<
|
|
|
136
149
|
lineWidth?: number
|
|
137
150
|
linePadding?: number
|
|
138
151
|
lineHeight?: number
|
|
152
|
+
historyKey?: string
|
|
139
153
|
} & {
|
|
140
154
|
jumpUrl?: string
|
|
141
155
|
urlParams?: string
|
|
@@ -156,9 +170,14 @@ declare const _default: import('vue').DefineComponent<
|
|
|
156
170
|
color: string
|
|
157
171
|
iconColor: string
|
|
158
172
|
gap: number
|
|
173
|
+
paddingVertical: number
|
|
174
|
+
marginHorizontal: number
|
|
159
175
|
cityColor: string
|
|
160
176
|
citySize: number
|
|
161
177
|
cityIconSize: number
|
|
178
|
+
radius: number
|
|
179
|
+
paddingHorizontal: number
|
|
180
|
+
borderColor: string
|
|
162
181
|
cityIconColor: string
|
|
163
182
|
lineColor: string
|
|
164
183
|
lineWidth: number
|
|
@@ -186,6 +205,7 @@ declare const _default: import('vue').DefineComponent<
|
|
|
186
205
|
link?: import('../lcb-action-view/types').LcbActionViewProps
|
|
187
206
|
iconType?: 'icon' | 'img'
|
|
188
207
|
mode?: 'search' | 'link'
|
|
208
|
+
productTypeList?: string[]
|
|
189
209
|
city?: boolean
|
|
190
210
|
cityColor?: string
|
|
191
211
|
citySize?: number
|
|
@@ -195,6 +215,7 @@ declare const _default: import('vue').DefineComponent<
|
|
|
195
215
|
lineWidth?: number
|
|
196
216
|
linePadding?: number
|
|
197
217
|
lineHeight?: number
|
|
218
|
+
historyKey?: string
|
|
198
219
|
} & {
|
|
199
220
|
jumpUrl?: string
|
|
200
221
|
urlParams?: string
|
|
@@ -217,9 +238,14 @@ declare const _default: import('vue').DefineComponent<
|
|
|
217
238
|
color: string
|
|
218
239
|
iconColor: string
|
|
219
240
|
gap: number
|
|
241
|
+
paddingVertical: number
|
|
242
|
+
marginHorizontal: number
|
|
220
243
|
cityColor: string
|
|
221
244
|
citySize: number
|
|
222
245
|
cityIconSize: number
|
|
246
|
+
radius: number
|
|
247
|
+
paddingHorizontal: number
|
|
248
|
+
borderColor: string
|
|
223
249
|
cityIconColor: string
|
|
224
250
|
lineColor: string
|
|
225
251
|
lineWidth: number
|
|
@@ -247,6 +273,7 @@ declare const _default: import('vue').DefineComponent<
|
|
|
247
273
|
link?: import('../lcb-action-view/types').LcbActionViewProps
|
|
248
274
|
iconType?: 'icon' | 'img'
|
|
249
275
|
mode?: 'search' | 'link'
|
|
276
|
+
productTypeList?: string[]
|
|
250
277
|
city?: boolean
|
|
251
278
|
cityColor?: string
|
|
252
279
|
citySize?: number
|
|
@@ -256,6 +283,7 @@ declare const _default: import('vue').DefineComponent<
|
|
|
256
283
|
lineWidth?: number
|
|
257
284
|
linePadding?: number
|
|
258
285
|
lineHeight?: number
|
|
286
|
+
historyKey?: string
|
|
259
287
|
} & {
|
|
260
288
|
jumpUrl?: string
|
|
261
289
|
urlParams?: string
|
|
@@ -273,9 +301,14 @@ declare const _default: import('vue').DefineComponent<
|
|
|
273
301
|
color: string
|
|
274
302
|
iconColor: string
|
|
275
303
|
gap: number
|
|
304
|
+
paddingVertical: number
|
|
305
|
+
marginHorizontal: number
|
|
276
306
|
cityColor: string
|
|
277
307
|
citySize: number
|
|
278
308
|
cityIconSize: number
|
|
309
|
+
radius: number
|
|
310
|
+
paddingHorizontal: number
|
|
311
|
+
borderColor: string
|
|
279
312
|
cityIconColor: string
|
|
280
313
|
lineColor: string
|
|
281
314
|
lineWidth: number
|
|
@@ -303,6 +336,7 @@ declare const _default: import('vue').DefineComponent<
|
|
|
303
336
|
link?: import('../lcb-action-view/types').LcbActionViewProps
|
|
304
337
|
iconType?: 'icon' | 'img'
|
|
305
338
|
mode?: 'search' | 'link'
|
|
339
|
+
productTypeList?: string[]
|
|
306
340
|
city?: boolean
|
|
307
341
|
cityColor?: string
|
|
308
342
|
citySize?: number
|
|
@@ -312,6 +346,7 @@ declare const _default: import('vue').DefineComponent<
|
|
|
312
346
|
lineWidth?: number
|
|
313
347
|
linePadding?: number
|
|
314
348
|
lineHeight?: number
|
|
349
|
+
historyKey?: string
|
|
315
350
|
} & {
|
|
316
351
|
jumpUrl?: string
|
|
317
352
|
urlParams?: string
|
|
@@ -328,9 +363,14 @@ declare const _default: import('vue').DefineComponent<
|
|
|
328
363
|
color: string
|
|
329
364
|
iconColor: string
|
|
330
365
|
gap: number
|
|
366
|
+
paddingVertical: number
|
|
367
|
+
marginHorizontal: number
|
|
331
368
|
cityColor: string
|
|
332
369
|
citySize: number
|
|
333
370
|
cityIconSize: number
|
|
371
|
+
radius: number
|
|
372
|
+
paddingHorizontal: number
|
|
373
|
+
borderColor: string
|
|
334
374
|
cityIconColor: string
|
|
335
375
|
lineColor: string
|
|
336
376
|
lineWidth: number
|
|
@@ -347,11 +387,16 @@ declare const _default: import('vue').DefineComponent<
|
|
|
347
387
|
mode: 'search' | 'link'
|
|
348
388
|
color: string
|
|
349
389
|
lineHeight: number
|
|
390
|
+
radius: number
|
|
350
391
|
iconSize: string
|
|
351
392
|
iconColor: string
|
|
352
393
|
placeholder: string
|
|
353
394
|
lineWidth: number
|
|
395
|
+
marginHorizontal: number
|
|
396
|
+
paddingHorizontal: number
|
|
397
|
+
paddingVertical: number
|
|
354
398
|
fontSize: number
|
|
399
|
+
borderColor: string
|
|
355
400
|
gap: number
|
|
356
401
|
iconType: 'icon' | 'img'
|
|
357
402
|
borderWidth: number
|
|
@@ -366,11 +411,16 @@ declare const _default: import('vue').DefineComponent<
|
|
|
366
411
|
mode: 'search' | 'link'
|
|
367
412
|
color: string
|
|
368
413
|
lineHeight: number
|
|
414
|
+
radius: number
|
|
369
415
|
iconSize: string
|
|
370
416
|
iconColor: string
|
|
371
417
|
placeholder: string
|
|
372
418
|
lineWidth: number
|
|
419
|
+
marginHorizontal: number
|
|
420
|
+
paddingHorizontal: number
|
|
421
|
+
paddingVertical: number
|
|
373
422
|
fontSize: number
|
|
423
|
+
borderColor: string
|
|
374
424
|
gap: number
|
|
375
425
|
iconType: 'icon' | 'img'
|
|
376
426
|
borderWidth: number
|
|
@@ -385,11 +435,16 @@ declare const _default: import('vue').DefineComponent<
|
|
|
385
435
|
mode: 'search' | 'link'
|
|
386
436
|
color: string
|
|
387
437
|
lineHeight: number
|
|
438
|
+
radius: number
|
|
388
439
|
iconSize: string
|
|
389
440
|
iconColor: string
|
|
390
441
|
placeholder: string
|
|
391
442
|
lineWidth: number
|
|
443
|
+
marginHorizontal: number
|
|
444
|
+
paddingHorizontal: number
|
|
445
|
+
paddingVertical: number
|
|
392
446
|
fontSize: number
|
|
447
|
+
borderColor: string
|
|
393
448
|
gap: number
|
|
394
449
|
iconType: 'icon' | 'img'
|
|
395
450
|
borderWidth: number
|
|
@@ -404,11 +459,16 @@ declare const _default: import('vue').DefineComponent<
|
|
|
404
459
|
mode: 'search' | 'link'
|
|
405
460
|
color: string
|
|
406
461
|
lineHeight: number
|
|
462
|
+
radius: number
|
|
407
463
|
iconSize: string
|
|
408
464
|
iconColor: string
|
|
409
465
|
placeholder: string
|
|
410
466
|
lineWidth: number
|
|
467
|
+
marginHorizontal: number
|
|
468
|
+
paddingHorizontal: number
|
|
469
|
+
paddingVertical: number
|
|
411
470
|
fontSize: number
|
|
471
|
+
borderColor: string
|
|
412
472
|
gap: number
|
|
413
473
|
iconType: 'icon' | 'img'
|
|
414
474
|
borderWidth: number
|
|
@@ -423,11 +483,16 @@ declare const _default: import('vue').DefineComponent<
|
|
|
423
483
|
mode: 'search' | 'link'
|
|
424
484
|
color: string
|
|
425
485
|
lineHeight: number
|
|
486
|
+
radius: number
|
|
426
487
|
iconSize: string
|
|
427
488
|
iconColor: string
|
|
428
489
|
placeholder: string
|
|
429
490
|
lineWidth: number
|
|
491
|
+
marginHorizontal: number
|
|
492
|
+
paddingHorizontal: number
|
|
493
|
+
paddingVertical: number
|
|
430
494
|
fontSize: number
|
|
495
|
+
borderColor: string
|
|
431
496
|
gap: number
|
|
432
497
|
iconType: 'icon' | 'img'
|
|
433
498
|
borderWidth: number
|
|
@@ -11,6 +11,7 @@ export type LcbSearchProps = {
|
|
|
11
11
|
link?: LcbActionViewProps
|
|
12
12
|
iconType?: 'icon' | 'img'
|
|
13
13
|
mode?: 'search' | 'link'
|
|
14
|
+
productTypeList?: string[]
|
|
14
15
|
city?: boolean
|
|
15
16
|
cityColor?: string
|
|
16
17
|
citySize?: number
|
|
@@ -20,5 +21,6 @@ export type LcbSearchProps = {
|
|
|
20
21
|
lineWidth?: number
|
|
21
22
|
linePadding?: number
|
|
22
23
|
lineHeight?: number
|
|
24
|
+
historyKey?: string
|
|
23
25
|
} & LcbActionViewProps &
|
|
24
26
|
LcbBlockProps
|
package/types/utils/utils.d.ts
CHANGED
|
@@ -8,6 +8,7 @@ export declare const getCurrentPage: () => {
|
|
|
8
8
|
options: any
|
|
9
9
|
route: string
|
|
10
10
|
}
|
|
11
|
+
export declare const getPreviousPageId: () => number
|
|
11
12
|
/** 合并url参数 url = /pages/data/index?id=1&name=2 urlParams = id=1&name=2&type=1 */
|
|
12
13
|
export declare const getFinalUrl: (url: string, urlParams?: string) => string
|
|
13
14
|
export declare const onPageScrollSelector: (selector: string) => void
|
package/utils/utils.ts
CHANGED
|
@@ -36,6 +36,16 @@ export const getCurrentPage = () => {
|
|
|
36
36
|
route: page.route,
|
|
37
37
|
}
|
|
38
38
|
}
|
|
39
|
+
|
|
40
|
+
// 获取上个页面的pageId
|
|
41
|
+
export const getPreviousPageId = () => {
|
|
42
|
+
const pages = getCurrentPages()
|
|
43
|
+
const page = pages[pages.length - 2] as {
|
|
44
|
+
getPageId: () => number
|
|
45
|
+
}
|
|
46
|
+
return page.getPageId?.()
|
|
47
|
+
}
|
|
48
|
+
|
|
39
49
|
/** 合并url参数 url = /pages/data/index?id=1&name=2 urlParams = id=1&name=2&type=1 */
|
|
40
50
|
export const getFinalUrl = (url: string, urlParams?: string) => {
|
|
41
51
|
if (!urlParams) return url
|