Skip to content

Commit dfffc02

Browse files
committed
bug fixed
1 parent 177558b commit dfffc02

14 files changed

+21
-437
lines changed

src/app/app.component.ts

+1-4
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,7 @@ import { Component } from '@angular/core';
77
})
88
export class AppComponent {
99
title = 'app';
10-
visible:string="fab";
10+
1111
constructor() {
12-
localStorage.setItem("visible",this.visible) ;
13-
// console.log(this.visible);
14-
1512
}
1613
}

src/app/app.module.ts

+2-3
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ import { LMarkdownEditorModule } from 'ngx-markdown-editor';
2222
import { ReadComponent } from './component/admin/read/read.component';
2323
import { ReadcourseComponent } from './component/readcourse/readcourse.component';
2424
import { ChatComponent } from './component/chat/chat.component';
25-
import { ChatroomsComponent } from './component/chatrooms/chatrooms.component';
25+
2626

2727
const appRoutes: Routes = [
2828
{ path: 'login', component: LoginComponent },
@@ -35,7 +35,7 @@ const appRoutes: Routes = [
3535
{ path: 'admin-read', component: ReadComponent },
3636
{ path: 'read-course', component: ReadcourseComponent},
3737
{ path: 'chat', component: ChatComponent},
38-
{ path: 'chatroom', component: ChatroomsComponent}
38+
3939
]
4040

4141
@NgModule({
@@ -55,7 +55,6 @@ const appRoutes: Routes = [
5555
ReadComponent,
5656
ReadcourseComponent,
5757
ChatComponent,
58-
ChatroomsComponent
5958
],
6059
imports: [
6160
BrowserModule,

src/app/component/admin/createnew/createnew.component.ts

+3-2
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { RequestOptions, URLSearchParams, RequestMethod } from '@angular/http';
44
import { Observable } from 'rxjs/Rx';
55
import { FileUploader } from 'ng2-file-upload';
66
import { Router } from '@angular/router';
7+
import { NodeService } from './../../../services/node.service'
78

89
@Component({
910
selector: 'app-createnew',
@@ -14,7 +15,7 @@ export class CreatenewComponent implements OnInit {
1415
course_id: String;
1516
course_name: String;
1617

17-
constructor(public http: Http,private router: Router) {
18+
constructor(public http: Http,private router: Router,private nodeService : NodeService) {
1819
this.course_id = "";
1920
this.course_name = "";
2021

@@ -59,7 +60,7 @@ export class CreatenewComponent implements OnInit {
5960
/** In Angular 5, including the header Content-Type can invalidate your request */
6061
let headers = new Headers();
6162
let options = new RequestOptions({ headers: headers, withCredentials: true });
62-
this.http.post('http://localhost:3000/createNew', formData, options)
63+
this.http.post(this.nodeService.baseUrl+'createNew', formData, options)
6364
.map(res => res.json())
6465
.catch(error => Observable.throw(error))
6566
.subscribe(

src/app/component/admin/view/view.component.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ export class ViewComponent implements OnInit {
1818

1919
for(var i=0;i<Object.keys(jsondata).length;i++){
2020
var feed = jsondata[i];
21-
this.courses.push({coursename:feed.coursename,path:"http://localhost:3000/"+feed.path});
21+
this.courses.push({coursename:feed.coursename,path:this.nodeService.baseUrl+feed.path});
2222
}
2323
},
2424
(err) => {
@@ -59,7 +59,7 @@ export class ViewComponent implements OnInit {
5959

6060
for(var i=0;i<Object.keys(jsondata).length;i++){
6161
var feed = jsondata[i];
62-
this.courses.push({coursename:feed.coursename,path:"http://localhost:3000/"+feed.path});
62+
this.courses.push({coursename:feed.coursename,path:this.nodeService.baseUrl+feed.path});
6363
}
6464
},
6565
(err) => {

src/app/component/chat/chat.component.css

+3-1
Original file line numberDiff line numberDiff line change
@@ -312,10 +312,12 @@ div.msg-box span.btn-group i
312312
}
313313
.connection{
314314
position: relative;
315+
display: inline-block;
315316
text-align: center;
316317
font-size: 14px;
317318
font-weight: 500;
318-
color: rgb(119, 119, 119)
319+
color: rgb(119, 119, 119);
320+
left:23%;
319321
}
320322
.chip {
321323
display: inline-block;

src/app/component/chat/chat.component.html

+1-2
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,7 @@
6464
<!-- <div *ngIf="m.username=='you';then you else bot"></div> -->
6565
<ng-template #bot [ngIf]="m.index == 'received'">
6666
<span class="friend last">
67-
<span class="username">{{m.username}} :</span><span>{{m.message}}</span>
68-
67+
<span class="username">{{m.username}} : </span><span>{{m.message}}</span>
6968
</span>
7069
</ng-template>
7170
<ng-template #you [ngIf]="m.index == 'sent'">

src/app/component/chat/chat.component.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,13 @@ export class ChatComponent implements OnInit {
2121
socket: SocketIOClient.Socket;
2222
constructor(private nodeService: NodeService) {
2323
this.username = localStorage.getItem("user")
24-
this.socket = io.connect('http://localhost:3000/'+this.coursename);
24+
this.socket = io.connect(this.nodeService.baseUrl+this.coursename);
2525
this.nodeService.home().subscribe(
2626
(result) => {
2727
var jsondata=JSON.parse(result["_body"]);
2828
for(var i=0;i<Object.keys(jsondata).length;i++){
2929
var feed = jsondata[i];
30-
this.courses.push({coursename:feed.coursename,path:"http://localhost:3000/"+feed.path});
30+
this.courses.push({coursename:feed.coursename,path:this.nodeService.baseUrl+feed.path});
3131
}
3232
},
3333
(err) => {
@@ -47,7 +47,7 @@ export class ChatComponent implements OnInit {
4747
this.flag = "chat";
4848
this.path = path;
4949
this.coursename = course;
50-
this.socket = io.connect('http://localhost:3000/'+course.replace(/ /g, "-"));
50+
this.socket = io.connect(this.nodeService.baseUrl+course.replace(/ /g, "-"));
5151
this.socket.on('new message', (msg: any) => {
5252
// console.log(msg.username);
5353
this.messages.push({ "index": "received", username: msg.username, message: msg.message.message });

0 commit comments

Comments
 (0)