فهرست منبع

资料归集,展开收起缓存调整

MaiXinRong 2 سال پیش
والد
کامیت
a91fd38952
1فایلهای تغییر یافته به همراه2 افزوده شده و 3 حذف شده
  1. 2 3
      app/public/js/file_detail.js

+ 2 - 3
app/public/js/file_detail.js

@@ -19,7 +19,7 @@ $(document).ready(function() {
             this.pageCount = 15;
             this.expandKey = 'filing-' + window.location.pathname.split('/')[2];
             const cache = getLocalCache(this.expandKey);
-            this.expandCache = cache ? cache.split(',') : [];
+            this.expandCache = cache ? _.uniq(cache.split(',')) : [];
             this.curFilingKey = 'cur-filing-' + window.location.pathname.split('/')[2];
         }
         analysisFiling(data) {
@@ -288,8 +288,7 @@ $(document).ready(function() {
             if (expand) {
                 this.expandCache.push(node.id);
             } else{
-                const index = this.expandCache.indexOf(node.id);
-                if (index >= 0) this.expandCache.splice(index, 1);
+                this.expandCache = this.expandCache.filter(x => { return x !== node.id });
             }
             setLocalCache(this.expandKey, this.expandCache.join(','));
         }