Browse Source

feat: comp-nav with logout

ryanemax 8 months ago
parent
commit
b32e56c1f2

+ 7 - 1
projects/textbook/src/app/comp-nav/comp-nav.component.html

@@ -1,4 +1,10 @@
 <div class="bar">
   <nz-avatar nzIcon="user" style="background-color:#87d068;"></nz-avatar>
-  <span>{{tbookSer.profile?.name}}</span>
+  <div class="title">{{tbookSer.profile?.name}}</div>
+  <div class="space"></div>
+  <div class="user">
+    <button mat-icon-button routerLink="/user/login" aria-label="LogOut" style="margin-top: -10px;">
+      <mat-icon>logout</mat-icon>
+    </button>
+  </div>
 </div>

+ 11 - 1
projects/textbook/src/app/comp-nav/comp-nav.component.scss

@@ -2,7 +2,17 @@
   width: 100%;
   padding: 10px;
   border-bottom: 1px solid #d3d3d3;
-  span{
+  display: flex;
+  div{
+    margin-top:5px;
+  }
+  .title{
     margin-left: 10px;
   }
+  .space{
+    flex:1;
+  }
+  .user{
+    width:100px;
+  }
 }

+ 8 - 1
projects/textbook/src/app/comp-nav/comp-nav.component.ts

@@ -1,11 +1,18 @@
 import { Component, OnInit } from '@angular/core';
 import { NzAvatarModule } from 'ng-zorro-antd/avatar';
 import { textbookServer } from "../../services/textbook";
+import { MatButtonModule } from '@angular/material/button';
+import { MatIconModule } from '@angular/material/icon';
+import { RouterModule } from '@angular/router';
 
 @Component({
   selector: 'app-comp-nav',
   standalone: true,
-  imports: [NzAvatarModule],
+  imports: [
+    RouterModule,
+    NzAvatarModule,
+    MatButtonModule,MatIconModule
+  ],
   templateUrl: './comp-nav.component.html',
   styleUrls: ['./comp-nav.component.scss'],
 })

+ 5 - 0
projects/textbook/src/app/comp-table/comp-table-list/comp-table-list.component.scss

@@ -0,0 +1,5 @@
+
+nz-table{
+    width:100%;
+    padding:20px;
+}

+ 1 - 1
projects/textbook/src/modules/login/login/login.component.ts

@@ -57,7 +57,7 @@ export class LoginComponent {
     {
       name: '作者/教师/主编',
       type: 6,
-      route:'/nav-author/home'
+      route:'/nav-author/textbook/list'
     },
   ];
   currentProfile: any = this.selector[0]

+ 1 - 1
projects/textbook/src/modules/nav-author/page-home/page-home.component.html

@@ -29,7 +29,7 @@
       } }
     </ul>
   </div>
-  <div class="proview">
+  <div class="preview">
     <router-outlet></router-outlet>
   </div>
 </div>

+ 1 - 1
projects/textbook/src/modules/nav-author/page-home/page-home.component.scss

@@ -6,7 +6,7 @@
   .content-left{
     background-color:#fff;
   }
-  .content-rifht{
+  .preview{
     height: 100%;
     overflow-y: scroll;
     padding: 20px 0 40px 0;

+ 1 - 1
server/config.js

@@ -2,7 +2,7 @@ module.exports = {
     "appName":"EduServer",
     "version":"1.0.1",
     "PARSE_SERVERURL":"http://localhost:61337/parse",
-    "PARSE_APPID":"edu-parse",
+    "PARSE_APPID":"edu-textbook",
     "PARSE_MASTERKEY":"EDU2024",
     "NOVA_SERVERURL":"http://localhost:61337/",
     "DATABASE_LOCAL":true, // 加载本地测试数据库

+ 5 - 1
server/server.js

@@ -45,6 +45,8 @@ global.monitorMap = {}
 // Web服务启动器
 const express = require('express');
 const parse = require('parse-server')
+const Parse = require('parse/node')
+
 const ParseServer = parse.ParseServer;
 const ParseDashboard = require('parse-dashboard');
 
@@ -71,10 +73,12 @@ global.parseConfig = {
 
 global.parseConfig.serverURL = `http://localhost:${global.parseConfig?.port}/parse`
 global.parseConfig.databaseURI = "postgresql://postgres@127.0.0.1:25432/"
-global.parseConfig.appId = 'edu-parse'
+global.parseConfig.appId = 'edu-textbook'
 global.parseConfig.appName = 'EduParse'
 global.parseConfig.masterKey = 'EDU2024'
 
+Parse.initialize(global.parseConfig.appId,null,global.parseConfig.masterKey);
+Parse.serverURL = global.parseConfig.serverURL;
 
 async function startParse(){
   if(global.config['DATABASE_LOCAL']) {