From b08db2d2a75bd8df5f648d856cb160ada7ff0068 Mon Sep 17 00:00:00 2001 From: odc.xiaohui <xiaohui@Q1> Date: 星期四, 09 十一月 2023 10:30:01 +0800 Subject: [PATCH] 修改视频专网 --- src/views/login.vue | 40 ++++++++++++++++++++++++++++++++++------ 1 files changed, 34 insertions(+), 6 deletions(-) diff --git a/src/views/login.vue b/src/views/login.vue index 02cef14..96e8be5 100644 --- a/src/views/login.vue +++ b/src/views/login.vue @@ -1,6 +1,6 @@ <template> <div class="login"> - <el-form ref="loginRef" :model="loginForm" :rules="loginRules" class="login-form"> + <el-form style="display: none" ref="loginRef" :model="loginForm" :rules="loginRules" class="login-form"> <h3 class="title">璺ㄧ綉鏂囦欢鍚屾绯荤粺</h3> <!-- <el-form-item prop="tenantId" v-if="tenantEnabled">--> <!-- <el-select v-model="loginForm.tenantId" filterable placeholder="璇烽�夋嫨/杈撳叆鍏徃鍚嶇О" style="width: 100%">--> @@ -63,8 +63,10 @@ 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(); @@ -203,12 +205,38 @@ }); }; +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> -- Gitblit v1.8.0