@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.
Files changed (34) hide show
  1. package/README.md +1 -1
  2. package/components/PrismAIAssist/PrismAIAssist.vue +98 -98
  3. package/components/PrismAddressInput/PrismAddressInput.vue +597 -597
  4. package/components/PrismCityCascadeSelect/PrismCityCascadeSelect.vue +793 -793
  5. package/components/PrismCityPicker/PrismCityPicker.vue +1008 -1008
  6. package/components/PrismCitySelect/PrismCitySelect.vue +435 -435
  7. package/components/PrismCode/PrismCode.vue +749 -749
  8. package/components/PrismCodeInput/PrismCodeInput.vue +156 -156
  9. package/components/PrismDateTimePicker/PrismDateTimePicker.vue +953 -953
  10. package/components/PrismDropdown/PrismDropdown.vue +77 -77
  11. package/components/PrismGroupSticky/PrismGroupSticky.vue +352 -352
  12. package/components/PrismIdCardInput/PrismIdCardInput.vue +253 -253
  13. package/components/PrismImagePicker/PrismImagePicker.vue +457 -457
  14. package/components/PrismIndexBar/PrismIndexBar.vue +243 -243
  15. package/components/PrismLicensePlateInput/PrismLicensePlateInput.vue +1100 -1100
  16. package/components/PrismMusicPlayer/PrismMusicPlayer.vue +530 -530
  17. package/components/PrismNavBar/PrismNavBar.vue +199 -199
  18. package/components/PrismSecureInput/PrismSecureInput.vue +360 -360
  19. package/components/PrismSticky/PrismSticky.vue +173 -173
  20. package/components/PrismSwiper/PrismSwiper.vue +338 -338
  21. package/components/PrismSwitch/PrismSwitch.vue +202 -202
  22. package/components/PrismTabBar/PrismTabBar.vue +147 -147
  23. package/components/PrismTabs/PrismTabs.vue +49 -49
  24. package/components/PrismVoiceInput/PrismVoiceInput.vue +529 -529
  25. package/fonts/fa-brands-400.woff2 +0 -0
  26. package/fonts/fa-regular-400.woff2 +0 -0
  27. package/fonts/fa-solid-900.woff2 +0 -0
  28. package/fonts/fa-v4compatibility.woff2 +0 -0
  29. package/fonts/font-awesome.css +913 -0
  30. package/fonts/iconfont.woff2 +0 -0
  31. package/package.json +7 -1
  32. package/store/app.d.ts +21 -0
  33. package/store/app.js +68 -0
  34. package/styles/base.scss +2 -2
