Selaa lähdekoodia

更新当前岛状态

wangxy 2 kuukautta sitten
vanhempi
commit
92b5f0ede7
2 muutettua tiedostoa jossa 19 lisäystä ja 3 poistoa
  1. 2 2
      pages/newEnglish/components/beiPage.vue
  2. 17 1
      utils/cacheManager.js

+ 2 - 2
pages/newEnglish/components/beiPage.vue

@@ -145,8 +145,8 @@
         wanchengFlag
       } = res.data;
       if (wanchengFlag == 1) {
-        // 通知岛重新调用接口
-        cacheManager.remove('zhangInfo')
+        // 更新当前岛小节完成状态
+        cacheManager.updateUnitStatus('zhangInfo', props.pageData.jieId)
       }
     })
 	}

+ 17 - 1
utils/cacheManager.js

@@ -108,6 +108,21 @@ const cacheManager = (function() {
 			}
 		}, obj);
 	}
+
+	// 新英语单元学习完所有单词更新单元状态
+	function updateUnitStatus(key, currentJieId) {
+		console.log('key',key,currentJieId)
+		let obj = get(key) || {};
+		obj.zhangList.map(item => item.jieList.forEach(jie => {
+			if (jie.jieId == currentJieId) {
+				jie.studyFlag = 1
+			}
+		}))
+
+		set(key, obj);
+	}
+
+
 	return {
 		set,
 		get,
@@ -116,7 +131,8 @@ const cacheManager = (function() {
 		getCurrentJieData,
 		updateObject,
 		findArrayInObject,
-		clearAll
+		clearAll,
+		updateUnitStatus
 	};
 })();