webpackJsonp([16],{ /***/ 1337: /***/ (function(module, exports, __webpack_require__) { module.exports = __webpack_require__(1531); /***/ }), /***/ 1437: /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "f", function() { return fetchOJList; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return fetchDeleteOJItem; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "g", function() { return fetchPostOjForm; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "e", function() { return fetchGetOjById; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return fetchDebuggerCode; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return fetchCodeSubmit; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "i", function() { return fetchStartProgram; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "p", function() { return fetchUserProgramDetail; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "m", function() { return fetchUserCommitRecord; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "n", function() { return fetchUserCommitRecordDetail; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "q", function() { return publishTask; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return cancelPublicTask; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "j", function() { return fetchUpdateCode; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "l", function() { return fetchUserCodeSubmit; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "h", function() { return fetchRestoreInitialCode; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "o", function() { return fetchUserInfoForNew; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "k", function() { return fetchUploadImage; }); /* unused harmony export fetchUploadImageUrl */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_regenerator__ = __webpack_require__(1337); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_regenerator___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_babel_runtime_regenerator__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_axios__ = __webpack_require__(12); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_axios___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_axios__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_prop_types__ = __webpack_require__(1); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_prop_types___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2_prop_types__); function _asyncToGenerator(fn){return function(){var gen=fn.apply(this,arguments);return new Promise(function(resolve,reject){function step(key,arg){try{var info=gen[key](arg);var value=info.value;}catch(error){reject(error);return;}if(info.done){resolve(value);}else{return Promise.resolve(value).then(function(value){step("next",value);},function(err){step("throw",err);});}}return step("next");});};}/* * @Description: 开发者社区接口 * @Author: tangjiang * @Github: * @Date: 2019-11-20 10:55:38 * @LastEditors: tangjiang * @LastEditTime: 2019-12-17 14:10:37 */var fetchOJList=function(){var _ref=_asyncToGenerator(/*#__PURE__*/__WEBPACK_IMPORTED_MODULE_0_babel_runtime_regenerator___default.a.mark(function _callee(params){var obj;return __WEBPACK_IMPORTED_MODULE_0_babel_runtime_regenerator___default.a.wrap(function _callee$(_context){while(1){switch(_context.prev=_context.next){case 0:console.log('传递的参数: ',params);obj={};Object.keys(params).forEach(function(key){if(params[key]){obj[key]=params[key];}});return _context.abrupt('return',__WEBPACK_IMPORTED_MODULE_1_axios___default.a.get('/problems.json',{params:obj}));case 4:case'end':return _context.stop();}}},_callee,this);}));return function fetchOJList(_x){return _ref.apply(this,arguments);};}();// 删除OJ列表 var fetchDeleteOJItem=function(){var _ref2=_asyncToGenerator(/*#__PURE__*/__WEBPACK_IMPORTED_MODULE_0_babel_runtime_regenerator___default.a.mark(function _callee2(identifier){var url;return __WEBPACK_IMPORTED_MODULE_0_babel_runtime_regenerator___default.a.wrap(function _callee2$(_context2){while(1){switch(_context2.prev=_context2.next){case 0:url='/problems/'+identifier+'.json';return _context2.abrupt('return',__WEBPACK_IMPORTED_MODULE_1_axios___default.a.delete(url));case 2:case'end':return _context2.stop();}}},_callee2,this);}));return function fetchDeleteOJItem(_x2){return _ref2.apply(this,arguments);};}();// 提交 var fetchPostOjForm=function(){var _ref3=_asyncToGenerator(/*#__PURE__*/__WEBPACK_IMPORTED_MODULE_0_babel_runtime_regenerator___default.a.mark(function _callee3(paramsObj){var params,submitType,identifier,url;return __WEBPACK_IMPORTED_MODULE_0_babel_runtime_regenerator___default.a.wrap(function _callee3$(_context3){while(1){switch(_context3.prev=_context3.next){case 0:params=paramsObj.params,submitType=paramsObj.submitType,identifier=paramsObj.identifier;url=submitType==='add'?'/problems.json':'/problems/'+identifier+'.json';// return axios.post(url, params); // if (identifier) { // return axios.post(url, params); // } else { // return // } return _context3.abrupt('return',identifier?__WEBPACK_IMPORTED_MODULE_1_axios___default.a.put(url,params):__WEBPACK_IMPORTED_MODULE_1_axios___default.a.post(url,params));case 3:case'end':return _context3.stop();}}},_callee3,this);}));return function fetchPostOjForm(_x3){return _ref3.apply(this,arguments);};}();// 根据id号获取OJ信息 var fetchGetOjById=function(){var _ref4=_asyncToGenerator(/*#__PURE__*/__WEBPACK_IMPORTED_MODULE_0_babel_runtime_regenerator___default.a.mark(function _callee4(id){var url;return __WEBPACK_IMPORTED_MODULE_0_babel_runtime_regenerator___default.a.wrap(function _callee4$(_context4){while(1){switch(_context4.prev=_context4.next){case 0:url='/problems/'+id+'/edit.json';return _context4.abrupt('return',__WEBPACK_IMPORTED_MODULE_1_axios___default.a.get(url));case 2:case'end':return _context4.stop();}}},_callee4,this);}));return function fetchGetOjById(_x4){return _ref4.apply(this,arguments);};}();// 调试代码 var fetchDebuggerCode=function(){var _ref5=_asyncToGenerator(/*#__PURE__*/__WEBPACK_IMPORTED_MODULE_0_babel_runtime_regenerator___default.a.mark(function _callee5(identifier,params){var url;return __WEBPACK_IMPORTED_MODULE_0_babel_runtime_regenerator___default.a.wrap(function _callee5$(_context5){while(1){switch(_context5.prev=_context5.next){case 0:url='/myproblems/'+identifier+'/code_debug.json';return _context5.abrupt('return',__WEBPACK_IMPORTED_MODULE_1_axios___default.a.get(url,{params:params}));case 2:case'end':return _context5.stop();}}},_callee5,this);}));return function fetchDebuggerCode(_x5,_x6){return _ref5.apply(this,arguments);};}();// 调试代码成功后,循环调用提交接口 var fetchCodeSubmit=function(){var _ref6=_asyncToGenerator(/*#__PURE__*/__WEBPACK_IMPORTED_MODULE_0_babel_runtime_regenerator___default.a.mark(function _callee6(identifier,params){var url;return __WEBPACK_IMPORTED_MODULE_0_babel_runtime_regenerator___default.a.wrap(function _callee6$(_context6){while(1){switch(_context6.prev=_context6.next){case 0:url='/myproblems/'+identifier+'/result.json';return _context6.abrupt('return',__WEBPACK_IMPORTED_MODULE_1_axios___default.a.get(url,{params:params}));case 2:case'end':return _context6.stop();}}},_callee6,this);}));return function fetchCodeSubmit(_x7,_x8){return _ref6.apply(this,arguments);};}();// 开启编程题接口 var fetchStartProgram=function(){var _ref7=_asyncToGenerator(/*#__PURE__*/__WEBPACK_IMPORTED_MODULE_0_babel_runtime_regenerator___default.a.mark(function _callee7(identifier){var url;return __WEBPACK_IMPORTED_MODULE_0_babel_runtime_regenerator___default.a.wrap(function _callee7$(_context7){while(1){switch(_context7.prev=_context7.next){case 0:url='/problems/'+identifier+'/start.json';return _context7.abrupt('return',__WEBPACK_IMPORTED_MODULE_1_axios___default.a.get(url));case 2:case'end':return _context7.stop();}}},_callee7,this);}));return function fetchStartProgram(_x9){return _ref7.apply(this,arguments);};}();// 用户编程题详情 var fetchUserProgramDetail=function(){var _ref8=_asyncToGenerator(/*#__PURE__*/__WEBPACK_IMPORTED_MODULE_0_babel_runtime_regenerator___default.a.mark(function _callee8(identifier){var url;return __WEBPACK_IMPORTED_MODULE_0_babel_runtime_regenerator___default.a.wrap(function _callee8$(_context8){while(1){switch(_context8.prev=_context8.next){case 0:url='/myproblems/'+identifier+'.json';return _context8.abrupt('return',__WEBPACK_IMPORTED_MODULE_1_axios___default.a.get(url));case 2:case'end':return _context8.stop();}}},_callee8,this);}));return function fetchUserProgramDetail(_x10){return _ref8.apply(this,arguments);};}();// 获取提交记录 var fetchUserCommitRecord=function(){var _ref9=_asyncToGenerator(/*#__PURE__*/__WEBPACK_IMPORTED_MODULE_0_babel_runtime_regenerator___default.a.mark(function _callee9(identifier){var url;return __WEBPACK_IMPORTED_MODULE_0_babel_runtime_regenerator___default.a.wrap(function _callee9$(_context9){while(1){switch(_context9.prev=_context9.next){case 0:console.log('identifier=====',identifier);url='/myproblems/'+identifier+'/submit_records.json';return _context9.abrupt('return',__WEBPACK_IMPORTED_MODULE_1_axios___default.a.get(url));case 3:case'end':return _context9.stop();}}},_callee9,this);}));return function fetchUserCommitRecord(_x11){return _ref9.apply(this,arguments);};}();// 获取提交记录详情 var fetchUserCommitRecordDetail=function(){var _ref10=_asyncToGenerator(/*#__PURE__*/__WEBPACK_IMPORTED_MODULE_0_babel_runtime_regenerator___default.a.mark(function _callee10(identifier){var url,params;return __WEBPACK_IMPORTED_MODULE_0_babel_runtime_regenerator___default.a.wrap(function _callee10$(_context10){while(1){switch(_context10.prev=_context10.next){case 0:url='/myproblems/record_detail.json';params={id:identifier};return _context10.abrupt('return',__WEBPACK_IMPORTED_MODULE_1_axios___default.a.get(url,{params:params}));case 3:case'end':return _context10.stop();}}},_callee10,this);}));return function fetchUserCommitRecordDetail(_x12){return _ref10.apply(this,arguments);};}();// 恢复初始代码 // export async function restoreInitialCode (identifier) { // const url = `/myproblems/${identifier}/restore_initial_code.json`; // return axios.get(url); // } // 发布任务 var publishTask=function(){var _ref11=_asyncToGenerator(/*#__PURE__*/__WEBPACK_IMPORTED_MODULE_0_babel_runtime_regenerator___default.a.mark(function _callee11(identifier){var url;return __WEBPACK_IMPORTED_MODULE_0_babel_runtime_regenerator___default.a.wrap(function _callee11$(_context11){while(1){switch(_context11.prev=_context11.next){case 0:url='/problems/'+identifier+'/publish.json';return _context11.abrupt('return',__WEBPACK_IMPORTED_MODULE_1_axios___default.a.post(url));case 2:case'end':return _context11.stop();}}},_callee11,this);}));return function publishTask(_x13){return _ref11.apply(this,arguments);};}();// 撤销发布 var cancelPublicTask=function(){var _ref12=_asyncToGenerator(/*#__PURE__*/__WEBPACK_IMPORTED_MODULE_0_babel_runtime_regenerator___default.a.mark(function _callee12(identifier){var url;return __WEBPACK_IMPORTED_MODULE_0_babel_runtime_regenerator___default.a.wrap(function _callee12$(_context12){while(1){switch(_context12.prev=_context12.next){case 0:url='/problems/'+identifier+'/cancel_publish.json';return _context12.abrupt('return',__WEBPACK_IMPORTED_MODULE_1_axios___default.a.post(url));case 2:case'end':return _context12.stop();}}},_callee12,this);}));return function cancelPublicTask(_x14){return _ref12.apply(this,arguments);};}();// 更新用户编辑代码 var fetchUpdateCode=function(){var _ref13=_asyncToGenerator(/*#__PURE__*/__WEBPACK_IMPORTED_MODULE_0_babel_runtime_regenerator___default.a.mark(function _callee13(identifier,params){var url;return __WEBPACK_IMPORTED_MODULE_0_babel_runtime_regenerator___default.a.wrap(function _callee13$(_context13){while(1){switch(_context13.prev=_context13.next){case 0:url='/myproblems/'+identifier+'/update_code.json';return _context13.abrupt('return',__WEBPACK_IMPORTED_MODULE_1_axios___default.a.post(url,params));case 2:case'end':return _context13.stop();}}},_callee13,this);}));return function fetchUpdateCode(_x15,_x16){return _ref13.apply(this,arguments);};}();// 用户提交代码 var fetchUserCodeSubmit=function(){var _ref14=_asyncToGenerator(/*#__PURE__*/__WEBPACK_IMPORTED_MODULE_0_babel_runtime_regenerator___default.a.mark(function _callee14(identifier){var url;return __WEBPACK_IMPORTED_MODULE_0_babel_runtime_regenerator___default.a.wrap(function _callee14$(_context14){while(1){switch(_context14.prev=_context14.next){case 0:url='/myproblems/'+identifier+'/code_submit.json';return _context14.abrupt('return',__WEBPACK_IMPORTED_MODULE_1_axios___default.a.get(url));case 2:case'end':return _context14.stop();}}},_callee14,this);}));return function fetchUserCodeSubmit(_x17){return _ref14.apply(this,arguments);};}();// 恢复初始代码 var fetchRestoreInitialCode=function(){var _ref15=_asyncToGenerator(/*#__PURE__*/__WEBPACK_IMPORTED_MODULE_0_babel_runtime_regenerator___default.a.mark(function _callee15(identifier){var url;return __WEBPACK_IMPORTED_MODULE_0_babel_runtime_regenerator___default.a.wrap(function _callee15$(_context15){while(1){switch(_context15.prev=_context15.next){case 0:// const url = `/myproblems/${identifier}/restore_initial_code.json`; url='/myproblems/'+identifier+'/sync_code.json';return _context15.abrupt('return',__WEBPACK_IMPORTED_MODULE_1_axios___default.a.post(url));case 2:case'end':return _context15.stop();}}},_callee15,this);}));return function fetchRestoreInitialCode(_x18){return _ref15.apply(this,arguments);};}();// 新建时调用获取用户信息接口 var fetchUserInfoForNew=function(){var _ref16=_asyncToGenerator(/*#__PURE__*/__WEBPACK_IMPORTED_MODULE_0_babel_runtime_regenerator___default.a.mark(function _callee16(){var url;return __WEBPACK_IMPORTED_MODULE_0_babel_runtime_regenerator___default.a.wrap(function _callee16$(_context16){while(1){switch(_context16.prev=_context16.next){case 0:url='/problems/new.json';return _context16.abrupt('return',__WEBPACK_IMPORTED_MODULE_1_axios___default.a.get(url));case 2:case'end':return _context16.stop();}}},_callee16,this);}));return function fetchUserInfoForNew(){return _ref16.apply(this,arguments);};}();// 文件上传 var fetchUploadImage=function(){var _ref17=_asyncToGenerator(/*#__PURE__*/__WEBPACK_IMPORTED_MODULE_0_babel_runtime_regenerator___default.a.mark(function _callee17(file){var url;return __WEBPACK_IMPORTED_MODULE_0_babel_runtime_regenerator___default.a.wrap(function _callee17$(_context17){while(1){switch(_context17.prev=_context17.next){case 0:url='/attachments.json';return _context17.abrupt('return',__WEBPACK_IMPORTED_MODULE_1_axios___default.a.post(url,file));case 2:case'end':return _context17.stop();}}},_callee17,this);}));return function fetchUploadImage(_x19){return _ref17.apply(this,arguments);};}();// 根据id号获取图片url var fetchUploadImageUrl=function(){var _ref18=_asyncToGenerator(/*#__PURE__*/__WEBPACK_IMPORTED_MODULE_0_babel_runtime_regenerator___default.a.mark(function _callee18(id){var url;return __WEBPACK_IMPORTED_MODULE_0_babel_runtime_regenerator___default.a.wrap(function _callee18$(_context18){while(1){switch(_context18.prev=_context18.next){case 0:url='/attachments/'+id;return _context18.abrupt('return',__WEBPACK_IMPORTED_MODULE_1_axios___default.a.get(url));case 2:case'end':return _context18.stop();}}},_callee18,this);}));return function fetchUploadImageUrl(_x20){return _ref18.apply(this,arguments);};}(); /***/ }), /***/ 1531: /***/ (function(module, exports, __webpack_require__) { /** * Copyright (c) 2014-present, Facebook, Inc. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ // This method of obtaining a reference to the global object needs to be // kept identical to the way it is obtained in runtime.js var g = (function() { return this })() || Function("return this")(); // Use `getOwnPropertyNames` because not all browsers support calling // `hasOwnProperty` on the global `self` object in a worker. See #183. var hadRuntime = g.regeneratorRuntime && Object.getOwnPropertyNames(g).indexOf("regeneratorRuntime") >= 0; // Save the old regeneratorRuntime in case it needs to be restored later. var oldRuntime = hadRuntime && g.regeneratorRuntime; // Force reevalutation of runtime.js. g.regeneratorRuntime = undefined; module.exports = __webpack_require__(1532); if (hadRuntime) { // Restore the original runtime. g.regeneratorRuntime = oldRuntime; } else { // Remove the global property added by runtime.js. try { delete g.regeneratorRuntime; } catch(e) { g.regeneratorRuntime = undefined; } } /***/ }), /***/ 1532: /***/ (function(module, exports) { /** * Copyright (c) 2014-present, Facebook, Inc. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ !(function(global) { "use strict"; var Op = Object.prototype; var hasOwn = Op.hasOwnProperty; var undefined; // More compressible than void 0. var $Symbol = typeof Symbol === "function" ? Symbol : {}; var iteratorSymbol = $Symbol.iterator || "@@iterator"; var asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator"; var toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; var inModule = typeof module === "object"; var runtime = global.regeneratorRuntime; if (runtime) { if (inModule) { // If regeneratorRuntime is defined globally and we're in a module, // make the exports object identical to regeneratorRuntime. module.exports = runtime; } // Don't bother evaluating the rest of this file if the runtime was // already defined globally. return; } // Define the runtime globally (as expected by generated code) as either // module.exports (if we're in a module) or a new, empty object. runtime = global.regeneratorRuntime = inModule ? module.exports : {}; function wrap(innerFn, outerFn, self, tryLocsList) { // If outerFn provided and outerFn.prototype is a Generator, then outerFn.prototype instanceof Generator. var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator; var generator = Object.create(protoGenerator.prototype); var context = new Context(tryLocsList || []); // The ._invoke method unifies the implementations of the .next, // .throw, and .return methods. generator._invoke = makeInvokeMethod(innerFn, self, context); return generator; } runtime.wrap = wrap; // Try/catch helper to minimize deoptimizations. Returns a completion // record like context.tryEntries[i].completion. This interface could // have been (and was previously) designed to take a closure to be // invoked without arguments, but in all the cases we care about we // already have an existing method we want to call, so there's no need // to create a new function object. We can even get away with assuming // the method takes exactly one argument, since that happens to be true // in every case, so we don't have to touch the arguments object. The // only additional allocation required is the completion record, which // has a stable shape and so hopefully should be cheap to allocate. function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } var GenStateSuspendedStart = "suspendedStart"; var GenStateSuspendedYield = "suspendedYield"; var GenStateExecuting = "executing"; var GenStateCompleted = "completed"; // Returning this object from the innerFn has the same effect as // breaking out of the dispatch switch statement. var ContinueSentinel = {}; // Dummy constructor functions that we use as the .constructor and // .constructor.prototype properties for functions that return Generator // objects. For full spec compliance, you may wish to configure your // minifier not to mangle the names of these two functions. function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} // This is a polyfill for %IteratorPrototype% for environments that // don't natively support it. var IteratorPrototype = {}; IteratorPrototype[iteratorSymbol] = function () { return this; }; var getProto = Object.getPrototypeOf; var NativeIteratorPrototype = getProto && getProto(getProto(values([]))); if (NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol)) { // This environment has a native %IteratorPrototype%; use it instead // of the polyfill. IteratorPrototype = NativeIteratorPrototype; } var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); GeneratorFunction.prototype = Gp.constructor = GeneratorFunctionPrototype; GeneratorFunctionPrototype.constructor = GeneratorFunction; GeneratorFunctionPrototype[toStringTagSymbol] = GeneratorFunction.displayName = "GeneratorFunction"; // Helper for defining the .next, .throw, and .return methods of the // Iterator interface in terms of a single ._invoke method. function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function(method) { prototype[method] = function(arg) { return this._invoke(method, arg); }; }); } runtime.isGeneratorFunction = function(genFun) { var ctor = typeof genFun === "function" && genFun.constructor; return ctor ? ctor === GeneratorFunction || // For the native GeneratorFunction constructor, the best we can // do is to check its .name property. (ctor.displayName || ctor.name) === "GeneratorFunction" : false; }; runtime.mark = function(genFun) { if (Object.setPrototypeOf) { Object.setPrototypeOf(genFun, GeneratorFunctionPrototype); } else { genFun.__proto__ = GeneratorFunctionPrototype; if (!(toStringTagSymbol in genFun)) { genFun[toStringTagSymbol] = "GeneratorFunction"; } } genFun.prototype = Object.create(Gp); return genFun; }; // Within the body of any async function, `await x` is transformed to // `yield regeneratorRuntime.awrap(x)`, so that the runtime can test // `hasOwn.call(value, "__await")` to determine if the yielded value is // meant to be awaited. runtime.awrap = function(arg) { return { __await: arg }; }; function AsyncIterator(generator) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if (record.type === "throw") { reject(record.arg); } else { var result = record.arg; var value = result.value; if (value && typeof value === "object" && hasOwn.call(value, "__await")) { return Promise.resolve(value.__await).then(function(value) { invoke("next", value, resolve, reject); }, function(err) { invoke("throw", err, resolve, reject); }); } return Promise.resolve(value).then(function(unwrapped) { // When a yielded Promise is resolved, its final value becomes // the .value of the Promise<{value,done}> result for the // current iteration. If the Promise is rejected, however, the // result for this iteration will be rejected with the same // reason. Note that rejections of yielded Promises are not // thrown back into the generator function, as is the case // when an awaited Promise is rejected. This difference in // behavior between yield and await is important, because it // allows the consumer to decide what to do with the yielded // rejection (swallow it and continue, manually .throw it back // into the generator, abandon iteration, whatever). With // await, by contrast, there is no opportunity to examine the // rejection reason outside the generator function, so the // only option is to throw it from the await expression, and // let the generator function handle the exception. result.value = unwrapped; resolve(result); }, reject); } } var previousPromise; function enqueue(method, arg) { function callInvokeWithMethodAndArg() { return new Promise(function(resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = // If enqueue has been called before, then we want to wait until // all previous Promises have been resolved before calling invoke, // so that results are always delivered in the correct order. If // enqueue has not been called before, then it is important to // call invoke immediately, without waiting on a callback to fire, // so that the async generator function has the opportunity to do // any necessary setup in a predictable way. This predictability // is why the Promise constructor synchronously invokes its // executor callback, and why async functions synchronously // execute code before the first await. Since we implement simple // async functions in terms of async generators, it is especially // important to get this right, even though it requires care. previousPromise ? previousPromise.then( callInvokeWithMethodAndArg, // Avoid propagating failures to Promises returned by later // invocations of the iterator. callInvokeWithMethodAndArg ) : callInvokeWithMethodAndArg(); } // Define the unified helper method that is used to implement .next, // .throw, and .return (see defineIteratorMethods). this._invoke = enqueue; } defineIteratorMethods(AsyncIterator.prototype); AsyncIterator.prototype[asyncIteratorSymbol] = function () { return this; }; runtime.AsyncIterator = AsyncIterator; // Note that simple async functions are implemented on top of // AsyncIterator objects; they just return a Promise for the value of // the final result produced by the iterator. runtime.async = function(innerFn, outerFn, self, tryLocsList) { var iter = new AsyncIterator( wrap(innerFn, outerFn, self, tryLocsList) ); return runtime.isGeneratorFunction(outerFn) ? iter // If outerFn is a generator, return the full iterator. : iter.next().then(function(result) { return result.done ? result.value : iter.next(); }); }; function makeInvokeMethod(innerFn, self, context) { var state = GenStateSuspendedStart; return function invoke(method, arg) { if (state === GenStateExecuting) { throw new Error("Generator is already running"); } if (state === GenStateCompleted) { if (method === "throw") { throw arg; } // Be forgiving, per 25.3.3.3.3 of the spec: // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorresume return doneResult(); } context.method = method; context.arg = arg; while (true) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if (context.method === "next") { // Setting context._sent for legacy support of Babel's // function.sent implementation. context.sent = context._sent = context.arg; } else if (context.method === "throw") { if (state === GenStateSuspendedStart) { state = GenStateCompleted; throw context.arg; } context.dispatchException(context.arg); } else if (context.method === "return") { context.abrupt("return", context.arg); } state = GenStateExecuting; var record = tryCatch(innerFn, self, context); if (record.type === "normal") { // If an exception is thrown from innerFn, we leave state === // GenStateExecuting and loop back for another invocation. state = context.done ? GenStateCompleted : GenStateSuspendedYield; if (record.arg === ContinueSentinel) { continue; } return { value: record.arg, done: context.done }; } else if (record.type === "throw") { state = GenStateCompleted; // Dispatch the exception by looping back around to the // context.dispatchException(context.arg) call above. context.method = "throw"; context.arg = record.arg; } } }; } // Call delegate.iterator[context.method](context.arg) and handle the // result, either by returning a { value, done } result from the // delegate iterator, or by modifying context.method and context.arg, // setting context.delegate to null, and returning the ContinueSentinel. function maybeInvokeDelegate(delegate, context) { var method = delegate.iterator[context.method]; if (method === undefined) { // A .throw or .return when the delegate iterator has no .throw // method always terminates the yield* loop. context.delegate = null; if (context.method === "throw") { if (delegate.iterator.return) { // If the delegate iterator has a return method, give it a // chance to clean up. context.method = "return"; context.arg = undefined; maybeInvokeDelegate(delegate, context); if (context.method === "throw") { // If maybeInvokeDelegate(context) changed context.method from // "return" to "throw", let that override the TypeError below. return ContinueSentinel; } } context.method = "throw"; context.arg = new TypeError( "The iterator does not provide a 'throw' method"); } return ContinueSentinel; } var record = tryCatch(method, delegate.iterator, context.arg); if (record.type === "throw") { context.method = "throw"; context.arg = record.arg; context.delegate = null; return ContinueSentinel; } var info = record.arg; if (! info) { context.method = "throw"; context.arg = new TypeError("iterator result is not an object"); context.delegate = null; return ContinueSentinel; } if (info.done) { // Assign the result of the finished delegate to the temporary // variable specified by delegate.resultName (see delegateYield). context[delegate.resultName] = info.value; // Resume execution at the desired location (see delegateYield). context.next = delegate.nextLoc; // If context.method was "throw" but the delegate handled the // exception, let the outer generator proceed normally. If // context.method was "next", forget context.arg since it has been // "consumed" by the delegate iterator. If context.method was // "return", allow the original .return call to continue in the // outer generator. if (context.method !== "return") { context.method = "next"; context.arg = undefined; } } else { // Re-yield the result returned by the delegate method. return info; } // The delegate iterator is finished, so forget it and continue with // the outer generator. context.delegate = null; return ContinueSentinel; } // Define Generator.prototype.{next,throw,return} in terms of the // unified ._invoke helper method. defineIteratorMethods(Gp); Gp[toStringTagSymbol] = "Generator"; // A Generator should always return itself as the iterator object when the // @@iterator function is called on it. Some browsers' implementations of the // iterator prototype chain incorrectly implement this, causing the Generator // object to not be returned from this call. This ensures that doesn't happen. // See https://github.com/facebook/regenerator/issues/274 for more details. Gp[iteratorSymbol] = function() { return this; }; Gp.toString = function() { return "[object Generator]"; }; function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; if (1 in locs) { entry.catchLoc = locs[1]; } if (2 in locs) { entry.finallyLoc = locs[2]; entry.afterLoc = locs[3]; } this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal"; delete record.arg; entry.completion = record; } function Context(tryLocsList) { // The root entry object (effectively a try statement without a catch // or a finally block) gives us a place to store values thrown from // locations where there is no enclosing try statement. this.tryEntries = [{ tryLoc: "root" }]; tryLocsList.forEach(pushTryEntry, this); this.reset(true); } runtime.keys = function(object) { var keys = []; for (var key in object) { keys.push(key); } keys.reverse(); // Rather than returning an object with a next method, we keep // things simple and return the next function itself. return function next() { while (keys.length) { var key = keys.pop(); if (key in object) { next.value = key; next.done = false; return next; } } // To avoid creating an additional object, we just hang the .value // and .done properties off the next function object itself. This // also ensures that the minifier will not anonymize the function. next.done = true; return next; }; }; function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) { return iteratorMethod.call(iterable); } if (typeof iterable.next === "function") { return iterable; } if (!isNaN(iterable.length)) { var i = -1, next = function next() { while (++i < iterable.length) { if (hasOwn.call(iterable, i)) { next.value = iterable[i]; next.done = false; return next; } } next.value = undefined; next.done = true; return next; }; return next.next = next; } } // Return an iterator with no values. return { next: doneResult }; } runtime.values = values; function doneResult() { return { value: undefined, done: true }; } Context.prototype = { constructor: Context, reset: function(skipTempReset) { this.prev = 0; this.next = 0; // Resetting context._sent for legacy support of Babel's // function.sent implementation. this.sent = this._sent = undefined; this.done = false; this.delegate = null; this.method = "next"; this.arg = undefined; this.tryEntries.forEach(resetTryEntry); if (!skipTempReset) { for (var name in this) { // Not sure about the optimal order of these conditions: if (name.charAt(0) === "t" && hasOwn.call(this, name) && !isNaN(+name.slice(1))) { this[name] = undefined; } } } }, stop: function() { this.done = true; var rootEntry = this.tryEntries[0]; var rootRecord = rootEntry.completion; if (rootRecord.type === "throw") { throw rootRecord.arg; } return this.rval; }, dispatchException: function(exception) { if (this.done) { throw exception; } var context = this; function handle(loc, caught) { record.type = "throw"; record.arg = exception; context.next = loc; if (caught) { // If the dispatched exception was caught by a catch block, // then let that catch block handle the exception normally. context.method = "next"; context.arg = undefined; } return !! caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; var record = entry.completion; if (entry.tryLoc === "root") { // Exception thrown outside of any try block that could handle // it, so set the completion value of the entire function to // throw the exception. return handle("end"); } if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"); var hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) { return handle(entry.catchLoc, true); } else if (this.prev < entry.finallyLoc) { return handle(entry.finallyLoc); } } else if (hasCatch) { if (this.prev < entry.catchLoc) { return handle(entry.catchLoc, true); } } else if (hasFinally) { if (this.prev < entry.finallyLoc) { return handle(entry.finallyLoc); } } else { throw new Error("try statement without catch or finally"); } } } }, abrupt: function(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } if (finallyEntry && (type === "break" || type === "continue") && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc) { // Ignore the finally entry if control is not jumping to a // location outside the try/catch block. finallyEntry = null; } var record = finallyEntry ? finallyEntry.completion : {}; record.type = type; record.arg = arg; if (finallyEntry) { this.method = "next"; this.next = finallyEntry.finallyLoc; return ContinueSentinel; } return this.complete(record); }, complete: function(record, afterLoc) { if (record.type === "throw") { throw record.arg; } if (record.type === "break" || record.type === "continue") { this.next = record.arg; } else if (record.type === "return") { this.rval = this.arg = record.arg; this.method = "return"; this.next = "end"; } else if (record.type === "normal" && afterLoc) { this.next = afterLoc; } return ContinueSentinel; }, finish: function(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) { this.complete(entry.completion, entry.afterLoc); resetTryEntry(entry); return ContinueSentinel; } } }, "catch": function(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if (record.type === "throw") { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } // The context.catch method must only be called with a location // argument that corresponds to a known catch block. throw new Error("illegal catch attempt"); }, delegateYield: function(iterable, resultName, nextLoc) { this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }; if (this.method === "next") { // Deliberately forget the last sent value so that we don't // accidentally pass it on to the delegate. this.arg = undefined; } return ContinueSentinel; } }; })( // In sloppy mode, unbound `this` refers to the global object, fallback to // Function constructor if we're in global strict mode. That is sadly a form // of indirect eval which violates Content Security Policy. (function() { return this })() || Function("return this")() ); /***/ }), /***/ 1643: /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* * @Description: * @Author: tangjiang * @Github: * @Date: 2019-11-20 23:10:48 * @LastEditors: tangjiang * @LastEditTime: 2019-12-06 15:53:27 */var CONST={jcLabel:{name:'任务名称',language:'编程语言',description:'描述',difficult:'难易度',category:'分类',openOrNot:'公开程序',timeLimit:'时间限制'},fontSetting:{title:'代码格式',type:'select',content:[{text:'显示风格',type:'style',value:[{key:'dark',text:'黑色背景',value:'dark'},{key:'light',text:'白色背景',value:'light'}]},{text:'字体大小',type:'font',value:[{key:1,text:'12px',value:12},{key:1,text:'14px',value:14},{key:1,text:'16px',value:16},{key:1,text:'18px',value:18},{key:1,text:'24px',value:24},{key:1,text:'30px',value:30}]}]},opacitySetting:{title:'代码格式',type:'label',content:[{text:'字体大小',value:'CTRL + S'},{text:'唤出快捷键列表',value:'F1/ALT + F1'},{text:'向左缩进',value:'CTRL + ['},{text:'向右缩进',value:'CTRL + ]'},{text:'跳到匹配的括号',value:'CTRL + SHIFT + \\'},{text:'转到行首',value:'HOME'},{text:'转到行尾',value:'END'}]},tagBackground:{1:'#52c41a',2:'#faad14',3:'#f5222d'},diffText:{1:'简单',2:'中等',3:'困难'},reviewResult:{'-1':'测试用例结果不匹配','0':'评测通过','1':'','2':'评测超时','3':'评测pod失败','4':'编译失败','5':'执行失败'}};/* harmony default export */ __webpack_exports__["a"] = (CONST); /***/ }), /***/ 1648: /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__testAction_js__ = __webpack_require__(2100); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__ojList__ = __webpack_require__(2101); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__ojForm__ = __webpack_require__(2102); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__ojForUser__ = __webpack_require__(2103); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__common__ = __webpack_require__(2104); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__user__ = __webpack_require__(2105); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__jupyter__ = __webpack_require__(2106); /* * @Description: 全局导出 action 类型 * @Author: tangjiang * @Date: 2019-11-13 20:12:23 * @Last Modified by: tangjiang * @Last Modified time: 2019-11-14 09:55:47 *//* harmony default export */ __webpack_exports__["a"] = ({toggleTodo:__WEBPACK_IMPORTED_MODULE_0__testAction_js__["a" /* default */],getOJList:__WEBPACK_IMPORTED_MODULE_1__ojList__["c" /* getOJList */],deleteItem:__WEBPACK_IMPORTED_MODULE_1__ojList__["b" /* deleteItem */],changePaginationInfo:__WEBPACK_IMPORTED_MODULE_1__ojList__["a" /* changePaginationInfo */],getOJFormById:__WEBPACK_IMPORTED_MODULE_2__ojForm__["d" /* getOJFormById */],saveOJFormId:__WEBPACK_IMPORTED_MODULE_2__ojForm__["f" /* saveOJFormId */],clearOJFormStore:__WEBPACK_IMPORTED_MODULE_2__ojForm__["b" /* clearOJFormStore */],validateOjForm:__WEBPACK_IMPORTED_MODULE_2__ojForm__["p" /* validateOjForm */],saveOjFormCode:__WEBPACK_IMPORTED_MODULE_2__ojForm__["g" /* saveOjFormCode */],validateOJName:__WEBPACK_IMPORTED_MODULE_2__ojForm__["l" /* validateOJName */],validateOjLanguage:__WEBPACK_IMPORTED_MODULE_2__ojForm__["q" /* validateOjLanguage */],validateOjDescription:__WEBPACK_IMPORTED_MODULE_2__ojForm__["n" /* validateOjDescription */],validateOjDifficult:__WEBPACK_IMPORTED_MODULE_2__ojForm__["o" /* validateOjDifficult */],validateOjTimeLimit:__WEBPACK_IMPORTED_MODULE_2__ojForm__["r" /* validateOjTimeLimit */],validateOjCategory:__WEBPACK_IMPORTED_MODULE_2__ojForm__["m" /* validateOjCategory */],validateOpenOrNot:__WEBPACK_IMPORTED_MODULE_2__ojForm__["s" /* validateOpenOrNot */],handleClickCancelPublish:__WEBPACK_IMPORTED_MODULE_2__ojForm__["e" /* handleClickCancelPublish */],addTestCase:__WEBPACK_IMPORTED_MODULE_2__ojForm__["a" /* addTestCase */],deleteTestCase:__WEBPACK_IMPORTED_MODULE_2__ojForm__["c" /* deleteTestCase */],testCaseInputChange:__WEBPACK_IMPORTED_MODULE_2__ojForm__["h" /* testCaseInputChange */],testCaseOutputChange:__WEBPACK_IMPORTED_MODULE_2__ojForm__["i" /* testCaseOutputChange */],debuggerCode:__WEBPACK_IMPORTED_MODULE_3__ojForUser__["b" /* debuggerCode */],startProgramQuestion:__WEBPACK_IMPORTED_MODULE_3__ojForUser__["k" /* startProgramQuestion */],changeShowOrHideControl:__WEBPACK_IMPORTED_MODULE_4__common__["c" /* changeShowOrHideControl */],changeLoadingState:__WEBPACK_IMPORTED_MODULE_4__common__["a" /* changeLoadingState */],getUserCommitRecord:__WEBPACK_IMPORTED_MODULE_3__ojForUser__["c" /* getUserCommitRecord */],getUserCommitRecordDetail:__WEBPACK_IMPORTED_MODULE_3__ojForUser__["d" /* getUserCommitRecordDetail */],updateCode:__WEBPACK_IMPORTED_MODULE_3__ojForUser__["m" /* updateCode */],saveUserInputCode:__WEBPACK_IMPORTED_MODULE_3__ojForUser__["i" /* saveUserInputCode */],changeUserCodeTab:__WEBPACK_IMPORTED_MODULE_3__ojForUser__["a" /* changeUserCodeTab */],changeSubmitLoadingStatus:__WEBPACK_IMPORTED_MODULE_4__common__["d" /* changeSubmitLoadingStatus */],submitUserCode:__WEBPACK_IMPORTED_MODULE_3__ojForUser__["l" /* submitUserCode */],changePublishLoadingStatus:__WEBPACK_IMPORTED_MODULE_4__common__["b" /* changePublishLoadingStatus */],isMyPublish:__WEBPACK_IMPORTED_MODULE_4__common__["e" /* isMyPublish */],getUserProgramDetail:__WEBPACK_IMPORTED_MODULE_3__ojForUser__["e" /* getUserProgramDetail */],updateTestAndValidate:__WEBPACK_IMPORTED_MODULE_2__ojForm__["k" /* updateTestAndValidate */],updateOpenTestCaseIndex:__WEBPACK_IMPORTED_MODULE_2__ojForm__["j" /* updateOpenTestCaseIndex */],saveUserProgramIdentifier:__WEBPACK_IMPORTED_MODULE_3__ojForUser__["j" /* saveUserProgramIdentifier */],restoreInitialCode:__WEBPACK_IMPORTED_MODULE_3__ojForUser__["f" /* restoreInitialCode */],getUserInfoForNew:__WEBPACK_IMPORTED_MODULE_5__user__["a" /* getUserInfoForNew */],saveUserCodeForInterval:__WEBPACK_IMPORTED_MODULE_3__ojForUser__["h" /* saveUserCodeForInterval */],saveEditorCodeForDetail:__WEBPACK_IMPORTED_MODULE_3__ojForUser__["g" /* saveEditorCodeForDetail */],// jupyter getJupyterTpiDataSet:__WEBPACK_IMPORTED_MODULE_6__jupyter__["d" /* getJupyterTpiDataSet */],getJupyterTpiUrl:__WEBPACK_IMPORTED_MODULE_6__jupyter__["e" /* getJupyterTpiUrl */],getJupyterInfo:__WEBPACK_IMPORTED_MODULE_6__jupyter__["c" /* getJupyterInfo */],syncJupyterCode:__WEBPACK_IMPORTED_MODULE_6__jupyter__["g" /* syncJupyterCode */],changeGetJupyterUrlState:__WEBPACK_IMPORTED_MODULE_6__jupyter__["b" /* changeGetJupyterUrlState */],saveJupyterTpi:__WEBPACK_IMPORTED_MODULE_6__jupyter__["f" /* saveJupyterTpi */],changeCurrentPage:__WEBPACK_IMPORTED_MODULE_6__jupyter__["a" /* changeCurrentPage */]// isUpdateCodeCtx }); /***/ }), /***/ 2100: /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (immutable) */ __webpack_exports__["a"] = toggleTodo; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__actionTypes__ = __webpack_require__(51); function toggleTodo(){return{type:__WEBPACK_IMPORTED_MODULE_0__actionTypes__["a" /* default */].ADD_TODO};} /***/ }), /***/ 2101: /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return getOJList; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return changePaginationInfo; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return deleteItem; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__actionTypes__ = __webpack_require__(51); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__services_ojService__ = __webpack_require__(1437); /* * @Description: 开发者社区action * @Author: tangjiang * @Github: * @Date: 2019-11-20 10:48:24 * @LastEditors: tangjiang * @LastEditTime: 2019-12-10 20:40:55 */var getOJList=function getOJList(params){return function(dispatch){Object(__WEBPACK_IMPORTED_MODULE_1__services_ojService__["f" /* fetchOJList */])(params).then(function(res){var data=res.data;dispatch({type:__WEBPACK_IMPORTED_MODULE_0__actionTypes__["a" /* default */].GET_OJ_LIST,payload:data});// 改变总页娄 dispatch({type:__WEBPACK_IMPORTED_MODULE_0__actionTypes__["a" /* default */].CHANGE_PAGINATION_INFO,payload:{total:data.hacks_count}});});};};// 改变分页数据 var changePaginationInfo=function changePaginationInfo(obj){return{type:__WEBPACK_IMPORTED_MODULE_0__actionTypes__["a" /* default */].CHANGE_PAGINATION_INFO,payload:obj};};// 删除 var deleteItem=function deleteItem(identifier){return function(dispatch,getState){var pagination=getState().ojListReducer.pagination;Object(__WEBPACK_IMPORTED_MODULE_1__services_ojService__["d" /* fetchDeleteOJItem */])(identifier).then(function(res){if(res.status===200){dispatch(getOJList(pagination));}});};}; /***/ }), /***/ 2102: /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "p", function() { return validateOjForm; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "e", function() { return handleClickCancelPublish; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "g", function() { return saveOjFormCode; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "l", function() { return validateOJName; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "q", function() { return validateOjLanguage; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "n", function() { return validateOjDescription; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "o", function() { return validateOjDifficult; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "r", function() { return validateOjTimeLimit; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "m", function() { return validateOjCategory; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "s", function() { return validateOpenOrNot; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return addTestCase; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return deleteTestCase; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return getOJFormById; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "f", function() { return saveOJFormId; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return clearOJFormStore; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "h", function() { return testCaseInputChange; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "i", function() { return testCaseOutputChange; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "k", function() { return updateTestAndValidate; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "j", function() { return updateOpenTestCaseIndex; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_antd_lib_notification_style_css__ = __webpack_require__(46); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_antd_lib_notification_style_css___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_antd_lib_notification_style_css__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_antd_lib_notification__ = __webpack_require__(47); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_antd_lib_notification___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_antd_lib_notification__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__actionTypes__ = __webpack_require__(51); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__constants__ = __webpack_require__(1643); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__services_ojService__ = __webpack_require__(1437); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_5_js_base64__ = __webpack_require__(188); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_5_js_base64___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_5_js_base64__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_6_educoder__ = __webpack_require__(5); function _defineProperty(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true});}else{obj[key]=value;}return obj;}/* * @Description: 开发者社区编辑模块 * @Author: tangjiang * @Github: * @Date: 2019-11-20 16:35:46 * @LastEditors: tangjiang * @LastEditTime: 2019-12-19 17:20:48 */var jcLabel=__WEBPACK_IMPORTED_MODULE_3__constants__["a" /* default */].jcLabel;// 表单字段映射 var maps={name:{label:jcLabel['name'],type:__WEBPACK_IMPORTED_MODULE_2__actionTypes__["a" /* default */].VALIDATE_OJ_NAME},language:{label:jcLabel['language'],type:__WEBPACK_IMPORTED_MODULE_2__actionTypes__["a" /* default */].VALIDATE_OJ_LANGUAGE},description:{label:jcLabel['description'],type:__WEBPACK_IMPORTED_MODULE_2__actionTypes__["a" /* default */].VALIDATE_OJ_DESCRIPTION},difficult:{label:jcLabel['difficult'],type:__WEBPACK_IMPORTED_MODULE_2__actionTypes__["a" /* default */].VALIDATE_OJ_DIFFICULT},timeLimit:{label:jcLabel['timeLimit'],type:__WEBPACK_IMPORTED_MODULE_2__actionTypes__["a" /* default */].VALIDATE_OJ_TIMELIMIT},category:{label:jcLabel['category'],type:__WEBPACK_IMPORTED_MODULE_2__actionTypes__["a" /* default */].VALIDATE_OJ_CATEGORY},openOrNot:{label:jcLabel['openOrNot'],type:__WEBPACK_IMPORTED_MODULE_2__actionTypes__["a" /* default */].VALIDATE_OJ_OPENORNOT},input:{label:'输入'},output:{label:'输出'}};// 非空校验 var emptyValidate=function emptyValidate(key,value){if([undefined,'',null].includes(value)){return _defineProperty({},key,{validateStatus:'error',errMsg:maps[key].label+'\u4E0D\u80FD\u4E3A\u7A7A'});}else{return _defineProperty({},key,{validateStatus:'',errMsg:''});}};// 组装字段值及校验信息 var payloadInfo=function payloadInfo(key,value,errMsg,validateInfo){return{ojForm:_defineProperty({},key,errMsg?'':value),ojFormValidate:_defineProperty({},key,validateInfo)};};// 接口调用成功后,跳转至列表页 function linkToDev(dispatch,props){Object(__WEBPACK_IMPORTED_MODULE_6_educoder__["_3" /* toStore */])('oj_description','');dispatch({type:__WEBPACK_IMPORTED_MODULE_2__actionTypes__["a" /* default */].IS_MY_SOURCE,payload:true});setTimeout(function(){props.history.push('/problems');},1000);}// 表单提交验证 var validateOjForm=function validateOjForm(props,type){return function(dispatch,getState){var _getState$ojFormReduc=getState().ojFormReducer,ojForm=_getState$ojFormReduc.ojForm,testCases=_getState$ojFormReduc.testCases,identifier=_getState$ojFormReduc.identifier,code=_getState$ojFormReduc.code;// console.log('code', code); /** 表单验证开始 */var keys=Object.keys(ojForm);// 循环判断每个字段是否为空 var hasSuccess=true;keys.forEach(function(key){var value=ojForm[key];var validateResult=emptyValidate(key,value);var errMsg=validateResult[key].errMsg;if(errMsg){hasSuccess=false;dispatch({type:maps[key].type,payload:payloadInfo(key,value,errMsg,validateResult[key])});}});// 验证测试用例中的数组是否都有对应的值 var tcValidResult=[];// 验证测试用例: 1.必须要有输出值 2. 输入值与输出值必须唯一 testCases.forEach(function(obj,i){var tempObj={};['input','output'].forEach(function(key){var value=obj[key];// 非空校验 var validateResult=emptyValidate(key,value);var errMsg=validateResult[key].errMsg;if(errMsg){hasSuccess=false;}else{// 唯一性校验 var bool=testCases.some(function(item,j){if(i!==j){return item[key]===value;}else{return false;}});if(bool){hasSuccess=false;validateResult=_defineProperty({},key,{validateStatus:'error',errMsg:key==='input'?'输入值必须是唯一的':'输出值必须是唯一的'});}}Object.assign(tempObj,validateResult);});tcValidResult.push(tempObj);});if(testCases.length===0){hasSuccess=false;__WEBPACK_IMPORTED_MODULE_1_antd_lib_notification___default.a['error']({message:'提示',description:'测试用例必须输入!'});}// if (!code) { // hasSuccess = false; // notification['error']({ // message: '必填', // description: '代码块内容必须输入!' // }); // } // 更改测试用例验证结果 dispatch({type:__WEBPACK_IMPORTED_MODULE_2__actionTypes__["a" /* default */].UPDATE_TEST_AND_VALIDATE,payload:{testCaseValidate:tcValidResult}});// 验证成功后,调用提交接口 if(!hasSuccess){dispatch({// 提交 type:__WEBPACK_IMPORTED_MODULE_2__actionTypes__["a" /* default */].SUBMIT_LOADING_STATUS,payload:false});dispatch({// 发布 type:__WEBPACK_IMPORTED_MODULE_2__actionTypes__["a" /* default */].PUBLISH_LOADING_STATUS,payload:false});}/** 表单验证结束 *//** 表单验证通过后,调用保存 or 更新 or 发布 */if(hasSuccess){// console.log('表单保存的数据为: ', getState()); var _getState=getState(),ojFormReducer=_getState.ojFormReducer;var _code=ojFormReducer.code,score=ojFormReducer.score,_ojForm2=ojFormReducer.ojForm,_ojFormReducer$testCa=ojFormReducer.testCases,_testCases=_ojFormReducer$testCa===undefined?[]:_ojFormReducer$testCa;var category=_ojForm2.category,description=_ojForm2.description,difficult=_ojForm2.difficult,language=_ojForm2.language,name=_ojForm2.name,openOrNot=_ojForm2.openOrNot,timeLimit=_ojForm2.timeLimit;var paramsObj={};var hack={// 编程题干 name:name,description:JSON.stringify(description),difficult:difficult,category:category,'open_or_not':openOrNot,'time_limit':timeLimit,score:score};var hack_codes={// 代码区域参数 code:__WEBPACK_IMPORTED_MODULE_5_js_base64__["Base64"].encode(_code),language:language};if(!identifier){// 新增 var tempTc=_testCases.map(function(tc){delete tc.isAdd;return tc;});paramsObj['params']={hack:hack,hack_sets:tempTc,hack_codes:hack_codes};paramsObj['submitType']='add';}else{// 存在时调用更新接口 var update_hack_sets=[];// 编辑的测试集 var hack_sets=[];// 新增的测试集 _testCases.forEach(function(tc){if(tc.isAdd){// 新增 delete tc.isAdd;hack_sets.push(tc);}else{delete tc.isAdd;update_hack_sets.push(tc);}});paramsObj['params']={hack:hack,hack_sets:hack_sets,hack_codes:hack_codes,update_hack_sets:update_hack_sets};paramsObj['submitType']='update';paramsObj['identifier']=identifier;}// 调用保存或更新 if(type==='publish'){// 提示发布信息 Object(__WEBPACK_IMPORTED_MODULE_4__services_ojService__["q" /* publishTask */])(identifier).then(function(res){if(res.data.status===0){// message.success('发布成功!'); __WEBPACK_IMPORTED_MODULE_1_antd_lib_notification___default.a.success({message:'提示',description:'发布成功!'});linkToDev(dispatch,props);}dispatch({type:__WEBPACK_IMPORTED_MODULE_2__actionTypes__["a" /* default */].PUBLISH_LOADING_STATUS,payload:false});}).catch(function(){dispatch({type:__WEBPACK_IMPORTED_MODULE_2__actionTypes__["a" /* default */].PUBLISH_LOADING_STATUS,payload:false});});}else{// 调用更新 Object(__WEBPACK_IMPORTED_MODULE_4__services_ojService__["g" /* fetchPostOjForm */])(paramsObj).then(function(res){if(res.status===200){// 保存成功后,重新跳转至列表页 if(res.data.status===0){// message.success(paramsObj['submitType'] === 'update' ? '更新成功' : '保存成功'); __WEBPACK_IMPORTED_MODULE_1_antd_lib_notification___default.a.success({message:'提示',description:paramsObj['submitType']==='update'?'更新成功':'保存成功'});linkToDev(dispatch,props);}dispatch({type:__WEBPACK_IMPORTED_MODULE_2__actionTypes__["a" /* default */].SUBMIT_LOADING_STATUS,payload:false});}}).catch(function(err){dispatch({type:__WEBPACK_IMPORTED_MODULE_2__actionTypes__["a" /* default */].SUBMIT_LOADING_STATUS,payload:false});});}}};};// 撤销发布 var handleClickCancelPublish=function handleClickCancelPublish(props,identifier){return function(dispatch){Object(__WEBPACK_IMPORTED_MODULE_4__services_ojService__["a" /* cancelPublicTask */])(identifier).then(function(res){dispatch({type:__WEBPACK_IMPORTED_MODULE_2__actionTypes__["a" /* default */].PUBLISH_LOADING_STATUS,payload:false});if(res.status=200){var data=res.data;if(data.status===0){// message.success('撤销发布成功!'); __WEBPACK_IMPORTED_MODULE_1_antd_lib_notification___default.a.success({message:'提示',description:'撤销发布成功!'});linkToDev(dispatch,props);}}}).catch(function(){dispatch({type:__WEBPACK_IMPORTED_MODULE_2__actionTypes__["a" /* default */].PUBLISH_LOADING_STATUS,payload:false});});};};// 保存提交的代码 var saveOjFormCode=function saveOjFormCode(value){return{type:__WEBPACK_IMPORTED_MODULE_2__actionTypes__["a" /* default */].SAVE_OJ_FORM_CODE,payload:value};};// 验证任务名称 var validateOJName=function validateOJName(value){var validate=emptyValidate('name',value)['name'];var errMsg=validate.errMsg;return{type:__WEBPACK_IMPORTED_MODULE_2__actionTypes__["a" /* default */].VALIDATE_OJ_NAME,payload:payloadInfo('name',value,errMsg,validate)};};// 验证编程语言 var validateOjLanguage=function validateOjLanguage(value){var validate=emptyValidate('language',value)['language'];var errMsg=validate.errMsg;return{type:__WEBPACK_IMPORTED_MODULE_2__actionTypes__["a" /* default */].VALIDATE_OJ_LANGUAGE,payload:payloadInfo('language',value,errMsg,validate)};};// 验证描述 var validateOjDescription=function validateOjDescription(value){// createAction('description', value, types.VALIDATE_OJ_DESCRIPTION); var validate=emptyValidate('description',value)['description'];var errMsg=validate.errMsg;return{type:__WEBPACK_IMPORTED_MODULE_2__actionTypes__["a" /* default */].VALIDATE_OJ_DESCRIPTION,payload:payloadInfo('description',value,errMsg,validate)};};// 验证难易度 var validateOjDifficult=function validateOjDifficult(value){// createAction('difficult', value, types.VALIDATE_OJ_DIFFICULT); var validate=emptyValidate('difficult',value)['difficult'];var errMsg=validate.errMsg;return{type:__WEBPACK_IMPORTED_MODULE_2__actionTypes__["a" /* default */].VALIDATE_OJ_DIFFICULT,payload:payloadInfo('difficult',value,errMsg,validate)};};// 验证时间限制 var validateOjTimeLimit=function validateOjTimeLimit(value){// createAction('timeLimit', value, types.VALIDATE_OJ_TIMELIMIT); var validate=emptyValidate('timeLimit',value)['timeLimit'];var errMsg=validate.errMsg;return{type:__WEBPACK_IMPORTED_MODULE_2__actionTypes__["a" /* default */].VALIDATE_OJ_TIMELIMIT,payload:payloadInfo('timeLimit',value,errMsg,validate)};};// 验证分类 var validateOjCategory=function validateOjCategory(value){// createAction('category', value, types.VALIDATE_OJ_CATEGORY); var validate=emptyValidate('category',value)['category'];var errMsg=validate.errMsg;return{type:__WEBPACK_IMPORTED_MODULE_2__actionTypes__["a" /* default */].VALIDATE_OJ_CATEGORY,payload:payloadInfo('category',value,errMsg,validate)};};// 验证公开程序 var validateOpenOrNot=function validateOpenOrNot(value){var validate=emptyValidate('openOrNot',value)['openOrNot'];var errMsg=validate.errMsg;return{type:__WEBPACK_IMPORTED_MODULE_2__actionTypes__["a" /* default */].VALIDATE_OJ_OPENORNOT,payload:payloadInfo('openOrNot',value,errMsg,validate)};};// 新增测试用例 var addTestCase=function addTestCase(obj){return{type:__WEBPACK_IMPORTED_MODULE_2__actionTypes__["a" /* default */].ADD_TEST_CASE,payload:obj};};// 删除测试用例 var deleteTestCase=function deleteTestCase(obj){return{type:__WEBPACK_IMPORTED_MODULE_2__actionTypes__["a" /* default */].DELETE_TEST_CASE,payload:obj};};// 根据id号编辑OJ var getOJFormById=function getOJFormById(id){return function(dispatch){Object(__WEBPACK_IMPORTED_MODULE_4__services_ojService__["e" /* fetchGetOjById */])(id).then(function(res){console.log('获取OJ表单信息成功: ',res);dispatch({type:__WEBPACK_IMPORTED_MODULE_2__actionTypes__["a" /* default */].SAVE_EDIT_OJ_FORM_AND_TEST_CASE,payload:res.data});// 保存用户信息 dispatch({type:__WEBPACK_IMPORTED_MODULE_2__actionTypes__["a" /* default */].SAVE_USER_INFO,payload:res.data.user});});};};// 保存表单 id 信息 var saveOJFormId=function saveOJFormId(id){return{type:__WEBPACK_IMPORTED_MODULE_2__actionTypes__["a" /* default */].SAVE_OJ_FORM_ID,payload:id};};// 清空值 var clearOJFormStore=function clearOJFormStore(){return{type:__WEBPACK_IMPORTED_MODULE_2__actionTypes__["a" /* default */].CLEAR_JSFORM_STORE};};// 测试用例输入值改变时 var testCaseInputChange=function testCaseInputChange(value,index){return function(dispatch,getState){// 非空校验 var validate=emptyValidate('input',value)['input'];if(!validate.errMsg){// 唯一性校验 var _errMsg='';var testCases=getState().ojFormReducer.testCases;var bool=testCases.some(function(item,i){if(i!==index){if(item['input']===value){_errMsg='\u4E0E\u6D4B\u8BD5\u7528\u4F8B'+index+'\u7684\u8F93\u5165\u503C\u91CD\u590D\u4E86\uFF0C\u8BF7\u91CD\u65B0\u586B\u5199';}return item['input']===value;}else{return false;}});if(bool){validate={validateStatus:'error',errMsg:_errMsg};}}dispatch({type:__WEBPACK_IMPORTED_MODULE_2__actionTypes__["a" /* default */].TEST_CASE_INPUT_CHANGE,payload:{input:validate,value:value,index:index}});};};// 测试用例输出值改变时 var testCaseOutputChange=function testCaseOutputChange(value,index){// const validate = emptyValidate('output', value)['output']; // return { // type: types.TEST_CASE_OUTPUT_CHANGE, // payload: { // output: validate, // value, // index // } // } return function(dispatch,getState){// 非空校验 var validate=emptyValidate('output',value)['output'];if(!validate.errMsg){// 唯一性校验 var testCases=getState().ojFormReducer.testCases;var _errMsg='';var bool=testCases.some(function(item,i){if(i!==index){if(item['output']===value){_errMsg='\u4E0E\u6D4B\u8BD5\u7528\u4F8B'+index+'\u7684\u8F93\u5165\u503C\u91CD\u590D\u4E86\uFF0C\u8BF7\u91CD\u65B0\u586B\u5199';}return item['output']===value;}else{return false;}});if(bool){validate={validateStatus:'error',errMsg:_errMsg};}}dispatch({type:__WEBPACK_IMPORTED_MODULE_2__actionTypes__["a" /* default */].TEST_CASE_OUTPUT_CHANGE,payload:{output:validate,value:value,index:index}});};};// // 调试代码时,更改对应的状态值 // export const changeTestCodeStatus = () => { // 更新测试用命及验证 var updateTestAndValidate=function updateTestAndValidate(obj){return function(dispatch){dispatch({type:__WEBPACK_IMPORTED_MODULE_2__actionTypes__["a" /* default */].UPDATE_TEST_AND_VALIDATE,payload:obj});};// return { // type: types.UPDATE_TEST_AND_VALIDATE, // payload: obj // } };// 更新测试用例索引 var updateOpenTestCaseIndex=function updateOpenTestCaseIndex(value){return{type:__WEBPACK_IMPORTED_MODULE_2__actionTypes__["a" /* default */].UPDATE_OPEN_TESTCASE_INDEX,payload:value};}; /***/ }), /***/ 2103: /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "k", function() { return startProgramQuestion; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "j", function() { return saveUserProgramIdentifier; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "e", function() { return getUserProgramDetail; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "h", function() { return saveUserCodeForInterval; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "m", function() { return updateCode; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return debuggerCode; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return getUserCommitRecord; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return getUserCommitRecordDetail; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "i", function() { return saveUserInputCode; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return changeUserCodeTab; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "l", function() { return submitUserCode; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "f", function() { return restoreInitialCode; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "g", function() { return saveEditorCodeForDetail; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_antd_lib_notification_style_css__ = __webpack_require__(46); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_antd_lib_notification_style_css___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_antd_lib_notification_style_css__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_antd_lib_notification__ = __webpack_require__(47); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_antd_lib_notification___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_antd_lib_notification__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__actionTypes__ = __webpack_require__(51); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_js_base64__ = __webpack_require__(188); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_js_base64___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_3_js_base64__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__services_ojService__ = __webpack_require__(1437); /* * @Description: * @Author: tangjiang * @Github: * @Date: 2019-11-27 13:42:11 * @LastEditors: tangjiang * @LastEditTime: 2019-12-19 15:11:56 */// 进入编程页面时,首先调用开启编程题接口 var startProgramQuestion=function startProgramQuestion(id,props){return function(dispatch){Object(__WEBPACK_IMPORTED_MODULE_4__services_ojService__["i" /* fetchStartProgram */])(id).then(function(res){var status=res.status,data=res.data;if(status===200){var identifier=data.identifier;dispatch({type:__WEBPACK_IMPORTED_MODULE_2__actionTypes__["a" /* default */].SAVE_USER_PROGRAM_ID,payload:identifier});// 保存id值 dispatch({type:__WEBPACK_IMPORTED_MODULE_2__actionTypes__["a" /* default */].SAVE_HACK_IDENTIFIER,payload:id});// 跳转至开启编程 if(identifier){// let data = Object.assign({}, props); // const path = { // pathname: `/myproblems/${identifier}`, // state: data // } // console.log(path); // props.history.push(`/myproblems/${identifier}`); props.history.push({pathname:"/myproblems/"+identifier});}}});};};// 保存 identifier, 防止刷新时读取不到 var saveUserProgramIdentifier=function saveUserProgramIdentifier(identifier){return{type:__WEBPACK_IMPORTED_MODULE_2__actionTypes__["a" /* default */].SAVE_USER_PROGRAM_ID,payload:identifier};};// 获取用户编程题详情 var getUserProgramDetail=function getUserProgramDetail(identifier,type){// 调用用户编程详情接口 return function(dispatch){Object(__WEBPACK_IMPORTED_MODULE_4__services_ojService__["p" /* fetchUserProgramDetail */])(identifier).then(function(res){var status=res.status,_res$data=res.data,data=_res$data===undefined?{}:_res$data;if(status===200){if(data.status===401)return;if(!type){dispatch({type:__WEBPACK_IMPORTED_MODULE_2__actionTypes__["a" /* default */].USER_PROGRAM_DETAIL,payload:data});}else{dispatch({type:__WEBPACK_IMPORTED_MODULE_2__actionTypes__["a" /* default */].GET_COMMIT_RECORD_DETAIL_BY_ID,payload:data});}// 保存默认测试用例 dispatch({type:__WEBPACK_IMPORTED_MODULE_2__actionTypes__["a" /* default */].SAVE_USE_TEST_CASE_VALUE,payload:data.test_case||{}});// 代码是否更新 var _modify_code=false;if(data.hack){_modify_code=data.hack.modify_code;}dispatch({type:__WEBPACK_IMPORTED_MODULE_2__actionTypes__["a" /* default */].SAVE_NOTICE_COUNT,payload:_modify_code});// 保存用户登录信息 dispatch({type:__WEBPACK_IMPORTED_MODULE_2__actionTypes__["a" /* default */].SAVE_USER_INFO,payload:data.user});}});};};var saveUserCodeForInterval=function saveUserCodeForInterval(identifier,code){return function(dispatch){dispatch({type:__WEBPACK_IMPORTED_MODULE_2__actionTypes__["a" /* default */].AUTO_UPDATE_CODE,payload:true});Object(__WEBPACK_IMPORTED_MODULE_4__services_ojService__["j" /* fetchUpdateCode */])(identifier,{code:__WEBPACK_IMPORTED_MODULE_3_js_base64__["Base64"].encode(code)}).then(function(res){if(res.data.status===401){return;};setTimeout(function(){dispatch({type:__WEBPACK_IMPORTED_MODULE_2__actionTypes__["a" /* default */].AUTO_UPDATE_CODE,payload:false});},1000);console.log('代码保存成功',res);}).catch(function(){dispatch({type:__WEBPACK_IMPORTED_MODULE_2__actionTypes__["a" /* default */].AUTO_UPDATE_CODE,payload:false});});};};/** * @description 保存或更新之前先更新代码 * @param {*} identifier * @param {*} inputValue 输入值: 自定义 | 系统返回的 * @param {*} type 测评类型 debug | submit */var updateCode=function updateCode(identifier,inputValue,type){return function(dispatch,getState){var _getState$ojForUserRe=getState().ojForUserReducer,userCode=_getState$ojForUserRe.userCode,isUpdateCode=_getState$ojForUserRe.isUpdateCode;if(isUpdateCode){Object(__WEBPACK_IMPORTED_MODULE_4__services_ojService__["j" /* fetchUpdateCode */])(identifier,{code:userCode}).then(function(res){// 是否更新了代码, 目的是当代码没有更新时不调用更新代码接口,目录没有实现 // TODO 需要优化 if(res.data.status===401){dispatch({// 改变 loading 值 type:__WEBPACK_IMPORTED_MODULE_2__actionTypes__["a" /* default */].LOADING_STATUS,payload:false});return;};dispatch({type:__WEBPACK_IMPORTED_MODULE_2__actionTypes__["a" /* default */].IS_UPDATE_CODE,flag:false});// debuggerCode(identifier, inputValue); dispatch(debuggerCode(identifier,inputValue,type));});}else{// 没有更新时,直接调用调试接口 dispatch(debuggerCode(identifier,inputValue,type));}};};/** * @description 调试代码 * @param {*} identifier * @param {*} inputValue 输入值: 自定义 | 系统返回的 * @param {*} type 测评类型 debug | submit */var debuggerCode=function debuggerCode(identifier,value,type){return function(dispatch,getState){// 调用之前 先保存 code // TODO // console.log(identifier, value); var _getState$ojForUserRe2=getState().ojForUserReducer.hack.time_limit,time_limit=_getState$ojForUserRe2===undefined?0:_getState$ojForUserRe2;if(!type||type==='debug'){dispatch({// 加载中... type:__WEBPACK_IMPORTED_MODULE_2__actionTypes__["a" /* default */].TEST_CODE_STATUS,payload:'loading'});}Object(__WEBPACK_IMPORTED_MODULE_4__services_ojService__["c" /* fetchDebuggerCode */])(identifier,value).then(function(res){// console.log('调用调试代码成功并返回结果: ', res); var status=res.status;if(status===200){var getCodeSubmit=function getCodeSubmit(intervalTime,finalTime,count,timer){var excuteTime=count++*intervalTime;// 当前执行时间 Object(__WEBPACK_IMPORTED_MODULE_4__services_ojService__["b" /* fetchCodeSubmit */])(identifier,{mode:type}).then(function(res){var status=res.data.status;// 评测返回结果 // 清除定时器条件: 评测通过或者评测时间大于指定时间 if(+status===0||excuteTime/1000>finalTime+1){clearInterval(timer);// 清除定时器 timer=null;var returnData=null;if(status===1){// 结果没有返回 returnData={error_line:-1,error_msg:'',execute_memory:'',execute_time:finalTime,input:'',output:'',status:2,expected_output:''};}else{// 成功返回结果 returnData=res.data.data;}// 返回评测结果 dispatch({type:__WEBPACK_IMPORTED_MODULE_2__actionTypes__["a" /* default */].COMMIT_RECORD_DETAIL,payload:returnData});if(!type||type==='debug'){dispatch({// 改变 loading 值 type:__WEBPACK_IMPORTED_MODULE_2__actionTypes__["a" /* default */].LOADING_STATUS,payload:false});// 保存执行状态 dispatch({type:__WEBPACK_IMPORTED_MODULE_2__actionTypes__["a" /* default */].TEST_CODE_STATUS,payload:'finish'});}else{// 回滚提交按钮状态 dispatch({type:__WEBPACK_IMPORTED_MODULE_2__actionTypes__["a" /* default */].SUBMIT_LOADING_STATUS,payload:false});// 改变tab值至提交记录(只在提交时才跳转,测评时,切换到代码执行结果就可以了) dispatch({type:__WEBPACK_IMPORTED_MODULE_2__actionTypes__["a" /* default */].CHANGE_USER_CODE_TAB,payload:'record'});// 重新调用一下提交记录接口 dispatch(getUserCommitRecord(identifier));}}}).catch(function(err){// 评测异常时 // 清除定时器 clearInterval(timer);timer=null;// 回滚按钮状态 if(!type||type==='debug'){dispatch({// 改变 loading 值 type:__WEBPACK_IMPORTED_MODULE_2__actionTypes__["a" /* default */].LOADING_STATUS,payload:false});}else{// 回滚提交按钮状态 dispatch({type:__WEBPACK_IMPORTED_MODULE_2__actionTypes__["a" /* default */].SUBMIT_LOADING_STATUS,payload:false});}});};// 开启定时器,调用监听接口 // 调试代码成功后,调用轮循接口, 注意: 代码执行的时间要小于设置的时间限制 var intervalTime=500;var count=1;/** * @param {*} excuteTime 执行时间 * @param {*} finalTime 总时间 * @param {*} count 执行次数 * @param {*} timer 定时器 */if(res.data.status===401){dispatch({// 改变 loading 值 type:__WEBPACK_IMPORTED_MODULE_2__actionTypes__["a" /* default */].LOADING_STATUS,payload:false});return;};var timer=setInterval(function(){getCodeSubmit(intervalTime,time_limit,count++,timer);},intervalTime);}}).catch(function(){dispatch({type:__WEBPACK_IMPORTED_MODULE_2__actionTypes__["a" /* default */].TEST_CODE_STATUS,payload:'error'});dispatch({type:__WEBPACK_IMPORTED_MODULE_2__actionTypes__["a" /* default */].LOADING_STATUS,payload:false});dispatch({type:__WEBPACK_IMPORTED_MODULE_2__actionTypes__["a" /* default */].SUBMIT_LOADING_STATUS,payload:false});});};};// 获取提交记录 var getUserCommitRecord=function getUserCommitRecord(identifier){return function(dispatch){Object(__WEBPACK_IMPORTED_MODULE_4__services_ojService__["m" /* fetchUserCommitRecord */])(identifier).then(function(res){var status=res.status,data=res.data;if(status===200){dispatch({type:__WEBPACK_IMPORTED_MODULE_2__actionTypes__["a" /* default */].COMMIT_RECORD,payload:data});}});};};// 获取提交记录详情 var getUserCommitRecordDetail=function getUserCommitRecordDetail(identifier){return function(dispatch){Object(__WEBPACK_IMPORTED_MODULE_4__services_ojService__["n" /* fetchUserCommitRecordDetail */])(identifier).then(function(res){console.log('提交记录详情======》》》》',res);var data=res.data;if(data.status===401)return;dispatch({type:__WEBPACK_IMPORTED_MODULE_2__actionTypes__["a" /* default */].GET_COMMIT_RECORD_DETAIL_BY_ID,payload:data});});};};// 保存用户时时输入的代码 var saveUserInputCode=function saveUserInputCode(code){return{type:__WEBPACK_IMPORTED_MODULE_2__actionTypes__["a" /* default */].SAVE_USER_CODE,payload:code};};// 监听是否更新代码块内容 // export const isUpdateCodeCtx = (flag) => { // return { // type: types.IS_UPDATE_CODE, // payload: flag // }; // } // 改变学员测评 tab 值 var changeUserCodeTab=function changeUserCodeTab(key){return{type:__WEBPACK_IMPORTED_MODULE_2__actionTypes__["a" /* default */].CHANGE_USER_CODE_TAB,payload:key};};/** * @description 用户提交代码, 先调用保存代码接口,再调提交接口,成功后调用调试接口 * @param {*} identifier */var submitUserCode=function submitUserCode(identifier,inputValue,type){return function(dispatch,getState){var _getState$ojForUserRe3=getState().ojForUserReducer,userCode=_getState$ojForUserRe3.userCode,isUpdateCode=_getState$ojForUserRe3.isUpdateCode;function userCodeSubmit(){Object(__WEBPACK_IMPORTED_MODULE_4__services_ojService__["l" /* fetchUserCodeSubmit */])(identifier).then(function(res){// console.log('用户提交代码成功======》》》》》', res); if(res.status===200){if(res.data.status===401){dispatch({type:__WEBPACK_IMPORTED_MODULE_2__actionTypes__["a" /* default */].SUBMIT_LOADING_STATUS,payload:false});return;};// 将编辑代码清空 dispatch({type:__WEBPACK_IMPORTED_MODULE_2__actionTypes__["a" /* default */].SAVE_EDITOR_CODE,payload:''});dispatch(debuggerCode(identifier,inputValue,type||'submit'));}}).catch(function(){dispatch({type:__WEBPACK_IMPORTED_MODULE_2__actionTypes__["a" /* default */].SUBMIT_LOADING_STATUS,payload:false});});}if(isUpdateCode){Object(__WEBPACK_IMPORTED_MODULE_4__services_ojService__["j" /* fetchUpdateCode */])(identifier,{code:userCode}).then(function(res){// 是否更新了代码, 目的是当代码没有更新时不调用更新代码接口,目录没有实现 // TODO 需要优化 if(res.data.status===401){dispatch({type:__WEBPACK_IMPORTED_MODULE_2__actionTypes__["a" /* default */].SUBMIT_LOADING_STATUS,payload:false});return;};dispatch({type:__WEBPACK_IMPORTED_MODULE_2__actionTypes__["a" /* default */].IS_UPDATE_CODE,flag:false});userCodeSubmit();}).catch(function(){dispatch({type:__WEBPACK_IMPORTED_MODULE_2__actionTypes__["a" /* default */].SUBMIT_LOADING_STATUS,payload:false});});}else{userCodeSubmit();}};};// 恢复初始代码 var restoreInitialCode=function restoreInitialCode(identifier,msg){return function(dispatch){Object(__WEBPACK_IMPORTED_MODULE_4__services_ojService__["h" /* fetchRestoreInitialCode */])(identifier).then(function(res){if(res.data.status===401)return;// console.log('恢复初始代码====》》》》', res); var status=res.status,data=res.data;if(status===200){dispatch({type:__WEBPACK_IMPORTED_MODULE_2__actionTypes__["a" /* default */].RESTORE_INITIAL_CODE,payload:data.code});__WEBPACK_IMPORTED_MODULE_1_antd_lib_notification___default.a.success({message:'提示',description:msg});dispatch({type:__WEBPACK_IMPORTED_MODULE_2__actionTypes__["a" /* default */].SAVE_NOTICE_COUNT,payload:false});}});};};// 保存详情页面中的编辑代码 var saveEditorCodeForDetail=function saveEditorCodeForDetail(code){return{type:__WEBPACK_IMPORTED_MODULE_2__actionTypes__["a" /* default */].SAVE_EDITOR_CODE,payload:code};};// 更新通知状态 /***/ }), /***/ 2104: /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return changeShowOrHideControl; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return changeLoadingState; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return changeSubmitLoadingStatus; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return changePublishLoadingStatus; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "e", function() { return isMyPublish; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__actionTypes__ = __webpack_require__(51); /* * @Description: 控制全局 * @Author: tangjiang * @Github: * @Date: 2019-11-27 16:30:50 * @LastEditors: tangjiang * @LastEditTime: 2019-12-19 19:42:10 */// 切换控制台显示与隐藏 var changeShowOrHideControl=function changeShowOrHideControl(flag){return{type:__WEBPACK_IMPORTED_MODULE_0__actionTypes__["a" /* default */].SHOW_OR_HIDE_CONTROL,payload:flag};};// 改变 loading 状态值 var changeLoadingState=function changeLoadingState(flag){return{type:__WEBPACK_IMPORTED_MODULE_0__actionTypes__["a" /* default */].LOADING_STATUS,payload:flag};};// 改变提交按钮状态值 var changeSubmitLoadingStatus=function changeSubmitLoadingStatus(flag){return{type:__WEBPACK_IMPORTED_MODULE_0__actionTypes__["a" /* default */].SUBMIT_LOADING_STATUS,payload:flag};};// 发布按钮状态 var changePublishLoadingStatus=function changePublishLoadingStatus(flag){return{type:__WEBPACK_IMPORTED_MODULE_0__actionTypes__["a" /* default */].PUBLISH_LOADING_STATUS,payload:flag};};// 是否是我发布的 var isMyPublish=function isMyPublish(flag){return{type:__WEBPACK_IMPORTED_MODULE_0__actionTypes__["a" /* default */].IS_MY_SOURCE,payload:flag};}; /***/ }), /***/ 2105: /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return getUserInfoForNew; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__actionTypes__ = __webpack_require__(51); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__services_ojService__ = __webpack_require__(1437); /* * @Description: * @Author: tangjiang * @Github: * @Date: 2019-12-06 15:09:22 * @LastEditors: tangjiang * @LastEditTime: 2019-12-09 20:34:50 */// 获取用户信息 var getUserInfoForNew=function getUserInfoForNew(){return function(dispatch){// 调用获取用户信息, 如果没有登录直接调用登录,成功后保存当前用户信息 Object(__WEBPACK_IMPORTED_MODULE_1__services_ojService__["o" /* fetchUserInfoForNew */])().then(function(res){// console.log('获取用户信息成功: ', res); var data=res.data;if(data.status===401)return;dispatch({type:__WEBPACK_IMPORTED_MODULE_0__actionTypes__["a" /* default */].SAVE_USER_INFO,payload:data.user});});};}; /***/ }), /***/ 2106: /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return getJupyterInfo; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return getJupyterTpiDataSet; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "e", function() { return getJupyterTpiUrl; }); /* unused harmony export saveJupyterIdentifier */ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "g", function() { return syncJupyterCode; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return changeGetJupyterUrlState; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "f", function() { return saveJupyterTpi; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return changeCurrentPage; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_antd_lib_message_style_css__ = __webpack_require__(177); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_antd_lib_message_style_css___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_antd_lib_message_style_css__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_antd_lib_message__ = __webpack_require__(178); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_antd_lib_message___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_antd_lib_message__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__actionTypes__ = __webpack_require__(51); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__services_jupyterServer__ = __webpack_require__(2107); /* * @Description: jupyter tpi 相关内容 * @Author: tangjiang * @Github: * @Date: 2019-12-12 09:01:30 * @LastEditors: tangjiang * @LastEditTime: 2019-12-13 23:03:27 */// 获取 jupyter 相关信息 var getJupyterInfo=function getJupyterInfo(id){return function(dispatch,getState){var jupyter_pagination=getState().jupyterReducer.jupyter_pagination;console.log(jupyter_pagination);Object(__WEBPACK_IMPORTED_MODULE_3__services_jupyterServer__["a" /* fetchJupyterInfo */])(id).then(function(res){if(res.data.status===401)return;if(res.status===200){var data=res.data;// if (data.status === 0) { dispatch({type:__WEBPACK_IMPORTED_MODULE_2__actionTypes__["a" /* default */].SAVE_JUPYTER_INFO,payload:data});var identifier=data.identifier,myshixun_identifier=data.myshixun_identifier;dispatch(saveJupyterIdentifier(identifier));// 调用获取数据集接口 dispatch(getJupyterTpiDataSet(identifier,jupyter_pagination));// 调用获取url接口 dispatch(getJupyterTpiUrl({identifier:myshixun_identifier}));// } }});};};// 获取 jupyter tpi 数据集 var getJupyterTpiDataSet=function getJupyterTpiDataSet(identifier,params){return function(dispatch,getState){if(!params){params=getState().jupyterReducer.jupyter_pagination;}Object(__WEBPACK_IMPORTED_MODULE_3__services_jupyterServer__["b" /* fetchJupyterTpiDataSet */])(identifier,params).then(function(res){if(res.data.status===401)return;// 用户未登录 if(res.status===200){var _res$data=res.data,data_sets=_res$data.data_sets,data_sets_count=_res$data.data_sets_count;dispatch({type:__WEBPACK_IMPORTED_MODULE_2__actionTypes__["a" /* default */].GET_JUPYTER_DATA_SETS,payload:{data_sets:data_sets,data_sets_count:data_sets_count}});}});};};// 获取 jupyter tpi 地址 var getJupyterTpiUrl=function getJupyterTpiUrl(obj){return function(dispatch,getState){var jupyter_info=getState().jupyterReducer.jupyter_info;if(!obj.identifier&&!jupyter_info.myshixun_identifier)return;var id=obj.identifier||jupyter_info.myshixun_identifier;Object(__WEBPACK_IMPORTED_MODULE_3__services_jupyterServer__["c" /* fetchJupyterTpiUrl */])({identifier:id}).then(function(res){if(res.data.status===401)return;// 用户未登录 console.log('获取url',res);if(res.status===200){var _res$data2=res.data,status=_res$data2.status,_res$data2$url=_res$data2.url,url=_res$data2$url===undefined?'':_res$data2$url,port=_res$data2.port;dispatch({type:__WEBPACK_IMPORTED_MODULE_2__actionTypes__["a" /* default */].GET_JUPYTER_TPI_URL,payload:{status:status,url:url,port:port}});}});};};// 保存 jupyter identifer var saveJupyterIdentifier=function saveJupyterIdentifier(identifier){return{type:__WEBPACK_IMPORTED_MODULE_2__actionTypes__["a" /* default */].SAVE_JUPYTER_IDENTIFIER,payload:identifier};};// 重置代码 var syncJupyterCode=function syncJupyterCode(identifier,msg){return function(dispatch){Object(__WEBPACK_IMPORTED_MODULE_3__services_jupyterServer__["e" /* fetchSyncJupyterCode */])(identifier).then(function(res){// console.log('同步代码成功: ', res); if(res.data.status===401)return;if(res.status===200){var status=res.data.status;if(status===0){__WEBPACK_IMPORTED_MODULE_1_antd_lib_message___default.a.success(msg);setTimeout(function(){window.location.reload();},300);}}});};};// 改变状态值 var changeGetJupyterUrlState=function changeGetJupyterUrlState(status){return{type:__WEBPACK_IMPORTED_MODULE_2__actionTypes__["a" /* default */].CHANGE_JUPYTER_URL_STATE,payload:status};};// 保存 jupyter tpi var saveJupyterTpi=function saveJupyterTpi(){return function(dispatch,getState){var _getState$jupyterRedu=getState().jupyterReducer,jupyter_tpi_code=_getState$jupyterRedu.jupyter_tpi_code,jupyter_info=_getState$jupyterRedu.jupyter_info;// console.log(jupyter_info.myshixun_identifier, jupyter_tpi_code); if(!jupyter_info.myshixun_identifier)return;var params={identifier:jupyter_info.myshixun_identifier,jupyter_port:jupyter_tpi_code};console.log(params);Object(__WEBPACK_IMPORTED_MODULE_3__services_jupyterServer__["d" /* fetchSaveJupyterTpi */])(params).then(function(res){dispatch({type:__WEBPACK_IMPORTED_MODULE_2__actionTypes__["a" /* default */].LOADING_STATUS,payload:false});if(res.status===200){var data=res.data;if(data.status===0){__WEBPACK_IMPORTED_MODULE_1_antd_lib_message___default.a.success('保存成功!');}}}).catch(function(){dispatch({type:__WEBPACK_IMPORTED_MODULE_2__actionTypes__["a" /* default */].LOADING_STATUS,payload:false});});};};// 改变当前页数 var changeCurrentPage=function changeCurrentPage(current){return{type:__WEBPACK_IMPORTED_MODULE_2__actionTypes__["a" /* default */].CHANGE_JUPYTER_CURRENT_PAGE,payload:current};}; /***/ }), /***/ 2107: /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return fetchJupyterInfo; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return fetchJupyterTpiDataSet; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return fetchJupyterTpiUrl; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "e", function() { return fetchSyncJupyterCode; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return fetchSaveJupyterTpi; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_regenerator__ = __webpack_require__(1337); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_regenerator___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_babel_runtime_regenerator__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_axios__ = __webpack_require__(12); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_axios___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_axios__); function _asyncToGenerator(fn){return function(){var gen=fn.apply(this,arguments);return new Promise(function(resolve,reject){function step(key,arg){try{var info=gen[key](arg);var value=info.value;}catch(error){reject(error);return;}if(info.done){resolve(value);}else{return Promise.resolve(value).then(function(value){step("next",value);},function(err){step("throw",err);});}}return step("next");});};}/* * @Description: jupyter相关接口 * @Author: tangjiang * @Github: * @Date: 2019-12-12 09:07:07 * @LastEditors: tangjiang * @LastEditTime: 2019-12-13 16:00:45 */// 获取 jupyter实训相关的内容 var fetchJupyterInfo=function(){var _ref=_asyncToGenerator(/*#__PURE__*/__WEBPACK_IMPORTED_MODULE_0_babel_runtime_regenerator___default.a.mark(function _callee(identifier){var url;return __WEBPACK_IMPORTED_MODULE_0_babel_runtime_regenerator___default.a.wrap(function _callee$(_context){while(1){switch(_context.prev=_context.next){case 0:url='/tasks/'+identifier+'/jupyter.json';return _context.abrupt('return',__WEBPACK_IMPORTED_MODULE_1_axios___default.a.get(url));case 2:case'end':return _context.stop();}}},_callee,this);}));return function fetchJupyterInfo(_x){return _ref.apply(this,arguments);};}();// 获取数据集 var fetchJupyterTpiDataSet=function(){var _ref2=_asyncToGenerator(/*#__PURE__*/__WEBPACK_IMPORTED_MODULE_0_babel_runtime_regenerator___default.a.mark(function _callee2(identifier,params){var url;return __WEBPACK_IMPORTED_MODULE_0_babel_runtime_regenerator___default.a.wrap(function _callee2$(_context2){while(1){switch(_context2.prev=_context2.next){case 0:url='/shixuns/'+identifier+'/get_data_sets.json';return _context2.abrupt('return',__WEBPACK_IMPORTED_MODULE_1_axios___default.a.get(url,{params:params}));case 2:case'end':return _context2.stop();}}},_callee2,this);}));return function fetchJupyterTpiDataSet(_x2,_x3){return _ref2.apply(this,arguments);};}();// 获取 tpi url var fetchJupyterTpiUrl=function(){var _ref3=_asyncToGenerator(/*#__PURE__*/__WEBPACK_IMPORTED_MODULE_0_babel_runtime_regenerator___default.a.mark(function _callee3(params){var url;return __WEBPACK_IMPORTED_MODULE_0_babel_runtime_regenerator___default.a.wrap(function _callee3$(_context3){while(1){switch(_context3.prev=_context3.next){case 0:url='/jupyters/get_info_with_tpi.json';return _context3.abrupt('return',__WEBPACK_IMPORTED_MODULE_1_axios___default.a.get(url,{params:params}));case 2:case'end':return _context3.stop();}}},_callee3,this);}));return function fetchJupyterTpiUrl(_x4){return _ref3.apply(this,arguments);};}();// 同步代码功能 var fetchSyncJupyterCode=function(){var _ref4=_asyncToGenerator(/*#__PURE__*/__WEBPACK_IMPORTED_MODULE_0_babel_runtime_regenerator___default.a.mark(function _callee4(identifier){var url;return __WEBPACK_IMPORTED_MODULE_0_babel_runtime_regenerator___default.a.wrap(function _callee4$(_context4){while(1){switch(_context4.prev=_context4.next){case 0:url='/myshixuns/'+identifier+'/sync_code.json';return _context4.abrupt('return',__WEBPACK_IMPORTED_MODULE_1_axios___default.a.post(url));case 2:case'end':return _context4.stop();}}},_callee4,this);}));return function fetchSyncJupyterCode(_x5){return _ref4.apply(this,arguments);};}();// jupyter 保存 var fetchSaveJupyterTpi=function(){var _ref5=_asyncToGenerator(/*#__PURE__*/__WEBPACK_IMPORTED_MODULE_0_babel_runtime_regenerator___default.a.mark(function _callee5(params){var url;return __WEBPACK_IMPORTED_MODULE_0_babel_runtime_regenerator___default.a.wrap(function _callee5$(_context5){while(1){switch(_context5.prev=_context5.next){case 0:url='/jupyters/save_with_tpi.json';return _context5.abrupt('return',__WEBPACK_IMPORTED_MODULE_1_axios___default.a.get(url,{params:params}));case 2:case'end':return _context5.stop();}}},_callee5,this);}));return function fetchSaveJupyterTpi(_x6){return _ref5.apply(this,arguments);};}(); /***/ }), /***/ 2282: /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* unused harmony export UserInfo */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__index_scss__ = __webpack_require__(2283); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__index_scss___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0__index_scss__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_react__ = __webpack_require__(0); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_react___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_react__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_educoder__ = __webpack_require__(5); /* * @Description: 用户头像及昵称 * @Author: tangjiang * @Github: * @Date: 2019-12-09 17:11:28 * @LastEditors: tangjiang * @LastEditTime: 2019-12-09 17:36:55 */function UserInfo(props){var _props$userInfo=props.userInfo,image_url=_props$userInfo.image_url,name=_props$userInfo.name;return __WEBPACK_IMPORTED_MODULE_1_react___default.a.createElement('div',{className:'avator_nicker'},__WEBPACK_IMPORTED_MODULE_1_react___default.a.createElement('img',{style:{display:image_url?'inline-block':'none'},alt:'\u7528\u6237\u5934\u50CF',className:'student_img',src:Object(__WEBPACK_IMPORTED_MODULE_2_educoder__["M" /* getImageUrl */])('images/'+image_url||'images/educoder/headNavLogo.png?1526520218')}),__WEBPACK_IMPORTED_MODULE_1_react___default.a.createElement('span',{className:'student_nicker'},name||''));}/* harmony default export */ __webpack_exports__["a"] = (UserInfo); /***/ }), /***/ 2283: /***/ (function(module, exports, __webpack_require__) { // style-loader: Adds some css to the DOM by adding a