Bläddra i källkod

头部一致改动

wlzhao 6 år sedan
förälder
incheckning
e23b385c4b

BIN
src/main/resources/static/assets/images/userImg.png


+ 47 - 1
src/main/resources/static/home/css/home.css

@@ -407,7 +407,6 @@ em{
 	}
 }
 .name{
-
 	margin-left: 20px;
 	font-size: 24px;
 	overflow: hidden;
@@ -1646,4 +1645,51 @@ em{
 .popupInfo {
 	font-size: 16px;
 	text-align: left;
+}
+.dropMenu{
+	display: inline-block;
+	position: relative;
+	height: 100%;
+	vertical-align: middle;
+	margin-right: 15px;
+}
+.loginName {
+	font-size: 14px;
+	overflow: hidden;
+	margin-left: 0;
+	cursor: pointer;
+}
+.dropMenu .menu{
+	display: none;
+	background: #fff;
+	position: absolute;
+	top: 60px;
+	right: 0;
+	z-index: 5;
+	line-height: 40px;
+	white-space: nowrap;
+	border: 1px solid #ebeef5;
+	border-radius: 4px;
+	box-shadow: 0 2px 12px 0 rgba(0,0,0,.1)
+}
+.dropMenu:hover .menu{
+	display: block;
+}
+.dropMenu .menu a{
+	display: block;
+	color: #606266;
+	padding: 3px 15px;
+}
+.dropMenu .menu a:hover {
+	color: #66b1ff;
+	background-color: #ecf5ff;
+}
+.toAdmin {
+	margin-right: 15px;
+	cursor: pointer;
+}
+.loginIcon {
+	margin-right: 15px;
+	max-height:80px;
+	max-width: 80px;
 }

+ 11 - 1
src/main/resources/templates/home/common/common.html

@@ -57,8 +57,13 @@
         loginUserId = localStorage.getItem('user_id')
         $(function () {
             if (loginUserName) {
-                document.getElementById('login_user_name').innerText = loginUserName;
+                // document.getElementsByClassName('.loginIcon')[0].src = loginUserName;
+                document.getElementsByClassName('loginName')[0].innerText = loginUserName;
                 document.getElementById('login-link').style.display = 'none'
+            } else {
+                document.getElementsByClassName('toAdmin')[0].style.display = 'none'
+                document.getElementsByClassName('loginIcon')[0].style.display = 'none'
+                document.getElementsByClassName('dropMenu')[0].style.display = 'none'
             }
         });
         $(function () {
@@ -67,6 +72,11 @@
             }
         });
 
+        function logOut() {
+            localStorage.clear()
+            window.location.href = 'http://' + window.location.host +  '/admin/logout'
+        }
+
         function showDT() {
             var days = new Array("日", "一", "二", "三", "四", "五", "六");
             var currentDT = new Date();

+ 11 - 1
src/main/resources/templates/home/common/header.html

@@ -30,7 +30,17 @@
 					<!--<a th:href="@{/home/login}" class="iconlogin"><i class="iconfont">&#xe634;</i></a>-->
 					<!--<span style="margin-right:10px;">登录人</span>-->
 					<!--<i class="iconfont">&#xe634;</i>-->
-					<span id="login_user_name" style="margin-right:10px;"></span>
+					<!--<span id="login_user_name" style="margin-right:10px;"></span>-->
+					<a th:href="@{/admin/home}" class="toAdmin">后台</a>
+					<img class="loginIcon" th:src="@{/assets/images/userImg.png}" alt="头像">
+					<div class="dropMenu">
+						<div class="loginName"></div>
+						<div class="menu">
+							<a th:href="@{/index/#/myActivity}">我的活动</a>
+							<a th:href="@{/index/#/favouriteActivity}">活动收藏</a>
+							<a onclick="logOut()">退出</a>
+						</div>
+					</div>
 					<a  id="login-link" style="margin-right:10px;" th:href="@{/home/login}">登录</a>
 					<a th:href="@{/home}"><img th:src="@{/assets/images/homePng.png}" alt=""></a>
 				</div>