@didaoktv/didaoui-uniapp 1.2.1 → 1.2.3

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.
@@ -36,7 +36,6 @@
36
36
 
37
37
  <script>
38
38
  import { nextTick } from 'vue'
39
- import { t } from '../../libs/i18n'
40
39
 
41
40
  export default {
42
41
  name: 'dd-barcode',
@@ -303,7 +302,7 @@ export default {
303
302
  })
304
303
  } catch (error) {
305
304
  console.error('生成条码失败:', error)
306
- this.error = error.message || t('dd.barcode.error')
305
+ this.error = error.message || '生成条码失败'
307
306
  this.$emit('error', error)
308
307
  }
309
308
  },
@@ -70,10 +70,10 @@
70
70
  <!-- 底部按钮区域 -->
71
71
  <view class="dd-cascader__action">
72
72
  <view class="dd-cascader__action-item">
73
- <dd-button type="secondary" block @click="handleCancel">{{ t('dd.common.cancel') }}</dd-button>
73
+ <dd-button type="secondary" block @click="handleCancel">取消</dd-button>
74
74
  </view>
75
75
  <view class="dd-cascader__action-item">
76
- <dd-button type="primary" block @click="handleConfirm">{{ t('dd.common.confirm') }}</dd-button>
76
+ <dd-button type="primary" block @click="handleConfirm">确定</dd-button>
77
77
  </view>
78
78
  </view>
79
79
  </dd-popup>
@@ -81,7 +81,6 @@
81
81
 
82
82
  <script setup lang="ts">
83
83
  import { computed, ref, watch } from 'vue'
84
- import { t } from '../../libs/i18n'
85
84
  import DdPopup from '../dd-popup/dd-popup.vue'
86
85
  import DdSteps from '../dd-steps/dd-steps.vue'
87
86
  import DdStep from '../dd-step/dd-step.vue'
