|
@@ -1,4 +1,7 @@
|
|
|
-import { Component, OnInit } from '@angular/core';
|
|
|
+import {Component, OnInit} from '@angular/core';
|
|
|
+import {ActivatedRoute, Router} from "@angular/router";
|
|
|
+import {ConfigService, RequsetData} from "../../../service/config.service";
|
|
|
+import {AlertController, MenuController, ModalController} from "@ionic/angular";
|
|
|
|
|
|
@Component({
|
|
|
selector: 'app-examtest',
|
|
@@ -7,8 +10,134 @@ import { Component, OnInit } from '@angular/core';
|
|
|
})
|
|
|
export class ExamtestComponent implements OnInit {
|
|
|
|
|
|
- constructor() { }
|
|
|
+ getDataUrl = '/api/exammanage/questiontypeSetting/getList';
|
|
|
+ getLibaryUrl = '/api/exampaper/getLibaryTree';
|
|
|
+ questionTypeList: any = [];
|
|
|
+ fileTypeData: any = {
|
|
|
+ title: '所有题库',
|
|
|
+ pSelectedName: '所有题库',
|
|
|
+ rootKids: [],
|
|
|
+ selectedNode: null,
|
|
|
+ selectedParent: null,
|
|
|
+ fileTypeName: ''
|
|
|
+ };
|
|
|
+ libaryTree = [];
|
|
|
+ typeList: any[] = [];
|
|
|
+ selectLibaryList = [];
|
|
|
+ bakLibaryList=[];
|
|
|
|
|
|
- ngOnInit() {}
|
|
|
+ constructor(private menu: MenuController, private router: Router, private configService: ConfigService, private routeInfo: ActivatedRoute) {
|
|
|
+ }
|
|
|
|
|
|
+ ngOnInit() {
|
|
|
+ this.routeInfo.queryParams.subscribe(params => {
|
|
|
+ this.getQuestionTypeList();
|
|
|
+ this.getLibaryTree();
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ getQuestionTypeList() {
|
|
|
+ this.configService.HttpGetRomote(this.getDataUrl, {}).subscribe((data: RequsetData) => {
|
|
|
+ if (data.success) {
|
|
|
+ this.questionTypeList = data.item;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ getLibaryTree() {
|
|
|
+ this.configService.HttpGetRomote(this.getLibaryUrl, {}).subscribe((data: RequsetData) => {
|
|
|
+ if (data.success) {
|
|
|
+ this.libaryTree = data.item;
|
|
|
+ this.typeList = data.item;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ selectFileType() {
|
|
|
+ this.menu.enable(true, 'typeRoot').then(a => {
|
|
|
+ });
|
|
|
+ this.menu.open('typeRoot').then(a => {
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ BackMenu() {
|
|
|
+ if (this.fileTypeData.selectedNode.parentList != null) {
|
|
|
+ this.typeList = this.fileTypeData.selectedNode.parentList;
|
|
|
+ this.fileTypeData.selectedNode = this.fileTypeData.selectedNode.parentNode;
|
|
|
+ }
|
|
|
+ if (this.fileTypeData.selectedNode == null) {
|
|
|
+ this.fileTypeData.pSelectedName = '所有题库';
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ selectedTitle() {
|
|
|
+ let result = false;
|
|
|
+
|
|
|
+ if (this.fileTypeData.selectedNode == null) {
|
|
|
+ result = true;
|
|
|
+ } else {
|
|
|
+ if (this.fileTypeData.selectedParent != null) {
|
|
|
+ result = this.fileTypeData.selectedNode.filetypeid == this.fileTypeData.selectedParent.filetypeid;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+
|
|
|
+ SelectTitleFileType() {
|
|
|
+ this.fileTypeData.selectedNode = this.fileTypeData.selectedParent;
|
|
|
+ }
|
|
|
+
|
|
|
+ selectedItem(it: any) {
|
|
|
+ let result = false;
|
|
|
+ if (this.fileTypeData.selectedNode != null) {
|
|
|
+ result = this.fileTypeData.selectedNode.id == it.id;
|
|
|
+ }
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+
|
|
|
+ ShowKidsFileType(it: any) {
|
|
|
+ if (it.childList == 0) {
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ it.parentNode = this.fileTypeData.selectedNode;
|
|
|
+ this.fileTypeData.selectedNode = it;
|
|
|
+
|
|
|
+ this.fileTypeData.pSelectedName = it.name;
|
|
|
+ it.parentList = this.typeList;
|
|
|
+ this.typeList = it.childList;
|
|
|
+ }
|
|
|
+
|
|
|
+ chooseFileType() {
|
|
|
+ this.selectLibaryList = this.bakLibaryList;//Object.assign({}, this.bakLibaryList);
|
|
|
+ this.CloseMenu();
|
|
|
+ }
|
|
|
+
|
|
|
+ CloseMenu() {
|
|
|
+ this.menu.close('typeRoot').then(a => {
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ checkedChange(it, checked) {
|
|
|
+ it.checked = checked;
|
|
|
+ this.bakLibaryList = this.bakLibaryList.filter(x => x.id != it.id);
|
|
|
+ if (checked) {
|
|
|
+ this.bakLibaryList.push({id: it.id, name: it.name});
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ eachLibaryTree(treeList: any[]) {
|
|
|
+ treeList.forEach((item: any) => {
|
|
|
+ if (item.checked) {
|
|
|
+ this.selectLibaryList.push({id: item.id, name: item.name});
|
|
|
+ }
|
|
|
+ if (item.childList.length > 0) {
|
|
|
+ this.eachLibaryTree(item.childList);
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
+ entryTest() {
|
|
|
+
|
|
|
+ }
|
|
|
}
|