verce-vue-test 0.0.33 → 0.0.34
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.
|
@@ -182,8 +182,17 @@ export const getCurrentUser = (onSuccess: (user: MXUser) => void): void => {
|
|
|
182
182
|
}
|
|
183
183
|
|
|
184
184
|
/** 从原生客户端获取加密密钥 */
|
|
185
|
-
export const getEncryptString = (
|
|
186
|
-
|
|
185
|
+
export const getEncryptString = (
|
|
186
|
+
onSuccess: (secret: string) => void,
|
|
187
|
+
onError?: (reason: string) => void,
|
|
188
|
+
): void => {
|
|
189
|
+
MXCommon!.getEncryptString((secret) => {
|
|
190
|
+
if (secret) {
|
|
191
|
+
onSuccess(secret)
|
|
192
|
+
} else {
|
|
193
|
+
onError?.('获取加密密钥失败')
|
|
194
|
+
}
|
|
195
|
+
})
|
|
187
196
|
}
|
|
188
197
|
|
|
189
198
|
/** 打开原生选人组件 */
|
|
@@ -22,11 +22,18 @@ onMounted(() => {
|
|
|
22
22
|
if (!appStore.isNative) return
|
|
23
23
|
|
|
24
24
|
loading.value = true
|
|
25
|
-
getEncryptString(
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
25
|
+
getEncryptString(
|
|
26
|
+
(secret) => {
|
|
27
|
+
loading.value = false
|
|
28
|
+
console.log(secret)
|
|
29
|
+
// TODO: 用 secret 自动换取 token 并跳转首页
|
|
30
|
+
},
|
|
31
|
+
() => {
|
|
32
|
+
loading.value = false
|
|
33
|
+
showToast({ message: '获取设备凭证失败,请手动登录', duration: 3000 })
|
|
34
|
+
appStore.isNative = false
|
|
35
|
+
},
|
|
36
|
+
)
|
|
30
37
|
})
|
|
31
38
|
|
|
32
39
|
async function onSubmit() {
|