af-mobile-client-vue3 1.3.99 → 1.4.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/certs/127.0.0.1+2-key.pem +28 -0
- package/certs/127.0.0.1+2.pem +27 -0
- package/mock/modules/prose.mock.ts.timestamp-1758877157774.mjs +53 -0
- package/mock/modules/user.mock.ts.timestamp-1758877157774.mjs +97 -0
- package/package.json +115 -115
- package/src/api/user/index.ts +45 -45
- package/src/components/core/XSelect/index.vue +211 -238
- package/src/components/data/XOlMap/types.ts +1 -1
- package/src/router/guards.ts +131 -131
- package/src/router/routes.ts +421 -421
- package/src/services/api/Login.ts +6 -6
- package/src/services/v3Api.ts +170 -170
- package/src/stores/modules/user.ts +362 -362
- package/src/styles/login.less +109 -109
- package/src/types/platform.ts +194 -194
- package/src/utils/platform-auth.ts +150 -150
- package/src/utils/wechat.ts +297 -297
- package/src/views/component/XCellListView/index.vue +77 -1
- package/src/views/component/XOlMapView/XLocationPicker/index.vue +118 -118
- package/src/views/external/index.vue +158 -158
- package/src/views/loading/AuthLoading.vue +395 -378
- package/src/views/user/register/index.vue +958 -958
- package/vite.config.ts +115 -115
|
@@ -1,238 +1,211 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
import {
|
|
3
|
-
Field as VanField,
|
|
4
|
-
Picker as VanPicker,
|
|
5
|
-
Popup as VanPopup,
|
|
6
|
-
Search as VanSearch,
|
|
7
|
-
} from 'vant'
|
|
8
|
-
import { computed, defineEmits, defineModel, defineProps, onBeforeMount, ref, watch } from 'vue'
|
|
9
|
-
|
|
10
|
-
const props = defineProps({
|
|
11
|
-
columns: {
|
|
12
|
-
type: Array,
|
|
13
|
-
default() {
|
|
14
|
-
return []
|
|
15
|
-
},
|
|
16
|
-
},
|
|
17
|
-
option: {
|
|
18
|
-
type: Object,
|
|
19
|
-
default() {
|
|
20
|
-
return { text: 'label', value: 'value', children: 'children' }
|
|
21
|
-
},
|
|
22
|
-
},
|
|
23
|
-
offOption: { // 关闭option配置key-value;当数据是非集合的数组的时候,开启
|
|
24
|
-
type: Boolean,
|
|
25
|
-
default: false,
|
|
26
|
-
},
|
|
27
|
-
border: { // 是否展示边框
|
|
28
|
-
type: Boolean,
|
|
29
|
-
default: false,
|
|
30
|
-
},
|
|
31
|
-
lazyLoad: { // 是否启用懒加载
|
|
32
|
-
type: String,
|
|
33
|
-
default: 'false',
|
|
34
|
-
},
|
|
35
|
-
onSearch: { // 懒加载时的搜索函数
|
|
36
|
-
type: Function,
|
|
37
|
-
default: null,
|
|
38
|
-
},
|
|
39
|
-
})
|
|
40
|
-
const emits = defineEmits(['confirm', 'change', 'cancel', 'input'])
|
|
41
|
-
const show = ref(false)
|
|
42
|
-
const resultValue = defineModel()
|
|
43
|
-
const columnsData = ref([])
|
|
44
|
-
const selectedOption = ref([])
|
|
45
|
-
const searchValue = ref('')
|
|
46
|
-
const
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
emits('
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
v-else
|
|
213
|
-
v-bind="$attrs"
|
|
214
|
-
:columns="filteredColumns"
|
|
215
|
-
:columns-field-names="props.option"
|
|
216
|
-
show-toolbar
|
|
217
|
-
:value-key="props.option.text"
|
|
218
|
-
@cancel="cancel"
|
|
219
|
-
@confirm="onConfirm"
|
|
220
|
-
@change="change"
|
|
221
|
-
/>
|
|
222
|
-
</div>
|
|
223
|
-
</VanPopup>
|
|
224
|
-
</template>
|
|
225
|
-
|
|
226
|
-
<style scoped>
|
|
227
|
-
.loading-container {
|
|
228
|
-
display: flex;
|
|
229
|
-
justify-content: center;
|
|
230
|
-
align-items: center;
|
|
231
|
-
height: 200px;
|
|
232
|
-
}
|
|
233
|
-
|
|
234
|
-
.loading-text {
|
|
235
|
-
color: #969799;
|
|
236
|
-
font-size: 14px;
|
|
237
|
-
}
|
|
238
|
-
</style>
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import {
|
|
3
|
+
Field as VanField,
|
|
4
|
+
Picker as VanPicker,
|
|
5
|
+
Popup as VanPopup,
|
|
6
|
+
Search as VanSearch,
|
|
7
|
+
} from 'vant'
|
|
8
|
+
import { computed, defineEmits, defineModel, defineProps, onBeforeMount, ref, watch } from 'vue'
|
|
9
|
+
|
|
10
|
+
const props = defineProps({
|
|
11
|
+
columns: {
|
|
12
|
+
type: Array,
|
|
13
|
+
default() {
|
|
14
|
+
return []
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
option: {
|
|
18
|
+
type: Object,
|
|
19
|
+
default() {
|
|
20
|
+
return { text: 'label', value: 'value', children: 'children' }
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
offOption: { // 关闭option配置key-value;当数据是非集合的数组的时候,开启
|
|
24
|
+
type: Boolean,
|
|
25
|
+
default: false,
|
|
26
|
+
},
|
|
27
|
+
border: { // 是否展示边框
|
|
28
|
+
type: Boolean,
|
|
29
|
+
default: false,
|
|
30
|
+
},
|
|
31
|
+
lazyLoad: { // 是否启用懒加载
|
|
32
|
+
type: String,
|
|
33
|
+
default: 'false',
|
|
34
|
+
},
|
|
35
|
+
onSearch: { // 懒加载时的搜索函数
|
|
36
|
+
type: Function,
|
|
37
|
+
default: null,
|
|
38
|
+
},
|
|
39
|
+
})
|
|
40
|
+
const emits = defineEmits(['confirm', 'change', 'cancel', 'input'])
|
|
41
|
+
const show = ref(false)
|
|
42
|
+
const resultValue = defineModel()
|
|
43
|
+
const columnsData = ref([])
|
|
44
|
+
const selectedOption = ref([])
|
|
45
|
+
const searchValue = ref('')
|
|
46
|
+
const isLoading = ref(false)
|
|
47
|
+
|
|
48
|
+
// 转换空children为空字符串
|
|
49
|
+
function transformColumns(data) {
|
|
50
|
+
return data.map((item) => {
|
|
51
|
+
if (item.children && item.children.length === 0) {
|
|
52
|
+
return {
|
|
53
|
+
...item,
|
|
54
|
+
children: '',
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
else if (item.children && item.children.length !== 0) {
|
|
58
|
+
return { ...item, children: transformColumns(item.children) }
|
|
59
|
+
}
|
|
60
|
+
else {
|
|
61
|
+
return { ...item }
|
|
62
|
+
}
|
|
63
|
+
})
|
|
64
|
+
}
|
|
65
|
+
const filteredColumns = ref([])
|
|
66
|
+
|
|
67
|
+
watch(
|
|
68
|
+
() => searchValue.value,
|
|
69
|
+
async (newValue) => {
|
|
70
|
+
if (props.lazyLoad && props.lazyLoad === 'true' && props.onSearch) {
|
|
71
|
+
if (!newValue) {
|
|
72
|
+
filteredColumns.value = []
|
|
73
|
+
return
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
isLoading.value = true
|
|
77
|
+
try {
|
|
78
|
+
const results = await props.onSearch(newValue)
|
|
79
|
+
filteredColumns.value = transformColumns(results || [])
|
|
80
|
+
}
|
|
81
|
+
catch (error) {
|
|
82
|
+
console.error('懒加载搜索失败:', error)
|
|
83
|
+
filteredColumns.value = []
|
|
84
|
+
}
|
|
85
|
+
finally {
|
|
86
|
+
isLoading.value = false
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
else {
|
|
90
|
+
// 普通搜索模式
|
|
91
|
+
if (!newValue) {
|
|
92
|
+
filteredColumns.value = columnsData.value
|
|
93
|
+
return
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
const searchTextLower = newValue.toLowerCase()
|
|
97
|
+
filteredColumns.value = columnsData.value.filter((item) => {
|
|
98
|
+
const text = props.offOption ? item : item[props.option.text]
|
|
99
|
+
return text?.toString().toLowerCase().includes(searchTextLower)
|
|
100
|
+
})
|
|
101
|
+
}
|
|
102
|
+
},
|
|
103
|
+
{ immediate: true },
|
|
104
|
+
)
|
|
105
|
+
|
|
106
|
+
onBeforeMount(() => {
|
|
107
|
+
columnsData.value = transformColumns(props.columns)
|
|
108
|
+
filteredColumns.value = columnsData.value
|
|
109
|
+
})
|
|
110
|
+
|
|
111
|
+
const resultLabel = computed({
|
|
112
|
+
get() {
|
|
113
|
+
if (!resultValue.value)
|
|
114
|
+
return ''
|
|
115
|
+
const res = props.columns.filter((item) => {
|
|
116
|
+
const data = props.offOption ? item : item[props.option.value]
|
|
117
|
+
return data === resultValue.value
|
|
118
|
+
})
|
|
119
|
+
return res.length ? (props.offOption ? res[0] : res[0][props.option.text]) : ''
|
|
120
|
+
},
|
|
121
|
+
set() {
|
|
122
|
+
|
|
123
|
+
},
|
|
124
|
+
})
|
|
125
|
+
|
|
126
|
+
function onConfirm(value, _index) {
|
|
127
|
+
resultValue.value = props.offOption ? value.selectedValues : value.selectedValues[0]
|
|
128
|
+
// resultValue.value = value.selectedValues
|
|
129
|
+
selectedOption.value = value.selectedOptions
|
|
130
|
+
show.value = !show.value
|
|
131
|
+
emits('confirm', value.selectedValues[0], value.selectedOptions)
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
function change(val, index) {
|
|
135
|
+
emits('change', val, index, resultValue.value)
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
function cancel(val, index) {
|
|
139
|
+
show.value = !show.value
|
|
140
|
+
emits('cancel', val, index, resultValue.value)
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
function showPopu(disabled) {
|
|
144
|
+
if (disabled !== undefined && disabled !== false)
|
|
145
|
+
return false
|
|
146
|
+
columnsData.value = transformColumns(props.columns)
|
|
147
|
+
filteredColumns.value = columnsData.value
|
|
148
|
+
searchValue.value = '' // 重置搜索
|
|
149
|
+
show.value = !show.value
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
watch(() => resultValue, (newVal, _oldVal) => {
|
|
153
|
+
columnsData.value = transformColumns(props.columns)
|
|
154
|
+
filteredColumns.value = columnsData.value
|
|
155
|
+
emits('input', newVal)
|
|
156
|
+
})
|
|
157
|
+
|
|
158
|
+
// 监听 columns 变化
|
|
159
|
+
watch(() => props.columns, () => {
|
|
160
|
+
columnsData.value = transformColumns(props.columns)
|
|
161
|
+
filteredColumns.value = columnsData.value
|
|
162
|
+
searchValue.value = ''
|
|
163
|
+
}, { deep: true })
|
|
164
|
+
</script>
|
|
165
|
+
|
|
166
|
+
<template>
|
|
167
|
+
<VanField
|
|
168
|
+
v-model="resultLabel"
|
|
169
|
+
v-bind="$attrs"
|
|
170
|
+
readonly
|
|
171
|
+
:is-link="true"
|
|
172
|
+
:border="props.border"
|
|
173
|
+
@click="showPopu($attrs.readonly)"
|
|
174
|
+
/>
|
|
175
|
+
<VanPopup v-model:show="show" position="bottom">
|
|
176
|
+
<div class="x-select-popup">
|
|
177
|
+
<!-- 搜索框 -->
|
|
178
|
+
<VanSearch
|
|
179
|
+
v-model="searchValue"
|
|
180
|
+
placeholder="搜索"
|
|
181
|
+
/>
|
|
182
|
+
|
|
183
|
+
<!-- 选择器 -->
|
|
184
|
+
<VanPicker
|
|
185
|
+
:loading="isLoading"
|
|
186
|
+
v-bind="$attrs"
|
|
187
|
+
:columns="filteredColumns"
|
|
188
|
+
:columns-field-names="props.option"
|
|
189
|
+
show-toolbar
|
|
190
|
+
:value-key="props.option.text"
|
|
191
|
+
@cancel="cancel"
|
|
192
|
+
@confirm="onConfirm"
|
|
193
|
+
@change="change"
|
|
194
|
+
/>
|
|
195
|
+
</div>
|
|
196
|
+
</VanPopup>
|
|
197
|
+
</template>
|
|
198
|
+
|
|
199
|
+
<style scoped>
|
|
200
|
+
.loading-container {
|
|
201
|
+
display: flex;
|
|
202
|
+
justify-content: center;
|
|
203
|
+
align-items: center;
|
|
204
|
+
height: 200px;
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
.loading-text {
|
|
208
|
+
color: #969799;
|
|
209
|
+
font-size: 14px;
|
|
210
|
+
}
|
|
211
|
+
</style>
|