feat:设备验证

This commit is contained in:
dzc committed 2026-04-17 14:54:47 +08:00
1 parent d1127ab5f8
commit 552a006e25
27 files changed
+962 -820

No files matched your search

+8
View File
@@ -119,6 +119,14 @@ export default {
data,
}),
// 判断该设备是否被验证
isVerifyDevice: (data: { mobile: string; userId: string }) =>
request({
url: "/thirdparty/thirdPartyOAth2/is-verify-device",
method: "POST",
data,
}),
// 用户注册
register: (data: any) =>
request({
+5
View File
@@ -1,6 +1,11 @@
import request from "@/sheep/utils/request"
export default {
createTopupWallet: (): Promise<any> =>
request({
url: "/wallet/wallet-manage/app/topup-wallet",
method: "GET",
}),
all: (): Promise<any> =>
request({
url: "/wallet/wallet-manage/app/get-all",
@@ -1,9 +1,12 @@
<script setup lang="ts">
import { watch, reactive, onMounted, computed } from "vue"
import { ref, watch, reactive, onMounted, computed } from "vue"
import { router } from "@@/index"
import { router, constant } from "@@/index"
import { useTabbarStore } from "@@/stores/tabbar"
import { jump } from "@/sheep/router";
import { userApi } from "@@/api/index"
import VerifyDeviceImpModel from "../../verify-device-imp-model.vue"
const tabbarStore = useTabbarStore()
@@ -18,6 +21,7 @@ export type Props = {
bg: string
}
const verifyDeviceImpModelRef = ref()
const props = withDefaults(defineProps<Props>(), {
tabBarType: "default",
title: "",
@@ -88,6 +92,41 @@ function tabbarChange(index: number) {
if (!target) return
jump(target.pagePath, {}, 3)
}
// 校验该设备是否被验证
async function checkVerifyDevice() {
// 从本地存储中获取用户信息
const userInfo = uni.getStorageSync(constant.storageConstant.USERINFO)
if (!userInfo || !userInfo.sysUser || !userInfo.sysUser.userId) return
// 是否在白名单中
if (constant.DEVICE_VERIFY_WRITE_LIST.includes(userInfo.sysUser.phone)) {
return
}
const _params = {
mobile: userInfo.sysUser.phone,
userId: userInfo.sysUser.userId,
}
try {
const { data, code }: any = await userApi.isVerifyDevice(_params)
if (code != 0) {
throw new Error()
}
if (data === false) {
verifyDeviceImpModelRef.value?.openDialog(userInfo.sysUser.phone)
}
} catch (error: any) {
console.log("校验该设备是否被验证意外的错误error:", error)
uni.showToast({ title: error.msg ?? "设备验证错误", icon: "none", })
}
}
function verifyDeviceImpModelClose() {
}
defineExpose({
checkVerifyDevice
})
</script>
<template>
@@ -118,6 +157,7 @@ function tabbarChange(index: number) {
borderColor="#DBDDDE" color="#8E8E8E" selected-color="#0094ff" position="fixed" @change="tabbarChange">
</tm-tabbar>
</view>
<VerifyDeviceImpModel ref="verifyDeviceImpModelRef" :close="verifyDeviceImpModelClose" />
</view>
</template>
+2
View File
@@ -5,3 +5,5 @@ export { default as storageConstant } from "./storage-constant"
export { default as APPENV } from "./app-env"
export * from "./service-image"
export * from "./write-list"
+3
View File
@@ -0,0 +1,3 @@
export const DEVICE_VERIFY_WRITE_LIST = [
"17683843144",
]