页签切换,一级菜单也要选中,报错信息提示多个问题

master
mabo 2021-07-23 11:46:01 +08:00
parent 66462b9085
commit ae329419a6
16 changed files with 59 additions and 34 deletions

View File

@ -304,11 +304,6 @@ export const deleteMessageSend = (ids, params) => {
return deleteRequest(`/manager/messageSend/delByIds/${ids}`, params);
};
// 通过id获取子地区
export const getRegion = (id) => {
return getRequest(`/region/item/${id}`);
};
// 分页获取文件数据
export const getFileListData = (params) => {
return getRequest("/file", params);
@ -389,11 +384,6 @@ export const delRegion = (ids) => {
return deleteRequest(`/region/${ids}`);
};
// 通过id获取地区详情
export const getRegionDetail = (id) => {
return getRequest(`/region/${id}`);
};
// 更新地区
export const updateRegion = (id, params) => {
return putRequest(`/region/${id}`, params);

View File

@ -17,14 +17,14 @@ export default {
* @description api请求基础路径
*/
api_dev: {
// common: "https://common-api.pickmall.cn",
// buyer: "https://buyer-api.pickmall.cn",
// seller: "https://store-api.pickmall.cn",
// manager: "https://admin-api.pickmall.cn"
common: 'http://192.168.0.101:8890',
buyer: 'http://192.168.0.101:8888',
seller: 'http://192.168.0.101:8889',
manager: 'http://192.168.0.101:8887'
common: "https://common-api.pickmall.cn",
buyer: "https://buyer-api.pickmall.cn",
seller: "https://store-api.pickmall.cn",
manager: "https://admin-api.pickmall.cn"
// common: 'http://192.168.0.101:8890',
// buyer: 'http://192.168.0.101:8888',
// seller: 'http://192.168.0.101:8889',
// manager: 'http://192.168.0.101:8887'
},
api_prod: {
common: "https://common-api.pickmall.cn",

View File

@ -103,6 +103,7 @@ service.interceptors.response.use(
} else {
// 其他错误处理
console.log(error.response.data);
Message.error(error.response.data.message)
}
}

View File

@ -331,7 +331,6 @@ util.initRouter = function (vm) { // 初始化路由
getCurrentPermissionList().then(res => {
if (!res.success) return false;
let menuData = res.result;
// let menuData = result
// 格式化数据,设置 空children 为 null
for(let i =0;i<menuData.length;i++){
@ -340,6 +339,8 @@ util.initRouter = function (vm) { // 初始化路由
let tt = t[k].children;
for(let z = 0;z<tt.length;z++){
tt[z].children = null
// 给所有三级路由添加字段显示一级菜单name方便点击页签时的选中筛选
tt[z].firstRouterName = menuData[i].name
}
}
}
@ -395,8 +396,7 @@ util.initMenuData = function (vm, data) {
menuData.forEach(e => {
let nav = {
name: e.name,
title: e.title,
icon: e.icon
title: e.title
}
navList.push(nav);
})
@ -460,6 +460,7 @@ util.initRouterNode = function (routers, data) { // data为所有子菜单数
meta.permTypes = menu.permTypes ? menu.permTypes : null;
meta.title = menu.title ? menu.title + " - lilishop 运营后台" : null;
meta.url = menu.url ? menu.url : null;
meta.firstRouterName = item.firstRouterName
menu.meta = meta;
routers.push(menu);

View File

@ -11,7 +11,7 @@
</template>
<script>
import * as API_Setup from "@/api/index.js";
import * as API_Setup from "@/api/common.js";
export default {
data() {
return {
@ -46,7 +46,7 @@ export default {
},
loadData(item, callback) {
item.loading = true;
API_Setup.getRegion(item.value).then((res) => {
API_Setup.getChildRegion(item.value).then((res) => {
if (res.result.length <= 0) {
item.loading = false;
this.selected = item;
@ -84,7 +84,7 @@ export default {
});
},
init() {
API_Setup.getRegion(this.id).then((res) => {
API_Setup.getChildRegion(this.id).then((res) => {
let way = [];
res.result.forEach((item) => {

View File

@ -58,7 +58,7 @@ export default {
if (res.success) {
this.$Message.success("保存模板成功");
} else {
this.$Message.error(res.message);
// this.$Message.error(res.message);
}
});
},

View File

@ -27,6 +27,7 @@
<script>
import util from "@/libs/util.js";
export default {
name: "shrinkableMenu",
computed: {
@ -45,6 +46,9 @@ export default {
$route: {
handler: function (val, oldVal) {
console.log(val);
if (val.meta.firstRouterName && val.meta.firstRouterName !== this.currNav) {
this.selectNav(val.meta.firstRouterName)
}
}
}
},
@ -58,6 +62,9 @@ export default {
this.$store.commit("setCurrNav", name);
this.setStore("currNav", name);
util.initRouter(this);
this.$nextTick(()=>{
this.$refs.childrenMenu.updateActiveName()
})
},
}
};

View File

@ -487,7 +487,7 @@ export default {
this.$Message.success("禁用成功");
this.getData();
} else {
this.$Message.error(res.message);
// this.$Message.error(res.message);
}
});
},

View File

@ -422,7 +422,7 @@
this.$Message.success('禁用成功');
this.getData()
} else {
this.$Message.error(res.message);
// this.$Message.error(res.message);
}
});
}
@ -447,7 +447,7 @@
this.$Message.success('禁用成功');
this.getData()
} else {
this.$Message.error(res.message);
// this.$Message.error(res.message);
}
});
}

View File

@ -132,7 +132,7 @@ export default {
this.$emit("input", this.currentValue);
this.$emit("on-change", this.currentValue);
} else {
this.$Message.error(res.message);
// this.$Message.error(res.message);
}
},
//

View File

@ -122,7 +122,7 @@ export default {
//
this.returnValue();
} else {
this.$Message.error(res.message);
// this.$Message.error(res.message);
}
},
handleError(error, file, fileList) {

View File

@ -492,7 +492,7 @@ export default {
this.$Message.success("收款成功");
this.getDataList();
} else {
this.$Message.error(res.message);
// this.$Message.error(res.message);
}
});
},

View File

@ -181,7 +181,7 @@
this.formAdd={}
} else {
this.$Message.error(res.message);
// this.$Message.error(res.message);
}
this.getAllList();
this.modalVisible = false;
@ -193,7 +193,7 @@
if (res.success) {
this.$Message.success("修改成功");
} else {
this.$Message.error(res.message);
// this.$Message.error(res.message);
}
this.getAllList();
this.modalVisible = false;

View File

@ -89,7 +89,6 @@
import {
getChildRegion,
updateRegion,
getRegionDetail,
delRegion,
asyncRegion,
addRegion,

View File

@ -338,6 +338,18 @@ util.initRouter = function (vm) { // 初始化路由
if (!menuData) {
return;
}
// 格式化数据,设置 空children 为 null
for(let i =0;i<menuData.length;i++){
let t = menuData[i].children
for(let k = 0;k<t.length;k++){
let tt = t[k].children;
for(let z = 0;z<tt.length;z++){
tt[z].children = null
// 给所有三级路由添加字段显示一级菜单name方便点击页签时的选中筛选
tt[z].firstRouterName = menuData[i].name
}
}
}
util.initAllMenuData(constRoutes, menuData);
util.initRouterNode(otherRoutes, otherRouter);
// 添加所有主界面路由
@ -451,6 +463,7 @@ util.initRouterNode = function (routers, data) { // data为所有子菜单数
meta.permTypes = menu.permTypes ? menu.permTypes : null;
meta.title = menu.title ? menu.title + " - lilishop商家后台" : null;
meta.url = menu.url ? menu.url : null;
meta.firstRouterName = item.firstRouterName
menu.meta = meta;
routers.push(menu);

View File

@ -46,6 +46,17 @@ export default {
return this.$store.state.app.currNav;
}
},
watch: {
//
$route: {
handler: function (val, oldVal) {
console.log(val);
if (val.meta.firstRouterName && val.meta.firstRouterName !== this.currNav) {
this.selectNav(val.meta.firstRouterName)
}
}
}
},
methods: {
changeMenu(name) { //
this.$router.push({
@ -56,6 +67,9 @@ export default {
this.$store.commit("setCurrNav", name);
this.setStore("currNav", name);
util.initRouter(this);
this.$nextTick(()=>{
this.$refs.childrenMenu.updateActiveName()
})
},
}
};