设置云触手默认登录设备
This commit is contained in:
+5
-2
@@ -261,12 +261,15 @@ const {
|
||||
<el-form label-width="auto" label-position="top">
|
||||
<div class="form-grid">
|
||||
<el-form-item label="deviceId">
|
||||
<el-input v-model="cloudtentaclesForm.deviceId" placeholder="默认 -" />
|
||||
<el-input
|
||||
v-model="cloudtentaclesForm.deviceId"
|
||||
placeholder="默认 08bc9d8c-fd15-48ea-bc00-8d754076cafc"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="deviceType">
|
||||
<el-input-number
|
||||
v-model="cloudtentaclesForm.deviceType"
|
||||
:min="0"
|
||||
:min="1"
|
||||
controls-position="right"
|
||||
class="w-full"
|
||||
/>
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
export const DEFAULT_CLOUDTENTACLES_DEVICE_ID =
|
||||
'08bc9d8c-fd15-48ea-bc00-8d754076cafc'
|
||||
export const DEFAULT_CLOUDTENTACLES_DEVICE_TYPE = 1
|
||||
|
||||
export function normalizeCloudtentaclesDeviceId(value: unknown) {
|
||||
const normalized = String(value || '').trim()
|
||||
return normalized && normalized !== '-' ? normalized : DEFAULT_CLOUDTENTACLES_DEVICE_ID
|
||||
}
|
||||
|
||||
export function normalizeCloudtentaclesDeviceType(value: unknown) {
|
||||
const parsed = Number(value)
|
||||
return Number.isInteger(parsed) && parsed > 0 ? parsed : DEFAULT_CLOUDTENTACLES_DEVICE_TYPE
|
||||
}
|
||||
+22
-16
@@ -20,6 +20,12 @@ import type {
|
||||
} from '@/types/admin'
|
||||
|
||||
import type { CloudtentaclesForm } from './useCloudtentaclesDebugActions'
|
||||
import {
|
||||
DEFAULT_CLOUDTENTACLES_DEVICE_ID,
|
||||
DEFAULT_CLOUDTENTACLES_DEVICE_TYPE,
|
||||
normalizeCloudtentaclesDeviceId,
|
||||
normalizeCloudtentaclesDeviceType,
|
||||
} from './cloudtentaclesDefaults'
|
||||
import { useCloudtentaclesDebugActions } from './useCloudtentaclesDebugActions'
|
||||
|
||||
export function useAdminCloudtentaclesPlatform() {
|
||||
@@ -41,8 +47,8 @@ export function useAdminCloudtentaclesPlatform() {
|
||||
vnId: 0,
|
||||
skuId: 5,
|
||||
skuCount: 1,
|
||||
deviceId: '-',
|
||||
deviceType: 0,
|
||||
deviceId: DEFAULT_CLOUDTENTACLES_DEVICE_ID,
|
||||
deviceType: DEFAULT_CLOUDTENTACLES_DEVICE_TYPE,
|
||||
})
|
||||
const cloudtentaclesSaving = ref(false)
|
||||
const cloudtentaclesSendingSms = ref(false)
|
||||
@@ -109,8 +115,8 @@ export function useAdminCloudtentaclesPlatform() {
|
||||
username: '',
|
||||
password: '',
|
||||
phone: '',
|
||||
deviceId: '-',
|
||||
deviceType: 0,
|
||||
deviceId: DEFAULT_CLOUDTENTACLES_DEVICE_ID,
|
||||
deviceType: DEFAULT_CLOUDTENTACLES_DEVICE_TYPE,
|
||||
} satisfies AdminCloudtentaclesSourceItem
|
||||
}
|
||||
|
||||
@@ -129,8 +135,8 @@ export function useAdminCloudtentaclesPlatform() {
|
||||
source.username = cloudtentaclesForm.value.username.trim()
|
||||
source.password = cloudtentaclesForm.value.password.trim()
|
||||
source.phone = cloudtentaclesForm.value.phone.trim()
|
||||
source.deviceId = cloudtentaclesForm.value.deviceId.trim() || '-'
|
||||
source.deviceType = Number(cloudtentaclesForm.value.deviceType || 0)
|
||||
source.deviceId = normalizeCloudtentaclesDeviceId(cloudtentaclesForm.value.deviceId)
|
||||
source.deviceType = normalizeCloudtentaclesDeviceType(cloudtentaclesForm.value.deviceType)
|
||||
}
|
||||
|
||||
function selectFallbackSource(preferredKey = '') {
|
||||
@@ -170,8 +176,8 @@ export function useAdminCloudtentaclesPlatform() {
|
||||
vnId: 0,
|
||||
skuId: 5,
|
||||
skuCount: 1,
|
||||
deviceId: source.deviceId || '-',
|
||||
deviceType: source.deviceType || 0,
|
||||
deviceId: normalizeCloudtentaclesDeviceId(source.deviceId),
|
||||
deviceType: normalizeCloudtentaclesDeviceType(source.deviceType),
|
||||
}
|
||||
}
|
||||
cloudtentaclesPersistedSession.value = session || null
|
||||
@@ -288,8 +294,8 @@ export function useAdminCloudtentaclesPlatform() {
|
||||
username: cloudtentaclesForm.value.username.trim(),
|
||||
password: cloudtentaclesForm.value.password.trim(),
|
||||
phone: cloudtentaclesForm.value.phone.trim(),
|
||||
deviceId: cloudtentaclesForm.value.deviceId.trim() || '-',
|
||||
deviceType: Number(cloudtentaclesForm.value.deviceType || 0),
|
||||
deviceId: normalizeCloudtentaclesDeviceId(cloudtentaclesForm.value.deviceId),
|
||||
deviceType: normalizeCloudtentaclesDeviceType(cloudtentaclesForm.value.deviceType),
|
||||
sourceKey: selectedSourceKey.value,
|
||||
}
|
||||
}
|
||||
@@ -383,8 +389,8 @@ export function useAdminCloudtentaclesPlatform() {
|
||||
username: response.data.username,
|
||||
phoneMasked: response.data.phoneMasked,
|
||||
loggedInAt: response.data.loggedInAt,
|
||||
deviceId: cloudtentaclesForm.value.deviceId.trim() || '-',
|
||||
deviceType: Number(cloudtentaclesForm.value.deviceType || 0),
|
||||
deviceId: normalizeCloudtentaclesDeviceId(cloudtentaclesForm.value.deviceId),
|
||||
deviceType: normalizeCloudtentaclesDeviceType(cloudtentaclesForm.value.deviceType),
|
||||
hasToken: Boolean(response.data.token),
|
||||
}
|
||||
// Update sessions map
|
||||
@@ -413,8 +419,8 @@ export function useAdminCloudtentaclesPlatform() {
|
||||
const response = await validateAdminCloudtentaclesSession({
|
||||
baseUrl: cloudtentaclesForm.value.baseUrl.trim() || 'https://123.207.217.176',
|
||||
token,
|
||||
deviceId: cloudtentaclesForm.value.deviceId.trim() || '-',
|
||||
deviceType: Number(cloudtentaclesForm.value.deviceType || 0),
|
||||
deviceId: normalizeCloudtentaclesDeviceId(cloudtentaclesForm.value.deviceId),
|
||||
deviceType: normalizeCloudtentaclesDeviceType(cloudtentaclesForm.value.deviceType),
|
||||
sourceKey: selectedSourceKey.value,
|
||||
})
|
||||
cloudtentaclesValidateResult.value = response.data
|
||||
@@ -427,8 +433,8 @@ export function useAdminCloudtentaclesPlatform() {
|
||||
cloudtentaclesForm.value.username.trim(),
|
||||
phoneMasked: cloudtentaclesPersistedSession.value?.phoneMasked || '',
|
||||
loggedInAt: response.data.loggedInAt,
|
||||
deviceId: cloudtentaclesForm.value.deviceId.trim() || '-',
|
||||
deviceType: Number(cloudtentaclesForm.value.deviceType || 0),
|
||||
deviceId: normalizeCloudtentaclesDeviceId(cloudtentaclesForm.value.deviceId),
|
||||
deviceType: normalizeCloudtentaclesDeviceType(cloudtentaclesForm.value.deviceType),
|
||||
hasToken: Boolean(token),
|
||||
}
|
||||
// Update sessions map
|
||||
|
||||
+7
-2
@@ -17,6 +17,11 @@ import {
|
||||
verifyAdminCloudtentaclesVnCode,
|
||||
} from '@/services/admin'
|
||||
|
||||
import {
|
||||
normalizeCloudtentaclesDeviceId,
|
||||
normalizeCloudtentaclesDeviceType,
|
||||
} from './cloudtentaclesDefaults'
|
||||
|
||||
export type CloudtentaclesForm = {
|
||||
baseUrl: string
|
||||
username: string
|
||||
@@ -44,8 +49,8 @@ export function useCloudtentaclesDebugActions(
|
||||
return {
|
||||
baseUrl: cloudtentaclesForm.value.baseUrl.trim() || 'https://123.207.217.176',
|
||||
token: cloudtentaclesForm.value.token.trim(),
|
||||
deviceId: cloudtentaclesForm.value.deviceId.trim() || '-',
|
||||
deviceType: Number(cloudtentaclesForm.value.deviceType || 0),
|
||||
deviceId: normalizeCloudtentaclesDeviceId(cloudtentaclesForm.value.deviceId),
|
||||
deviceType: normalizeCloudtentaclesDeviceType(cloudtentaclesForm.value.deviceType),
|
||||
sourceKey: selectedSourceKey.value,
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user