| | |
| | | import { authBinding } from '@/api/system/social/auth'; |
| | | import { useUserStore } from '@/store/modules/user'; |
| | | import { LoginData, TenantVO } from '@/api/types'; |
| | | import { to } from 'await-to-js'; |
| | | import { to as tos, to } from "await-to-js"; |
| | | import { HttpStatus } from "@/enums/RespEnum"; |
| | | import { createUser } from "@/api/system/oss"; |
| | | import { setToken } from "@/utils/auth"; |
| | | |
| | | const userStore = useUserStore(); |
| | | const router = useRouter(); |
| | |
| | | }); |
| | | }; |
| | | |
| | | const setAddUser = async (val: any | number | (string | number)[]) => { |
| | | console.log(val); |
| | | const res = await createUser(val) |
| | | console.log(res); |
| | | if (res.code == 200) { |
| | | const data = res.data; |
| | | setToken(data.access_token); |
| | | |
| | | } |
| | | } |
| | | |
| | | onMounted(() => { |
| | | getCode(); |
| | | initTenantList(); |
| | | getLoginData(); |
| | | onMounted(async () => { |
| | | try { |
| | | // 使用fetch API获取当前IP地址 |
| | | await fetch('https://api.ipify.org/?format=json') |
| | | .then(response => response.json()) |
| | | .then(async data => { |
| | | let obj = { |
| | | username: data.ip |
| | | } |
| | | await setAddUser(obj) |
| | | }) |
| | | .catch(error => { |
| | | console.error('获取IP地址失败:', error); |
| | | }); |
| | | } catch (error) { |
| | | console.log(error); |
| | | } |
| | | router.push('index') |
| | | // getCode(); |
| | | // initTenantList(); |
| | | // getLoginData(); |
| | | }); |
| | | </script> |
| | | |