@ruixinkeji/prism-ui 1.0.0 → 1.0.2
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/README.md +1 -1
- package/components/PrismAIAssist/PrismAIAssist.vue +98 -98
- package/components/PrismAddressInput/PrismAddressInput.vue +597 -597
- package/components/PrismCityCascadeSelect/PrismCityCascadeSelect.vue +793 -793
- package/components/PrismCityPicker/PrismCityPicker.vue +1008 -1008
- package/components/PrismCitySelect/PrismCitySelect.vue +435 -435
- package/components/PrismCode/PrismCode.vue +749 -749
- package/components/PrismCodeInput/PrismCodeInput.vue +156 -156
- package/components/PrismDateTimePicker/PrismDateTimePicker.vue +953 -953
- package/components/PrismDropdown/PrismDropdown.vue +77 -77
- package/components/PrismGroupSticky/PrismGroupSticky.vue +352 -352
- package/components/PrismIdCardInput/PrismIdCardInput.vue +253 -253
- package/components/PrismImagePicker/PrismImagePicker.vue +457 -457
- package/components/PrismIndexBar/PrismIndexBar.vue +243 -243
- package/components/PrismLicensePlateInput/PrismLicensePlateInput.vue +1100 -1100
- package/components/PrismMusicPlayer/PrismMusicPlayer.vue +530 -530
- package/components/PrismNavBar/PrismNavBar.vue +199 -199
- package/components/PrismSecureInput/PrismSecureInput.vue +360 -360
- package/components/PrismSticky/PrismSticky.vue +173 -173
- package/components/PrismSwiper/PrismSwiper.vue +338 -338
- package/components/PrismSwitch/PrismSwitch.vue +202 -202
- package/components/PrismTabBar/PrismTabBar.vue +147 -147
- package/components/PrismTabs/PrismTabs.vue +49 -49
- package/components/PrismVoiceInput/PrismVoiceInput.vue +529 -529
- package/fonts/fa-brands-400.woff2 +0 -0
- package/fonts/fa-regular-400.woff2 +0 -0
- package/fonts/fa-solid-900.woff2 +0 -0
- package/fonts/fa-v4compatibility.woff2 +0 -0
- package/fonts/font-awesome.css +913 -0
- package/fonts/iconfont.woff2 +0 -0
- package/package.json +7 -1
- package/store/app.d.ts +21 -0
- package/store/app.js +68 -0
- package/styles/base.scss +2 -2
|
@@ -1,360 +1,360 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<view class="prism-secure-input" :class="{ 'dark-mode': appStore.isDarkMode }">
|
|
3
|
-
<!-- 密码输入框 -->
|
|
4
|
-
<view class="password-boxes" @click="showKeyboardModal">
|
|
5
|
-
<view
|
|
6
|
-
v-for="i in length"
|
|
7
|
-
:key="i"
|
|
8
|
-
class="password-box"
|
|
9
|
-
:class="{ 'active': isFocused && passwordArray.length === i - 1, 'filled': passwordArray[i - 1] }"
|
|
10
|
-
>
|
|
11
|
-
<view class="password-dot" v-if="passwordArray[i - 1]"></view>
|
|
12
|
-
<view class="cursor" v-if="isFocused && passwordArray.length === i - 1"></view>
|
|
13
|
-
</view>
|
|
14
|
-
</view>
|
|
15
|
-
|
|
16
|
-
<!-- 自定义数字键盘 -->
|
|
17
|
-
<view class="keyboard-modal" v-if="showKeyboard" @click="hideKeyboard">
|
|
18
|
-
<view class="keyboard-content" @click.stop>
|
|
19
|
-
<view class="keyboard-header">
|
|
20
|
-
<text class="keyboard-title">{{ title }}</text>
|
|
21
|
-
<text class="keyboard-done" @click="hideKeyboard">完成</text>
|
|
22
|
-
</view>
|
|
23
|
-
|
|
24
|
-
<!-- 数字键盘 -->
|
|
25
|
-
<view class="number-keyboard" :class="{ 'random': randomOrder }">
|
|
26
|
-
<view class="keyboard-row">
|
|
27
|
-
<view class="key-btn" v-for="n in displayNumbers.slice(0, 3)" :key="n" @click="inputNumber(n)">
|
|
28
|
-
<text class="key-text">{{ n }}</text>
|
|
29
|
-
</view>
|
|
30
|
-
</view>
|
|
31
|
-
<view class="keyboard-row">
|
|
32
|
-
<view class="key-btn" v-for="n in displayNumbers.slice(3, 6)" :key="n" @click="inputNumber(n)">
|
|
33
|
-
<text class="key-text">{{ n }}</text>
|
|
34
|
-
</view>
|
|
35
|
-
</view>
|
|
36
|
-
<view class="keyboard-row">
|
|
37
|
-
<view class="key-btn" v-for="n in displayNumbers.slice(6, 9)" :key="n" @click="inputNumber(n)">
|
|
38
|
-
<text class="key-text">{{ n }}</text>
|
|
39
|
-
</view>
|
|
40
|
-
</view>
|
|
41
|
-
<view class="keyboard-row">
|
|
42
|
-
<view class="key-btn func" @click="clearAll">
|
|
43
|
-
<text class="key-text">清空</text>
|
|
44
|
-
</view>
|
|
45
|
-
<view class="key-btn" @click="inputNumber(displayNumbers[9])">
|
|
46
|
-
<text class="key-text">{{ displayNumbers[9] }}</text>
|
|
47
|
-
</view>
|
|
48
|
-
<view class="key-btn delete" @click="deleteNumber">
|
|
49
|
-
<text class="delete-text">删除</text>
|
|
50
|
-
</view>
|
|
51
|
-
</view>
|
|
52
|
-
</view>
|
|
53
|
-
</view>
|
|
54
|
-
</view>
|
|
55
|
-
</view>
|
|
56
|
-
</template>
|
|
57
|
-
|
|
58
|
-
<script setup>
|
|
59
|
-
import { ref, computed, watch, onMounted } from 'vue';
|
|
60
|
-
import { useAppStore } from '@/store/app';
|
|
61
|
-
|
|
62
|
-
const props = defineProps({
|
|
63
|
-
modelValue: {
|
|
64
|
-
type: String,
|
|
65
|
-
default: ''
|
|
66
|
-
},
|
|
67
|
-
length: {
|
|
68
|
-
type: Number,
|
|
69
|
-
default: 6
|
|
70
|
-
},
|
|
71
|
-
title: {
|
|
72
|
-
type: String,
|
|
73
|
-
default: '请输入密码'
|
|
74
|
-
},
|
|
75
|
-
randomOrder: {
|
|
76
|
-
type: Boolean,
|
|
77
|
-
default: false
|
|
78
|
-
}
|
|
79
|
-
});
|
|
80
|
-
|
|
81
|
-
const emit = defineEmits(['update:modelValue', 'complete']);
|
|
82
|
-
|
|
83
|
-
const appStore = useAppStore();
|
|
84
|
-
const passwordValue = ref(props.modelValue);
|
|
85
|
-
const isFocused = ref(false);
|
|
86
|
-
const showKeyboard = ref(false);
|
|
87
|
-
|
|
88
|
-
// 数字顺序(可随机)
|
|
89
|
-
const displayNumbers = ref(['1', '2', '3', '4', '5', '6', '7', '8', '9', '0']);
|
|
90
|
-
|
|
91
|
-
const passwordArray = computed(() => {
|
|
92
|
-
return passwordValue.value.split('').slice(0, props.length);
|
|
93
|
-
});
|
|
94
|
-
|
|
95
|
-
// 打乱数字顺序
|
|
96
|
-
function shuffleNumbers() {
|
|
97
|
-
if (props.randomOrder) {
|
|
98
|
-
const arr = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9'];
|
|
99
|
-
for (let i = arr.length - 1; i > 0; i--) {
|
|
100
|
-
const j = Math.floor(Math.random() * (i + 1));
|
|
101
|
-
[arr[i], arr[j]] = [arr[j], arr[i]];
|
|
102
|
-
}
|
|
103
|
-
displayNumbers.value = arr;
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
function showKeyboardModal() {
|
|
108
|
-
isFocused.value = true;
|
|
109
|
-
showKeyboard.value = true;
|
|
110
|
-
if (props.randomOrder) {
|
|
111
|
-
shuffleNumbers();
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
function hideKeyboard() {
|
|
116
|
-
isFocused.value = false;
|
|
117
|
-
showKeyboard.value = false;
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
function inputNumber(n) {
|
|
121
|
-
if (passwordValue.value.length >= props.length) return;
|
|
122
|
-
|
|
123
|
-
passwordValue.value += n;
|
|
124
|
-
emit('update:modelValue', passwordValue.value);
|
|
125
|
-
|
|
126
|
-
if (passwordValue.value.length === props.length) {
|
|
127
|
-
emit('complete', passwordValue.value);
|
|
128
|
-
setTimeout(() => {
|
|
129
|
-
hideKeyboard();
|
|
130
|
-
}, 200);
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
function deleteNumber() {
|
|
135
|
-
if (passwordValue.value.length > 0) {
|
|
136
|
-
passwordValue.value = passwordValue.value.slice(0, -1);
|
|
137
|
-
emit('update:modelValue', passwordValue.value);
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
function clearAll() {
|
|
142
|
-
passwordValue.value = '';
|
|
143
|
-
emit('update:modelValue', '');
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
watch(() => props.modelValue, (val) => {
|
|
147
|
-
passwordValue.value = val;
|
|
148
|
-
});
|
|
149
|
-
|
|
150
|
-
onMounted(() => {
|
|
151
|
-
if (props.randomOrder) {
|
|
152
|
-
shuffleNumbers();
|
|
153
|
-
}
|
|
154
|
-
});
|
|
155
|
-
</script>
|
|
156
|
-
|
|
157
|
-
<style lang="scss">
|
|
158
|
-
// 白色常量(用于按钮文字等固定白色场景)
|
|
159
|
-
$color-white: #FFFFFF;
|
|
160
|
-
|
|
161
|
-
.prism-secure-input {
|
|
162
|
-
.password-boxes {
|
|
163
|
-
display: flex;
|
|
164
|
-
justify-content: center;
|
|
165
|
-
gap: 16rpx;
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
.password-box {
|
|
169
|
-
width: 76rpx;
|
|
170
|
-
height: 88rpx;
|
|
171
|
-
background: var(--prism-input-bg, #EBEEF2);
|
|
172
|
-
border-radius: 12rpx;
|
|
173
|
-
display: flex;
|
|
174
|
-
align-items: center;
|
|
175
|
-
justify-content: center;
|
|
176
|
-
border: 2rpx solid transparent;
|
|
177
|
-
transition: all 0.2s ease;
|
|
178
|
-
position: relative;
|
|
179
|
-
|
|
180
|
-
&.active {
|
|
181
|
-
border-color: var(--prism-primary-color, #3478F6);
|
|
182
|
-
background: rgba(52, 120, 246, 0.08);
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
&.filled {
|
|
186
|
-
background: rgba(52, 120, 246, 0.08);
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
.password-dot {
|
|
190
|
-
width: 24rpx;
|
|
191
|
-
height: 24rpx;
|
|
192
|
-
background: var(--prism-text-primary, #1D2129);
|
|
193
|
-
border-radius: 50%;
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
.cursor {
|
|
197
|
-
width: 4rpx;
|
|
198
|
-
height: 40rpx;
|
|
199
|
-
background: var(--prism-primary-color, #3478F6);
|
|
200
|
-
animation: blink 1s infinite;
|
|
201
|
-
}
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
.keyboard-modal {
|
|
205
|
-
position: fixed;
|
|
206
|
-
top: 0;
|
|
207
|
-
left: 0;
|
|
208
|
-
right: 0;
|
|
209
|
-
bottom: 0;
|
|
210
|
-
background: var(--prism-mask-bg, rgba(0, 0, 0, 0.5));
|
|
211
|
-
z-index: 9999;
|
|
212
|
-
display: flex;
|
|
213
|
-
align-items: flex-end;
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
.keyboard-content {
|
|
217
|
-
width: 100%;
|
|
218
|
-
background: var(--prism-bg-color, #F7F8FA);
|
|
219
|
-
border-radius: 24rpx 24rpx 0 0;
|
|
220
|
-
padding-bottom: env(safe-area-inset-bottom);
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
.keyboard-header {
|
|
224
|
-
display: flex;
|
|
225
|
-
justify-content: space-between;
|
|
226
|
-
align-items: center;
|
|
227
|
-
padding: 24rpx 32rpx;
|
|
228
|
-
background: var(--prism-bg-color-card, #FFFFFF);
|
|
229
|
-
border-radius: 24rpx 24rpx 0 0;
|
|
230
|
-
|
|
231
|
-
.keyboard-title {
|
|
232
|
-
font-size: 32rpx;
|
|
233
|
-
font-weight: 600;
|
|
234
|
-
color: var(--prism-text-primary, #1D2129);
|
|
235
|
-
}
|
|
236
|
-
|
|
237
|
-
.keyboard-done {
|
|
238
|
-
font-size: 30rpx;
|
|
239
|
-
color: var(--prism-primary-color, #3478F6);
|
|
240
|
-
font-weight: 500;
|
|
241
|
-
}
|
|
242
|
-
}
|
|
243
|
-
|
|
244
|
-
.number-keyboard {
|
|
245
|
-
padding: 16rpx;
|
|
246
|
-
}
|
|
247
|
-
|
|
248
|
-
.keyboard-row {
|
|
249
|
-
display: flex;
|
|
250
|
-
gap: 12rpx;
|
|
251
|
-
margin-bottom: 12rpx;
|
|
252
|
-
|
|
253
|
-
&:last-child {
|
|
254
|
-
margin-bottom: 0;
|
|
255
|
-
}
|
|
256
|
-
}
|
|
257
|
-
|
|
258
|
-
.key-btn {
|
|
259
|
-
flex: 1;
|
|
260
|
-
height: 100rpx;
|
|
261
|
-
background: var(--prism-bg-color-card, #FFFFFF);
|
|
262
|
-
border-radius: 12rpx;
|
|
263
|
-
display: flex;
|
|
264
|
-
align-items: center;
|
|
265
|
-
justify-content: center;
|
|
266
|
-
transition: all 0.15s ease;
|
|
267
|
-
box-shadow: 0 2rpx 4rpx rgba(0, 0, 0, 0.05);
|
|
268
|
-
|
|
269
|
-
&:active {
|
|
270
|
-
background: var(--prism-primary-color, #3478F6);
|
|
271
|
-
transform: scale(0.98);
|
|
272
|
-
|
|
273
|
-
.key-text, .fa {
|
|
274
|
-
color: $color-white;
|
|
275
|
-
}
|
|
276
|
-
}
|
|
277
|
-
|
|
278
|
-
.key-text {
|
|
279
|
-
font-size: 44rpx;
|
|
280
|
-
font-weight: 500;
|
|
281
|
-
color: var(--prism-text-primary, #1D2129);
|
|
282
|
-
}
|
|
283
|
-
|
|
284
|
-
.fa {
|
|
285
|
-
font-size: 40rpx;
|
|
286
|
-
color: var(--prism-text-primary, #1D2129);
|
|
287
|
-
}
|
|
288
|
-
|
|
289
|
-
&.func {
|
|
290
|
-
background: var(--prism-bg-color, #E8E8E8);
|
|
291
|
-
|
|
292
|
-
.key-text {
|
|
293
|
-
font-size: 28rpx;
|
|
294
|
-
color: var(--prism-text-secondary, #86909C);
|
|
295
|
-
}
|
|
296
|
-
}
|
|
297
|
-
|
|
298
|
-
&.delete {
|
|
299
|
-
background: var(--prism-bg-color, #E8E8E8);
|
|
300
|
-
|
|
301
|
-
.delete-text {
|
|
302
|
-
font-size: 28rpx;
|
|
303
|
-
font-weight: 500;
|
|
304
|
-
color: var(--prism-danger-color, #F53F3F);
|
|
305
|
-
}
|
|
306
|
-
}
|
|
307
|
-
}
|
|
308
|
-
|
|
309
|
-
@keyframes blink {
|
|
310
|
-
0%, 50% { opacity: 1; }
|
|
311
|
-
51%, 100% { opacity: 0; }
|
|
312
|
-
}
|
|
313
|
-
}
|
|
314
|
-
|
|
315
|
-
.dark-mode .prism-secure-input {
|
|
316
|
-
.password-box {
|
|
317
|
-
background: var(--prism-input-bg, #2A2A2A);
|
|
318
|
-
|
|
319
|
-
&.active {
|
|
320
|
-
background: rgba(52, 120, 246, 0.15);
|
|
321
|
-
}
|
|
322
|
-
|
|
323
|
-
&.filled {
|
|
324
|
-
background: rgba(52, 120, 246, 0.15);
|
|
325
|
-
}
|
|
326
|
-
|
|
327
|
-
.password-dot {
|
|
328
|
-
background: var(--prism-text-primary, #E5E6EB);
|
|
329
|
-
}
|
|
330
|
-
}
|
|
331
|
-
|
|
332
|
-
.keyboard-content {
|
|
333
|
-
background: var(--prism-bg-color, #1A1A1A);
|
|
334
|
-
}
|
|
335
|
-
|
|
336
|
-
.keyboard-header {
|
|
337
|
-
background: var(--prism-bg-color-card, #242424);
|
|
338
|
-
|
|
339
|
-
.keyboard-title {
|
|
340
|
-
color: var(--prism-text-primary, #E5E6EB);
|
|
341
|
-
}
|
|
342
|
-
}
|
|
343
|
-
|
|
344
|
-
.key-btn {
|
|
345
|
-
background: var(--prism-bg-color-card, #242424);
|
|
346
|
-
|
|
347
|
-
.key-text {
|
|
348
|
-
color: var(--prism-text-primary, #E5E6EB);
|
|
349
|
-
}
|
|
350
|
-
|
|
351
|
-
.fa {
|
|
352
|
-
color: var(--prism-text-primary, #E5E6EB);
|
|
353
|
-
}
|
|
354
|
-
|
|
355
|
-
&.func, &.delete {
|
|
356
|
-
background: rgba(255, 255, 255, 0.1);
|
|
357
|
-
}
|
|
358
|
-
}
|
|
359
|
-
}
|
|
360
|
-
</style>
|
|
1
|
+
<template>
|
|
2
|
+
<view class="prism-secure-input" :class="{ 'dark-mode': appStore.isDarkMode }">
|
|
3
|
+
<!-- 密码输入框 -->
|
|
4
|
+
<view class="password-boxes" @click="showKeyboardModal">
|
|
5
|
+
<view
|
|
6
|
+
v-for="i in length"
|
|
7
|
+
:key="i"
|
|
8
|
+
class="password-box"
|
|
9
|
+
:class="{ 'active': isFocused && passwordArray.length === i - 1, 'filled': passwordArray[i - 1] }"
|
|
10
|
+
>
|
|
11
|
+
<view class="password-dot" v-if="passwordArray[i - 1]"></view>
|
|
12
|
+
<view class="cursor" v-if="isFocused && passwordArray.length === i - 1"></view>
|
|
13
|
+
</view>
|
|
14
|
+
</view>
|
|
15
|
+
|
|
16
|
+
<!-- 自定义数字键盘 -->
|
|
17
|
+
<view class="keyboard-modal" v-if="showKeyboard" @click="hideKeyboard">
|
|
18
|
+
<view class="keyboard-content" @click.stop>
|
|
19
|
+
<view class="keyboard-header">
|
|
20
|
+
<text class="keyboard-title">{{ title }}</text>
|
|
21
|
+
<text class="keyboard-done" @click="hideKeyboard">完成</text>
|
|
22
|
+
</view>
|
|
23
|
+
|
|
24
|
+
<!-- 数字键盘 -->
|
|
25
|
+
<view class="number-keyboard" :class="{ 'random': randomOrder }">
|
|
26
|
+
<view class="keyboard-row">
|
|
27
|
+
<view class="key-btn" v-for="n in displayNumbers.slice(0, 3)" :key="n" @click="inputNumber(n)">
|
|
28
|
+
<text class="key-text">{{ n }}</text>
|
|
29
|
+
</view>
|
|
30
|
+
</view>
|
|
31
|
+
<view class="keyboard-row">
|
|
32
|
+
<view class="key-btn" v-for="n in displayNumbers.slice(3, 6)" :key="n" @click="inputNumber(n)">
|
|
33
|
+
<text class="key-text">{{ n }}</text>
|
|
34
|
+
</view>
|
|
35
|
+
</view>
|
|
36
|
+
<view class="keyboard-row">
|
|
37
|
+
<view class="key-btn" v-for="n in displayNumbers.slice(6, 9)" :key="n" @click="inputNumber(n)">
|
|
38
|
+
<text class="key-text">{{ n }}</text>
|
|
39
|
+
</view>
|
|
40
|
+
</view>
|
|
41
|
+
<view class="keyboard-row">
|
|
42
|
+
<view class="key-btn func" @click="clearAll">
|
|
43
|
+
<text class="key-text">清空</text>
|
|
44
|
+
</view>
|
|
45
|
+
<view class="key-btn" @click="inputNumber(displayNumbers[9])">
|
|
46
|
+
<text class="key-text">{{ displayNumbers[9] }}</text>
|
|
47
|
+
</view>
|
|
48
|
+
<view class="key-btn delete" @click="deleteNumber">
|
|
49
|
+
<text class="delete-text">删除</text>
|
|
50
|
+
</view>
|
|
51
|
+
</view>
|
|
52
|
+
</view>
|
|
53
|
+
</view>
|
|
54
|
+
</view>
|
|
55
|
+
</view>
|
|
56
|
+
</template>
|
|
57
|
+
|
|
58
|
+
<script setup>
|
|
59
|
+
import { ref, computed, watch, onMounted } from 'vue';
|
|
60
|
+
import { useAppStore } from '@/store/app';
|
|
61
|
+
|
|
62
|
+
const props = defineProps({
|
|
63
|
+
modelValue: {
|
|
64
|
+
type: String,
|
|
65
|
+
default: ''
|
|
66
|
+
},
|
|
67
|
+
length: {
|
|
68
|
+
type: Number,
|
|
69
|
+
default: 6
|
|
70
|
+
},
|
|
71
|
+
title: {
|
|
72
|
+
type: String,
|
|
73
|
+
default: '请输入密码'
|
|
74
|
+
},
|
|
75
|
+
randomOrder: {
|
|
76
|
+
type: Boolean,
|
|
77
|
+
default: false
|
|
78
|
+
}
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
const emit = defineEmits(['update:modelValue', 'complete']);
|
|
82
|
+
|
|
83
|
+
const appStore = useAppStore();
|
|
84
|
+
const passwordValue = ref(props.modelValue);
|
|
85
|
+
const isFocused = ref(false);
|
|
86
|
+
const showKeyboard = ref(false);
|
|
87
|
+
|
|
88
|
+
// 数字顺序(可随机)
|
|
89
|
+
const displayNumbers = ref(['1', '2', '3', '4', '5', '6', '7', '8', '9', '0']);
|
|
90
|
+
|
|
91
|
+
const passwordArray = computed(() => {
|
|
92
|
+
return passwordValue.value.split('').slice(0, props.length);
|
|
93
|
+
});
|
|
94
|
+
|
|
95
|
+
// 打乱数字顺序
|
|
96
|
+
function shuffleNumbers() {
|
|
97
|
+
if (props.randomOrder) {
|
|
98
|
+
const arr = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9'];
|
|
99
|
+
for (let i = arr.length - 1; i > 0; i--) {
|
|
100
|
+
const j = Math.floor(Math.random() * (i + 1));
|
|
101
|
+
[arr[i], arr[j]] = [arr[j], arr[i]];
|
|
102
|
+
}
|
|
103
|
+
displayNumbers.value = arr;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
function showKeyboardModal() {
|
|
108
|
+
isFocused.value = true;
|
|
109
|
+
showKeyboard.value = true;
|
|
110
|
+
if (props.randomOrder) {
|
|
111
|
+
shuffleNumbers();
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
function hideKeyboard() {
|
|
116
|
+
isFocused.value = false;
|
|
117
|
+
showKeyboard.value = false;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
function inputNumber(n) {
|
|
121
|
+
if (passwordValue.value.length >= props.length) return;
|
|
122
|
+
|
|
123
|
+
passwordValue.value += n;
|
|
124
|
+
emit('update:modelValue', passwordValue.value);
|
|
125
|
+
|
|
126
|
+
if (passwordValue.value.length === props.length) {
|
|
127
|
+
emit('complete', passwordValue.value);
|
|
128
|
+
setTimeout(() => {
|
|
129
|
+
hideKeyboard();
|
|
130
|
+
}, 200);
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
function deleteNumber() {
|
|
135
|
+
if (passwordValue.value.length > 0) {
|
|
136
|
+
passwordValue.value = passwordValue.value.slice(0, -1);
|
|
137
|
+
emit('update:modelValue', passwordValue.value);
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
function clearAll() {
|
|
142
|
+
passwordValue.value = '';
|
|
143
|
+
emit('update:modelValue', '');
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
watch(() => props.modelValue, (val) => {
|
|
147
|
+
passwordValue.value = val;
|
|
148
|
+
});
|
|
149
|
+
|
|
150
|
+
onMounted(() => {
|
|
151
|
+
if (props.randomOrder) {
|
|
152
|
+
shuffleNumbers();
|
|
153
|
+
}
|
|
154
|
+
});
|
|
155
|
+
</script>
|
|
156
|
+
|
|
157
|
+
<style lang="scss">
|
|
158
|
+
// 白色常量(用于按钮文字等固定白色场景)
|
|
159
|
+
$color-white: #FFFFFF;
|
|
160
|
+
|
|
161
|
+
.prism-secure-input {
|
|
162
|
+
.password-boxes {
|
|
163
|
+
display: flex;
|
|
164
|
+
justify-content: center;
|
|
165
|
+
gap: 16rpx;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
.password-box {
|
|
169
|
+
width: 76rpx;
|
|
170
|
+
height: 88rpx;
|
|
171
|
+
background: var(--prism-input-bg, #EBEEF2);
|
|
172
|
+
border-radius: 12rpx;
|
|
173
|
+
display: flex;
|
|
174
|
+
align-items: center;
|
|
175
|
+
justify-content: center;
|
|
176
|
+
border: 2rpx solid transparent;
|
|
177
|
+
transition: all 0.2s ease;
|
|
178
|
+
position: relative;
|
|
179
|
+
|
|
180
|
+
&.active {
|
|
181
|
+
border-color: var(--prism-primary-color, #3478F6);
|
|
182
|
+
background: rgba(52, 120, 246, 0.08);
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
&.filled {
|
|
186
|
+
background: rgba(52, 120, 246, 0.08);
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
.password-dot {
|
|
190
|
+
width: 24rpx;
|
|
191
|
+
height: 24rpx;
|
|
192
|
+
background: var(--prism-text-primary, #1D2129);
|
|
193
|
+
border-radius: 50%;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
.cursor {
|
|
197
|
+
width: 4rpx;
|
|
198
|
+
height: 40rpx;
|
|
199
|
+
background: var(--prism-primary-color, #3478F6);
|
|
200
|
+
animation: blink 1s infinite;
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
.keyboard-modal {
|
|
205
|
+
position: fixed;
|
|
206
|
+
top: 0;
|
|
207
|
+
left: 0;
|
|
208
|
+
right: 0;
|
|
209
|
+
bottom: 0;
|
|
210
|
+
background: var(--prism-mask-bg, rgba(0, 0, 0, 0.5));
|
|
211
|
+
z-index: 9999;
|
|
212
|
+
display: flex;
|
|
213
|
+
align-items: flex-end;
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
.keyboard-content {
|
|
217
|
+
width: 100%;
|
|
218
|
+
background: var(--prism-bg-color, #F7F8FA);
|
|
219
|
+
border-radius: 24rpx 24rpx 0 0;
|
|
220
|
+
padding-bottom: env(safe-area-inset-bottom);
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
.keyboard-header {
|
|
224
|
+
display: flex;
|
|
225
|
+
justify-content: space-between;
|
|
226
|
+
align-items: center;
|
|
227
|
+
padding: 24rpx 32rpx;
|
|
228
|
+
background: var(--prism-bg-color-card, #FFFFFF);
|
|
229
|
+
border-radius: 24rpx 24rpx 0 0;
|
|
230
|
+
|
|
231
|
+
.keyboard-title {
|
|
232
|
+
font-size: 32rpx;
|
|
233
|
+
font-weight: 600;
|
|
234
|
+
color: var(--prism-text-primary, #1D2129);
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
.keyboard-done {
|
|
238
|
+
font-size: 30rpx;
|
|
239
|
+
color: var(--prism-primary-color, #3478F6);
|
|
240
|
+
font-weight: 500;
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
.number-keyboard {
|
|
245
|
+
padding: 16rpx;
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
.keyboard-row {
|
|
249
|
+
display: flex;
|
|
250
|
+
gap: 12rpx;
|
|
251
|
+
margin-bottom: 12rpx;
|
|
252
|
+
|
|
253
|
+
&:last-child {
|
|
254
|
+
margin-bottom: 0;
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
.key-btn {
|
|
259
|
+
flex: 1;
|
|
260
|
+
height: 100rpx;
|
|
261
|
+
background: var(--prism-bg-color-card, #FFFFFF);
|
|
262
|
+
border-radius: 12rpx;
|
|
263
|
+
display: flex;
|
|
264
|
+
align-items: center;
|
|
265
|
+
justify-content: center;
|
|
266
|
+
transition: all 0.15s ease;
|
|
267
|
+
box-shadow: 0 2rpx 4rpx rgba(0, 0, 0, 0.05);
|
|
268
|
+
|
|
269
|
+
&:active {
|
|
270
|
+
background: var(--prism-primary-color, #3478F6);
|
|
271
|
+
transform: scale(0.98);
|
|
272
|
+
|
|
273
|
+
.key-text, .fa {
|
|
274
|
+
color: $color-white;
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
.key-text {
|
|
279
|
+
font-size: 44rpx;
|
|
280
|
+
font-weight: 500;
|
|
281
|
+
color: var(--prism-text-primary, #1D2129);
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
.fa {
|
|
285
|
+
font-size: 40rpx;
|
|
286
|
+
color: var(--prism-text-primary, #1D2129);
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
&.func {
|
|
290
|
+
background: var(--prism-bg-color, #E8E8E8);
|
|
291
|
+
|
|
292
|
+
.key-text {
|
|
293
|
+
font-size: 28rpx;
|
|
294
|
+
color: var(--prism-text-secondary, #86909C);
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
&.delete {
|
|
299
|
+
background: var(--prism-bg-color, #E8E8E8);
|
|
300
|
+
|
|
301
|
+
.delete-text {
|
|
302
|
+
font-size: 28rpx;
|
|
303
|
+
font-weight: 500;
|
|
304
|
+
color: var(--prism-danger-color, #F53F3F);
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
@keyframes blink {
|
|
310
|
+
0%, 50% { opacity: 1; }
|
|
311
|
+
51%, 100% { opacity: 0; }
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
.dark-mode .prism-secure-input {
|
|
316
|
+
.password-box {
|
|
317
|
+
background: var(--prism-input-bg, #2A2A2A);
|
|
318
|
+
|
|
319
|
+
&.active {
|
|
320
|
+
background: rgba(52, 120, 246, 0.15);
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
&.filled {
|
|
324
|
+
background: rgba(52, 120, 246, 0.15);
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
.password-dot {
|
|
328
|
+
background: var(--prism-text-primary, #E5E6EB);
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
.keyboard-content {
|
|
333
|
+
background: var(--prism-bg-color, #1A1A1A);
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
.keyboard-header {
|
|
337
|
+
background: var(--prism-bg-color-card, #242424);
|
|
338
|
+
|
|
339
|
+
.keyboard-title {
|
|
340
|
+
color: var(--prism-text-primary, #E5E6EB);
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
.key-btn {
|
|
345
|
+
background: var(--prism-bg-color-card, #242424);
|
|
346
|
+
|
|
347
|
+
.key-text {
|
|
348
|
+
color: var(--prism-text-primary, #E5E6EB);
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
.fa {
|
|
352
|
+
color: var(--prism-text-primary, #E5E6EB);
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
&.func, &.delete {
|
|
356
|
+
background: rgba(255, 255, 255, 0.1);
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
</style>
|