From 3956513a8a8785bbd82f7b71a5ed3f27e0c8de23 Mon Sep 17 00:00:00 2001
From: Sum1Dream <418471657@qq.com>
Date: Thu, 18 Apr 2024 17:25:29 +0800
Subject: [PATCH] 1
---
src/app/pages/body/index/index.component.html | 13 +++
src/app/pages/body/index/index.component.less | 13 +++
src/app/pages/body/index/index.component.ts | 36 ++++++--
.../pages/body/index/index1.component.html | 61 --------------
.../pages/body/index/index1.component.less | 84 -------------------
src/app/pages/body/tab/tab.component.less | 4 +
.../pages/index/index/index.component.html | 63 ++++++++++++++
src/app/servies/login/login.service.ts | 20 +++++
8 files changed, 144 insertions(+), 150 deletions(-)
delete mode 100644 src/app/pages/body/index/index1.component.html
delete mode 100644 src/app/pages/body/index/index1.component.less
diff --git a/src/app/pages/body/index/index.component.html b/src/app/pages/body/index/index.component.html
index 75aa3f1..6e70ce6 100644
--- a/src/app/pages/body/index/index.component.html
+++ b/src/app/pages/body/index/index.component.html
@@ -13,6 +13,19 @@
{{item.menuName}}
+
+
+
{{userInfo['userName']}}
+
+
+
+
+
+
+
diff --git a/src/app/pages/body/index/index.component.less b/src/app/pages/body/index/index.component.less
index 53c0417..735b7cf 100644
--- a/src/app/pages/body/index/index.component.less
+++ b/src/app/pages/body/index/index.component.less
@@ -54,3 +54,16 @@ nz-sider {
nz-content {
padding: 0 0 0 4px;
}
+.user {
+ div {
+ cursor: pointer;
+ float: right;
+ margin-right: 30px;
+ color: white;
+ white-space: nowrap;
+ text-align: left;
+ overflow: hidden;
+ text-overflow: ellipsis;
+ }
+
+}
diff --git a/src/app/pages/body/index/index.component.ts b/src/app/pages/body/index/index.component.ts
index 9ee66b9..628f8c6 100644
--- a/src/app/pages/body/index/index.component.ts
+++ b/src/app/pages/body/index/index.component.ts
@@ -17,7 +17,10 @@ import {NzIconDirective} from "ng-zorro-antd/icon";
import {NzTabComponent, NzTabSetComponent} from "ng-zorro-antd/tabs";
import {TabComponent} from "../tab/tab.component";
import {BrowserStorageService} from "../../../utils/localStorage.service";
-import {DATA} from "../../../data/login/localStorage.namespace";
+import {DATA, INIT_FLAG, LOGIN_DATA, USER_TOKEN} from "../../../data/login/localStorage.namespace";
+import {NzDropDownDirective, NzDropdownMenuComponent} from "ng-zorro-antd/dropdown";
+import {LoginService} from "../../../servies/login/login.service";
+import {NzMessageService} from "ng-zorro-antd/message";
@Component({
selector: 'app-index',
@@ -43,7 +46,9 @@ import {DATA} from "../../../data/login/localStorage.namespace";
NzTabSetComponent,
TabComponent,
NzSiderComponent,
- NzMenuGroupComponent
+ NzMenuGroupComponent,
+ NzDropDownDirective,
+ NzDropdownMenuComponent
],
templateUrl: './index.component.html',
styleUrl: './index.component.less',
@@ -54,16 +59,22 @@ export class IndexComponent {
'menuName' : '首页',
'selected' : true,
}];
-
+ userInfo: any;
// 左侧菜单栏数据
leftMenuData: any = [];
// 侧边菜单展示开关
isCollapse = true;
- constructor(private storage: BrowserStorageService,
- private router: Router) {
+ constructor(
+ private storage: BrowserStorageService,
+ private message: NzMessageService,
+ private router: Router, // 路由
+ private login: LoginService
+ ) {
this.menuData = this.menuData.concat(this.storage.get(DATA)['menuTree']);
+ this.userInfo = this.storage.get(DATA)['account'];
+ console.log("用户数据" , this.userInfo);
}
// 选择操作
@@ -80,4 +91,19 @@ export class IndexComponent {
this.isCollapse = item['menuName'] === '首页';
}
+
+ // 退出登录
+ public loginOut(): void {
+ this.login.loginOut( (data: any) => {
+ if (data['return_code'] === '000000') {
+ this.storage.remove(LOGIN_DATA);
+ this.storage.remove(DATA);
+ this.storage.remove(USER_TOKEN);
+ this.storage.remove(INIT_FLAG);
+ this.router.navigateByUrl('/login').then();
+ } else {
+ this.message.error(data['return_msg']);
+ }
+ });
+ }
}
diff --git a/src/app/pages/body/index/index1.component.html b/src/app/pages/body/index/index1.component.html
deleted file mode 100644
index 6c515c1..0000000
--- a/src/app/pages/body/index/index1.component.html
+++ /dev/null
@@ -1,61 +0,0 @@
-
-
-
-
-
-
普惠GO管理平台
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/src/app/pages/body/index/index1.component.less b/src/app/pages/body/index/index1.component.less
deleted file mode 100644
index eba7283..0000000
--- a/src/app/pages/body/index/index1.component.less
+++ /dev/null
@@ -1,84 +0,0 @@
-nz-header {
- background: #181f47;
- padding: 0 26px;
- .logo {
- h2 {
- color: white;
- }
- }
- .menu {
- width: 52%;
- display: flex;
- justify-content: center;
- ul {
- li {
- height: 56px;
- float: left;
- color: #fff;
- opacity: .65;
- font-size: 14px;
- padding: 0 20px;
- cursor: pointer;
- }
- .li-selected {
- opacity: 1;
- border-bottom: 2px solid #1890ff;
- }
- li:hover {
- opacity: 1;
- border-bottom: 2px solid #1890ff;
- }
- list-style-type: none; /* 移除列表的标记,如果需要的话 */
- padding: 0; /* 移除padding,如果需要的话 */
- }
- }
-}
-
-nz-breadcrumb {
- margin: 16px 0;
-}
-
-nz-footer {
- text-align: center;
-}
-
-.inner-content {
- div {
- float: left;
- }
- .side_menu {
- height: 100%;
- color: #595959;
- box-shadow: 2px 0 8px rgba(0,0,0,.15);
- .side_menu_top {
- width: 100%;
- margin-top: 8px;
- font-size: 18px;
- height: 26px;
- line-height: 23px;
- margin-left: 14px;
- .side_menu_top_icon {
- height: 26px;
- line-height: 26px;
- }
- span {
- margin-left: 6px;
- }
- }
- .side_menu_content {
- margin-top: 10px;
- width: 100%;
- height: 100%;
- }
-
- }
- height: calc(100vh - 64px);
-}
-.content {
- width:100vw;
-}
-.content-width {
- width: calc(100vw - 280px);
-}
-
-
diff --git a/src/app/pages/body/tab/tab.component.less b/src/app/pages/body/tab/tab.component.less
index e172304..bb0c823 100644
--- a/src/app/pages/body/tab/tab.component.less
+++ b/src/app/pages/body/tab/tab.component.less
@@ -28,3 +28,7 @@
background: #f5f5f5;
}
+nz-card {
+ height: calc(100vh - 114px);
+ overflow: auto;
+}
diff --git a/src/app/pages/index/index/index.component.html b/src/app/pages/index/index/index.component.html
index e7dcaf7..54c2e44 100644
--- a/src/app/pages/index/index/index.component.html
+++ b/src/app/pages/index/index/index.component.html
@@ -1 +1,64 @@
首页
+首页
+首页
+首页
+首页
+首页
+首页
+首页
+首页
+首页
+首页
+首页
+首页
+首页
+首页
+首页
+首页
+首页
+首页
+首页
+首页
+首页
+首页
+首页
+首页
+首页
+首页
+首页
+首页
+首页
+首页
+首页
+首页
+首页
+首页
+首页
+首页
+首页
+首页
+首页
+首页
+首页
+首页
+首页
+首页
+首页
+首页
+首页
+首页
+首页
+首页
+首页
+首页
+首页
+首页
+首页
+首页
+首页
+首页
+首页
+首页
+首页
+首页
+首页
diff --git a/src/app/servies/login/login.service.ts b/src/app/servies/login/login.service.ts
index 26ba724..a8f28b4 100644
--- a/src/app/servies/login/login.service.ts
+++ b/src/app/servies/login/login.service.ts
@@ -9,10 +9,30 @@ export class LoginService {
constructor(private http: HttpClient) {}
+ /**
+ * @Author Sum1Dream
+ * @Name userLogin
+ * @Description // 登录
+ * @Date 15:52 2024/4/18
+ * @Param params
+ * @Param callBack
+ */
public userLogin(params: object, callBack:any) {
this.http.post(environment.userUrl + 'secUser/login', params).subscribe(data => {
callBack(data);
});
+ }
+ /**
+ * @Author Sum1Dream
+ * @Name loginOut
+ * @Description // 退出登录
+ * @Date 15:52 2024/4/18
+ * @Param callBack
+ */
+ public loginOut(callBack:any) {
+ this.http.post(environment.userUrl + 'secUser/loginOut', null).subscribe(data => {
+ callBack(data);
+ });
}
}