-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #9 from ssysm/update
Update
- Loading branch information
Showing
35 changed files
with
1,021 additions
and
60 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { Pipe, PipeTransform } from '@angular/core'; | ||
|
||
@Pipe({ | ||
name: 'textSlice' | ||
}) | ||
export class TextSlicePipe implements PipeTransform { | ||
|
||
transform(value: String, args?: number): String { | ||
if(value.length <= args){ | ||
return value | ||
}else{ | ||
return value.slice(0,args)+"..." | ||
} | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import { Injectable } from '@angular/core'; | ||
import {Http, RequestOptions} from "@angular/http"; | ||
import {environment} from "../../environments/environment"; | ||
|
||
@Injectable() | ||
export class QaService { | ||
|
||
constructor( | ||
private http:Http | ||
) { } | ||
|
||
fetchQaList(page:number,limit:number){ | ||
return this.http | ||
.get(environment.apiBase+'/qa?page='+page+'&limit='+limit) | ||
} | ||
|
||
createQa(data){ | ||
return this.http | ||
.post(environment.apiBase+'/qa/ask',data) | ||
} | ||
|
||
fetchAllQaList(page:number,limit:number){ | ||
return this.http | ||
.get(environment.apiBase+'/qa/all?page='+page+'&limit='+limit) | ||
} | ||
|
||
answerQa(data){ | ||
return this.http | ||
.patch(environment.apiBase+'/qa/answer',data) | ||
} | ||
|
||
deleteQa(uid:String){ | ||
return this.http | ||
.delete(environment.apiBase+'/qa/delete',new RequestOptions({ | ||
body: {uid:uid} | ||
})) | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,15 @@ | ||
.introh1{ | ||
color: #23b1f7; | ||
} | ||
.intro{ | ||
font-size: large; | ||
font-family: "微软雅黑",-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"; | ||
} | ||
.blockquote{ | ||
border-left:5px solid #eee | ||
border-left:5px solid #eee; | ||
font-size: large; | ||
} | ||
.qBox{ | ||
padding: 25px; | ||
text-align: center; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 3 additions & 0 deletions
3
client/src/app/view/admin/qa-management/qa-management.component.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
a{ | ||
margin: 10px; | ||
} |
51 changes: 51 additions & 0 deletions
51
client/src/app/view/admin/qa-management/qa-management.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
<div class="container" *ngIf="qaList"> | ||
<table class="table"> | ||
<thead> | ||
<tr> | ||
<th scope="col">#</th> | ||
<th scope="col">问题</th> | ||
<th scope="col">提问时间</th> | ||
<th scope="col">操作</th> | ||
</tr> | ||
</thead> | ||
<tbody *ngFor="let qa of qaList"> | ||
<tr> | ||
<th scope="row">{{qa._id | textSlice:12}}</th> | ||
<td>{{qa.question|textSlice:8}}</td> | ||
<td>{{qa.created | date : 'yyyy/mm/dd HH:ss'}}</td> | ||
<td> | ||
<button class="btn btn-info" (click)="cQaId=qa._id" *ngIf="!qa.answered" data-toggle="modal" data-value="{{qa._id}}" data-target="#qaAnswerBox">回答</button> | ||
<a (click)="deleteQa(qa._id)" style="cursor: pointer;color:red">删除</a> | ||
</td> | ||
</tr> | ||
</tbody> | ||
</table> | ||
</div> | ||
<div class="modal fade" id="qaAnswerBox" tabindex="-1" role="dialog" aria-hidden="true"> | ||
<div class="modal-dialog" role="document"> | ||
<div class="modal-content"> | ||
<div class="modal-header"> | ||
<h5 class="modal-title">回答问题</h5> | ||
<button type="button" class="close" data-dismiss="modal" aria-label="Close"> | ||
<span aria-hidden="true">×</span> | ||
</button> | ||
</div> | ||
<div class="modal-body"> | ||
<form (ngSubmit)="answerQa(f.value)" #f="ngForm" [formGroup]="qaAnswerForm"> | ||
<div class="form-group"> | ||
<label for="uid" class="col-form-label">问题ID:</label> | ||
<input type="text" formControlName="uid" [ngModel]="cQaId" class="form-control disabled" name="uid" disabled id="uid"> | ||
</div> | ||
<div class="form-group"> | ||
<label for="message-text" class="col-form-label">回复:</label> | ||
<textarea class="form-control" name="answer" formControlName="answer" id="message-text" style="resize: none;"></textarea> | ||
</div> | ||
<div class="modal-footer"> | ||
<button type="button" class="btn btn-secondary" data-dismiss="modal">关闭</button> | ||
<button type="submit" class="btn btn-primary" *ngIf="qaAnswerForm.valid">回复</button> | ||
</div> | ||
</form> | ||
</div> | ||
</div> | ||
</div> | ||
</div> |
25 changes: 25 additions & 0 deletions
25
client/src/app/view/admin/qa-management/qa-management.component.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { async, ComponentFixture, TestBed } from '@angular/core/testing'; | ||
|
||
import { QaManagementComponent } from './qa-management.component'; | ||
|
||
describe('QaManagementComponent', () => { | ||
let component: QaManagementComponent; | ||
let fixture: ComponentFixture<QaManagementComponent>; | ||
|
||
beforeEach(async(() => { | ||
TestBed.configureTestingModule({ | ||
declarations: [ QaManagementComponent ] | ||
}) | ||
.compileComponents(); | ||
})); | ||
|
||
beforeEach(() => { | ||
fixture = TestBed.createComponent(QaManagementComponent); | ||
component = fixture.componentInstance; | ||
fixture.detectChanges(); | ||
}); | ||
|
||
it('should create', () => { | ||
expect(component).toBeTruthy(); | ||
}); | ||
}); |
Oops, something went wrong.