mirror of
https://gitee.com/bookshelfplus/bookshelfplus
synced 2025-09-16 23:22:20 +08:00
后台管理前端结构调整;管理员后台添加第三方账号绑定
This commit is contained in:
@@ -10,19 +10,22 @@
|
||||
<a class="home narrowHide" href="/">首页</a>
|
||||
<a href="/search">搜索</a>
|
||||
<a class="narrowHide" href="/category">分类</a>
|
||||
<a href="/login">登录</a>
|
||||
<a id="dashboard" href="/login">登录</a>
|
||||
</div>
|
||||
<div class="grid-item"></div>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
if (localStorage.token)
|
||||
$("#dashboard").html("后台");
|
||||
|
||||
function navbarHighlight() {
|
||||
// 导航栏中突出当前页面
|
||||
var route = location.pathname.split('/').filter(s=>!!s);
|
||||
var page = route[route.length-1];
|
||||
var route = location.pathname.split('/').filter(s => !!s);
|
||||
var page = route[route.length - 1];
|
||||
|
||||
// 首页
|
||||
if(route.length === 0) {
|
||||
if (route.length === 0) {
|
||||
$(".home").addClass("active");
|
||||
return;
|
||||
}
|
||||
@@ -30,12 +33,12 @@
|
||||
//其他页面
|
||||
// console.log("page:", page);
|
||||
$("a").toArray().forEach(element => {
|
||||
var linkRoute = element.getAttribute("href").split('/').filter(s=>!!s);
|
||||
var linkRoute = element.getAttribute("href").split('/').filter(s => !!s);
|
||||
// console.log(element.href, linkRoute);
|
||||
if(linkRoute.length > 0) {
|
||||
var linkPage = linkRoute[linkRoute.length-1];
|
||||
if (linkRoute.length > 0) {
|
||||
var linkPage = linkRoute[linkRoute.length - 1];
|
||||
// console.log(element, linkPage);
|
||||
if(page == linkPage) {
|
||||
if (page == linkPage) {
|
||||
$(element).addClass("active");
|
||||
return;
|
||||
}
|
||||
|
@@ -1,24 +0,0 @@
|
||||
<button class="btn-third-party" id="btn_gitee" onclick="thirdPartyLogin('gitee')">Gitee</button>
|
||||
<button class="btn-third-party" id="btn_oschina" onclick="thirdPartyLogin('OSCHINA')">OSCHINA</button>
|
||||
<button class="btn-third-party" id="btn_feishu" onclick="thirdPartyLogin('feishu')">飞书</button>
|
||||
<button class="btn-third-party" id="btn_github" onclick="thirdPartyLogin('GitHub')">GitHub(不稳定)</button>
|
||||
<button class="btn-third-party" id="btn_qq" onclick="thirdPartyLogin('qq')">QQ</button>
|
||||
<script>
|
||||
// 第三方授权登录逻辑
|
||||
function thirdPartyLogin(platform) {
|
||||
getRequest("/third-party/login", { platform: platform })
|
||||
.then(function (response) {
|
||||
var axiosData = response.data;
|
||||
var status = axiosData.status;
|
||||
var data = axiosData.data;
|
||||
if (status === "success") {
|
||||
location.href = data;
|
||||
} else {
|
||||
alert(`出错啦!${data.errMsg} (错误码: ${data.errCode}) `);
|
||||
}
|
||||
}).catch(function (error) {
|
||||
console.log(error);
|
||||
alert("无法连接到服务器,请检查网络连接!");
|
||||
});
|
||||
}
|
||||
</script>
|
Reference in New Issue
Block a user