Commit b2abf2ea authored by wangqinghua's avatar wangqinghua

出题采纳

parent 6403513f
......@@ -70,15 +70,18 @@
</div>
<div class="stuff-comment">
<p class="comment-title">回答</p>
<div *ngFor="let answer of answerList" class="comment-item">
<div *ngFor="let answer of item?.answers" class="comment-item">
<ion-row>
<ion-col col-12>
<ion-col col-1></ion-col>
<ion-col col-11 style="position: relative">
<p class="comment-info">
{{answer.userName}}
</p>
<p class="commnet-content">
<span class="margin-right-5 margin-left-20">回答:</span>{{answer.answer}} <span style="color: #003388" class="margin-left-10" (click)="accept(answer.id)">采纳</span>
<span class="margin-right-5 margin-left-20">回答:</span>{{answer.answer}} <span
style="color: #003388" class="margin-left-10" (click)="accept(answer.id)">采纳</span>
</p>
<span *ngIf="answer.isAccept == 1" class="accept">已采纳</span>
</ion-col>
</ion-row>
</div>
......
......@@ -279,4 +279,11 @@ page-accept {
margin-top: .5rem;
}
}
.accept{
position: absolute;
right: 0;
bottom: 0;
font-size: 1.2rem;
color: #2bab4e;
}
}
......@@ -11,17 +11,25 @@ import {CommonService} from "../../../provide/common.service";
})
export class AcceptPage {
item;
id;
answer = "";
answerList = [];
item;
constructor(public navCtrl: NavController, public navParams: NavParams,
private tabSer: TabsService, private commonSer: CommonService) {
}
ionViewDidLoad() {
this.item = this.navParams.get('item');
this.answerList = this.item.answers;
this.id = this.navParams.get('id');
this.getDetail();
}
getDetail(){
this.tabSer.personDetail(this.id).subscribe(
(res)=>{
this.item = res.data;
}
)
}
//采纳回答
......@@ -31,7 +39,12 @@ export class AcceptPage {
}
this.tabSer.accept(data).subscribe(
(res)=>{
if(res.errcode == '1000'){
this.commonSer.toast('采纳成功');
this.getDetail();
}else{
this.commonSer.toast(res.errmsg);
}
}
)
}
......
......@@ -236,7 +236,7 @@ export class DiscoverPage {
constructor(public navCtrl: NavController, public navParams: NavParams,
public commonSer: CommonService, public renderer: Renderer2,
public zone: NgZone,public storage: Storage,
public zone: NgZone, public storage: Storage,
public tabsSer: TabsService, public emitSer: EmitService) {
// 接收发射过来的数据
this.emitSer.eventEmit.subscribe((value: any) => {
......@@ -246,6 +246,10 @@ export class DiscoverPage {
});
}
ionViewDidEnter() {
this.getQuestion();
}
ionViewDidLoad() {
this.storage.get('userLoginInfo').then((value) => {
this.userId = value.userid;
......@@ -254,7 +258,7 @@ export class DiscoverPage {
this.getBanner();
this.slideList.length = 7;
this.scrollHeight();
timer(20).subscribe(()=>{
timer(20).subscribe(() => {
this.itemWidth = window.screen.width / 4;
this.spanWidth = this.tabSpan.nativeElement.offsetWidth; //文字宽度
this.changeParent(this.tabsList[0])
......@@ -577,9 +581,9 @@ export class DiscoverPage {
//回答题目
goToResponse(item) {
console.log(item);
if(item.userId == this.userId){
this.navCtrl.push('AcceptPage', {item: item})
}else{
if (item.userId == this.userId) {
this.navCtrl.push('AcceptPage', {id: item.id})
} else {
this.navCtrl.push('ResponsePage', {item: item})
}
}
......@@ -623,8 +627,8 @@ export class DiscoverPage {
let img = new Image();
img.src = canvas.toDataURL("image/png");
img.setAttribute("crossOrigin",'Anonymous')
img.onload = ()=>{
img.setAttribute("crossOrigin", 'Anonymous')
img.onload = () => {
// console.log(img);
e.target.setAttribute("poster", canvas.toDataURL("image/png"));
}
......
......@@ -92,7 +92,7 @@
<img src="./assets/imgs/mine/wdsh.png">
</ion-col>
<ion-col class="group-right" col-10>
<span>我的审核 <span class="main-color" *ngIf="checkList.length > 0">({{checkList.length}})</span></span>
<span>我的审核 <span class="main-color" *ngIf="checkList.length > 0">{{checkList.length}}</span></span>
<ion-icon name="ios-arrow-forward"></ion-icon>
</ion-col>
</ion-row>
......
......@@ -184,6 +184,11 @@ export class TabsService {
return this.http.post(AppGlobal.domain + '/wisdomgroup/modules/personanswer/answer', data);
}
//我要出题的题目详情
personDetail(params): Observable<any> {
return this.http.get(AppGlobal.domain + '/wisdomgroup/modules/personquestion/detail/'+params);
}
//采纳答案
accept(data): Observable<any> {
return this.http.post(AppGlobal.domain + '/wisdomgroup/modules/personquestion/accept', this.commonSer.toFormData(data));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment