Commit 2e84221a801fec86638f1427c4d182a003c6456b

Authored by ykxie
1 parent 2d5945e6

fixbug

Showing 1 changed file with 22 additions and 14 deletions
src/js/gb.js
... ... @@ -1229,10 +1229,8 @@ $(function() {
1229 1229  
1230 1230 // 单个文件路径及内容 数组
1231 1231 var programmingFileList = ZTREE.getTreeData();
1232   - for (var i = 0; i < GBCodePlayBack.records.length; i++) {
1233   - GBCodePlayBack.records[i].changeobj = JSON.stringify(GBCodePlayBack.records[i].changeobj);
1234   - GBCodePlayBack.records[i].treefile = JSON.stringify(GBCodePlayBack.records[i].treefile) || '';
1235   - }
  1232 +
  1233 +
1236 1234 var keepTimer = $('.recording-time').val()
1237 1235 var postData = {
1238 1236 "mainPath": mainPath,
... ... @@ -1250,19 +1248,29 @@ $(function() {
1250 1248 "audioUrl": $('.audio-url').val(),
1251 1249 "programmingSource": 1,
1252 1250 "programmingFileList": programmingFileList,
1253   - "codeRecordList": GBCodePlayBack.records,
1254 1251 "totaltime": keepTimer
1255 1252 }
1256   -
1257   - console.log('============');
1258   - console.log(postData);
1259   -
  1253 + var temp_record = JSON.parse(JSON.stringify(GBCodePlayBack.records))
  1254 + var codeRecordLists = [];
  1255 + for (var i = 0; i < temp_record.length; i++) {
  1256 + var temp_record_item = temp_record[i];
  1257 + if(temp_record_item){
  1258 + temp_record_item.changeobj=JSON.stringify(temp_record_item.changeobj);
  1259 + if(temp_record_item.treefile){
  1260 + temp_record_item.treefile=JSON.stringify(temp_record_item.treefile);
  1261 + }
  1262 + }
  1263 + codeRecordLists.push(temp_record_item);
  1264 + }
1260 1265 if (_role == 0) {
  1266 + postData.codeRecordList = codeRecordLists;
1261 1267 var roleUrl = gxb_api + "/programming/codeReplay/api"
1262 1268 }else if (_role == 1) {
  1269 + postData.codeRecordList = codeRecordLists;
1263 1270 var roleUrl = gxb_api + "/programming/student/studentReplay/api"
1264 1271 }
1265   -
  1272 + console.log('============');
  1273 + console.log(postData);
1266 1274 $.ajax({
1267 1275 type: "post",
1268 1276 url: roleUrl,
... ... @@ -1897,14 +1905,14 @@ $(function() {
1897 1905 if (_thisNum == 0) {
1898 1906 for (var i = 0; i < treeLinkEditor.length; i++) {
1899 1907 if (treeLinkEditor[i].CodeMirrorRecord.getValue() != undefined) {
1900   - ZTREE.showEdite({'treeNode': treeLinkEditor[i].file, 'replay': true});
  1908 + ZTREE.showEdite({'treeNode': treeLinkEditor[i].file});
1901 1909 treeLinkEditor[i].CodeMirrorRecord.setValue("");
1902 1910 }
1903 1911 }
1904 1912 } else if (_thisNum == 1) {
1905 1913 for (var i = 0; i < treeLinkEditor.length; i++) {
1906 1914 if (treeLinkEditor[i].CodeMirrorReplay.getValue() != undefined) {
1907   - ZTREE.showEdite({'treeNode': treeLinkEditor[i].file, 'replay': true});
  1915 + ZTREE.showEdite({'treeNode': treeLinkEditor[i].file});
1908 1916 treeLinkEditor[i].CodeMirrorReplay.setValue("");
1909 1917 }
1910 1918 }
... ... @@ -1912,11 +1920,11 @@ $(function() {
1912 1920 for (var i = 0; i < treeLinkEditor.length; i++) {
1913 1921  
1914 1922 if (treeLinkEditor[i].CodeMirrorRecord.getValue() != undefined) {
1915   - ZTREE.showEdite({'treeNode': treeLinkEditor[i].file, 'replay': true});
  1923 + ZTREE.showEdite({'treeNode': treeLinkEditor[i].file});
1916 1924 treeLinkEditor[i].CodeMirrorRecord.setValue("");
1917 1925 }
1918 1926 if (treeLinkEditor[i].CodeMirrorReplay.getValue() != undefined) {
1919   - ZTREE.showEdite({'treeNode': treeLinkEditor[i].file, 'replay': true});
  1927 + ZTREE.showEdite({'treeNode': treeLinkEditor[i].file});
1920 1928 treeLinkEditor[i].CodeMirrorReplay.setValue("");
1921 1929 }
1922 1930 }
... ...