Commit b2abf2ea authored by wangqinghua's avatar wangqinghua

出题采纳

parent 6403513f
<ion-header> <ion-header>
<ion-navbar> <ion-navbar>
<ion-title>我的问答</ion-title> <ion-title>我的问答</ion-title>
</ion-navbar> </ion-navbar>
</ion-header> </ion-header>
<ion-content> <ion-content>
<div class="learn-item"> <div class="learn-item">
<div class="item-container"> <div class="item-container">
<div class="item-title"> <div class="item-title">
<p> <p>
<span *ngIf="item?.type == 1">(判断)</span> <span *ngIf="item?.type == 1">(判断)</span>
<span *ngIf="item?.type == 2">(单选)</span> <span *ngIf="item?.type == 2">(单选)</span>
<span *ngIf="item?.type == 3">(多选)</span> <span *ngIf="item?.type == 3">(多选)</span>
{{item?.stem}} {{item?.stem}}
</p> </p>
</div> </div>
<div class="item-content"> <div class="item-content">
<div class="padding-20-20"> <div class="padding-20-20">
<!--判断题--> <!--判断题-->
<ng-container *ngIf="item?.type == 1"> <ng-container *ngIf="item?.type == 1">
<p> <p>
<label> <label>
<input [disabled]="true" [(ngModel)]="answer" [name]="item?.id" value="A" type="radio"> <input [disabled]="true" [(ngModel)]="answer" [name]="item?.id" value="A" type="radio">
<span class=" selectIndex">A</span>&nbsp;&nbsp; <span class=" selectIndex">A</span>&nbsp;&nbsp;
</label> </label>
</p> </p>
<p> <p>
<label> <label>
<input [disabled]="true" [(ngModel)]="answer" [name]="item?.id" value="B" type="radio"> <input [disabled]="true" [(ngModel)]="answer" [name]="item?.id" value="B" type="radio">
<span class=" selectIndex">B</span>&nbsp;&nbsp; <span class=" selectIndex">B</span>&nbsp;&nbsp;
</label> </label>
</p> </p>
</ng-container> </ng-container>
<!--单选题--> <!--单选题-->
<ng-container *ngIf="item?.type == 2"> <ng-container *ngIf="item?.type == 2">
<ng-container *ngFor=" let option1 of item?.options;"> <ng-container *ngFor=" let option1 of item?.options;">
<p> <p>
<label> <label>
<input [disabled]="true" [(ngModel)]="answer" type="radio" [value]="option1.option" <input [disabled]="true" [(ngModel)]="answer" type="radio" [value]="option1.option"
[name]="item?.id"> [name]="item?.id">
<span class="selectIndex">{{option1.option}}</span>&nbsp;&nbsp; <span class="selectIndex">{{option1.option}}</span>&nbsp;&nbsp;
{{option1.comment}} {{option1.comment}}
</label> </label>
</p> </p>
</ng-container> </ng-container>
</ng-container> </ng-container>
<!--多选题--> <!--多选题-->
<ng-container *ngIf="item?.type == 3"> <ng-container *ngIf="item?.type == 3">
<ng-container *ngFor=" let option2 of item.options;let i2 = index;"> <ng-container *ngFor=" let option2 of item.options;let i2 = index;">
<p> <p>
<label> <label>
<input type="checkbox" [disabled]="true" <input type="checkbox" [disabled]="true"
[value]="option2.option" [name]="item?.id"> [value]="option2.option" [name]="item?.id">
<span class="input-duox selectIndex">{{option2.option}}</span>&nbsp;&nbsp; <span class="input-duox selectIndex">{{option2.option}}</span>&nbsp;&nbsp;
{{option2.comment}} {{option2.comment}}
</label> </label>
</p> </p>
</ng-container> </ng-container>
</ng-container> </ng-container>
</div>
</div>
</div> </div>
</div>
</div> </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 item?.answers" class="comment-item">
<div *ngFor="let answer of answerList" class="comment-item"> <ion-row>
<ion-row> <ion-col col-1></ion-col>
<ion-col col-12> <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
</p> style="color: #003388" class="margin-left-10" (click)="accept(answer.id)">采纳</span>
</ion-col> </p>
</ion-row> <span *ngIf="answer.isAccept == 1" class="accept">已采纳</span>
</ion-col>
</ion-row>
</div>
</div> </div>
</div>
</ion-content> </ion-content>
...@@ -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])
...@@ -306,7 +310,7 @@ export class DiscoverPage { ...@@ -306,7 +310,7 @@ export class DiscoverPage {
that.swiper.update(); that.swiper.update();
that.changeParent(that.tabsList[this.activeIndex]); that.changeParent(that.tabsList[this.activeIndex]);
const distancs = this.activeIndex * that.itemWidth / 2; //滑动的长度 const distancs = this.activeIndex * that.itemWidth / 2; //滑动的长度
that.newContentParent.nativeElement.scrollLeft = distancs; that.newContentParent.nativeElement.scrollLeft = distancs;
// let scrollInter = window.setInterval(() => { // let scrollInter = window.setInterval(() => {
// if (distancs == that.newContentParent.nativeElement.scrollLeft) { // if (distancs == that.newContentParent.nativeElement.scrollLeft) {
// window.clearInterval(scrollInter); // window.clearInterval(scrollInter);
...@@ -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