验证码登陆

This commit is contained in:
republicline 2024-08-15 11:11:55 +08:00
parent 41089bbd71
commit b10dc89005
5 changed files with 517 additions and 452 deletions

3
.env
View File

@ -2,4 +2,7 @@ VITE_PWD_ENC_KEY='thanks,rax4cloud'
VITE_OAUTH2_PASSWORD_CLIENT='rax:rax' VITE_OAUTH2_PASSWORD_CLIENT='rax:rax'
# OAUTH2 短信客户端信息
VITE_OAUTH2_MOBILE_CLIENT='app:app'
VITE_RAX_BASE_URL='/api' VITE_RAX_BASE_URL='/api'

31
src/api/login-phone.ts Normal file
View File

@ -0,0 +1,31 @@
import request from '@/utils/request';
import {Session} from "@/utils/storage";
const FORM_CONTENT_TYPE = 'application/x-www-form-urlencoded';
export const sendMobileCode = (mobile: any) => {
return request({
url: '/admin/mobile/' + mobile,
method: 'get',
});
};
export const loginByMobile = (mobile: any, code: any) => {
const grant_type = 'mobile';
const scope = 'server';
const basicAuth = 'Basic ' + window.btoa(import.meta.env.VITE_OAUTH2_MOBILE_CLIENT);
Session.set('basicAuth', basicAuth);
return request({
url: '/admin/oauth2/token',
headers: {
skipToken: true,
Authorization: basicAuth,
'Content-Type': FORM_CONTENT_TYPE,
},
method: 'post',
data: {mobile: mobile, code: code, grant_type, scope},
});
};

View File

@ -58,10 +58,10 @@ export const constantRoute = [
] ]
}, },
{ {
path: '/remote-manage', path: '/remote-manage/remote-manage',
name: '远程管理', name: '远程管理',
component: () => import('@/views/remote-manage/index.vue'), component: () => import('@/views/remote-manage/index.vue'),
redirect: '/remote-manage/remote-manage', // redirect: '/remote-manage/remote-manage',
children: [ children: [
{ {
path: '/remote-manage/remote-manage', path: '/remote-manage/remote-manage',

File diff suppressed because it is too large Load Diff

View File

@ -24,16 +24,16 @@ export default defineConfig({
proxy: { proxy: {
'/api': { '/api': {
// target: 'http://localhost:9999', // 目标服务器地址 // target: 'http://localhost:9999', // 目标服务器地址
// target: 'http://localhost:6379', // 目标服务器地址 target: 'http://localhost:6379', // 目标服务器地址
target: 'http://110.41.142.124:6379', // 目标服务器地址 // target: 'http://110.41.142.124:6379', // 目标服务器地址
ws: true, // 是否启用 WebSocket ws: true, // 是否启用 WebSocket
changeOrigin: true, // 是否修改请求头中的 Origin 字段 changeOrigin: true, // 是否修改请求头中的 Origin 字段
rewrite: (path) => path.replace(/^\/api/, ''), rewrite: (path) => path.replace(/^\/api/, ''),
}, },
'/socket.io': { '/socket.io': {
// target: 'ws://localhost:9999', // target: 'ws://localhost:9999',
// target: 'ws://localhost:6379', target: 'ws://localhost:6379',
target: 'ws://110.41.142.124:6379', // target: 'ws://110.41.142.124:6379',
ws: true, ws: true,
changeOrigin: true, changeOrigin: true,
rewrite: (path) => path.replace(/^\/socket.io/, ''), rewrite: (path) => path.replace(/^\/socket.io/, ''),