Commit b2abf2ea authored by wangqinghua's avatar wangqinghua

出题采纳

parent 6403513f
...@@ -70,15 +70,18 @@ ...@@ -70,15 +70,18 @@
</div> </div>
<div class="stuff-comment"> <div class="stuff-comment">
<p class="comment-title">回答</p> <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-row>
<ion-col col-12> <ion-col col-1></ion-col>
<ion-col col-11 style="position: relative">
<p class="comment-info"> <p class="comment-info">
{{answer.userName}} {{answer.userName}}
</p> </p>
<p class="commnet-content"> <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> </p>
<span *ngIf="answer.isAccept == 1" class="accept">已采纳</span>
</ion-col> </ion-col>
</ion-row> </ion-row>
</div> </div>
......
...@@ -279,4 +279,11 @@ page-accept { ...@@ -279,4 +279,11 @@ page-accept {
margin-top: .5rem; 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"; ...@@ -11,17 +11,25 @@ import {CommonService} from "../../../provide/common.service";
}) })
export class AcceptPage { export class AcceptPage {
item; id;
answer = ""; answer = "";
answerList = []; item;
constructor(public navCtrl: NavController, public navParams: NavParams, constructor(public navCtrl: NavController, public navParams: NavParams,
private tabSer: TabsService, private commonSer: CommonService) { private tabSer: TabsService, private commonSer: CommonService) {
} }
ionViewDidLoad() { ionViewDidLoad() {
this.item = this.navParams.get('item'); this.id = this.navParams.get('id');
this.answerList = this.item.answers; this.getDetail();
}
getDetail(){
this.tabSer.personDetail(this.id).subscribe(
(res)=>{
this.item = res.data;
}
)
} }
//采纳回答 //采纳回答
...@@ -31,7 +39,12 @@ export class AcceptPage { ...@@ -31,7 +39,12 @@ export class AcceptPage {
} }
this.tabSer.accept(data).subscribe( this.tabSer.accept(data).subscribe(
(res)=>{ (res)=>{
if(res.errcode == '1000'){
this.commonSer.toast('采纳成功');
this.getDetail();
}else{
this.commonSer.toast(res.errmsg);
}
} }
) )
} }
......
...@@ -236,7 +236,7 @@ export class DiscoverPage { ...@@ -236,7 +236,7 @@ export class DiscoverPage {
constructor(public navCtrl: NavController, public navParams: NavParams, constructor(public navCtrl: NavController, public navParams: NavParams,
public commonSer: CommonService, public renderer: Renderer2, public commonSer: CommonService, public renderer: Renderer2,
public zone: NgZone,public storage: Storage, public zone: NgZone, public storage: Storage,
public tabsSer: TabsService, public emitSer: EmitService) { public tabsSer: TabsService, public emitSer: EmitService) {
// 接收发射过来的数据 // 接收发射过来的数据
this.emitSer.eventEmit.subscribe((value: any) => { this.emitSer.eventEmit.subscribe((value: any) => {
...@@ -246,6 +246,10 @@ export class DiscoverPage { ...@@ -246,6 +246,10 @@ export class DiscoverPage {
}); });
} }
ionViewDidEnter() {
this.getQuestion();
}
ionViewDidLoad() { ionViewDidLoad() {
this.storage.get('userLoginInfo').then((value) => { this.storage.get('userLoginInfo').then((value) => {
this.userId = value.userid; this.userId = value.userid;
...@@ -254,7 +258,7 @@ export class DiscoverPage { ...@@ -254,7 +258,7 @@ export class DiscoverPage {
this.getBanner(); this.getBanner();
this.slideList.length = 7; this.slideList.length = 7;
this.scrollHeight(); this.scrollHeight();
timer(20).subscribe(()=>{ timer(20).subscribe(() => {
this.itemWidth = window.screen.width / 4; this.itemWidth = window.screen.width / 4;
this.spanWidth = this.tabSpan.nativeElement.offsetWidth; //文字宽度 this.spanWidth = this.tabSpan.nativeElement.offsetWidth; //文字宽度
this.changeParent(this.tabsList[0]) this.changeParent(this.tabsList[0])
...@@ -577,9 +581,9 @@ export class DiscoverPage { ...@@ -577,9 +581,9 @@ export class DiscoverPage {
//回答题目 //回答题目
goToResponse(item) { goToResponse(item) {
console.log(item); console.log(item);
if(item.userId == this.userId){ if (item.userId == this.userId) {
this.navCtrl.push('AcceptPage', {item: item}) this.navCtrl.push('AcceptPage', {id: item.id})
}else{ } else {
this.navCtrl.push('ResponsePage', {item: item}) this.navCtrl.push('ResponsePage', {item: item})
} }
} }
...@@ -623,8 +627,8 @@ export class DiscoverPage { ...@@ -623,8 +627,8 @@ export class DiscoverPage {
let img = new Image(); let img = new Image();
img.src = canvas.toDataURL("image/png"); img.src = canvas.toDataURL("image/png");
img.setAttribute("crossOrigin",'Anonymous') img.setAttribute("crossOrigin", 'Anonymous')
img.onload = ()=>{ img.onload = () => {
// console.log(img); // console.log(img);
e.target.setAttribute("poster", canvas.toDataURL("image/png")); e.target.setAttribute("poster", canvas.toDataURL("image/png"));
} }
......
...@@ -92,7 +92,7 @@ ...@@ -92,7 +92,7 @@
<img src="./assets/imgs/mine/wdsh.png"> <img src="./assets/imgs/mine/wdsh.png">
</ion-col> </ion-col>
<ion-col class="group-right" col-10> <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-icon name="ios-arrow-forward"></ion-icon>
</ion-col> </ion-col>
</ion-row> </ion-row>
......
...@@ -184,6 +184,11 @@ export class TabsService { ...@@ -184,6 +184,11 @@ export class TabsService {
return this.http.post(AppGlobal.domain + '/wisdomgroup/modules/personanswer/answer', data); 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> { accept(data): Observable<any> {
return this.http.post(AppGlobal.domain + '/wisdomgroup/modules/personquestion/accept', this.commonSer.toFormData(data)); 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