@tplc/business 0.0.1

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.
@@ -0,0 +1,128 @@
1
+ <template>
2
+ <view
3
+ class="box-border"
4
+ :style="{
5
+ backgroundColor: bgColor,
6
+ color: textColor,
7
+ gridTemplateColumns: `repeat(${pictureDistribution}, minmax(0, 1fr))`,
8
+ padding: `${topMargin}rpx ${leftRightMargin}rpx ${bottomMargin}rpx`,
9
+ backgroundImage: bgImg ? `url(${bgImg})` : '',
10
+ backgroundSize: '100% 100%',
11
+ }"
12
+ :class="[styleGroup === 2 ? 'mutil' : 'single']"
13
+ >
14
+ <view v-for="item in items" :key="item.title" class="flex flex-col justify-center items-center">
15
+ <div
16
+ class="overflow-hidden"
17
+ :style="{
18
+ height: iconSize + 'rpx',
19
+ width: iconSize + 'rpx',
20
+ borderRadius: (iconType === 1 ? iconRadius : 0) + 'rpx',
21
+ color: iconColor,
22
+ marginBottom: iconTextMargin + 'rpx',
23
+ backgroundImage: iconType === 1 ? 'url(' + item.img + ')' : '',
24
+ backgroundSize: '100% 100%',
25
+ }"
26
+ :class="{
27
+ imageNav: iconType === 1,
28
+ }"
29
+ >
30
+ <div v-if="iconType === 0" class="flex justify-center items-center">
31
+ <wd-icon class-prefix="iconfont" :name="item.icon" size="36" />
32
+ </div>
33
+ </div>
34
+ <view class="title">{{ item.title }}</view>
35
+ </view>
36
+ </view>
37
+ </template>
38
+ <script lang="ts">
39
+ export default {
40
+ name: 'LcbImgNav',
41
+ options: {
42
+ addGlobalClass: true,
43
+ virtualHost: true,
44
+ styleIsolation: 'shared',
45
+ },
46
+ }
47
+ </script>
48
+ <script lang="ts" setup>
49
+ interface LcbImgNavProps {
50
+ /** 模式 1.单行 2.多行 */
51
+ styleGroup?: 1 | 2
52
+ /** 文字颜色 #212121 */
53
+ textColor?: string
54
+ /** 背景颜色 #ffffff */
55
+ bgColor?: string
56
+ /** 背景图片 */
57
+ bgImg?: string
58
+ /** 图标颜色 #212121 */
59
+ iconColor?: string
60
+ /** 图标类型 0.系统 1.自定义 */
61
+ iconType?: 0 | 1
62
+ /** 数据内容 */
63
+ items?: {
64
+ title: string
65
+ icon?: string
66
+ link: string
67
+ img?: string
68
+ }[]
69
+ /** 上边距 */
70
+ topMargin?: 0 | 24 | 36
71
+ /** 下边距 */
72
+ bottomMargin?: 0 | 24 | 36
73
+ /** 排布方式每行几个 */
74
+ pictureDistribution?: 3 | 4 | 5
75
+ /** 左右间距 */
76
+ leftRightMargin?: number
77
+ /** 图标尺寸 0.小40px 2.大50px */
78
+ iconSize?: number
79
+ /** 图标圆角 默认 0 */
80
+ iconRadius?: number
81
+ /** 文字与图标距离 */
82
+ iconTextMargin?: number
83
+ }
84
+ const props = withDefaults(defineProps<LcbImgNavProps>(), {
85
+ bgColor: '#ffffff',
86
+ textColor: '#212121',
87
+ iconColor: '#212121',
88
+ iconRadius: 0,
89
+ topMargin: 36,
90
+ bottomMargin: 36,
91
+ iconSize: 80,
92
+ leftRightMargin: 0,
93
+ iconTextMargin: 8,
94
+ pictureDistribution: 4,
95
+ })
96
+ </script>
97
+
98
+ <style lang="scss" scoped>
99
+ .single {
100
+ display: flex;
101
+ gap: 24rpx;
102
+ width: 100%;
103
+ overflow-x: auto;
104
+ white-space: nowrap;
105
+ > view {
106
+ display: inline-flex;
107
+ }
108
+ }
109
+ .mutil {
110
+ display: grid;
111
+ row-gap: 36rpx;
112
+ }
113
+ .imageNav {
114
+ box-sizing: content-box;
115
+ background-repeat: no-repeat;
116
+ background-position: center;
117
+ background-size: cover;
118
+ }
119
+ .title {
120
+ width: 68px;
121
+ overflow: hidden;
122
+ font-size: 24rpx;
123
+ line-height: 14px;
124
+ text-align: center;
125
+ letter-spacing: 0;
126
+ white-space: nowrap;
127
+ }
128
+ </style>
@@ -0,0 +1,242 @@
1
+ <template>
2
+ <view
3
+ class="customNavigation"
4
+ :class="{
5
+ immersiveTop: topStyle === 2,
6
+ }"
7
+ >
8
+ <view
9
+ class="header"
10
+ :style="{
11
+ backgroundColor: backgroundType === 'color' ? backColor : '',
12
+ color: contentColor,
13
+ backgroundImage: backgroundType === 'img' ? `url(${backgroundImage})` : '',
14
+ }"
15
+ >
16
+ <view class="header_body" :class="[titleLocation]" v-if="topStyle === 1">
17
+ <view
18
+ class="items"
19
+ :class="{
20
+ on_center: styleGroup === 1,
21
+ }"
22
+ >
23
+ <view class="titleContainer" v-if="titleMode === 'text'">
24
+ <view class="images mr-2" v-if="logoImg">
25
+ <img :src="logoImg" />
26
+ </view>
27
+
28
+ <view class="title">{{ title }}</view>
29
+ </view>
30
+ <view class="images" v-else>
31
+ <img :src="typographyTextBackground" />
32
+ </view>
33
+ </view>
34
+ <template v-if="styleGroup === 2">
35
+ <view
36
+ class="center_mod items pr-80px"
37
+ :class="{
38
+ searchLeft: titleLocation === 'center',
39
+ }"
40
+ >
41
+ <view class="search-input" @click="emits('search')">
42
+ <wd-icon name="search" color="#a1a1a1" />
43
+ <view class="search-text">{{ searchText }}</view>
44
+ </view>
45
+ </view>
46
+ </template>
47
+ </view>
48
+ </view>
49
+ </view>
50
+ </template>
51
+
52
+ <script setup lang="ts">
53
+ defineOptions({
54
+ name: 'FinalNav',
55
+ })
56
+ const emits = defineEmits<{ (e: 'search'): void }>()
57
+
58
+ interface NanProps {
59
+ /** 模式 1.标题 2.搜索 3.导航 4.沉浸式 */
60
+ styleGroup?: 1 | 2 | 3 | 4
61
+ /** 方位 */
62
+ titleLocation?: 'left' | 'center'
63
+ /** 是否沉浸式状态栏 */
64
+ // 1 标准 2沉浸式
65
+ topStyle?: 1 | 2
66
+ /** 标题 */
67
+ title?: string
68
+ /** 图片 */
69
+ logoImg?: string
70
+ /** 背景图片 */
71
+ backgroundImage?: string
72
+ /** 模式 */
73
+ titleMode?: 'text' | 'img'
74
+ /** 颜色模式 */
75
+ colorMode?: 'custom' | 'default'
76
+ /** 背景颜色 */
77
+ backColor?: string
78
+ /** 背景样式 */
79
+ backgroundType?: 'img' | 'color'
80
+ /** 内容颜色 */
81
+ contentColor?: string
82
+ searchText?: string
83
+ typographyTextBackground?: string
84
+ }
85
+ withDefaults(defineProps<NanProps>(), {
86
+ styleGroup: 1,
87
+ titleLocation: 'center',
88
+ topStyle: 1,
89
+ title: '页面标题',
90
+ titleMode: 'text',
91
+ backgroundType: 'color',
92
+ colorMode: 'default',
93
+ backColor: '#ffffff',
94
+ contentColor: '#000000',
95
+ logoImg: '',
96
+ searchText: '搜索',
97
+ })
98
+ </script>
99
+ <style lang="scss" scoped>
100
+ .customNavigation {
101
+ position: relative;
102
+ width: 100%;
103
+ height: 88px;
104
+
105
+ .header {
106
+ position: absolute;
107
+ top: 0px;
108
+ left: 0px;
109
+ width: 100%;
110
+ height: 100%;
111
+ background-image: url(https://cdn2.weimob.com/saas/@assets/saas-fe-basis-web-stc/cms/h5/topNavBlack_new.png);
112
+ background-repeat: no-repeat;
113
+ background-position: 50%;
114
+ background-position-x: 50%;
115
+ background-position-y: center;
116
+ background-size: cover;
117
+
118
+ .header_body {
119
+ position: absolute;
120
+ bottom: 0;
121
+ box-sizing: border-box;
122
+ display: flex;
123
+ justify-content: space-between;
124
+ width: 100%;
125
+ height: 44px;
126
+ padding: 12rpx 28rpx;
127
+ text-align: center;
128
+
129
+ .items {
130
+ display: flex;
131
+ align-items: center;
132
+ height: 100%;
133
+ overflow: hidden;
134
+ }
135
+
136
+ .center_mod {
137
+ flex: 1 1;
138
+ margin-right: 20rpx;
139
+ margin-left: 20rpx;
140
+
141
+ .search-input {
142
+ display: flex;
143
+ align-items: center;
144
+ justify-content: center;
145
+ width: 100%;
146
+ height: 64rpx;
147
+ padding: 0 24rpx;
148
+ font-size: 26rpx;
149
+ font-weight: 400;
150
+ color: #a1a1a1;
151
+ background: #f5f5f5;
152
+ border-radius: 32rpx;
153
+
154
+ .search-text {
155
+ flex: 1 1;
156
+ margin-left: 12rpx;
157
+ overflow: hidden;
158
+ text-align: left;
159
+ text-overflow: ellipsis;
160
+ white-space: nowrap;
161
+ }
162
+ }
163
+ }
164
+
165
+ .searchLeft {
166
+ position: absolute;
167
+ left: 0;
168
+
169
+ .search-input {
170
+ :last-child {
171
+ display: none;
172
+ border-radius: 100%;
173
+ }
174
+ }
175
+ }
176
+
177
+ .on_center {
178
+ flex: initial;
179
+ align-items: center;
180
+ justify-content: center;
181
+ height: 60rpx;
182
+
183
+ .titleContainer {
184
+ display: flex;
185
+ align-items: center;
186
+ justify-content: center;
187
+
188
+ .title {
189
+ max-width: 300rpx;
190
+ overflow: hidden;
191
+ font-size: 32rpx;
192
+ font-weight: 500;
193
+ text-overflow: ellipsis;
194
+ white-space: nowrap;
195
+ }
196
+ }
197
+ }
198
+
199
+ .images {
200
+ width: auto;
201
+ max-width: 320rpx !important;
202
+ height: 100%;
203
+ overflow: hidden;
204
+
205
+ img {
206
+ min-width: 60rpx;
207
+ height: 60rpx;
208
+ -o-object-fit: cover;
209
+ object-fit: cover;
210
+ -o-object-position: center;
211
+ object-position: center;
212
+ }
213
+ }
214
+ }
215
+
216
+ .left {
217
+ justify-content: flex-start;
218
+ }
219
+
220
+ .center {
221
+ justify-content: center;
222
+ }
223
+ }
224
+ }
225
+
226
+ .immersiveTop {
227
+ position: fixed;
228
+ top: 0;
229
+ right: 0;
230
+ left: 0;
231
+ z-index: 999999;
232
+ width: 375px;
233
+ background: transparent;
234
+
235
+ .header {
236
+ color: rgb(0, 0, 0) !important;
237
+ background-color: rgba(0, 0, 0, 0) !important;
238
+ background-repeat: no-repeat;
239
+ background-size: contain;
240
+ }
241
+ }
242
+ </style>
package/index.ts ADDED
File without changes
package/package.json ADDED
@@ -0,0 +1,20 @@
1
+ {
2
+ "name": "@tplc/business",
3
+ "version": "0.0.1",
4
+ "keywords": [
5
+ "业务组件i"
6
+ ],
7
+ "publishConfig": {
8
+ "access": "public",
9
+ "registry": "https://registry.npmjs.org/"
10
+ },
11
+ "main": "index.ts",
12
+ "peerDependencies": {
13
+ "vue": ">=3.2.47",
14
+ "@tplc/wot": "0.0.1"
15
+ },
16
+ "engines": {
17
+ "node": ">=18",
18
+ "pnpm": ">=7.30"
19
+ }
20
+ }
package/tsconfig.json ADDED
@@ -0,0 +1,12 @@
1
+ {
2
+ "extends": "../../tsconfig.json",
3
+ "compilerOptions": {
4
+ "baseUrl": ".",
5
+ "types": ["@dcloudio/types", "miniprogram-api-typings", "mini-types"],
6
+ "paths": {
7
+ "@/*": ["./src/*"]
8
+ },
9
+ "lib": ["esnext", "dom", "dom.iterable", "scripthost"]
10
+ },
11
+ "exclude": ["node_modules"]
12
+ }