浏览代码

补充自定义评卷参数的服务端保存逻辑,增加延时回调机制

luoshi 6 年之前
父节点
当前提交
dae76ab412

+ 11 - 2
stmms-web/src/main/webapp/static/mark-new/js/mark-control.js

@@ -97,6 +97,7 @@ MarkControl.prototype.initMarkFunction = function() {
 MarkControl.prototype.initSetting = function(option) {
     this.userId = option.userId;
     this.settingSyncUrl = option.settingSyncUrl;
+    this.settingSyncing = false;
     this.localStore = window.localStorage;
     this.setting = {};
 
@@ -133,8 +134,16 @@ MarkControl.prototype.updateSetting = function(item) {
         this.setting[key] = item[key];
     }
     this.localSettingSave();
-    if (this.syncUrl != undefined) {
-
+    if (this.settingSyncUrl != undefined && this.settingSyncing == false) {
+        this.settingSyncing = true;
+        var self = this;
+        setTimeout(function() {
+            //同步个性化设置
+            $.post(self.settingSyncUrl, {
+                setting: JSON.stringify(self.setting)
+            });
+            self.settingSyncing = false;
+        }, 1000);
     }
 }
 

+ 11 - 2
stmms-web/src/main/webapp/static/mark-track/js/mark-control.js

@@ -121,6 +121,7 @@ MarkControl.prototype.addNavGroup = function(title, content) {
 MarkControl.prototype.initSetting = function(option) {
     this.userId = option.userId;
     this.settingSyncUrl = option.settingSyncUrl;
+    this.settingSyncing = false;
     this.localStore = window.localStorage;
     this.setting = {};
 
@@ -157,8 +158,16 @@ MarkControl.prototype.updateSetting = function(item) {
         this.setting[key] = item[key];
     }
     this.localSettingSave();
-    if (this.syncUrl != undefined) {
-
+    if (this.settingSyncUrl != undefined && this.settingSyncing == false) {
+        this.settingSyncing = true;
+        var self = this;
+        setTimeout(function() {
+            //同步个性化设置
+            $.post(self.settingSyncUrl, {
+                setting: JSON.stringify(self.setting)
+            });
+            self.settingSyncing = false;
+        }, 1000);
     }
 }