-
+
正在加载资源
diff --git a/src/api/system/role.js b/src/api/system/role.js
index 2e677c5..8a862ab 100644
--- a/src/api/system/role.js
+++ b/src/api/system/role.js
@@ -22,7 +22,7 @@ export const grant = (roleIds, menuIds) => {
return request({
url: '/api/blade-system/role/grant',
method: 'post',
- params: {
+ data: {
roleIds,
menuIds
}
diff --git a/src/api/user.js b/src/api/user.js
index 199b59e..abe7d4b 100644
--- a/src/api/user.js
+++ b/src/api/user.js
@@ -18,6 +18,22 @@ export const loginByUsername = (tenantId, account, password, type, key, code) =>
}
});
+export const loginBySocial = (tenantId, source, code, state) => request({
+ url: '/api/blade-auth/token',
+ method: 'post',
+ headers: {
+ 'Tenant-Id': tenantId
+ },
+ params: {
+ tenantId,
+ source,
+ code,
+ state,
+ grantType: "social",
+ scope: "all",
+ }
+});
+
export const getButtons = () => request({
url: '/api/blade-system/menu/buttons',
method: 'get'
@@ -28,11 +44,23 @@ export const getUserInfo = () => request({
method: 'get'
});
-export const refeshToken = () => request({
+export const refreshToken = () => request({
url: baseUrl + '/user/refesh',
method: 'post'
})
+export const registerGuest = (form, oauthId) => request({
+ url: '/api/blade-user/register-guest',
+ method: 'post',
+ params: {
+ tenantId: form.tenantId,
+ name: form.name,
+ account: form.account,
+ password: form.password,
+ oauthId
+ }
+});
+
export const getMenu = () => request({
url: '/api/blade-system/menu/routes',
method: 'get'
diff --git a/src/components/third-register/main.vue b/src/components/third-register/main.vue
new file mode 100644
index 0000000..c454872
--- /dev/null
+++ b/src/components/third-register/main.vue
@@ -0,0 +1,106 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/config/env.js b/src/config/env.js
index e51c2ae..5e7dd5d 100644
--- a/src/config/env.js
+++ b/src/config/env.js
@@ -1,7 +1,7 @@
// 配置编译环境和线上环境之间的切换
let baseUrl = '';
-let iconfontVersion = ['567566_pwc3oottzol', '1066523_v8rsbcusj5q'];
+let iconfontVersion = ['567566_pwc3oottzol', '1066523_6bvkeuqao36'];
let iconfontUrl = `//at.alicdn.com/t/font_$key.css`;
let codeUrl = `${baseUrl}/code`
const env = process.env
diff --git a/src/config/iconList.js b/src/config/iconList.js
index d668e3c..e79647e 100644
--- a/src/config/iconList.js
+++ b/src/config/iconList.js
@@ -64,6 +64,8 @@ export default [
"iconfont iconicon_addmessage",
"iconfont iconicon_addresslist",
"iconfont iconicon_add",
+ "iconfont icongithub",
+ "iconfont icongitee2",
]
},
{
diff --git a/src/config/website.js b/src/config/website.js
index 0f39005..91cd5df 100644
--- a/src/config/website.js
+++ b/src/config/website.js
@@ -36,5 +36,7 @@ export default {
icon: 'source',
children: 'children'
}
- }
+ },
+ // 授权地址
+ authUrl: 'http://localhost/blade-auth/oauth/render'
}
diff --git a/src/lang/en.js b/src/lang/en.js
index 98ff77f..5cb73c7 100644
--- a/src/lang/en.js
+++ b/src/lang/en.js
@@ -71,6 +71,8 @@ export default {
password: 'Please input a password',
wechat: 'Wechat',
qq: 'QQ',
+ github: 'github',
+ gitee: 'gitee',
phone: 'Please input a phone',
code: 'Please input a code',
submit: 'Login',
diff --git a/src/lang/zh.js b/src/lang/zh.js
index f0aa8bb..854f0aa 100644
--- a/src/lang/zh.js
+++ b/src/lang/zh.js
@@ -71,6 +71,8 @@ export default {
password: '请输入密码',
wechat: '微信',
qq: 'QQ',
+ github: 'github',
+ gitee: '码云',
phone: '请输入手机号',
code: '请输入验证码',
submit: '登录',
diff --git a/src/main.js b/src/main.js
index 3fc758d..2e202d4 100644
--- a/src/main.js
+++ b/src/main.js
@@ -17,6 +17,7 @@ import i18n from './lang' // Internationalization
import './styles/common.scss';
import basicContainer from './components/basic-container/main'
+import thirdRegister from './components/third-register/main'
Vue.use(router)
Vue.use(VueAxios, axios)
@@ -28,6 +29,7 @@ Vue.use(window.AVUE, {
})
//注册全局容器
Vue.component('basicContainer', basicContainer)
+Vue.component('thirdRegister', thirdRegister);
// 加载相关url地址
Object.keys(urls).forEach(key => {
Vue.prototype[key] = urls[key];
@@ -45,4 +47,4 @@ new Vue({
store,
i18n,
render: h => h(App)
-}).$mount('#app')
\ No newline at end of file
+}).$mount('#app')
diff --git a/src/page/index/index.vue b/src/page/index/index.vue
index 944835b..5c21d1b 100644
--- a/src/page/index/index.vue
+++ b/src/page/index/index.vue
@@ -95,7 +95,7 @@ export default {
if (!(date.seconds >= this.website.tokenTime) && !this.refreshLock) {
this.refreshLock = true;
this.$store
- .dispatch("RefeshToken")
+ .dispatch("RefreshToken")
.then(() => {
this.refreshLock = false;
})
diff --git a/src/page/login/index.vue b/src/page/login/index.vue
index 39aa552..9244176 100644
--- a/src/page/login/index.vue
+++ b/src/page/login/index.vue
@@ -22,12 +22,9 @@
@@ -44,6 +41,7 @@ import { dateFormat } from "@/util/date";
import { validatenull } from "@/util/validate";
import topLang from "@/page/index/top/top-lang";
import topColor from "@/page/index/top/top-color";
+import {getQueryString, getTopUrl} from "@/util/util";
export default {
name: "login",
components: {
@@ -56,42 +54,61 @@ export default {
data() {
return {
time: "",
- activeName: "user"
+ activeName: "user",
+ socialForm: {
+ tenantId: "000000",
+ source: "",
+ code: "",
+ state: "",
+ }
};
},
watch: {
$route() {
- const params = this.$route.query;
- this.socialForm.state = params.state;
- this.socialForm.code = params.code;
- if (!validatenull(this.socialForm.state)) {
- const loading = this.$loading({
- lock: true,
- text: `${
- this.socialForm.state === "WX" ? "微信" : "QQ"
- }登录中,请稍后。。。`,
- spinner: "el-icon-loading"
- });
- setTimeout(() => {
- loading.close();
- }, 2000);
- }
+ this.handleLogin();
}
},
created() {
+ this.handleLogin();
this.getTime();
- setInterval(() => {
- this.getTime();
- }, 1000);
},
- mounted() {},
+ mounted() {
+ },
computed: {
- ...mapGetters(["website"])
+ ...mapGetters(["website", "tagWel"])
},
props: [],
methods: {
getTime() {
- this.time = dateFormat(new Date());
+ setInterval(() => {
+ this.time = dateFormat(new Date());
+ }, 1000);
+ },
+ handleLogin() {
+ const topUrl = getTopUrl();
+ const redirectUrl = "/oauth/redirect/";
+ this.socialForm.source = getQueryString("source");
+ this.socialForm.code = getQueryString("code");
+ this.socialForm.state = getQueryString("state");
+ if (validatenull(this.socialForm.source) && topUrl.includes(redirectUrl)) {
+ let source = topUrl.split("?")[0];
+ source = source.split(redirectUrl)[1];
+ this.socialForm.source = source;
+ }
+ if (!validatenull(this.socialForm.source) && !validatenull(this.socialForm.code) && !validatenull(this.socialForm.state)) {
+ const loading = this.$loading({
+ lock: true,
+ text: '第三方系统登录中,请稍后。。。',
+ spinner: "el-icon-loading"
+ });
+ this.$store.dispatch("LoginBySocial", this.socialForm).then(() => {
+ window.location.href = topUrl.split(redirectUrl)[0];
+ this.$router.push({path: this.tagWel.value});
+ loading.close();
+ }).catch(() => {
+ loading.close();
+ });
+ }
}
}
};
@@ -99,4 +116,4 @@ export default {
\ No newline at end of file
+
diff --git a/src/page/login/thirdlogin.vue b/src/page/login/thirdlogin.vue
index eda4d96..dd79367 100644
--- a/src/page/login/thirdlogin.vue
+++ b/src/page/login/thirdlogin.vue
@@ -1,20 +1,26 @@