Commit df7ff131 authored by Tt's avatar Tt

修改通用异常

parent 407525e5
import {Component, EventEmitter, Input, OnDestroy, OnInit, Output, NgZone, OnChanges} from '@angular/core';
import {NzMessageService, NzNotificationService, UploadFile} from 'ng-zorro-antd';
import {HttpClient, HttpEvent, HttpEventType, HttpRequest} from '@angular/common/http';
import {environment} from '../../../environments/environment';
import { Component, EventEmitter, Input, OnDestroy, OnInit, Output, NgZone, OnChanges } from '@angular/core';
import { NzMessageService, NzNotificationService, UploadFile } from 'ng-zorro-antd';
import { HttpClient, HttpEvent, HttpEventType, HttpRequest } from '@angular/common/http';
import { environment } from '../../../environments/environment';
declare var Recorder;
......@@ -53,7 +53,14 @@ export class AudioRecorderComponent implements OnInit, OnChanges, OnDestroy {
audioBlob: any;
constructor( private nzMessageService: NzMessageService ) {
constructor(private nzMessageService: NzMessageService) {
this.uploadUrl = (<any>window).courseware.uploadUrl();
this.uploadData = (<any>window).courseware.uploadData();
window['air'].getUploadCallback = (url, data) => {
this.uploadUrl = url;
this.uploadData = data;
};
}
......@@ -196,9 +203,9 @@ export class AudioRecorderComponent implements OnInit, OnChanges, OnDestroy {
uploadSuccess = (url) => {
this.nzMessageService.info('Upload Success');
this.isUploading = false;
if(typeof url == "string"){
if (typeof url == "string") {
this.audioUrl = url
}else{
} else {
this.audioUrl = url.url
}
}
......
......@@ -120,7 +120,7 @@ export class PlayComponent implements OnInit, OnDestroy {
g_clickY; // 点击坐标 Y
g_ctx; // canvas 实例
g_data; // 数据
g_formData: FormData; // 表单转换之后的数据
g_formData: any; // 表单转换之后的数据
g_teacherFlag = false; // 默认角色
g_currentUser;
......@@ -2516,24 +2516,12 @@ export class PlayComponent implements OnInit, OnDestroy {
// this.g_currentUser = window['air'].airClassInfo.user;
if (data && typeof data == "object") {
this.g_data = data;
this.g_formData = data.contentObj;
this.g_formData = data;
} else {
this.g_data = {};
this.g_formData = {};
}
if (!this.g_data.contentObj) {
this.g_data.contentObj = {};
this.g_formData = {
score: 0,
title: '',
doubleModal: false,
questionText: '',
questionType: '',
questionTextAudio: '',
bgAudio: '',
questions: []
};
}
this.initDefaultData();
this.initAudio();
......@@ -2562,9 +2550,13 @@ export class PlayComponent implements OnInit, OnDestroy {
// 初始化默认数据
// ----------------------------------
initDefaultData() {
console.log("Init default form data")
if (Object.keys(this.g_formData).length === 0) {
this.g_formData = defaultFormData;
console.log("this.g_formData", this.g_formData)
} else {
this.g_formData = this.g_data;
console.log("this.g_formData", this.g_formData);
}
}
......
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