@@ -1,243 +1,243 @@
1
- <template>
2
- <view>
3
- <!-- 右侧索引条 -->
4
- <view
5
- class="prism-index-bar"
6
- :class="{ 'dark-mode': isDarkMode }"
7
- @touchstart="onIndexTouchStart"
8
- @touchmove.stop.prevent="onIndexTouchMove"
9
- @touchend="onIndexTouchEnd"
10
- >
11
- <view
12
- v-for="item in items"
13
- :key="item.value"
14
- class="prism-index-item"
15
- :class="{ 'active': currentIndex === item.value }"
16
- :style="{ background: item.background }"
17
- >
18
- </view>
19
- </view>
20
-
21
- <!-- 气泡提示 -->
22
- <view
23
- v-if="showIndicator && currentIndex"
24
- class="prism-index-indicator"
25
- :class="{ 'dark-mode': isDarkMode }"
26
- :style="{
27
- top: indicatorTop + 'px',
28
- background: currentItemBackground
29
- }"
30
- >
31
- {{ currentItemLabel }}
32
- <!-- 箭头 -->
33
- <view
34
- class="prism-index-indicator-arrow"
35
- :style="{ borderLeftColor: currentItemBackground }"
36
- ></view>
37
- </view>
38
- </view>
39
- </template>
40
-
41
- <script setup>
42
- import { ref, computed, getCurrentInstance } from 'vue';
43
-
44
- const props = defineProps({
45
- // 索引项列表 [{ value: 'key', label: '显示文字', background: '#fff' 或 'linear-gradient(...)' }]
46
- items: {
47
- type: Array,
48
- default: () => []
49
- },
50
- // 是否深色模式
51
- isDarkMode: {
52
- type: Boolean,
53
- default: false
54
- },
55
- // 当前选中的索引值(支持 v-model)
56
- modelValue: {
57
- type: String,
58
- default: ''
59
- }
60
- });
61
-
62
- const emit = defineEmits(['update:modelValue', 'change']);
63
-
64
- const instance = getCurrentInstance();
65
-
66
- // 当前选中的索引
67
- const currentIndex = ref(props.modelValue);
68
- // 是否显示气泡
69
- const showIndicator = ref(false);
70
- // 气泡位置
71
- const indicatorTop = ref(0);
72
- // 索引条位置信息
73
- let indexBarRect = null;
74
-
75
- // 当前选中项的标签
76
- const currentItemLabel = computed(() => {
77
- const item = props.items.find(i => i.value === currentIndex.value);
78
- return item ? item.label : '';
79
- });
80
-
81
- // 当前选中项的背景
82
- const currentItemBackground = computed(() => {
83
- const item = props.items.find(i => i.value === currentIndex.value);
84
- return item ? item.background : 'rgba(0, 0, 0, 0.85)';
85
- });
86
-
87
- // 根据触摸位置计算当前索引
88
- const getItemByTouch = (touchY) => {
89
- if (!indexBarRect || !props.items.length) return null;
90
- const itemHeight = indexBarRect.height / props.items.length;
91
- const relativeY = touchY - indexBarRect.top;
92
- const index = Math.floor(relativeY / itemHeight);
93
- if (index < 0) return props.items[0];
94
- if (index >= props.items.length) return props.items[props.items.length - 1];
95
- return props.items[index];
96
- };
97
-
98
- // 更新选中索引
99
- const updateIndex = (touchY) => {
100
- // 更新气泡位置
101
- indicatorTop.value = touchY;
102
-
103
- const item = getItemByTouch(touchY);
104
- if (item && item.value !== currentIndex.value) {
105
- currentIndex.value = item.value;
106
- emit('update:modelValue', item.value);
107
- emit('change', item.value);
108
- }
109
- };
110
-
111
- // 触摸开始
112
- const onIndexTouchStart = (e) => {
113
- showIndicator.value = true;
114
- const touchY = e.touches[0].clientY;
115
- indicatorTop.value = touchY;
116
-
117
- // 获取索引条位置并更新索引
118
- uni.createSelectorQuery()
119
- .in(instance)
120
- .select('.prism-index-bar')
121
- .boundingClientRect((rect) => {
122
- if (rect) {
123
- indexBarRect = rect;
124
- const item = getItemByTouch(touchY);
125
- if (item) {
126
- currentIndex.value = item.value;
127
- emit('update:modelValue', item.value);
128
- emit('change', item.value);
129
- }
130
- }
131
- })
132
- .exec();
133
- };
134
-
135
- // 触摸移动
136
- const onIndexTouchMove = (e) => {
137
- const touchY = e.touches[0].clientY;
138
- if (indexBarRect) {
139
- updateIndex(touchY);
140
- }
141
- };
142
-
143
- // 触摸结束
144
- const onIndexTouchEnd = () => {
145
- showIndicator.value = false;
146
- };
147
- </script>
148
-
149
- <style lang="scss" scoped>
150
- /* 右侧索引条 */
151
- .prism-index-bar {
152
- position: fixed;
153
- right: 8rpx;
154
- top: 50%;
155
- transform: translateY(-50%);
156
- display: flex;
157
- flex-direction: column;
158
- align-items: center;
159
- gap: 12rpx;
160
- z-index: 999;
161
- padding: 16rpx 12rpx;
162
- background: rgba(255, 255, 255, 0.1);
163
- border-radius: 24rpx;
164
- backdrop-filter: blur(10px);
165
- -webkit-backdrop-filter: blur(10px);
166
- }
167
-
168
- .prism-index-item {
169
- width: 40rpx;
170
- height: 40rpx;
171
- border-radius: 50%;
172
- border: 3rpx solid rgba(255, 255, 255, 0.8);
173
- box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.15);
174
- transition: all 0.3s ease;
175
- position: relative;
176
- flex-shrink: 0;
177
-
178
- &:active {
179
- transform: scale(1.15);
180
- }
181
-
182
- &.active {
183
- width: 48rpx;
184
- height: 48rpx;
185
- border-width: 4rpx;
186
- border-color: #FFFFFF;
187
- box-shadow: 0 4rpx 16rpx rgba(0, 0, 0, 0.3);
188
- }
189
- }
190
-
191
- /* 气泡提示 */
192
- .prism-index-indicator {
193
- position: fixed;
194
- right: 80rpx;
195
- padding: 12rpx 20rpx;
196
- color: #FFFFFF;
197
- border-radius: 8rpx;
198
- font-size: 24rpx;
199
- white-space: nowrap;
200
- backdrop-filter: blur(10px);
201
- -webkit-backdrop-filter: blur(10px);
202
- box-shadow: 0 4rpx 16rpx rgba(0, 0, 0, 0.3);
203
- animation: fadeIn 0.2s ease;
204
- z-index: 1000;
205
- transform: translateY(-50%);
206
- pointer-events: none;
207
- }
208
-
209
- /* 气泡箭头 */
210
- .prism-index-indicator-arrow {
211
- position: absolute;
212
- right: -8rpx;
213
- top: 50%;
214
- transform: translateY(-50%);
215
- width: 0;
216
- height: 0;
217
- border-left: 8rpx solid;
218
- border-top: 8rpx solid transparent;
219
- border-bottom: 8rpx solid transparent;
220
- }
221
-
222
- @keyframes fadeIn {
223
- from {
224
- opacity: 0;
225
- }
226
- to {
227
- opacity: 1;
228
- }
229
- }
230
-
231
- /* 深色模式适配 */
232
- .dark-mode.prism-index-bar {
233
- .prism-index-item {
234
- border-color: rgba(0, 0, 0, 0.5);
235
- box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.4);
236
-
237
- &.active {
238
- border-color: rgba(255, 255, 255, 0.9);
239
- box-shadow: 0 4rpx 16rpx rgba(0, 0, 0, 0.6);
240
- }
241
- }
242
- }
243
- </style>
1
+ <template>
2
+ <view>
3
+ <!-- 右侧索引条 -->
4
+ <view
5
+ class="prism-index-bar"
6
+ :class="{ 'dark-mode': isDarkMode }"
7
+ @touchstart="onIndexTouchStart"
8
+ @touchmove.stop.prevent="onIndexTouchMove"
9
+ @touchend="onIndexTouchEnd"
10
+ >
11
+ <view
12
+ v-for="item in items"
13
+ :key="item.value"
14
+ class="prism-index-item"
15
+ :class="{ 'active': currentIndex === item.value }"
16
+ :style="{ background: item.background }"
17
+ >
18
+ </view>
19
+ </view>
20
+
21
+ <!-- 气泡提示 -->
22
+ <view
23
+ v-if="showIndicator && currentIndex"
24
+ class="prism-index-indicator"
25
+ :class="{ 'dark-mode': isDarkMode }"
26
+ :style="{
27
+ top: indicatorTop + 'px',
28
+ background: currentItemBackground
29
+ }"
30
+ >
31
+ {{ currentItemLabel }}
32
+ <!-- 箭头 -->
33
+ <view
34
+ class="prism-index-indicator-arrow"
35
+ :style="{ borderLeftColor: currentItemBackground }"
36
+ ></view>
37
+ </view>
38
+ </view>
39
+ </template>
40
+
41
+ <script setup>
42
+ import { ref, computed, getCurrentInstance } from 'vue';
43
+
44
+ const props = defineProps({
45
+ // 索引项列表 [{ value: 'key', label: '显示文字', background: '#fff' 或 'linear-gradient(...)' }]
46
+ items: {
47
+ type: Array,
48
+ default: () => []
49
+ },
50
+ // 是否深色模式
51
+ isDarkMode: {
52
+ type: Boolean,
53
+ default: false
54
+ },
55
+ // 当前选中的索引值(支持 v-model)
56
+ modelValue: {
57
+ type: String,
58
+ default: ''
59
+ }
60
+ });
61
+
62
+ const emit = defineEmits(['update:modelValue', 'change']);
63
+
64
+ const instance = getCurrentInstance();
65
+
66
+ // 当前选中的索引
67
+ const currentIndex = ref(props.modelValue);
68
+ // 是否显示气泡
69
+ const showIndicator = ref(false);
70
+ // 气泡位置
71
+ const indicatorTop = ref(0);
72
+ // 索引条位置信息
73
+ let indexBarRect = null;
74
+
75
+ // 当前选中项的标签
76
+ const currentItemLabel = computed(() => {
77
+ const item = props.items.find(i => i.value === currentIndex.value);
78
+ return item ? item.label : '';
79
+ });
80
+
81
+ // 当前选中项的背景
82
+ const currentItemBackground = computed(() => {
83
+ const item = props.items.find(i => i.value === currentIndex.value);
84
+ return item ? item.background : 'rgba(0, 0, 0, 0.85)';
85
+ });
86
+
87
+ // 根据触摸位置计算当前索引
88
+ const getItemByTouch = (touchY) => {
89
+ if (!indexBarRect || !props.items.length) return null;
90
+ const itemHeight = indexBarRect.height / props.items.length;
91
+ const relativeY = touchY - indexBarRect.top;
92
+ const index = Math.floor(relativeY / itemHeight);
93
+ if (index < 0) return props.items[0];
94
+ if (index >= props.items.length) return props.items[props.items.length - 1];
95
+ return props.items[index];
96
+ };
97
+
98
+ // 更新选中索引
99
+ const updateIndex = (touchY) => {
100
+ // 更新气泡位置
101
+ indicatorTop.value = touchY;
102
+
103
+ const item = getItemByTouch(touchY);
104
+ if (item && item.value !== currentIndex.value) {
105
+ currentIndex.value = item.value;
106
+ emit('update:modelValue', item.value);
107
+ emit('change', item.value);
108
+ }
109
+ };
110
+
111
+ // 触摸开始
112
+ const onIndexTouchStart = (e) => {
113
+ showIndicator.value = true;
114
+ const touchY = e.touches[0].clientY;
115
+ indicatorTop.value = touchY;
116
+
117
+ // 获取索引条位置并更新索引
118
+ uni.createSelectorQuery()
119
+ .in(instance)
120
+ .select('.prism-index-bar')
121
+ .boundingClientRect((rect) => {
122
+ if (rect) {
123
+ indexBarRect = rect;
124
+ const item = getItemByTouch(touchY);
125
+ if (item) {
126
+ currentIndex.value = item.value;
127
+ emit('update:modelValue', item.value);
128
+ emit('change', item.value);
129
+ }
130
+ }
131
+ })
132
+ .exec();
133
+ };
134
+
135
+ // 触摸移动
136
+ const onIndexTouchMove = (e) => {
137
+ const touchY = e.touches[0].clientY;
138
+ if (indexBarRect) {
139
+ updateIndex(touchY);
140
+ }
141
+ };
142
+
143
+ // 触摸结束
144
+ const onIndexTouchEnd = () => {
145
+ showIndicator.value = false;
146
+ };
147
+ </script>
148
+
149
+ <style lang="scss" scoped>
150
+ /* 右侧索引条 */
151
+ .prism-index-bar {
152
+ position: fixed;
153
+ right: 8rpx;
154
+ top: 50%;
155
+ transform: translateY(-50%);
156
+ display: flex;
157
+ flex-direction: column;
158
+ align-items: center;
159
+ gap: 12rpx;
160
+ z-index: 999;
161
+ padding: 16rpx 12rpx;
162
+ background: rgba(255, 255, 255, 0.1);
163
+ border-radius: 24rpx;
164
+ backdrop-filter: blur(10px);
165
+ -webkit-backdrop-filter: blur(10px);
166
+ }
167
+
168
+ .prism-index-item {
169
+ width: 40rpx;
170
+ height: 40rpx;
171
+ border-radius: 50%;
172
+ border: 3rpx solid rgba(255, 255, 255, 0.8);
173
+ box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.15);
174
+ transition: all 0.3s ease;
175
+ position: relative;
176
+ flex-shrink: 0;
177
+
178
+ &:active {
179
+ transform: scale(1.15);
180
+ }
181
+
182
+ &.active {
183
+ width: 48rpx;
184
+ height: 48rpx;
185
+ border-width: 4rpx;
186
+ border-color: #FFFFFF;
187
+ box-shadow: 0 4rpx 16rpx rgba(0, 0, 0, 0.3);
188
+ }
189
+ }
190
+
191
+ /* 气泡提示 */
192
+ .prism-index-indicator {
193
+ position: fixed;
194
+ right: 80rpx;
195
+ padding: 12rpx 20rpx;
196
+ color: #FFFFFF;
197
+ border-radius: 8rpx;
198
+ font-size: 24rpx;
199
+ white-space: nowrap;
200
+ backdrop-filter: blur(10px);
201
+ -webkit-backdrop-filter: blur(10px);
202
+ box-shadow: 0 4rpx 16rpx rgba(0, 0, 0, 0.3);
203
+ animation: fadeIn 0.2s ease;
204
+ z-index: 1000;
205
+ transform: translateY(-50%);
206
+ pointer-events: none;
207
+ }
208
+
209
+ /* 气泡箭头 */
210
+ .prism-index-indicator-arrow {
211
+ position: absolute;
212
+ right: -8rpx;
213
+ top: 50%;
214
+ transform: translateY(-50%);
215
+ width: 0;
216
+ height: 0;
217
+ border-left: 8rpx solid;
218
+ border-top: 8rpx solid transparent;
219
+ border-bottom: 8rpx solid transparent;
220
+ }
221
+
222
+ @keyframes fadeIn {
223
+ from {
224
+ opacity: 0;
225
+ }
226
+ to {
227
+ opacity: 1;
228
+ }
229
+ }
230
+
231
+ /* 深色模式适配 */
232
+ .dark-mode.prism-index-bar {
233
+ .prism-index-item {
234
+ border-color: rgba(0, 0, 0, 0.5);
235
+ box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.4);
236
+
237
+ &.active {
238
+ border-color: rgba(255, 255, 255, 0.9);
239
+ box-shadow: 0 4rpx 16rpx rgba(0, 0, 0, 0.6);
240
+ }
241
+ }
242
+ }
243
+ </style>