1234567891011121314151617181920212223242526272829303132333435363738 |
- //评卷状态模块
- var idle_process = function(option, success) {
- var object = new IdleProcess(option);
- success();
- return object;
- }
- function IdleProcess(option) {
- this.markControl = option.markControl;
- this.logoutUrl = option.logoutUrl;
- this.timeoutMinute = parseInt(option.timeout) != undefined ? parseInt(option.timeout) : 3;
- this.intervalSecond = 15;
- this.markControl.on('task.get.success', this, function(event, context, eventObject) {
- this.libraryId = context.task.libraryId;
- this.start = new Date().getTime();
- });
- this.process();
- }
- IdleProcess.prototype.process = function() {
- var self = this;
- if (this.lastLibraryId == undefined) {
- this.lastLibraryId = this.libraryId;
- }
- var now = new Date().getTime();
- if (this.lastLibraryId != undefined && this.libraryId != undefined && this.start != undefined) {
- if (this.lastLibraryId == this.libraryId) {
- if ((now - this.start) > (this.timeoutMinute * 60 * 1000)) {
- window.location.href = this.logoutUrl;
- }
- }
- }
- setTimeout(function() {
- self.process();
- }, self.intervalSecond * 1000);
- }
|