Merge branch 'dev' of github.com:jetlinks/jetlinks-ui-vue into dev
This commit is contained in:
commit
11fe52ce49
|
|
@ -1,17 +0,0 @@
|
||||||
import server from '@/utils/request'
|
|
||||||
|
|
||||||
export const config = () => server.get(`/authorize/captcha/config`)
|
|
||||||
|
|
||||||
export const code = () => server.get(`/authorize/captcha/image?width=130&height=30`)
|
|
||||||
|
|
||||||
export const authLogin = (data) => server.post(`/authorize/login`, data)
|
|
||||||
|
|
||||||
export const getInitSet = () => server.get(`/user/settings/init`)
|
|
||||||
|
|
||||||
export const postInitSet = (data) => server.post(`/user/settings/init`, data)
|
|
||||||
|
|
||||||
export const systemVersion = () => server.get(`/system/version`)
|
|
||||||
|
|
||||||
export const bindInfo = () => server.get(`/application/sso/_all`)
|
|
||||||
|
|
||||||
export const settingDetail = (scopes) => server.get(`/system/config/${scopes}`)
|
|
||||||
|
|
@ -0,0 +1,49 @@
|
||||||
|
import server from '@/utils/request'
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取验证码配置
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
|
export const config = () => server.get(`/authorize/captcha/config`)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取验证码图片
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
|
export const code = () => server.get(`/authorize/captcha/image?width=130&height=30`)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 登录
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
|
export const authLogin = (data: any) => server.post(`/authorize/login`, data)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询初始化配置信息
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
|
export const getInitSet = () => server.get(`/user/settings/init`)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建初始化配置信息
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
|
export const postInitSet = (data: any) => server.post(`/user/settings/init`, data)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询系统版本信息
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
|
export const systemVersion = () => server.get(`/system/version`)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取支持的SSO的应用
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
|
export const bindInfo = () => server.get(`/application/sso/_all`)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询配置信息
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
|
export const settingDetail = (scopes: string) => server.get(`/system/config/${scopes}`)
|
||||||
|
|
@ -83,19 +83,20 @@
|
||||||
]"
|
]"
|
||||||
>
|
>
|
||||||
<a-input
|
<a-input
|
||||||
class="login-code-input"
|
|
||||||
v-model:value="form.verifyCode"
|
v-model:value="form.verifyCode"
|
||||||
autocomplete="off"
|
autocomplete="off"
|
||||||
:maxlength="64"
|
:maxlength="64"
|
||||||
placeholder="请输入验证码"
|
placeholder="请输入验证码"
|
||||||
></a-input>
|
>
|
||||||
<div class="login-code">
|
<template #addonAfter>
|
||||||
<img
|
<div>
|
||||||
:src="codeUrl"
|
<img
|
||||||
@click="getCode()"
|
:src="codeUrl"
|
||||||
class="login-code-img"
|
@click="getCode()"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
</template>
|
||||||
|
</a-input>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
<a-form-item
|
<a-form-item
|
||||||
name="remember"
|
name="remember"
|
||||||
|
|
@ -103,7 +104,14 @@
|
||||||
>
|
>
|
||||||
<a-checkbox
|
<a-checkbox
|
||||||
v-model:checked="form.remember"
|
v-model:checked="form.remember"
|
||||||
>记住密码</a-checkbox
|
@change="
|
||||||
|
() =>
|
||||||
|
(form.expires =
|
||||||
|
form.remember
|
||||||
|
? -1
|
||||||
|
: 3600000)
|
||||||
|
"
|
||||||
|
>记住我</a-checkbox
|
||||||
>
|
>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
<a-form-item>
|
<a-form-item>
|
||||||
|
|
@ -180,7 +188,6 @@ import {
|
||||||
bindInfo,
|
bindInfo,
|
||||||
settingDetail,
|
settingDetail,
|
||||||
} from '@/api/login';
|
} from '@/api/login';
|
||||||
import Cookies from 'js-cookie';
|
|
||||||
import { useUserInfo } from '@/store/userInfo';
|
import { useUserInfo } from '@/store/userInfo';
|
||||||
import { LocalStore } from '@/utils/comm';
|
import { LocalStore } from '@/utils/comm';
|
||||||
import { BASE_API_PATH, TOKEN_KEY, Version_Code } from '@/utils/variable';
|
import { BASE_API_PATH, TOKEN_KEY, Version_Code } from '@/utils/variable';
|
||||||
|
|
@ -220,34 +227,24 @@ iconMap.set('dingtalk-ent-app', getImage('/bind/dingtalk.png'));
|
||||||
iconMap.set('wechat-webapp', getImage('/bind/wechat-webapp.png'));
|
iconMap.set('wechat-webapp', getImage('/bind/wechat-webapp.png'));
|
||||||
|
|
||||||
const onFinish = async () => {
|
const onFinish = async () => {
|
||||||
form.remember
|
|
||||||
? Cookies.set('user', encodeURIComponent(JSON.stringify(form)), {
|
|
||||||
expires: 7,
|
|
||||||
})
|
|
||||||
: Cookies.remove('user');
|
|
||||||
Cookies.set('username', form.username, { expires: 30 });
|
|
||||||
try {
|
try {
|
||||||
loading.value = true;
|
loading.value = true;
|
||||||
const res: any = await authLogin(form);
|
const res: any = await authLogin(form);
|
||||||
|
loading.value = false;
|
||||||
if (res.success) {
|
if (res.success) {
|
||||||
store.$patch({
|
store.$patch({
|
||||||
...res.result,
|
...res.result,
|
||||||
username: form.username,
|
username: form.username,
|
||||||
});
|
});
|
||||||
LocalStore.set(TOKEN_KEY, res?.result.token);
|
LocalStore.set(TOKEN_KEY, res?.result.token);
|
||||||
// if (res.result.username === 'admin') {
|
if (res.result.username === 'admin') {
|
||||||
// const resp: any = await getInitSet();
|
const resp: any = await getInitSet();
|
||||||
// if (resp.status === 200 && !resp.result.length) {
|
if (resp.status === 200 && !resp.result.length) {
|
||||||
// window.location.href = '/#/init-home';
|
window.location.href = '/#/init-home';
|
||||||
// return;
|
return;
|
||||||
// }
|
}
|
||||||
// }
|
|
||||||
// window.location.href = '/';
|
|
||||||
|
|
||||||
const resp: any = await getInitSet();
|
|
||||||
if (resp.success) {
|
|
||||||
router.push('/demo');
|
|
||||||
}
|
}
|
||||||
|
window.location.href = '/';
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
form.verifyCode = '';
|
form.verifyCode = '';
|
||||||
|
|
@ -269,14 +266,6 @@ const getCode = async () => {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const getCookie = () => {
|
|
||||||
// form.username = Cookies.get('username');
|
|
||||||
if (!Cookies.get('user')) return;
|
|
||||||
const user = JSON.parse(decodeURIComponent(Cookies.get('user')));
|
|
||||||
form.username = user.username;
|
|
||||||
form.password = user.password;
|
|
||||||
form.remember = user.remember || false;
|
|
||||||
};
|
|
||||||
|
|
||||||
const getOpen = () => {
|
const getOpen = () => {
|
||||||
LocalStore.removeAll();
|
LocalStore.removeAll();
|
||||||
|
|
@ -292,7 +281,7 @@ const getOpen = () => {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
settingDetail('front').then((res) => {
|
settingDetail('front').then((res: any) => {
|
||||||
if (res.status === 200) {
|
if (res.status === 200) {
|
||||||
const ico: any = document.querySelector('link[rel="icon"]');
|
const ico: any = document.querySelector('link[rel="icon"]');
|
||||||
ico.href = res.result.ico;
|
ico.href = res.result.ico;
|
||||||
|
|
@ -337,7 +326,6 @@ watch(
|
||||||
|
|
||||||
getOpen();
|
getOpen();
|
||||||
getCode();
|
getCode();
|
||||||
getCookie();
|
|
||||||
screenRotation(screenWidth.value, screenHeight.value);
|
screenRotation(screenWidth.value, screenHeight.value);
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
@ -470,23 +458,9 @@ screenRotation(screenWidth.value, screenHeight.value);
|
||||||
}
|
}
|
||||||
|
|
||||||
.verifyCode {
|
.verifyCode {
|
||||||
.login-code-input {
|
img {
|
||||||
width: 70%;
|
cursor: pointer;
|
||||||
float: left;
|
// vertical-align: middle;
|
||||||
}
|
|
||||||
.login-code {
|
|
||||||
width: 30%;
|
|
||||||
height: 32px;
|
|
||||||
float: left;
|
|
||||||
background-color: #e4e6e7;
|
|
||||||
img {
|
|
||||||
cursor: pointer;
|
|
||||||
vertical-align: middle;
|
|
||||||
}
|
|
||||||
.login-code-img {
|
|
||||||
width: 100%;
|
|
||||||
height: 100%;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue