@tplc/business 0.2.34 → 0.2.36
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 +9 -0
- package/components/lcb-action-view/lcb-action-view.vue +4 -1
- package/components/lcb-action-view/types.ts +1 -0
- package/components/lcb-calendar/lcb-calendar.vue +0 -1
- package/components/lcb-home-search/lcb-home-search.vue +40 -20
- package/components/lcb-home-search/types.ts +6 -0
- package/components/lcb-product-item/components/ItemValue.vue +0 -1
- package/components/lcb-tags/types.ts +4 -4
- package/package.json +2 -2
- package/types/components/lcb-action-view/types.d.ts +1 -0
- package/types/components/lcb-home-search/types.d.ts +6 -0
- package/types/utils/utils.d.ts +2 -0
- package/utils/utils.ts +12 -0
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,15 @@
|
|
|
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.2.36](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/compare/v0.1.45...v0.2.36) (2024-12-26)
|
|
6
|
+
|
|
7
|
+
### [0.2.35](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/compare/v0.2.34...v0.2.35) (2024-12-26)
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
### 🐛 Bug Fixes | Bug 修复
|
|
11
|
+
|
|
12
|
+
* 修改样式错误 ([a4d5aab](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/a4d5aab85ac0e92fba75a964846eb62045b18239))
|
|
13
|
+
|
|
5
14
|
### [0.2.34](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/compare/v0.2.33...v0.2.34) (2024-12-25)
|
|
6
15
|
|
|
7
16
|
|
|
@@ -39,6 +39,7 @@ import { LcbActionViewProps } from './types'
|
|
|
39
39
|
import { uploadFile } from '../../hooks/useUpload'
|
|
40
40
|
import mpHtml from 'mp-html/src/uni-app/components/mp-html/mp-html.vue'
|
|
41
41
|
import { PAGE_ANCHOR_PROVIDE_KEY } from '../../constants'
|
|
42
|
+
import { getFinalUrl } from '../../utils/utils'
|
|
42
43
|
defineOptions({
|
|
43
44
|
name: 'LcbActionView',
|
|
44
45
|
options: {
|
|
@@ -70,12 +71,14 @@ const openType = computed(() => {
|
|
|
70
71
|
}[props.jumpType || '']
|
|
71
72
|
})
|
|
72
73
|
const onActionClick = async () => {
|
|
73
|
-
const { jumpUrl
|
|
74
|
+
const { jumpUrl, jumpType } = props
|
|
74
75
|
/**
|
|
75
76
|
* 跳转类型 1: 网页 2: 小程序内页 10: 跳转小程序 11: 跳转半屏小程序 12: 小程序客服
|
|
76
77
|
* 13: 退出登录 14: 小程序弹框 21: 新窗口跳到页面 22: 切换TAB页 23: 重启进入某页面
|
|
77
78
|
* 24: 回到上一层 25: 关闭当前页面 26: 关闭当前窗口 30: 拨打电话 88: 授权手机号
|
|
78
79
|
*/
|
|
80
|
+
const url = getFinalUrl(jumpUrl || '', props.urlParams)
|
|
81
|
+
console.log('url', url)
|
|
79
82
|
switch (jumpType) {
|
|
80
83
|
/** 网页 */
|
|
81
84
|
case 1:
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
<view class="flex w-full search-view overflow-hidden">
|
|
4
4
|
<view
|
|
5
5
|
v-for="(item, index) in tabs"
|
|
6
|
-
:key="
|
|
6
|
+
:key="index"
|
|
7
7
|
class="search-tab"
|
|
8
8
|
@click="current = index"
|
|
9
9
|
:class="{
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
: `rgba(245,246,249,${opacity ?? 1})`,
|
|
19
19
|
}"
|
|
20
20
|
>
|
|
21
|
-
{{ item }}
|
|
21
|
+
{{ item.label }}
|
|
22
22
|
</view>
|
|
23
23
|
</view>
|
|
24
24
|
<view
|
|
@@ -46,9 +46,12 @@
|
|
|
46
46
|
:style="{
|
|
47
47
|
backgroundColor: `rgba(241,241, 241, ${opacity})`,
|
|
48
48
|
}"
|
|
49
|
-
|
|
50
|
-
<
|
|
51
|
-
|
|
49
|
+
/>
|
|
50
|
+
<input
|
|
51
|
+
class="text-#333 text-28rpx flex-1 mr-3"
|
|
52
|
+
:placeholder="placeholder"
|
|
53
|
+
v-model="form.keywords"
|
|
54
|
+
/>
|
|
52
55
|
<view class="justify-center flex flex-col items-center" @click="getLocation">
|
|
53
56
|
<wd-loading size="30rpx" v-if="locationIng" />
|
|
54
57
|
<img
|
|
@@ -79,9 +82,11 @@
|
|
|
79
82
|
<view class="tag">{{ translate('共') }}{{ nightCount }}{{ translate('晚') }}</view>
|
|
80
83
|
</view>
|
|
81
84
|
</lcb-calendar>
|
|
82
|
-
<
|
|
83
|
-
|
|
84
|
-
|
|
85
|
+
<lcb-action-view v-bind="link" :urlParams="stringify(form)">
|
|
86
|
+
<wd-button type="primary" customClass="!w-full my-42rpx" size="large">
|
|
87
|
+
{{ btnText }}
|
|
88
|
+
</wd-button>
|
|
89
|
+
</lcb-action-view>
|
|
85
90
|
<view
|
|
86
91
|
class="px-50rpx flex justify-between items-center pb-42rpx text-#000 text-28rpx"
|
|
87
92
|
v-if="items?.length"
|
|
@@ -101,12 +106,13 @@
|
|
|
101
106
|
</template>
|
|
102
107
|
|
|
103
108
|
<script setup lang="ts">
|
|
104
|
-
import { computed, ref } from 'vue'
|
|
109
|
+
import { computed, ref, reactive, watchEffect } from 'vue'
|
|
105
110
|
import { LcbHomeSearch } from './types'
|
|
106
111
|
import dayjs from 'dayjs/esm'
|
|
107
112
|
import useLocation from '../../hooks/useLocation'
|
|
108
113
|
import { useTranslate } from '@tplc/wot'
|
|
109
114
|
import { ChildHotAddress } from '../lcb-city-select/api'
|
|
115
|
+
import { stringify } from 'qs'
|
|
110
116
|
const dayRange = ref([dayjs().valueOf(), dayjs().add(1, 'day').valueOf()])
|
|
111
117
|
const { translate } = useTranslate()
|
|
112
118
|
const { getLocation, userLocation, locationIng } = useLocation()
|
|
@@ -123,8 +129,7 @@ defineOptions({
|
|
|
123
129
|
styleIsolation: 'shared',
|
|
124
130
|
},
|
|
125
131
|
})
|
|
126
|
-
|
|
127
|
-
withDefaults(defineProps<LcbHomeSearch>(), {
|
|
132
|
+
const props = withDefaults(defineProps<LcbHomeSearch>(), {
|
|
128
133
|
marginHorizontal: 24,
|
|
129
134
|
backgroundColor: '#ffffff',
|
|
130
135
|
radius: 16,
|
|
@@ -132,8 +137,16 @@ withDefaults(defineProps<LcbHomeSearch>(), {
|
|
|
132
137
|
btnText: '搜索酒店',
|
|
133
138
|
opacity: 1,
|
|
134
139
|
})
|
|
135
|
-
|
|
140
|
+
|
|
136
141
|
const current = ref(0)
|
|
142
|
+
const form = reactive({
|
|
143
|
+
categoryTags: '',
|
|
144
|
+
keywords: '',
|
|
145
|
+
startDate: '',
|
|
146
|
+
endDate: '',
|
|
147
|
+
hotAddressId: '',
|
|
148
|
+
})
|
|
149
|
+
|
|
137
150
|
// 今天 明天 后天 周...
|
|
138
151
|
const getDayName = (time: number) => {
|
|
139
152
|
const day = dayjs(time).day()
|
|
@@ -147,6 +160,21 @@ const getDayName = (time: number) => {
|
|
|
147
160
|
return `周${'日一二三四五六'[day]}`
|
|
148
161
|
}
|
|
149
162
|
}
|
|
163
|
+
|
|
164
|
+
watchEffect(() => {
|
|
165
|
+
form.categoryTags = props.tabs[current.value].value
|
|
166
|
+
})
|
|
167
|
+
|
|
168
|
+
watchEffect(() => {
|
|
169
|
+
form.startDate = dayjs(dayRange.value[0]).format('YYYY-MM-DD')
|
|
170
|
+
form.endDate = dayjs(dayRange.value[1]).format('YYYY-MM-DD')
|
|
171
|
+
})
|
|
172
|
+
|
|
173
|
+
watchEffect(() => {
|
|
174
|
+
if (addressCity.value) {
|
|
175
|
+
form.hotAddressId = addressCity.value.hotAddressId
|
|
176
|
+
}
|
|
177
|
+
})
|
|
150
178
|
</script>
|
|
151
179
|
<style lang="scss" scoped>
|
|
152
180
|
@import '@tplc/wot/components/common/abstracts/variable';
|
|
@@ -165,14 +193,6 @@ const getDayName = (time: number) => {
|
|
|
165
193
|
.active {
|
|
166
194
|
color: $-color-theme;
|
|
167
195
|
font-weight: bold;
|
|
168
|
-
// border-top-left-radius: 16rpx;
|
|
169
|
-
// border-top-right-radius: 16rpx;
|
|
170
|
-
// &-left {
|
|
171
|
-
// border-bottom-right-radius: 16rpx;
|
|
172
|
-
// }
|
|
173
|
-
// &-right {
|
|
174
|
-
// border-bottom-left-radius: 16rpx;
|
|
175
|
-
// }
|
|
176
196
|
}
|
|
177
197
|
}
|
|
178
198
|
|
|
@@ -1,8 +1,14 @@
|
|
|
1
1
|
import { ActionView } from 'action'
|
|
2
2
|
import { LcbBlockProps } from '../lcb-block/types'
|
|
3
|
+
import { LcbActionViewProps } from '../lcb-action-view/types'
|
|
3
4
|
|
|
4
5
|
export interface LcbHomeSearch extends LcbBlockProps {
|
|
5
6
|
placeholder?: string
|
|
6
7
|
items?: ActionView[]
|
|
7
8
|
btnText?: string
|
|
9
|
+
tabs: {
|
|
10
|
+
label: string
|
|
11
|
+
value: string
|
|
12
|
+
}[]
|
|
13
|
+
link?: LcbActionViewProps
|
|
8
14
|
}
|
|
@@ -15,16 +15,16 @@
|
|
|
15
15
|
|
|
16
16
|
export interface LcbTagsProps {
|
|
17
17
|
// Define the component's prop types here
|
|
18
|
-
items?: any
|
|
19
|
-
mode?: 1 | 2 //1是不换行滚动 这是加在大部分产品里的用法 2是自然换行
|
|
18
|
+
items?: any
|
|
19
|
+
mode?: 1 | 2 // 1是不换行滚动 这是加在大部分产品里的用法 2是自然换行
|
|
20
20
|
tagRadius?: number
|
|
21
21
|
fontSize?: number
|
|
22
22
|
tagColor?: string
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
export interface LcbTagsItemProps {
|
|
26
|
-
items: object[]
|
|
26
|
+
items: object[]
|
|
27
27
|
tagRadius?: number
|
|
28
28
|
fontSize?: number
|
|
29
29
|
tagColor?: string
|
|
30
|
-
}
|
|
30
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tplc/business",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.36",
|
|
4
4
|
"keywords": [
|
|
5
5
|
"业务组件"
|
|
6
6
|
],
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
},
|
|
12
12
|
"peerDependencies": {
|
|
13
13
|
"vue": ">=3.2.47",
|
|
14
|
-
"@tplc/wot": "0.1.
|
|
14
|
+
"@tplc/wot": "0.1.45"
|
|
15
15
|
},
|
|
16
16
|
"engines": {
|
|
17
17
|
"node": ">=18",
|
|
@@ -1,7 +1,13 @@
|
|
|
1
1
|
import { ActionView } from 'action'
|
|
2
2
|
import { LcbBlockProps } from '../lcb-block/types'
|
|
3
|
+
import { LcbActionViewProps } from '../lcb-action-view/types'
|
|
3
4
|
export interface LcbHomeSearch extends LcbBlockProps {
|
|
4
5
|
placeholder?: string
|
|
5
6
|
items?: ActionView[]
|
|
6
7
|
btnText?: string
|
|
8
|
+
tabs: {
|
|
9
|
+
label: string
|
|
10
|
+
value: string
|
|
11
|
+
}[]
|
|
12
|
+
link?: LcbActionViewProps
|
|
7
13
|
}
|
package/types/utils/utils.d.ts
CHANGED
|
@@ -2,3 +2,5 @@ export declare function formatJson(str: string | object | undefined, defVal?: {}
|
|
|
2
2
|
/** 获取上个页面Exposed */
|
|
3
3
|
export declare const getExposed: () => any
|
|
4
4
|
export declare const getPageOptions: () => Record<string, any>
|
|
5
|
+
/** 合并url参数 url = /pages/data/index?id=1&name=2 urlParams = id=1&name=2&type=1 */
|
|
6
|
+
export declare const getFinalUrl: (url: string, urlParams?: string) => string
|
package/utils/utils.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { parse, stringify } from 'qs'
|
|
1
2
|
export function formatJson(str: string | object | undefined, defVal = {}) {
|
|
2
3
|
if (!str) return defVal
|
|
3
4
|
if (typeof str === 'object') return str
|
|
@@ -22,3 +23,14 @@ export const getPageOptions = () => {
|
|
|
22
23
|
}
|
|
23
24
|
return currentPage.options
|
|
24
25
|
}
|
|
26
|
+
/** 合并url参数 url = /pages/data/index?id=1&name=2 urlParams = id=1&name=2&type=1 */
|
|
27
|
+
export const getFinalUrl = (url: string, urlParams?: string) => {
|
|
28
|
+
if (!urlParams) return url
|
|
29
|
+
const params = parse(urlParams)
|
|
30
|
+
const query = parse(url.split('?')[1])
|
|
31
|
+
const path = url.split('?')[0]
|
|
32
|
+
return `${path}?${stringify({
|
|
33
|
+
...query,
|
|
34
|
+
...params,
|
|
35
|
+
})}`
|
|
36
|
+
}
|