Commit 8b643750 authored by wangqinghua's avatar wangqinghua

回答答案

parent 9299d0ad
......@@ -99,10 +99,11 @@ export class IssuePage {
this.tabSer.saveMineQuestion(data).subscribe(
(res) => {
if(res.errcode == '1000'){
let index = this.navCtrl.length() - 2;
this.navCtrl.remove(2, index)
}else{
let index = this.navCtrl.length() - 1;
this.navCtrl.remove(1, index);
this.commonSer.toast('提问成功');
}else{
this.commonSer.toast(res.errMsg);
}
}
)
......
<ion-header>
<ion-navbar>
<ion-title>你问我答</ion-title>
</ion-navbar>
</ion-header>
<ion-content>
<div class="learn-item">
<div class="item-container">
<div class="item-title">
<p>
<span *ngIf="item?.type == 1">(判断)</span>
<span *ngIf="item?.type == 2">(单选)</span>
<span *ngIf="item?.type == 3">(多选)</span>
{{item?.stem}}
</p>
</div>
<div class="item-content">
<div class="padding-20-20">
<!--判断题-->
<ng-container *ngIf="item?.type == 1">
<p>
<label>
<input [(ngModel)]="answer" [name]="item?.id" value="A" type="radio">
<span class=" selectIndex">A</span>&nbsp;&nbsp;
</label>
</p>
<p>
<label>
<input [(ngModel)]="answer" [name]="item?.id" value="B" type="radio">
<span class=" selectIndex">B</span>&nbsp;&nbsp;
</label>
</p>
</ng-container>
<!--单选题-->
<ng-container *ngIf="item?.type == 2">
<ng-container *ngFor=" let option1 of item?.options;">
<p>
<label>
<input [(ngModel)]="answer" type="radio" [value]="option1.option"
[name]="item?.id">
<span class="selectIndex">{{option1.option}}</span>&nbsp;&nbsp;
{{option1.comment}}
</label>
</p>
</ng-container>
</ng-container>
<!--多选题-->
<ng-container *ngIf="item?.type == 3">
<ng-container *ngFor=" let option2 of item.options;let i2 = index;">
<p>
<label>
<input type="checkbox" (change)="mutiSelect(i2,option2.option)"
[value]="option2.option" [name]="item?.id">
<span class="input-duox selectIndex">{{option2.option}}</span>&nbsp;&nbsp;
{{option2.comment}}
</label>
</p>
</ng-container>
</ng-container>
</div>
</div>
</div>
</div>
<button class="submit-btn submit" (click)="submit()">确认</button>
</ion-content>
import { NgModule } from '@angular/core';
import { IonicPageModule } from 'ionic-angular';
import { ResponsePage } from './response';
@NgModule({
declarations: [
ResponsePage,
],
imports: [
IonicPageModule.forChild(ResponsePage),
],
})
export class ResponsePageModule {}
page-response {
.main-container {
height: calc(100% - 8rem);
background-color: #e6e8ed ;
padding: 1.8rem;
}
.bgc{
position: absolute;
top: 0;
left: 0;
z-index: 0;
}
.learn-item {
width: 100%;
padding-bottom: 1rem;
}
ion-slides{
height: calc(100% - 4rem);
}
.swiper-slide, .slide-zoom {
text-align: left;
}
.swiper-slide {
justify-content: normal;
align-items: normal;
}
.learn-title {
background-color: rgba(18, 28, 52, 0.34);
font-size: 1.8rem;
color: #ffffff;
text-align: center;
padding: 1rem;
border-top-left-radius: .8rem;
border-top-right-radius: .8rem;
}
.item-container {
background-color: #fff;
border-bottom-left-radius: .8rem;
border-bottom-right-radius: .8rem;
overflow-y: scroll;
}
.item-title {
padding: 1rem;
font-size: 1.5rem;
}
.item-content {
padding: 1rem;
font-size: 1.6rem;
div {
p {
margin-bottom: 1rem;
margin-left: 1rem;
line-height: 1.5rem;
}
}
}
.footer-subject {
padding: 0 1rem;
position: absolute;
left: 0;
bottom: 4rem;
height: 5rem;
width: 100%;
background-color: #e6e8ed;
display: flex;
font-size: 1.8rem;
div {
line-height: 5rem;
}
.prev {
flex: 3;
}
.next {
flex: 3;
text-align: right;
}
.index {
flex: 3;
text-align: center;
}
}
.footer-submit {
position: absolute;
left: 0;
bottom: 0;
height: 4rem;
width: 100%;
border-top: .1rem solid #34b4fc;
display: flex;
div {
line-height: 4rem;
}
.time {
text-align: center;
flex: 4;
}
.submit {
background-color: #34b4fc;
color: #ffffff;
text-align: center;
flex: 1;
}
}
.item-ios p {
margin: 15px 0;
white-space: normal;
}
label {
position: relative;
display: inline-block;
height: 2rem;
line-height: 2rem;
input {
display: none;
}
}
.content-textarea {
padding: 10px;
min-height: 100px;
width: 100%;
border: 1px solid #ddd;
}
.selectIndex {
display: inline-block;
vertical-align: middle;
width: 2rem;
text-align: center;
height: 2rem;
line-height: 1.9rem;
border: 1px solid #ddd;
border-radius: 50%;
margin-right: 5px;
color: #666;
font-size: 1.5rem;
position: relative;
}
input:checked + .selectIndex {
background-color: #ec1826;
color: #ffffff;
border: 1px solid #ec1826;
}
.submit-error{
height: 3rem;
width: 40%;
background-color: #5579bb;
color: #fff;
line-height: 3rem;
}
.button-error{
line-height: 4rem;
height: 4rem;
text-align: center;
margin-top: .5rem;
}
.error-text{
position: absolute;
top: 0;
left: 0;
height: 100%;
width: 100%;
background-color: rgba(0,0,0,.2);
z-index: 9;
display: flex;
align-items: center;
justify-content: center;
.error-flex{
text-align: center;
width: 80%;
background-color: #fff;
.error-title{
background-color: #5579bb;
color: #ffffff;
padding: 1rem 0;
}
.error-footer{
height: 4rem;
.sure,.cancel{
color: #ffffff;
background-color: #5579bb;
width: 69%;
margin-right: 10px;
height: 3rem;
}
}
}
}
}
import { Component } from '@angular/core';
import { IonicPage, NavController, NavParams } from 'ionic-angular';
import {TabsService} from "../../tabs/tabs.service";
@IonicPage()
@Component({
selector: 'page-response',
templateUrl: 'response.html',
})
export class ResponsePage {
item;
answer;
constructor(public navCtrl: NavController, public navParams: NavParams,
private tabSer:TabsService) {
}
ionViewDidLoad() {
this.item = this.navParams.get('item');
}
//多选
mutiSelect(i, option) {
if (this.answer.includes(option)) {
this.answer = this.answer.replace(option, '');
} else {
this.answer += option + ";";
}
}
//提交答案
submit(){
const data = {
questionId:this.item.id,
answer:this.answer
};
this.tabSer.answerMineQuestion(data).subscribe(
(res)=>{
}
)
}
}
......@@ -63,7 +63,7 @@
</ion-refresher>
<div class="search-content">
<ng-container *ngFor="let item of new">
<div class="search-item" (click)="goToDetail(item)">
<div *ngIf="indexChildren != '45'" class="search-item" (click)="goToDetail(item)">
<p class="item-info">
<span class="item-source">{{item.source}}</span>
<span>{{item.publishTime | date:'yyyy-MM-dd'}}</span>
......@@ -112,6 +112,24 @@
</ion-row>
</div>
</div>
<div *ngIf="indexChildren =='45' " class="search-item" (click)="goToResponse(item)">
<p style="margin: 0;" class="item-info">
<span>{{item.dateTime | date:'yyyy-MM-dd'}}</span>
</p>
<div class="item-news">
<ion-row class="news-item">
<ion-col col-8 class="news-left">
<p style="margin: 0;" class="news-title">
<span *ngIf="item.type == 1">(判断)</span>
<span *ngIf="item.type == 2">(单选)</span>
<span *ngIf="item.type == 3">(多选)</span>{{item.stem}}
</p>
</ion-col>
<ion-col col-4 class="news-right">
</ion-col>
</ion-row>
</div>
</div>
</ng-container>
</div>
<ion-infinite-scroll (ionInfinite)="doInfinite($event)" *ngIf="indexParent == i ">
......
......@@ -215,7 +215,6 @@ export class DiscoverPage {
//父级选择
changeParent(item) {
this.newsContent.nativeElement.scrollLeft = 0; //二级菜单滑动重置
// this.infiniteScrollContent.inf.enable(true);
this.loadMore = true;
const index = item.indexParent;
......@@ -256,7 +255,6 @@ export class DiscoverPage {
//子级选择
changeChildren(item) {
this.indexChildren = item.indexChildren;
// this.infiniteScrollContent.inf.enable(true);
if (this.indexChildren == 45) {
this.getQuestion();
return false;
......@@ -279,7 +277,7 @@ export class DiscoverPage {
if (e.attachments.length > 0) {
e.imgUrl = e.attachments[0].path;
}
})
});
this.slideList[this.indexParent] = this.newList;
}
)
......@@ -348,7 +346,6 @@ export class DiscoverPage {
'resourceType': 1
}
};
// this.renderer.setStyle(this.infiniteScrollContentEle.nativeElement.children[0], 'minHeight', '60px');
this.tabsSer.stuffPage(data).subscribe(
(res) => {
let arr = res.data.list;
......@@ -362,7 +359,6 @@ export class DiscoverPage {
}
setTimeout(() => {
infiniteScroll.complete();
// this.renderer.setStyle(this.infiniteScrollContentEle.nativeElement.children[0], 'minHeight', '0px');
}, 1000)
}
)
......@@ -387,6 +383,11 @@ export class DiscoverPage {
this.isPublish = false;
}
//回答题目
goToResponse(item){
this.navCtrl.push('ResponsePage',{item:item})
}
//消息提醒页面
goToNotice() {
this.navCtrl.push(NoticePage);
......
......@@ -100,8 +100,8 @@
<div id="swiper-article" class="swiper-container">
<div class="swiper-wrapper">
<ng-container *ngIf="slidersItems.length > 0">
<div [style.top]="isScroll == true?'50px':''" class="swiper-slide"
*ngFor="let item of slideList;let i = index;">
<div [style.top]="isScroll == true?'50px':''" class="swiper-slide" *ngFor="let item of slideList;let i = index;">
<ion-content>
<div class="main-news">
<ng-container *ngFor="let new of item;">
<ng-container *ngIf="new.imgUrl">
......@@ -138,16 +138,16 @@
</ng-container>
<p class="noData" *ngIf="!loadMore">你已经看到我的底线了</p>
</div>
</div>
</ng-container>
</div>
</div>
<ion-infinite-scroll #infiniteScrollContentEle (ionInfinite)="doInfinite($event)">
<ion-infinite-scroll-content
loadingSpinner="bubbles"
loadingText="加载中"></ion-infinite-scroll-content>
</ion-infinite-scroll>
</ion-content>
</div>
</ng-container>
</div>
</div>
</ion-content>
<!--政治生日-->
......
......@@ -347,13 +347,13 @@ page-home {
}
#swiper-article.swiper-container {
height: fit-content;
height: 100%;
.swiper-wrapper {
height: fit-content;
height: 100%;
.swiper-slide {
height: fit-content;
height: 100%;
}
}
}
......
......@@ -196,7 +196,6 @@ export class HomePage {
// 自身div的一半 - 滑块的一半
this.tips.nativeElement.style.left = this.itemWidth * (this.index) + (this.itemWidth - this.spanWidth) / 2 + 'px';
this.tips1.nativeElement.style.left = this.itemWidth * (this.index) + (this.itemWidth - this.spanWidth) / 2 + 'px';
this.InfiniteScrollContent.inf.enable(true);
if (item.type == 0) {
this.isRecent = 1;
} else {
......@@ -236,10 +235,6 @@ export class HomePage {
this.initSlide = 1;
return false;
}
// let index = this.slides.toArray()[1].getActiveIndex();
// if (index == this.tabsList.length) index = 0;
// if (index == this.tabsList.length + 1) index = 1;
// this.change(this.tabsList[index])
}
......@@ -388,7 +383,6 @@ export class HomePage {
'resourceType': 1
}
};
// this.renderer.setStyle(this.infiniteScrollContentEle.nativeElement, 'height', '60px');
this.tabsSer.stuffPage(data).subscribe(
(res) => {
let arr = res.data.list;
......@@ -402,7 +396,6 @@ export class HomePage {
}
setTimeout(() => {
e.complete();
// this.renderer.setStyle(this.infiniteScrollContentEle.nativeElement, 'height', '0px');
}, 1000)
}
)
......
......@@ -168,4 +168,9 @@ export class TabsService {
saveMineQuestion(data): Observable<any> {
return this.http.post(AppGlobal.domain + '/wisdomgroup/modules/personquestion/save', data);
}
//我要出题列表
answerMineQuestion(data): Observable<any> {
return this.http.post(AppGlobal.domain + '/wisdomgroup/modules/personanswer/answer', 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