Commit 545e0b9a authored by 仇晓婷's avatar 仇晓婷

收藏bug

parent 917b5f19
...@@ -27,3 +27,33 @@ ...@@ -27,3 +27,33 @@
//弹框颜色 //弹框颜色
@modal-header-bg-color: #515A6E; @modal-header-bg-color: #515A6E;
// //滚动条颜色
// @scrollbar-track-bg-color: rgb(239, 239, 239);
// @scrollbar-thumb-bg-color: rgba(38, 128, 235, 0.5);
// @scrollbar-thumb-bg-color-hover: rgba(38, 128, 235, 0.8);
// @scrollbar-corner-bg-color: rgba(38, 128, 235, 1);
// //顶部导航颜色
// @home-mene: #2680eb;
// @layout-header: #515A6E;
// //bady颜色
// @layout-content-bg-color: #fff;
// @card-bg: #fff;
// //收藏夹自体图标颜色
// @icon-color: #2680eb;
// //首页标题颜色
// @title-color: #0099ff;
// //表格、表单 以及其他字体颜色
// @table-color:#515A6E;
// //弹框颜色
// @modal-header-bg-color: #515A6E;
...@@ -143,7 +143,7 @@ export default { ...@@ -143,7 +143,7 @@ export default {
oldScrollTop: 0, oldScrollTop: 0,
isDelayHideSider: false, // hack,当从隐藏侧边栏的 header 切换到正常 header 时,防止 Logo 抖动 isDelayHideSider: false, // hack,当从隐藏侧边栏的 header 切换到正常 header 时,防止 Logo 抖动
loadRouter: true, loadRouter: true,
showStar: null, showStar: false,
content: "收藏", content: "收藏",
menuId: null, menuId: null,
homeMenu: "", homeMenu: "",
...@@ -153,6 +153,9 @@ export default { ...@@ -153,6 +153,9 @@ export default {
isStatic: false, isStatic: false,
}; };
}, },
async fetch({ store, params }) {
await store.dispatch("collectList"); // 加载数据字典
},
computed: { computed: {
...mapState("admin/layout", [ ...mapState("admin/layout", [
"siderTheme", "siderTheme",
...@@ -181,6 +184,7 @@ export default { ...@@ -181,6 +184,7 @@ export default {
]), ]),
...mapState("admin/page", ["keepAlive"]), ...mapState("admin/page", ["keepAlive"]),
...mapGetters("admin/menu", ["hideSider", "filterSider"]), ...mapGetters("admin/menu", ["hideSider", "filterSider"]),
...mapState({ collect: "collect" }),
// 如果开启 headerMenu,且当前 header 的 hideSider 为 true,则将顶部按 headerStick 处理 // 如果开启 headerMenu,且当前 header 的 hideSider 为 true,则将顶部按 headerStick 处理
// 这时,即使没有开启 headerStick,仍然按开启处理 // 这时,即使没有开启 headerStick,仍然按开启处理
isHeaderStick() { isHeaderStick() {
...@@ -266,19 +270,18 @@ export default { ...@@ -266,19 +270,18 @@ export default {
this.handleReload(); this.handleReload();
} }
} }
console.warn("to-from", to, from, this.filterSider); // console.warn("to-from", to, from, this.filterSider);
//获取收藏列表,判断的当前路由是否收藏 //获取收藏列表,判断的当前路由是否收藏
let star = false; // let star = false;
// console.warn("to-from======", this.$store.state.collect); // console.warn("to-from======", this.collect);
this.$store.state.collect.map((u) => { this.collect.some((u) => {
if (u.url == to.path) { if (u.url == to.path) {
star = true; this.showStar = true;
return true;
} else { } else {
star = false; this.showStar = false;
} }
}); });
this.showStar = star;
// alert(this.showStar);
//获取菜单path并与当前路由比对,获取当前菜单id //获取菜单path并与当前路由比对,获取当前菜单id
let dataTemp = this.$u.treeToList(this.filterSider); let dataTemp = this.$u.treeToList(this.filterSider);
...@@ -385,6 +388,7 @@ export default { ...@@ -385,6 +388,7 @@ export default {
this.$api.post(url, menuId).then((r) => { this.$api.post(url, menuId).then((r) => {
if (r.success) { if (r.success) {
this.showStar = false; this.showStar = false;
this.$store.dispatch("collectList");
this.$Message.success("已取消收藏"); this.$Message.success("已取消收藏");
this.content = "收藏"; this.content = "收藏";
} }
...@@ -399,6 +403,7 @@ export default { ...@@ -399,6 +403,7 @@ export default {
this.$api.post(url, { menuId: this.menuId }).then((r) => { this.$api.post(url, { menuId: this.menuId }).then((r) => {
if (r.result) { if (r.result) {
this.showStar = true; this.showStar = true;
this.$store.dispatch("collectList");
this.$Message.success("收藏成功"); this.$Message.success("收藏成功");
this.content = "取消收藏"; this.content = "取消收藏";
} }
......
...@@ -32,5 +32,8 @@ export default { ...@@ -32,5 +32,8 @@ export default {
list(params) { list(params) {
return Api.post(`${systemUrl}/newmessage/list`, params); //获取列表信息 return Api.post(`${systemUrl}/newmessage/list`, params); //获取列表信息
}, },
list5(params) {
return Api.post(`${systemUrl}/favorite/listbyuser`, params); //获取列表信息
},
} }
\ No newline at end of file
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
<span>{{userData.roleTitles}}</span> <span>{{userData.roleTitles}}</span>
</p> </p>
</div> </div>
<div class="incon-carousel"> <div class="incon-carousel">
<Icon <Icon
type="ios-arrow-back" type="ios-arrow-back"
...@@ -211,9 +212,12 @@ export default { ...@@ -211,9 +212,12 @@ export default {
}; };
}, },
async fetch({ store, params }) { async fetch({ store, params }) {
// console.warn("vvvvvv");
await store.dispatch("collectList"); // 加载数据字典 await store.dispatch("collectList"); // 加载数据字典
}, },
created() { created() {
this.$store.dispatch("collectList");
this.get(); this.get();
this.getUserInfoFn(); this.getUserInfoFn();
// console.log(this.$store.state.collect); // console.log(this.$store.state.collect);
......
...@@ -70,6 +70,7 @@ export const mutations = { ...@@ -70,6 +70,7 @@ export const mutations = {
state.userMap.push(user); state.userMap.push(user);
}, },
setCollect(state, collectData) { setCollect(state, collectData) {
state.collect = collectData; state.collect = collectData;
}, },
setDictionary(state, dictionary) { setDictionary(state, dictionary) {
...@@ -128,7 +129,7 @@ export const actions = { ...@@ -128,7 +129,7 @@ export const actions = {
let { let {
result result
} = await Api.post(`${systemUrl}/favorite/listbyuser`); } = await Api.post(`${systemUrl}/favorite/listbyuser`);
console.warn("result---", result)
commit("setCollect", result); commit("setCollect", result);
}, },
async loadUser({ async loadUser({
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment