| | |
| | | <!-- <template #prefix><svg-icon icon-class="company" class="el-input__icon input-icon" /></template>--> |
| | | <!-- </el-select>--> |
| | | <!-- </el-form-item>--> |
| | | <el-form-item prop="username"> |
| | | <el-form-item style="display: none" prop="username"> |
| | | <el-input v-model="loginForm.username" type="text" size="large" auto-complete="off" placeholder="账号"> |
| | | <template #prefix><svg-icon icon-class="user" class="el-input__icon input-icon" /></template> |
| | | </el-input> |
| | | </el-form-item> |
| | | <el-form-item prop="password"> |
| | | <el-form-item style="display: none" prop="password"> |
| | | <el-input v-model="loginForm.password" type="password" size="large" auto-complete="off" placeholder="密码" @keyup.enter="handleLogin"> |
| | | <template #prefix><svg-icon icon-class="password" class="el-input__icon input-icon" /></template> |
| | | </el-input> |
| | | </el-form-item> |
| | | <el-form-item prop="code" v-if="captchaEnabled"> |
| | | <el-form-item style="display: none" prop="code" v-if="captchaEnabled"> |
| | | <el-input v-model="loginForm.code" size="large" auto-complete="off" placeholder="验证码" style="width: 63%" @keyup.enter="handleLogin"> |
| | | <template #prefix><svg-icon icon-class="validCode" class="el-input__icon input-icon" /></template> |
| | | </el-input> |
| | |
| | | <img :src="codeUrl" @click="getCode" class="login-code-img" /> |
| | | </div> |
| | | </el-form-item> |
| | | <el-checkbox v-model="loginForm.rememberMe" style="margin:0px 0px 25px 0px;">记住密码</el-checkbox> |
| | | <el-checkbox style="display: none;margin:0px 0px 25px 0px;" v-model="loginForm.rememberMe" >记住密码</el-checkbox> |
| | | <!-- <el-form-item style="float: right;">--> |
| | | <!-- <el-button circle title="微信登录" @click="doSocialLogin('wechat')">--> |
| | | <!-- <svg-icon icon-class="wechat" />--> |
| | |
| | | <!-- <svg-icon icon-class="github" />--> |
| | | <!-- </el-button>--> |
| | | <!-- </el-form-item>--> |
| | | <el-form-item style="width:100%;"> |
| | | <el-form-item style="display: none;width:100%;" > |
| | | <el-button :loading="loading" size="large" type="primary" style="width:100%;" @click.prevent="handleLogin"> |
| | | <span v-if="!loading">登 录</span> |
| | | <span v-else>登 录 中...</span> |
| | |
| | | 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> |
| | | |