stellar-ui-plus 1.20.20 → 1.20.21
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/components/ste-cub-box/ATTRIBUTES.md +19 -0
- package/components/ste-cub-box/README.md +350 -0
- package/components/ste-cub-box/config.json +5 -0
- package/components/ste-cub-box/props.ts +10 -0
- package/components/ste-cub-box/ste-cub-box.vue +244 -0
- package/components/ste-cub-box/ste-user-info.easycom.json +71 -0
- package/components/ste-dropdown-menu/ste-dropdown-menu.vue +2 -0
- package/components/ste-function-list/ATTRIBUTES.md +15 -2
- package/components/ste-login/ATTRIBUTES.md +23 -0
- package/components/ste-login/README.md +236 -0
- package/components/{ste-main-info → ste-login}/config.json +1 -1
- package/components/ste-login/props.ts +33 -0
- package/components/ste-login/ste-login.easycom.json +134 -0
- package/components/ste-login/ste-login.vue +372 -0
- package/components/ste-login/type.d.ts +26 -0
- package/components/ste-login-info/ATTRIBUTES.md +17 -0
- package/components/ste-login-info/README.md +91 -0
- package/components/ste-login-info/config.json +5 -0
- package/components/ste-login-info/props.ts +15 -0
- package/components/ste-login-info/ste-login-info.vue +99 -0
- package/components/ste-login-info/type.d.ts +5 -0
- package/components/ste-order-card/ATTRIBUTES.md +10 -0
- package/components/ste-order-card/props.ts +2 -2
- package/components/ste-order-card/ste-order-card.vue +101 -4
- package/index.ts +8 -0
- package/package.json +1 -1
- package/types/components.d.ts +8 -0
- package/types/refComponents.d.ts +8 -0
- package/components/ste-main-info/README.md +0 -157
- package/components/ste-main-info/props.ts +0 -19
- package/components/ste-main-info/ste-main-info.scss +0 -90
- package/components/ste-main-info/ste-main-info.vue +0 -187
- package/components/ste-main-info/type.d.ts +0 -12
- /package/components/{ste-main-info/ste-main-info.easycom.json → ste-login-info/ste-login-info.easycom.json} +0 -0
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
#### Props
|
|
2
|
+
| 属性名 | 说明 | 类型 | 默认值 | 可选值 | 支持版本 |
|
|
3
|
+
| ----- | ----- | --- | ------- | ------ | -------- |
|
|
4
|
+
| `avatar` | 头像 | `String` | `` | - | - |
|
|
5
|
+
| `nickname` | 昵称 | `String` | `` | - | - |
|
|
6
|
+
| `showUserInfo` | 是否展示用户相关 | `Boolean` | `true` | - | - |
|
|
7
|
+
| `list` | 数据列表(最多三个) | `Array` | `[]` | - | - |
|
|
8
|
+
| `codeSrc` | 功能码图片 | `String` | `` | - | - |
|
|
9
|
+
| `codeTitle` | 功能码标题 | `String` | `` | - | - |
|
|
10
|
+
| `codeTitleColor` | 功能码标题颜色 | `String` | `主题色` | - | - |
|
|
11
|
+
| `showCode` | 是否展示功能码相关 | `Boolean` | `true` | - | - |
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
#### Events
|
|
15
|
+
| 事件名 | 说明 | 事件参数 | 支持版本 |
|
|
16
|
+
| ----- | ----- | ------- | -------- |
|
|
17
|
+
| `userClick` | 用户区域点击 | - | - |
|
|
18
|
+
| `dataClick` | 数据点击 | - | - |
|
|
19
|
+
| `codeClick` | 功能码区域点击 | - | - |
|
|
@@ -0,0 +1,350 @@
|
|
|
1
|
+
# UserInfo 用户信息
|
|
2
|
+
|
|
3
|
+
提供用户信息展示。
|
|
4
|
+
|
|
5
|
+
---$
|
|
6
|
+
|
|
7
|
+
## 代码演示
|
|
8
|
+
|
|
9
|
+
### 基本使用
|
|
10
|
+
|
|
11
|
+
- 通过 `avatar`设置头像,默认为``
|
|
12
|
+
- 通过 `nickname`设置昵称,默认为``
|
|
13
|
+
- 通过 `desc`插槽设置用户描述,默认为``
|
|
14
|
+
- 通过 `list`设置数据列表(最多三个),默认为`[]`
|
|
15
|
+
- 通过 `codeSrc`设置功能码图片,默认为``
|
|
16
|
+
- 通过 `codeTitle`设置功能码标题,默认为``
|
|
17
|
+
- 通过 `codeTitleColor`设置功能码标题颜色,默认为`主题色`
|
|
18
|
+
|
|
19
|
+
```html
|
|
20
|
+
<script lang="ts" setup>
|
|
21
|
+
import { ref } from 'vue';
|
|
22
|
+
let list1 = ref([
|
|
23
|
+
{ title: '余额', value: '100' },
|
|
24
|
+
{ title: '订餐数', value: '8' },
|
|
25
|
+
]);
|
|
26
|
+
|
|
27
|
+
let list2 = ref([
|
|
28
|
+
{ title: '数据1', value: '100' },
|
|
29
|
+
{ title: '数据2', value: '8' },
|
|
30
|
+
{ title: '数据3', value: '8' },
|
|
31
|
+
]);
|
|
32
|
+
let list3 = ref([{ title: '数据1', value: '100' }]);
|
|
33
|
+
</script>
|
|
34
|
+
<template>
|
|
35
|
+
<view class="item-block">
|
|
36
|
+
<view>
|
|
37
|
+
<ste-user-info
|
|
38
|
+
avatar="https://image.whzb.com/chain/StellarUI/图片.jpg"
|
|
39
|
+
nickname="张三"
|
|
40
|
+
:list="list1"
|
|
41
|
+
codeSrc="https://image.whzb.com/chain/StellarUI/image/code1.png"
|
|
42
|
+
codeTitle="核销码"
|
|
43
|
+
codeTitleColor="#EC3E1A"
|
|
44
|
+
>
|
|
45
|
+
<template v-slot:desc>
|
|
46
|
+
<view class="desc">
|
|
47
|
+
<ste-icon code="" color="#EC3E1A" size="26"></ste-icon>
|
|
48
|
+
<view class="title">中百食堂</view>
|
|
49
|
+
</view>
|
|
50
|
+
</template>
|
|
51
|
+
</ste-user-info>
|
|
52
|
+
</view>
|
|
53
|
+
</view>
|
|
54
|
+
<view class="item-block">
|
|
55
|
+
<view>
|
|
56
|
+
<ste-user-info
|
|
57
|
+
avatar="https://image.whzb.com/chain/StellarUI/图片.jpg"
|
|
58
|
+
nickname="张三"
|
|
59
|
+
:list="[]"
|
|
60
|
+
codeSrc="https://image.whzb.com/chain/StellarUI/image/code1.png"
|
|
61
|
+
codeTitle="核销码"
|
|
62
|
+
codeTitleColor="#EC3E1A"
|
|
63
|
+
>
|
|
64
|
+
<template v-slot:desc>
|
|
65
|
+
<view class="desc">
|
|
66
|
+
<ste-icon code="" color="#EC3E1A" size="26"></ste-icon>
|
|
67
|
+
<view class="title">中百食堂</view>
|
|
68
|
+
</view>
|
|
69
|
+
</template>
|
|
70
|
+
</ste-user-info>
|
|
71
|
+
</view>
|
|
72
|
+
</view>
|
|
73
|
+
<view class="item-block">
|
|
74
|
+
<view>
|
|
75
|
+
<ste-user-info
|
|
76
|
+
avatar="https://image.whzb.com/chain/StellarUI/图片.jpg"
|
|
77
|
+
nickname="张三"
|
|
78
|
+
:list="list3"
|
|
79
|
+
codeSrc="https://image.whzb.com/chain/StellarUI/image/code1.png"
|
|
80
|
+
codeTitle="核销码"
|
|
81
|
+
codeTitleColor="#EC3E1A"
|
|
82
|
+
>
|
|
83
|
+
<template v-slot:desc>
|
|
84
|
+
<view class="desc">
|
|
85
|
+
<ste-icon code="" color="#EC3E1A" size="26"></ste-icon>
|
|
86
|
+
<view class="title">中百食堂</view>
|
|
87
|
+
</view>
|
|
88
|
+
</template>
|
|
89
|
+
</ste-user-info>
|
|
90
|
+
</view>
|
|
91
|
+
</view>
|
|
92
|
+
<view class="item-block">
|
|
93
|
+
<view>
|
|
94
|
+
<ste-user-info
|
|
95
|
+
avatar="https://image.whzb.com/chain/StellarUI/图片.jpg"
|
|
96
|
+
nickname="张三"
|
|
97
|
+
:list="list2"
|
|
98
|
+
codeSrc="https://image.whzb.com/chain/StellarUI/image/code1.png"
|
|
99
|
+
codeTitle="核销码"
|
|
100
|
+
codeTitleColor="#EC3E1A"
|
|
101
|
+
>
|
|
102
|
+
<template v-slot:desc>
|
|
103
|
+
<view class="desc">
|
|
104
|
+
<ste-icon code="" color="#EC3E1A" size="26"></ste-icon>
|
|
105
|
+
<view class="title">中百食堂</view>
|
|
106
|
+
</view>
|
|
107
|
+
</template>
|
|
108
|
+
</ste-user-info>
|
|
109
|
+
</view>
|
|
110
|
+
</view>
|
|
111
|
+
</template>
|
|
112
|
+
<style>
|
|
113
|
+
.item-block {
|
|
114
|
+
> view {
|
|
115
|
+
margin: 0 36rpx 36rpx 0;
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
.desc {
|
|
119
|
+
display: flex;
|
|
120
|
+
align-items: center;
|
|
121
|
+
.title {
|
|
122
|
+
font-size: 24rpx;
|
|
123
|
+
color: #ec3e1a;
|
|
124
|
+
margin: 4rpx;
|
|
125
|
+
margin-right: 14rpx;
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
</style>
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
### 用户信息隐藏
|
|
132
|
+
|
|
133
|
+
- 通过 `showUserInfo`设置是否展示用户相关,默认为`true`
|
|
134
|
+
|
|
135
|
+
```html
|
|
136
|
+
<script lang="ts" setup>
|
|
137
|
+
import { ref } from 'vue';
|
|
138
|
+
let list1 = ref([
|
|
139
|
+
{ title: '余额', value: '100' },
|
|
140
|
+
{ title: '订餐数', value: '8' },
|
|
141
|
+
]);
|
|
142
|
+
|
|
143
|
+
let list2 = ref([
|
|
144
|
+
{ title: '数据1', value: '100' },
|
|
145
|
+
{ title: '数据2', value: '8' },
|
|
146
|
+
{ title: '数据3', value: '8' },
|
|
147
|
+
]);
|
|
148
|
+
let list3 = ref([{ title: '数据1', value: '100' }]);
|
|
149
|
+
</script>
|
|
150
|
+
<template>
|
|
151
|
+
<view class="item-block">
|
|
152
|
+
<view>
|
|
153
|
+
<ste-user-info :showUserInfo="false" :list="list1" codeSrc="https://image.whzb.com/chain/StellarUI/image/code1.png" codeTitle="核销码" codeTitleColor="#EC3E1A"></ste-user-info>
|
|
154
|
+
</view>
|
|
155
|
+
</view>
|
|
156
|
+
<view class="item-block">
|
|
157
|
+
<view>
|
|
158
|
+
<ste-user-info :showUserInfo="false" :list="[]" codeSrc="https://image.whzb.com/chain/StellarUI/image/code1.png" codeTitle="核销码" codeTitleColor="#EC3E1A"></ste-user-info>
|
|
159
|
+
</view>
|
|
160
|
+
</view>
|
|
161
|
+
<view class="item-block">
|
|
162
|
+
<view>
|
|
163
|
+
<ste-user-info :showUserInfo="false" :list="list3" codeSrc="https://image.whzb.com/chain/StellarUI/image/code1.png" codeTitle="核销码" codeTitleColor="#EC3E1A"></ste-user-info>
|
|
164
|
+
</view>
|
|
165
|
+
</view>
|
|
166
|
+
<view class="item-block">
|
|
167
|
+
<view>
|
|
168
|
+
<ste-user-info :showUserInfo="false" :list="list2" codeSrc="https://image.whzb.com/chain/StellarUI/image/code1.png" codeTitle="核销码" codeTitleColor="#EC3E1A"></ste-user-info>
|
|
169
|
+
</view>
|
|
170
|
+
</view>
|
|
171
|
+
</template>
|
|
172
|
+
<style>
|
|
173
|
+
.item-block {
|
|
174
|
+
> view {
|
|
175
|
+
margin: 0 36rpx 36rpx 0;
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
.desc {
|
|
179
|
+
display: flex;
|
|
180
|
+
align-items: center;
|
|
181
|
+
.title {
|
|
182
|
+
font-size: 24rpx;
|
|
183
|
+
color: #ec3e1a;
|
|
184
|
+
margin: 4rpx;
|
|
185
|
+
margin-right: 14rpx;
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
</style>
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
### 核销码隐藏
|
|
192
|
+
|
|
193
|
+
- 通过 `showCode`设置核销码隐藏,默认为`true`
|
|
194
|
+
|
|
195
|
+
```html
|
|
196
|
+
<script lang="ts" setup>
|
|
197
|
+
import { ref } from 'vue';
|
|
198
|
+
let list1 = ref([
|
|
199
|
+
{ title: '余额', value: '100' },
|
|
200
|
+
{ title: '订餐数', value: '8' },
|
|
201
|
+
]);
|
|
202
|
+
|
|
203
|
+
let list2 = ref([
|
|
204
|
+
{ title: '数据1', value: '100' },
|
|
205
|
+
{ title: '数据2', value: '8' },
|
|
206
|
+
{ title: '数据3', value: '8' },
|
|
207
|
+
]);
|
|
208
|
+
let list3 = ref([{ title: '数据1', value: '100' }]);
|
|
209
|
+
</script>
|
|
210
|
+
<template>
|
|
211
|
+
<view class="item-block">
|
|
212
|
+
<view>
|
|
213
|
+
<ste-user-info avatar="https://image.whzb.com/chain/StellarUI/图片.jpg" nickname="张三" :list="list1" :showCode="false">
|
|
214
|
+
<template v-slot:desc>
|
|
215
|
+
<view class="desc">
|
|
216
|
+
<ste-icon code="" color="#EC3E1A" size="26"></ste-icon>
|
|
217
|
+
<view class="title">中百食堂</view>
|
|
218
|
+
</view>
|
|
219
|
+
</template>
|
|
220
|
+
</ste-user-info>
|
|
221
|
+
</view>
|
|
222
|
+
</view>
|
|
223
|
+
<view class="item-block">
|
|
224
|
+
<view>
|
|
225
|
+
<ste-user-info avatar="https://image.whzb.com/chain/StellarUI/图片.jpg" nickname="张三" :list="[]" :showCode="false">
|
|
226
|
+
<template v-slot:desc>
|
|
227
|
+
<view class="desc">
|
|
228
|
+
<ste-icon code="" color="#EC3E1A" size="26"></ste-icon>
|
|
229
|
+
<view class="title">中百食堂</view>
|
|
230
|
+
</view>
|
|
231
|
+
</template>
|
|
232
|
+
</ste-user-info>
|
|
233
|
+
</view>
|
|
234
|
+
</view>
|
|
235
|
+
<view class="item-block">
|
|
236
|
+
<view>
|
|
237
|
+
<ste-user-info avatar="https://image.whzb.com/chain/StellarUI/图片.jpg" nickname="张三" :list="list3" :showCode="false">
|
|
238
|
+
<template v-slot:desc>
|
|
239
|
+
<view class="desc">
|
|
240
|
+
<ste-icon code="" color="#EC3E1A" size="26"></ste-icon>
|
|
241
|
+
<view class="title">中百食堂</view>
|
|
242
|
+
</view>
|
|
243
|
+
</template>
|
|
244
|
+
</ste-user-info>
|
|
245
|
+
</view>
|
|
246
|
+
</view>
|
|
247
|
+
<view class="item-block">
|
|
248
|
+
<view>
|
|
249
|
+
<ste-user-info avatar="https://image.whzb.com/chain/StellarUI/图片.jpg" nickname="张三" :list="list2" :showCode="false">
|
|
250
|
+
<template v-slot:desc>
|
|
251
|
+
<view class="desc">
|
|
252
|
+
<ste-icon code="" color="#EC3E1A" size="26"></ste-icon>
|
|
253
|
+
<view class="title">中百食堂</view>
|
|
254
|
+
</view>
|
|
255
|
+
</template>
|
|
256
|
+
</ste-user-info>
|
|
257
|
+
</view>
|
|
258
|
+
</view>
|
|
259
|
+
</template>
|
|
260
|
+
<style>
|
|
261
|
+
.item-block {
|
|
262
|
+
> view {
|
|
263
|
+
margin: 0 36rpx 36rpx 0;
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
.desc {
|
|
267
|
+
display: flex;
|
|
268
|
+
align-items: center;
|
|
269
|
+
.title {
|
|
270
|
+
font-size: 24rpx;
|
|
271
|
+
color: #ec3e1a;
|
|
272
|
+
margin: 4rpx;
|
|
273
|
+
margin-right: 14rpx;
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
</style>
|
|
277
|
+
```
|
|
278
|
+
|
|
279
|
+
### 用户信息和核销码隐藏
|
|
280
|
+
|
|
281
|
+
```html
|
|
282
|
+
<script lang="ts" setup>
|
|
283
|
+
import { ref } from 'vue';
|
|
284
|
+
let list1 = ref([
|
|
285
|
+
{ title: '余额', value: '100' },
|
|
286
|
+
{ title: '订餐数', value: '8' },
|
|
287
|
+
]);
|
|
288
|
+
|
|
289
|
+
let list2 = ref([
|
|
290
|
+
{ title: '数据1', value: '100' },
|
|
291
|
+
{ title: '数据2', value: '8' },
|
|
292
|
+
{ title: '数据3', value: '8' },
|
|
293
|
+
]);
|
|
294
|
+
let list3 = ref([{ title: '数据1', value: '100' }]);
|
|
295
|
+
</script>
|
|
296
|
+
<template>
|
|
297
|
+
<view class="item-block">
|
|
298
|
+
<view>
|
|
299
|
+
<ste-user-info :showCode="false" :showUserInfo="false" :list="list1"></ste-user-info>
|
|
300
|
+
</view>
|
|
301
|
+
</view>
|
|
302
|
+
<view class="item-block">
|
|
303
|
+
<view>
|
|
304
|
+
<ste-user-info :showCode="false" :showUserInfo="false" :list="[]"></ste-user-info>
|
|
305
|
+
</view>
|
|
306
|
+
</view>
|
|
307
|
+
<view class="item-block">
|
|
308
|
+
<view>
|
|
309
|
+
<ste-user-info :showCode="false" :showUserInfo="false" :list="list3"></ste-user-info>
|
|
310
|
+
</view>
|
|
311
|
+
</view>
|
|
312
|
+
<view class="item-block">
|
|
313
|
+
<view>
|
|
314
|
+
<ste-user-info :showCode="false" :showUserInfo="false" :list="list2"></ste-user-info>
|
|
315
|
+
</view>
|
|
316
|
+
</view>
|
|
317
|
+
</template>
|
|
318
|
+
<style>
|
|
319
|
+
.item-block {
|
|
320
|
+
> view {
|
|
321
|
+
margin: 0 36rpx 36rpx 0;
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
.desc {
|
|
325
|
+
display: flex;
|
|
326
|
+
align-items: center;
|
|
327
|
+
.title {
|
|
328
|
+
font-size: 24rpx;
|
|
329
|
+
color: #ec3e1a;
|
|
330
|
+
margin: 4rpx;
|
|
331
|
+
margin-right: 14rpx;
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
</style>
|
|
335
|
+
```
|
|
336
|
+
|
|
337
|
+
---$
|
|
338
|
+
|
|
339
|
+
### API
|
|
340
|
+
|
|
341
|
+
<!-- props -->
|
|
342
|
+
|
|
343
|
+
#### Slots
|
|
344
|
+
|
|
345
|
+
| 插槽名 | 说明 | 插槽参数 | 支持版本 |
|
|
346
|
+
| ------ | -------- | -------- | -------- |
|
|
347
|
+
| `desc` | 用户描述 | - | - |
|
|
348
|
+
|
|
349
|
+
---$
|
|
350
|
+
{{qinpengfei}}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
avatar: { type: String, default: '' },
|
|
3
|
+
nickname: { type: String, default: '' },
|
|
4
|
+
showUserInfo: { type: Boolean, default: true },
|
|
5
|
+
list: { type: Array, default: () => [] },
|
|
6
|
+
codeSrc: { type: String, default: '' },
|
|
7
|
+
codeTitle: { type: String, default: '' },
|
|
8
|
+
codeTitleColor: { type: String, default: '' },
|
|
9
|
+
showCode: { type: Boolean, default: true },
|
|
10
|
+
};
|
|
@@ -0,0 +1,244 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<!-- 魔方组件 -->
|
|
3
|
+
<div class="page">
|
|
4
|
+
<div
|
|
5
|
+
class="cap-cube"
|
|
6
|
+
:class="{ 'c-box-angle-2': imageAngle == 2 }"
|
|
7
|
+
:style="{
|
|
8
|
+
width: capCubeStyle.width,
|
|
9
|
+
marginLeft: capCubeStyle.marginLeft,
|
|
10
|
+
marginBottom: capCubeStyle.marginBottom,
|
|
11
|
+
gridRowGap: capCubeStyle.gridRowGap,
|
|
12
|
+
gridColumnGap: capCubeStyle.gridColumnGap,
|
|
13
|
+
gridTemplateRows: capCubeStyle.gridTemplateRows,
|
|
14
|
+
gridTemplateColumns: capCubeStyle.gridTemplateColumns,
|
|
15
|
+
}"
|
|
16
|
+
>
|
|
17
|
+
<div
|
|
18
|
+
class="cap-cube__item"
|
|
19
|
+
v-for="(item, index) in showCubeListWrap"
|
|
20
|
+
:key="index"
|
|
21
|
+
:style="{
|
|
22
|
+
gridColumnStart: item.columnStart,
|
|
23
|
+
gridColumnEnd: item.columnEnd,
|
|
24
|
+
gridRowStart: item.rowStart,
|
|
25
|
+
gridRowEnd: item.rowEnd,
|
|
26
|
+
}"
|
|
27
|
+
@click="handleTap(index)"
|
|
28
|
+
>
|
|
29
|
+
<ste-image
|
|
30
|
+
:mode="radioTC == 1 ? 'aspectFill' : radioTC == 2 ? 'aspectFit' : 'scaleToFill'"
|
|
31
|
+
:class="{ 'c-box-angle-2': imageAngle == 2 }"
|
|
32
|
+
class="cap-cube__table-image cap-cube__table-image--invisible"
|
|
33
|
+
:src="item.img"
|
|
34
|
+
v-if="item.img"
|
|
35
|
+
/>
|
|
36
|
+
</div>
|
|
37
|
+
</div>
|
|
38
|
+
</div>
|
|
39
|
+
</template>
|
|
40
|
+
<script>
|
|
41
|
+
import utils from '@/common/utils';
|
|
42
|
+
import useRouter from '@/common/useRouter.js';
|
|
43
|
+
let router = useRouter();
|
|
44
|
+
|
|
45
|
+
/**以0.5为单位进行四舍五入*/
|
|
46
|
+
const toFixed = num => {
|
|
47
|
+
if (!num) return 0;
|
|
48
|
+
const n = Math.floor(num);
|
|
49
|
+
const f = num % 1;
|
|
50
|
+
if (f < 0.26) return n;
|
|
51
|
+
if (f < 0.76) return n + 0.5;
|
|
52
|
+
return n + 1;
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
export default {
|
|
56
|
+
props: {
|
|
57
|
+
decoration: {},
|
|
58
|
+
},
|
|
59
|
+
data() {
|
|
60
|
+
return {
|
|
61
|
+
borderWidth: 0,
|
|
62
|
+
layoutWidth: 0,
|
|
63
|
+
layoutHeight: 0,
|
|
64
|
+
showMethod: 0,
|
|
65
|
+
pageMargin: 0,
|
|
66
|
+
marginBottom: 0,
|
|
67
|
+
width: 0,
|
|
68
|
+
subEntry: [],
|
|
69
|
+
showCubeListWrap: [],
|
|
70
|
+
imageAngle: 1, //单选:1.直角 2.圆角
|
|
71
|
+
radioTC: 1, //单选:1填充 2留白
|
|
72
|
+
pageMarginStyle: {
|
|
73
|
+
width: 0,
|
|
74
|
+
row: 1, // 行数
|
|
75
|
+
column: 1, // 列数
|
|
76
|
+
itemWidth: 0,
|
|
77
|
+
itemHeight: 0,
|
|
78
|
+
widthDiff: 0, // 差值
|
|
79
|
+
},
|
|
80
|
+
// businessType: 0,
|
|
81
|
+
};
|
|
82
|
+
},
|
|
83
|
+
computed: {
|
|
84
|
+
capCubeStyle() {
|
|
85
|
+
const { width, row, column, itemWidth, itemHeight, widthDiff } = this.pageMarginStyle;
|
|
86
|
+
|
|
87
|
+
let gridTemplateRows = '',
|
|
88
|
+
gridTemplateColumns = '';
|
|
89
|
+
for (let i = 0; i < row; i++) {
|
|
90
|
+
gridTemplateRows += `${itemHeight}px `;
|
|
91
|
+
}
|
|
92
|
+
for (let i = 0; i < column; i++) {
|
|
93
|
+
let w = itemWidth;
|
|
94
|
+
// 如果差值不是0,则将差值分配到第一列和最后一列(最多七列,每列差值上限0.25,总差值不会超过1.75)
|
|
95
|
+
if (widthDiff) {
|
|
96
|
+
if (i === 0) {
|
|
97
|
+
// 将小数位分配给第一列
|
|
98
|
+
w += widthDiff % 1;
|
|
99
|
+
} else if (i === column - 1) {
|
|
100
|
+
// 整数位分配给最后一列(因为可能有负数,不能使用Math.floor函数向下取证)
|
|
101
|
+
w += parseInt(widthDiff);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
gridTemplateColumns += `${w}px `;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
return {
|
|
108
|
+
width: `${width}px`,
|
|
109
|
+
marginLeft: `${this.pageMargin}px`,
|
|
110
|
+
marginBottom: `${this.marginBottom}px`,
|
|
111
|
+
gridRowGap: `${this.borderWidth}px`,
|
|
112
|
+
gridColumnGap: `${this.borderWidth}px`,
|
|
113
|
+
gridTemplateRows,
|
|
114
|
+
gridTemplateColumns,
|
|
115
|
+
};
|
|
116
|
+
},
|
|
117
|
+
},
|
|
118
|
+
created() {
|
|
119
|
+
// 因为做的是定位,使用rpx会失真,直接使用PX绝对值
|
|
120
|
+
let formdata = utils.deepClone(this.decoration);
|
|
121
|
+
this.getProperties(formdata);
|
|
122
|
+
this.drawCubeWrap();
|
|
123
|
+
},
|
|
124
|
+
// 组件周期函数--监听组件挂载完毕
|
|
125
|
+
mounted() {},
|
|
126
|
+
methods: {
|
|
127
|
+
getProperties(formdata) {
|
|
128
|
+
this.borderWidth = formdata.borderWidth;
|
|
129
|
+
this.layoutWidth = formdata.layoutWidth;
|
|
130
|
+
this.layoutHeight = formdata.layoutHeight;
|
|
131
|
+
this.showMethod = formdata.showMethod;
|
|
132
|
+
this.pageMargin = formdata.pageMargin;
|
|
133
|
+
this.marginBottom = formdata.marginBottom;
|
|
134
|
+
this.width = formdata.width;
|
|
135
|
+
this.subEntry = formdata.subEntry;
|
|
136
|
+
this.showCubeListWrap = formdata.showCubeListWrap;
|
|
137
|
+
this.pageMarginStyle = formdata.pageMarginStyle;
|
|
138
|
+
this.imageAngle = formdata.imageAngle;
|
|
139
|
+
this.radioTC = formdata.radioTC;
|
|
140
|
+
// this.businessType = formdata.businessType;
|
|
141
|
+
},
|
|
142
|
+
/**
|
|
143
|
+
* 动态计算图片规格
|
|
144
|
+
*/
|
|
145
|
+
drawCubeWrap() {
|
|
146
|
+
const perviewLayoutWidth = utils.getWindowInfo().windowWidth;
|
|
147
|
+
const layoutWidth = this.layoutWidth;
|
|
148
|
+
const layoutHeight = this.layoutHeight;
|
|
149
|
+
// 应该展示的内容区域总宽度
|
|
150
|
+
const wrapWith = perviewLayoutWidth - this.pageMargin * 2;
|
|
151
|
+
// 单个块的宽度
|
|
152
|
+
const itemWidth = toFixed((wrapWith - this.borderWidth * (layoutWidth - 1)) / layoutWidth);
|
|
153
|
+
// 重新计算盒子实际总宽度
|
|
154
|
+
const _wrapWith = (itemWidth + this.borderWidth) * layoutWidth - this.borderWidth;
|
|
155
|
+
// 计算实际宽度和应该展示宽度之间的差值,求绝对值
|
|
156
|
+
const widthDiff = wrapWith - _wrapWith;
|
|
157
|
+
// 单个块的高度
|
|
158
|
+
const itemHeight = layoutHeight === 1 ? itemWidth : toFixed((perviewLayoutWidth - this.borderWidth * (layoutWidth - 1)) / layoutHeight);
|
|
159
|
+
|
|
160
|
+
const subEntry = this.subEntry;
|
|
161
|
+
const showCubeListWrap = [];
|
|
162
|
+
let maxHeight = 0,
|
|
163
|
+
row = 1;
|
|
164
|
+
if (subEntry.length) {
|
|
165
|
+
for (let i = 0; i < subEntry.length; i++) {
|
|
166
|
+
const a = subEntry[i];
|
|
167
|
+
const coverDiv = {
|
|
168
|
+
columnStart: a.x + 1,
|
|
169
|
+
columnEnd: a.x + a.width + 1,
|
|
170
|
+
rowStart: a.y + 1,
|
|
171
|
+
rowEnd: a.y + a.height + 1,
|
|
172
|
+
img: a[`img`] ? a[`img`] : '',
|
|
173
|
+
};
|
|
174
|
+
if (maxHeight < coverDiv.top + coverDiv.height) {
|
|
175
|
+
maxHeight = coverDiv.top + coverDiv.height;
|
|
176
|
+
}
|
|
177
|
+
if (row < a.y + a.height) {
|
|
178
|
+
row = a.y + a.height;
|
|
179
|
+
}
|
|
180
|
+
showCubeListWrap.push(coverDiv);
|
|
181
|
+
}
|
|
182
|
+
this.showCubeListWrap = showCubeListWrap;
|
|
183
|
+
this.pageMarginStyle = {
|
|
184
|
+
width: wrapWith,
|
|
185
|
+
column: this.layoutWidth, // 列数
|
|
186
|
+
row, // 行数
|
|
187
|
+
itemWidth,
|
|
188
|
+
itemHeight,
|
|
189
|
+
widthDiff, // 差值
|
|
190
|
+
};
|
|
191
|
+
}
|
|
192
|
+
},
|
|
193
|
+
/**
|
|
194
|
+
* 跳转
|
|
195
|
+
*/
|
|
196
|
+
handleTap(index) {
|
|
197
|
+
const currentSwiperItem = this.subEntry[index];
|
|
198
|
+
const itemLink = currentSwiperItem.link;
|
|
199
|
+
router.navtofun(itemLink);
|
|
200
|
+
},
|
|
201
|
+
},
|
|
202
|
+
};
|
|
203
|
+
</script>
|
|
204
|
+
|
|
205
|
+
<style lang="scss" scoped>
|
|
206
|
+
/*预览*/
|
|
207
|
+
.rc-design-vue-preview {
|
|
208
|
+
.cap-cube-wrap {
|
|
209
|
+
width: 100%;
|
|
210
|
+
overflow: hidden;
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
.cap-cube {
|
|
215
|
+
position: relative;
|
|
216
|
+
display: grid;
|
|
217
|
+
overflow: hidden;
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
.cap-cube__item {
|
|
221
|
+
display: flex;
|
|
222
|
+
align-items: center;
|
|
223
|
+
justify-content: center;
|
|
224
|
+
background-repeat: no-repeat;
|
|
225
|
+
background-position: 50%;
|
|
226
|
+
background-size: 100% 100%;
|
|
227
|
+
overflow: hidden;
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
.cap-cube__table-image--invisible {
|
|
231
|
+
width: 100%;
|
|
232
|
+
height: 100%;
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
.iconshangpinxiangqing-baozhuang-2 {
|
|
236
|
+
position: absolute;
|
|
237
|
+
top: 50%;
|
|
238
|
+
left: 50%;
|
|
239
|
+
font-size: 40px;
|
|
240
|
+
z-index: 999;
|
|
241
|
+
color: #fff;
|
|
242
|
+
transform: translate(-50%, -50%);
|
|
243
|
+
}
|
|
244
|
+
</style>
|