@@ -183,7 +182,7 @@ watch(
183
182
  const isChange = computed(() => tabsIndex.value > 1)
184
183
 
185
184
  const genTabsList = computed(() => {
186
- const tabsList: { name: string }[] = [{ name: t('dd.common.pleaseChoose') }]
185
+ const tabsList: { name: string }[] = [{ name: '请选择' }]
187
186
 
188
187
  // 根据选中的值动态生成tabs
189
188
  for (let i = 0; i < selectedValueIndexs.value.length; i++) {
@@ -199,7 +198,7 @@ const genTabsList = computed(() => {
199
198
  selectedItem[props.childrenKey] &&
200
199
  selectedItem[props.childrenKey].length > 0
201
200
  ) {
202
- tabsList.push({ name: t('dd.common.pleaseChoose') })
201
+ tabsList.push({ name: '请选择' })
203
202
  }
204
203
  }
205
204
  }
@@ -1,10 +1,9 @@
1
1
  <template>
2
2
  <view @click="handleClick">
3
- <slot>{{ t("dd.common.copy") }}</slot>
3
+ <slot>复制</slot>
4
4
  </view>
5
5
  </template>
6
6
  <script>
7
- import { t } from '../../libs/i18n'
8
7
  export default {
9
8
  name: "up-copy",
10
9
  props: {
@@ -18,17 +17,16 @@ export default {
18
17
  },
19
18
  notice: {
20
19
  type: String,
21
- default: t("dd.common.copy") + t("dd.common.success")
20
+ default: '复制成功'
22
21
  }
23
22
  },
24
23
  emits: ['success'],
25
24
  methods: {
26
- t,
27
25
  handleClick() {
28
26
  let content = this.content;
29
27
  if (!content) {
30
28
  uni.showToast({
31
- title: t("dd.common.none"),
29
+ title: "暂无",
32
30
  icon: 'none',
33
31
  duration: 2000,
34
32
  });
@@ -44,7 +42,7 @@ export default {
44
42
  success: function() {
45
43
  if (that.alertStyle == 'modal') {
46
44
  uni.showModal({
47
- title: t("dd.common.tip"),
45
+ title: "提示",
48
46
  content: that.notice
49
47
  });
50
48
  } else {
@@ -57,7 +55,7 @@ export default {
57
55
  },
58
56
  fail:function(){
59
57
  uni.showToast({
60
- title: t("dd.common.copy") + t("dd.common.fail"),
58
+ title: "复制失败",
61
59
  icon: 'none',
62
60
  duration:3000,
63
61
  });
@@ -10,17 +10,19 @@
10
10
  @click="handleClick"
11
11
  >
12
12
  <view class="dd-coupon__content">
13
- <!-- 左侧金额区域 -->
13
+ <!-- 左侧金额区域:unit + amount 基线对齐,limit 换行在下 -->
14
14
  <view class="dd-coupon__amount">
15
- <slot name="unit" :unit="unit" :unitPosition="unitPosition">
16
- <text v-if="unitPosition === 'left'" class="dd-coupon__amount-unit">{{ unit }}</text>
17
- </slot>
18
- <slot name="amount" :amount="amount">
19
- <text class="dd-coupon__amount-value">{{ amount }}</text>
20
- </slot>
21
- <slot name="unit" :unit="unit" :unitPosition="unitPosition">
22
- <text v-if="unitPosition === 'right'" class="dd-coupon__amount-unit">{{ unit }}</text>
23
- </slot>
15
+ <view class="dd-coupon__amount-main">
16
+ <slot v-if="unitPosition === 'left'" name="unit" :unit="unit" :unitPosition="unitPosition">
17
+ <text class="dd-coupon__amount-unit">{{ unit }}</text>
18
+ </slot>
19
+ <slot name="amount" :amount="amount">
20
+ <text class="dd-coupon__amount-value">{{ amount }}</text>
21
+ </slot>
22
+ <slot v-if="unitPosition === 'right'" name="unit" :unit="unit" :unitPosition="unitPosition">
23
+ <text class="dd-coupon__amount-unit">{{ unit }}</text>
24
+ </slot>
25
+ </view>
24
26
  <slot name="limit" :limit="limit">
25
27
  <text v-if="limit" class="dd-coupon__amount-limit">{{ limit }}</text>
26
28
  </slot>
@@ -41,21 +43,14 @@
41
43
 
42
44
  <!-- 右侧操作区域 -->
43
45
  <view class="dd-coupon__action">
44
- <slot name="action" :actionText="actionText" :circle="circle">
45
- <!-- ponytail: 原版 :shape="circle ? 'circle': 'circle'" 恒为圆形,故 round 恒 true -->
46
- <dd-tag
47
- variant="error"
48
- :type="type ? 'outlined' : 'filled'"
49
- round
50
- size="sm"
51
- class="dd-coupon__action-btn"
52
- >{{ actionText }}</dd-tag>
46
+ <slot name="action" :actionText="actionText">
47
+ <view class="dd-coupon__action-btn"><text>{{ actionText }}</text></view>
53
48
  </slot>
54
49
  </view>
55
50
  </view>
56
51
 
57
- <!-- 红包绳子效果 -->
58
- <view v-if="shape === 'envelope'" class="dd-coupon__rope"></view>
52
+ <!-- 红包顶部金条纹 -->
53
+ <view v-if="shape === 'envelope'" class="dd-coupon__stripe"></view>
59
54
 
60
55
  <!-- 默认插槽,可用于添加额外内容 -->
61
56
  <slot></slot>
@@ -64,7 +59,6 @@
64
59
 
65
60
  <script setup lang="ts">
66
61
  import { computed } from 'vue'
67
- import DdTag from '../dd-tag/dd-tag.vue'
68
62
 
69
63
  interface Props {
70
64
  /** 金额 */
@@ -87,16 +81,14 @@ interface Props {
87
81
  shape?: 'coupon' | 'envelope' | 'card'
88
82
  /** 尺寸:small, medium, large */
89
83
  size?: 'small' | 'medium' | 'large'
90
- /** 是否圆形按钮(保留 API;原实现恒为圆形) */
91
- circle?: boolean
92
84
  /** 是否禁用 */
93
85
  disabled?: boolean
94
- /** 背景颜色 */
86
+ /** 背景颜色(覆盖内置主题渐变) */
95
87
  bgColor?: string
96
88
  /** 文字颜色 */
97
89
  color?: string
98
- /** 内置背景主题:primary/success/warning/error */
99
- type?: string
90
+ /** 内置渐变主题:primary/success/warning/error */
91
+ type?: 'primary' | 'success' | 'warning' | 'error' | ''
100
92
  }
101
93
 
102
94
  const props = withDefaults(defineProps<Props>(), {
@@ -110,7 +102,6 @@ const props = withDefaults(defineProps<Props>(), {
110
102
  actionText: '使用',
111
103
  shape: 'coupon',
112
104
  size: 'medium',
113
- circle: false,
114
105
  disabled: false,
115
106
  bgColor: '',
116
107
  color: '',
@@ -139,15 +130,14 @@ function handleClick() {
139
130
  .dd-coupon {
140
131
  position: relative;
141
132
  overflow: hidden;
142
- border-radius: $dd-radius-md;
143
- background: #ffebf0;
133
+ border-radius: $dd-radius-lg;
134
+ background: $dd-bg-elevated;
144
135
  color: $dd-text-primary;
145
136
  width: 100%;
146
137
 
138
+ // === 形状 ===
147
139
  &--coupon {
148
- border-radius: $dd-radius-lg;
149
- overflow: hidden;
150
-
140
+ // 两侧打孔:孔色取页面底色,需在 $dd-bg 页面上使用(文档化限制)
151
141
  &::before {
152
142
  content: '';
153
143
  position: absolute;
@@ -156,8 +146,9 @@ function handleClick() {
156
146
  transform: translateY(-50%);
157
147
  width: 48rpx;
158
148
  height: 48rpx;
159
- background-color: $dd-bg;
149
+ background: $dd-bg;
160
150
  border-radius: 50%;
151
+ z-index: 1;
161
152
  }
162
153
 
163
154
  &::after {
@@ -168,39 +159,35 @@ function handleClick() {
168
159
  transform: translateY(-50%);
169
160
  width: 48rpx;
170
161
  height: 48rpx;
171
- background-color: $dd-bg;
162
+ background: $dd-bg;
172
163
  border-radius: 50%;
164
+ z-index: 1;
173
165
  }
174
166
  }
175
167
 
176
- &--envelope {
177
- border-radius: $dd-radius-lg;
168
+ // === 尺寸(min-height,长内容不被裁剪) ===
169
+ &--small .dd-coupon__content {
170
+ min-height: 160rpx;
171
+ }
178
172
 
179
- &::before {
180
- content: '';
181
- position: absolute;
182
- left: 0;
183
- top: 0;
184
- right: 0;
185
- height: 20rpx;
186
- background: repeating-linear-gradient(-45deg, #ffd000, #ffd000 10rpx, #ffa000 10rpx, #ffa000 20rpx);
187
- }
173
+ &--medium .dd-coupon__content {
174
+ min-height: 180rpx;
188
175
  }
189
176
 
190
- &--card {
191
- border-radius: $dd-radius-lg;
177
+ &--large .dd-coupon__content {
178
+ min-height: 220rpx;
192
179
  }
193
180
 
194
- &--small {
195
- height: 160rpx;
181
+ &--small .dd-coupon__amount-value {
182
+ font-size: 44rpx;
196
183
  }
197
184
 
198
- &--medium {
199
- height: 180rpx;
185
+ &--medium .dd-coupon__amount-value {
186
+ font-size: 56rpx;
200
187
  }
201
188
 
202
- &--large {
203
- height: 220rpx;
189
+ &--large .dd-coupon__amount-value {
190
+ font-size: 72rpx;
204
191
  }
205
192
 
206
193
  &--disabled {
@@ -212,156 +199,264 @@ function handleClick() {
212
199
  flex-direction: row;
213
200
  align-items: center;
214
201
  justify-content: space-between;
215
- height: 100%;
216
- padding: 0 30rpx;
202
+ padding: 0 $dd-space-4;
217
203
  position: relative;
218
204
  z-index: 2;
205
+ box-sizing: border-box;
219
206
  }
220
207
 
221
208
  &__amount {
209
+ flex-shrink: 0;
222
210
  display: flex;
223
211
  flex-direction: column;
224
212
  align-items: flex-start;
225
- padding-left: 10rpx;
226
- padding-right: 30rpx;
227
- border-right: 1px dashed $dd-border-default;
213
+ min-width: 144rpx;
214
+ padding: $dd-space-2 $dd-space-4 $dd-space-2 0;
215
+ border-right: 1px dashed $dd-border-strong;
216
+
217
+ &-main {
218
+ display: flex;
219
+ flex-direction: row;
220
+ align-items: baseline;
221
+ }
228
222
 
229
223
  &-unit {
230
- font-size: $dd-font-size-caption;
231
- font-weight: normal;
224
+ font-size: $dd-font-size-h3;
225
+ font-weight: $dd-font-weight-h4;
226
+ color: $dd-error-400;
227
+ line-height: 1;
232
228
  }
233
229
 
234
230
  &-value {
235
231
  font-size: 56rpx;
236
- font-weight: bold;
232
+ font-weight: $dd-font-weight-display;
237
233
  color: $dd-error-400;
238
234
  line-height: 1;
239
- margin: 10rpx 0;
240
235
  }
241
236
 
242
237
  &-limit {
238
+ margin-top: $dd-space-1;
243
239
  font-size: $dd-font-size-caption;
244
- opacity: 0.9;
240
+ color: $dd-text-tertiary;
241
+ line-height: $dd-line-height-caption;
245
242
  }
246
243
  }
247
244
 
248
245
  &__info {
249
246
  flex: 1;
247
+ min-width: 0;
250
248
  display: flex;
251
249
  flex-direction: column;
252
250
  align-items: flex-start;
253
- padding-left: 30rpx;
251
+ padding: $dd-space-2 0 $dd-space-2 $dd-space-4;
254
252
 
255
253
  &-title {
256
254
  font-size: $dd-font-size-h4;
257
- font-weight: bold;
258
- margin-bottom: 10rpx;
255
+ font-weight: $dd-font-weight-h4;
256
+ color: $dd-text-primary;
257
+ line-height: $dd-line-height-h4;
258
+ @include dd-ellipsis(1);
259
259
  }
260
260
 
261
261
  &-desc {
262
+ margin-top: $dd-space-1;
262
263
  font-size: $dd-font-size-caption;
263
- opacity: 0.9;
264
- margin-bottom: 10rpx;
264
+ color: $dd-text-secondary;
265
+ line-height: $dd-line-height-caption;
266
+ @include dd-ellipsis(1);
265
267
  }
266
268
 
267
269
  &-time {
270
+ margin-top: $dd-space-1;
268
271
  font-size: $dd-font-size-caption;
269
- opacity: 0.8;
272
+ color: $dd-text-tertiary;
273
+ line-height: $dd-line-height-caption;
274
+ @include dd-ellipsis(1);
270
275
  }
271
276
  }
272
277
 
273
278
  &__action {
279
+ flex-shrink: 0;
274
280
  display: flex;
275
281
  flex-direction: row;
276
282
  align-items: center;
277
283
  justify-content: center;
278
- padding-right: 20rpx;
284
+ padding-left: $dd-space-4;
285
+ }
286
+
287
+ // 默认操作按钮:error 实底胶囊;type 主题下在各主题块中改对比色描边
288
+ &__action-btn {
289
+ display: inline-flex;
290
+ align-items: center;
291
+ justify-content: center;
292
+ height: 56rpx;
293
+ padding: 0 $dd-space-5;
294
+ border-radius: $dd-radius-full;
295
+ background: $dd-error-500;
296
+ color: $dd-error-contrast;
297
+ font-size: $dd-font-size-caption;
298
+ font-weight: $dd-font-weight-caption;
279
299
  }
280
300
 
281
- &__rope {
301
+ // 红包顶部金条纹(帝王金)
302
+ &__stripe {
282
303
  position: absolute;
283
- top: -40rpx;
284
- left: 50%;
285
- transform: translateX(-50%);
286
- width: 80rpx;
287
- height: 80rpx;
288
- background: linear-gradient(to right, #ffd000, #ffa000);
289
- border-radius: 40rpx 40rpx 0 0;
304
+ left: 0;
305
+ top: 0;
306
+ right: 0;
307
+ height: 20rpx;
308
+ background: repeating-linear-gradient(
309
+ -45deg,
310
+ $dd-primary-300,
311
+ $dd-primary-300 10rpx,
312
+ $dd-primary-500 10rpx,
313
+ $dd-primary-500 20rpx
314
+ );
290
315
  z-index: 1;
316
+ }
291
317
 
292
- &::before {
293
- content: '';
294
- position: absolute;
295
- top: 0;
296
- left: -20rpx;
297
- width: 20rpx;
298
- height: 40rpx;
299
- background: linear-gradient(to bottom, #ffd000, #ffa000);
300
- border-radius: 10rpx 0 0 10rpx;
301
- }
302
-
303
- &::after {
304
- content: '';
305
- position: absolute;
306
- top: 0;
307
- right: -20rpx;
308
- width: 20rpx;
309
- height: 40rpx;
310
- background: linear-gradient(to bottom, #ffd000, #ffa000);
311
- border-radius: 0 10rpx 10rpx 0;
312
- }
318
+ &--envelope .dd-coupon__content {
319
+ padding-top: $dd-space-3;
313
320
  }
314
321
 
315
- // 内置主题样式(保留原版券面渐变视觉)
322
+ // === 内置渐变主题($dd-gradient-* token + 各主题 contrast 文字) ===
316
323
  &--primary {
317
- background: linear-gradient(90deg, #43afff, #3b8cff);
318
- color: $dd-color-white;
324
+ background: $dd-gradient-primary;
325
+ color: $dd-primary-contrast;
319
326
 
320
327
  .dd-coupon__amount {
321
- border-right: 1px dashed #eee;
328
+ border-right-color: $dd-border-subtle;
322
329
  }
323
330
 
331
+ .dd-coupon__amount-unit,
324
332
  .dd-coupon__amount-value {
325
- color: $dd-color-white;
333
+ color: $dd-primary-contrast;
334
+ }
335
+
336
+ .dd-coupon__amount-limit {
337
+ color: $dd-primary-contrast;
338
+ opacity: 0.75;
339
+ }
340
+
341
+ .dd-coupon__info-title {
342
+ color: $dd-primary-contrast;
343
+ }
344
+
345
+ .dd-coupon__info-desc,
346
+ .dd-coupon__info-time {
347
+ color: $dd-primary-contrast;
348
+ opacity: 0.8;
349
+ }
350
+
351
+ .dd-coupon__action-btn {
352
+ background: transparent;
353
+ border: 1px solid $dd-primary-contrast;
354
+ color: $dd-primary-contrast;
326
355
  }
327
356
  }
328
357
 
329
358
  &--success {
330
- background: linear-gradient(90deg, #67dda9, #19be6b);
331
- color: $dd-color-white !important;
359
+ background: $dd-gradient-success;
360
+ color: $dd-success-contrast;
332
361
 
333
362
  .dd-coupon__amount {
334
- border-right: 1px dashed #eee;
363
+ border-right-color: $dd-border-subtle;
335
364
  }
336
365
 
366
+ .dd-coupon__amount-unit,
337
367
  .dd-coupon__amount-value {
338
- color: $dd-color-white;
368
+ color: $dd-success-contrast;
369
+ }
370
+
371
+ .dd-coupon__amount-limit {
372
+ color: $dd-success-contrast;
373
+ opacity: 0.75;
374
+ }
375
+
376
+ .dd-coupon__info-title {
377
+ color: $dd-success-contrast;
378
+ }
379
+
380
+ .dd-coupon__info-desc,
381
+ .dd-coupon__info-time {
382
+ color: $dd-success-contrast;
383
+ opacity: 0.8;
384
+ }
385
+
386
+ .dd-coupon__action-btn {
387
+ background: transparent;
388
+ border: 1px solid $dd-success-contrast;
389
+ color: $dd-success-contrast;
339
390
  }
340
391
  }
341
392
 
342
393
  &--warning {
343
- background: linear-gradient(90deg, #ff9739, #ff6a39);
344
- color: $dd-color-white;
394
+ background: $dd-gradient-warning;
395
+ color: $dd-warning-contrast;
345
396
 
346
397
  .dd-coupon__amount {
347
- border-right: 1px dashed #eee;
398
+ border-right-color: $dd-border-subtle;
348
399
  }
349
400
 
401
+ .dd-coupon__amount-unit,
350
402
  .dd-coupon__amount-value {
351
- color: $dd-color-white;
403
+ color: $dd-warning-contrast;
404
+ }
405
+
406
+ .dd-coupon__amount-limit {
407
+ color: $dd-warning-contrast;
408
+ opacity: 0.75;
409
+ }
410
+
411
+ .dd-coupon__info-title {
412
+ color: $dd-warning-contrast;
413
+ }
414
+
415
+ .dd-coupon__info-desc,
416
+ .dd-coupon__info-time {
417
+ color: $dd-warning-contrast;
418
+ opacity: 0.8;
419
+ }
420
+
421
+ .dd-coupon__action-btn {
422
+ background: transparent;
423
+ border: 1px solid $dd-warning-contrast;
424
+ color: $dd-warning-contrast;
352
425
  }
353
426
  }
354
427
 
355
428
  &--error {
356
- background: linear-gradient(90deg, #ff7070, #ff4747);
357
- color: $dd-color-white;
429
+ background: $dd-gradient-error;
430
+ color: $dd-error-contrast;
358
431
 
359
432
  .dd-coupon__amount {
360
- border-right: 1px dashed #eee;
433
+ border-right-color: $dd-border-subtle;
361
434
  }
362
435
 
436
+ .dd-coupon__amount-unit,
363
437
  .dd-coupon__amount-value {
364
- color: $dd-color-white;
438
+ color: $dd-error-contrast;
439
+ }
440
+
441
+ .dd-coupon__amount-limit {
442
+ color: $dd-error-contrast;
443
+ opacity: 0.75;
444
+ }
445
+
446
+ .dd-coupon__info-title {
447
+ color: $dd-error-contrast;
448
+ }
449
+
450
+ .dd-coupon__info-desc,
451
+ .dd-coupon__info-time {
452
+ color: $dd-error-contrast;
453
+ opacity: 0.8;
454
+ }
455
+
456
+ .dd-coupon__action-btn {
457
+ background: transparent;
458
+ border: 1px solid $dd-error-contrast;
459
+ color: $dd-error-contrast;
365
460
  }
366
461
  }
367
462
  }