Commit e47f4bdd authored by wangqinghua's avatar wangqinghua

下载附件

parent 680b51fc
<?xml version='1.0' encoding='utf-8'?>
<widget id="io.ionic.smart19.starter.test" version="4.0.3" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<widget id="io.ionic.smart19.starter.test" version="4.0.4" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<name>党建云平台(测试)</name>
<description>An awesome Ionic/Cordova app.</description>
<author email="hi@ionicframework" href="http://ionicframework.com/">Ionic Framework Team</author>
......
......@@ -61,14 +61,14 @@
<ng-container *ngIf="item.questionType == 4">
<p>
<label>
<input [(ngModel)]="item.answer" [name]="item.questionQueId" value="A" type="radio">
<input [(ngModel)]="item.answer" [name]="item.questionId" value="1" type="radio">
<span class=" selectIndex">A</span>&nbsp;&nbsp;
</label>
</p>
<p>
<label>
<input [(ngModel)]="item.answer" [name]="item.questionQueId" value="B" type="radio">
<input [(ngModel)]="item.answer" [name]="item.questionId" value="0" type="radio">
<span class=" selectIndex">B</span>&nbsp;&nbsp;
</label>
......
......@@ -38,8 +38,9 @@ page-learning-do {
font-size: 1.6rem;
div{
p{
margin-bottom: .8rem;
margin-left: .8rem;
margin-bottom: 1rem;
margin-left: 1rem;
line-height: 1.5rem;
}
}
}
......
......@@ -31,9 +31,9 @@ export class LearningDoPage {
public toastCtrl: ToastController, public appService: AppService, public datePipe: DatePipe) {
}
ionViewDidLoad(){
this.navbar.backButtonClick= ()=>{
this.appService.alert("是否退出当前测试,中途退出直接交卷?"),()=>{
ionViewDidLoad() {
this.navbar.backButtonClick = () => {
this.appService.alert("是否退出当前测试,中途退出直接交卷?"), () => {
this.submit();
}
};
......@@ -101,7 +101,7 @@ export class LearningDoPage {
//下一题
next() {
if (this.index == this.list.length -1) {
if (this.index == this.list.length - 1) {
const toast = this.toastCtrl.create(message);
toast.setMessage('已经是最后一题了哦');
toast.present();
......@@ -112,7 +112,7 @@ export class LearningDoPage {
}
//左划右划
slideChanged(){
slideChanged() {
this.index = this.slides.getActiveIndex();
}
......@@ -154,9 +154,9 @@ export class LearningDoPage {
submit() {
const data = {
listMap: this.list.map(e => {
if (e.answer.length > 1) {
if (e.answer.length > 1 && e.questionType == 2) {
e.answer = e.answer.substr(0, e.answer.length - 1);
e.answer = e.answer.split(";").sort();
e.answer = e.answer.split(";").sort().join(";");
}
const d = {
questionId: e.questionId,
......@@ -171,12 +171,12 @@ export class LearningDoPage {
this.learnSer.submitPaper(data).subscribe(
(res) => {
this.commonSer.toast("提交成功");
if(this.type == 'reset') {
if (this.type == 'reset') {
this.navCtrl.push("ReviewResultPage", {
result: res.data,
title: this.title
})
}else{
} else {
this.navCtrl.push("LearningResultPage", {
testId: this.testId,
title: this.title
......
......@@ -67,20 +67,16 @@
</ng-container>
<!--判断题-->
<ng-container *ngIf="item.questionType == 4">
<p>
<label>
<input disabled [(ngModel)]="item.answer" [name]="item.questionQueId" value="A" type="radio">
<span class=" selectIndex">A</span>&nbsp;&nbsp;
</label>
</p>
<p>
<label>
<input disabled [(ngModel)]="item.answer" [name]="item.questionQueId" value="B" type="radio">
<span class=" selectIndex">B</span>&nbsp;&nbsp;
</label>
</p>
<ng-container *ngFor=" let option4 of item.options;let opindex4 = index;">
<p>
<label>
<input disabled [(ngModel)]="item.answer" [name]="item.questionId" value="A" type="radio">
<span class="selectIndex" [ngClass]="{'select-right' : option4.answer == 'right',
'select-error':option4.answer == 'error'}">{{option4.option}}</span>&nbsp;&nbsp;
{{option4.comment}}
</label>
</p>
</ng-container>
</ng-container>
<!--问答-->
<ng-container *ngIf="item.questionType == 5">
......
......@@ -32,7 +32,15 @@ export class ReviewLearnPage {
(res)=>{
this.list = res.data;
this.list.forEach(e=>{
if(e.questionType == 1 || e.questionType == 2){
if(e.questionType == 4){
e.options = [
{option:'A', comment:'是'},
{option:'B', comment:'否'},
];
e.myAnswer = e.myAnswer == '1'?'A':'B';
e.correctAnswer = e.correctAnswer == '1'?'A':'B';
}
if(e.questionType == 1 || e.questionType == 2 || e.questionType == 4){
e.options.forEach(s=>{
if(e.correctAnswer.includes(s.option)){
s.answer = 'right';
......@@ -44,6 +52,8 @@ export class ReviewLearnPage {
})
}
})
console.log(this.list)
}
)
}
......
......@@ -81,4 +81,19 @@ export class CommonService{
alert.present();
}
}
/**
* 下载文件
* @param url 文件URL
*/
downloadFile(title,data: Response) {
const blob = new Blob([data], {type:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;"});
const url= window.URL.createObjectURL(blob);
let link = document.createElement("a");
link.setAttribute("href", url);
link.setAttribute("download", title);
document.body.appendChild(link);
link.click();
document.body.removeChild(link);
}
}
\ No newline at end of file
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