优化收藏

hn2.0
fanluyan 2 years ago
parent e4883fb24f
commit 58e038f4b9

@ -525,8 +525,13 @@ export default {
// },
//treenode
handleNodeClick(data) {
console.log("我点击了收藏了在次回来了");
this.clearfun();
console.log(data);
localStorage.setItem("currentData", JSON.stringify(data));
data = JSON.parse(localStorage.getItem("currentData"));
this.selectData = data;
this.zztermId = data.id;
this.zzprotocol = data.protocol;
@ -620,6 +625,7 @@ export default {
) {
console.log("aaa");
this.currentNodekey = this.currentData.id;
this.handleNodeClick(this.currentData);
} else {
console.log("diyici");
@ -819,8 +825,13 @@ export default {
}).then(() => {
this.collectFlag = true;
addFavorList({ list: [this.zztermId], type: 1 }).then((res) => {
this.getupdateFavorTreeList();
this.getfavRadio();
});
this.currentData = JSON.parse(localStorage.getItem("currentData"));
console.log("我是添加收藏成功时的数据", this.currentData);
this.currentData.isfavor = 1;
console.log("我是改变了之后的只需要更新", this.currentData);
localStorage.setItem("currentData", JSON.stringify(this.currentData));
this.$message({
type: "success",
message: "添加成功!",
@ -834,8 +845,14 @@ export default {
}).then(() => {
this.collectFlag = false;
addFavorList({ list: [this.zztermId], type: 0 }).then((res) => {
this.getupdateFavorTreeList();
this.getfavRadio();
});
this.currentData = JSON.parse(localStorage.getItem("currentData"));
console.log("我是添加收藏成功时的数据", this.currentData);
this.currentData.isfavor = 0;
console.log("我是改变了之后的只需要更新", this.currentData);
localStorage.setItem("currentData", JSON.stringify(this.currentData));
this.$message({
type: "success",
message: "取消收藏!",

Loading…
Cancel
Save