diff --git a/.gitignore b/.gitignore
index 6f365d5c..f998f72f 100644
--- a/.gitignore
+++ b/.gitignore
@@ -17,4 +17,5 @@
*/node_modules/
**/vendor/
.idea
+.vscode
out
diff --git a/build_release.sh b/build_release.sh
index cc4c218c..462eea0b 100755
--- a/build_release.sh
+++ b/build_release.sh
@@ -106,7 +106,7 @@ function buildDocker() {
imageVersion=$1
cd ${server_folder}
imageName="mayflygo/mayfly-go:${imageVersion}"
- docker build -t "${imageName}" .
+ docker build --platform linux/amd64 -t "${imageName}" .
echo_green "docker镜像构建完成->[${imageName}]"
echo_yellow "-------------------构建docker镜像结束-------------------"
}
@@ -197,4 +197,4 @@ function runBuild() {
rm -rf ${server_folder}/static/static/index.html
}
-runBuild
\ No newline at end of file
+runBuild
diff --git a/mayfly_go_web/src/common/openApi.ts b/mayfly_go_web/src/common/openApi.ts
index d7404881..062d8ada 100644
--- a/mayfly_go_web/src/common/openApi.ts
+++ b/mayfly_go_web/src/common/openApi.ts
@@ -6,6 +6,7 @@ export default {
changePwd: (param: any) => request.post('/sys/accounts/change-pwd', param),
getPublicKey: () => request.get('/common/public-key'),
getConfigValue: (params: any) => request.get('/sys/configs/value', params),
+ oauthConfig: () => request.get('/sys/configs/auth'),
captcha: () => request.get('/sys/captcha'),
logout: () => request.post('/sys/accounts/logout/{token}'),
getPermissions: () => request.get('/sys/accounts/permissions'),
diff --git a/mayfly_go_web/src/views/login/component/AccountLogin.vue b/mayfly_go_web/src/views/login/component/AccountLogin.vue
index e72bdaf4..5f7ff958 100644
--- a/mayfly_go_web/src/views/login/component/AccountLogin.vue
+++ b/mayfly_go_web/src/views/login/component/AccountLogin.vue
@@ -2,37 +2,24 @@
-
+
-
+
-
+
-
![]()
+
@@ -47,21 +34,19 @@
-
+
-
+
-
+
@@ -73,28 +58,17 @@
-
-
+
+
-
+
@@ -265,10 +239,14 @@ const onSignIn = async () => {
return;
}
state.showLoginFailTips = false;
+ loginResDeal(loginRes);
+}
+
+const loginResDeal = (loginRes: any) => {
// 用户信息
const userInfos = {
name: loginRes.name,
- username: state.loginForm.username,
+ username: loginRes.username,
// 头像
photo: letterAvatar(state.loginForm.username),
time: new Date().getTime(),
@@ -297,6 +275,10 @@ const onSignIn = async () => {
}, 400);
};
+defineExpose({
+ loginResDeal
+});
+
// 登录成功后的跳转
const signInSuccess = async (accessToken: string = '') => {
// 存储 token 到浏览器缓存
diff --git a/mayfly_go_web/src/views/login/index.vue b/mayfly_go_web/src/views/login/index.vue
index 0f337dc5..36e83c0c 100644
--- a/mayfly_go_web/src/views/login/index.vue
+++ b/mayfly_go_web/src/views/login/index.vue
@@ -9,7 +9,7 @@
-
+
-
+
+
+
+
+
+
+
+
+
+
+
@@ -160,18 +154,20 @@
立即设置
-
-
+
-->
+
-
绑定QQ
-
已绑定QQ:110****566
+
绑定OAuth2
+
+ {{ authStatus.bind.oauth2 ? '已绑定' : '未绑定' }}
+
- 立即设置
+ 立即绑定
-
-->
+
@@ -186,6 +182,8 @@ import { personApi } from './api';
import { dateFormat } from '@/common/utils/date';
import { storeToRefs } from 'pinia';
import { useUserInfo } from '@/store/userInfo';
+import config from '@/common/config';
+import { getSession } from '@/common/utils/storage';
const { userInfo } = storeToRefs(useUserInfo());
const state = reactive({
@@ -208,9 +206,13 @@ const state = reactive({
accountForm: {
password: '',
},
+ authStatus: {
+ enable: { oauth2: false },
+ bind: { oauth2: false }
+ }
});
-const { msgDialog, accountForm } = toRefs(state);
+const { msgDialog, accountForm, authStatus } = toRefs(state);
// 当前时间提示语
const currentTime = computed(() => {
@@ -228,9 +230,10 @@ const roleInfo = computed(() => {
return state.accountInfo.roles.map((val: any) => val.name).join('、');
});
-onMounted(() => {
+onMounted(async () => {
getAccountInfo();
getMsgs();
+ state.authStatus = await personApi.authStatus.request()
});
const getAccountInfo = async () => {
@@ -242,6 +245,31 @@ const updateAccount = async () => {
ElMessage.success('更新成功');
};
+const bindOAuth2 = () => {
+ // 小窗口打开oauth2鉴权
+ let oauthWindoe = window.open(config.baseApiUrl + "/sys/auth/oauth2/bind?token=" + getSession('token'), "oauth2", "width=600,height=600");
+ if (oauthWindoe) {
+ const handler = (e: any) => {
+ if (e.data.action === "oauthBind") {
+ oauthWindoe!.close();
+ window.removeEventListener("message", handler);
+ // 处理登录token
+ console.log(e.data);
+ ElMessage.success('绑定成功');
+ setTimeout(() => {
+ location.reload();
+ }, 1000);
+ }
+ }
+ window.addEventListener("message", handler);
+ setInterval(() => {
+ if (oauthWindoe!.closed) {
+ window.removeEventListener("message", handler);
+ }
+ }, 1000);
+ }
+}
+
const getMsgs = async () => {
const res = await personApi.getMsgs.request(state.msgDialog.query);
state.msgDialog.msgs = res;
diff --git a/mayfly_go_web/src/views/system/api.ts b/mayfly_go_web/src/views/system/api.ts
index 601c1895..7a21a751 100644
--- a/mayfly_go_web/src/views/system/api.ts
+++ b/mayfly_go_web/src/views/system/api.ts
@@ -43,3 +43,8 @@ export const configApi = {
export const logApi = {
list: Api.newGet('/syslogs'),
};
+
+export const authApi = {
+ info: Api.newGet('/sys/auth'),
+ saveOAuth2: Api.newPut('/sys/auth/oauth2'),
+};
diff --git a/mayfly_go_web/src/views/system/auth/AuthInfo.vue b/mayfly_go_web/src/views/system/auth/AuthInfo.vue
new file mode 100644
index 00000000..39fe8451
--- /dev/null
+++ b/mayfly_go_web/src/views/system/auth/AuthInfo.vue
@@ -0,0 +1,105 @@
+
+
+
+
+ 登录认证
+ 管理三方登录认证平台
+
+
+
+
+
+ OAuth2.0
+ 自定义oauth2.0 server登录
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 保存
+
+
+
+
+
+
+
+
diff --git a/mayfly_go_web/src/views/system/config/ConfigList.vue b/mayfly_go_web/src/views/system/config/ConfigList.vue
index 87fc0aca..4626dff2 100755
--- a/mayfly_go_web/src/views/system/config/ConfigList.vue
+++ b/mayfly_go_web/src/views/system/config/ConfigList.vue
@@ -29,12 +29,17 @@
+
" +
+ "" +
+ "