diff --git a/core/request/apis.js b/core/request/apis.js index 3ef856e..a4db44c 100644 --- a/core/request/apis.js +++ b/core/request/apis.js @@ -133,6 +133,14 @@ export default { auth: true, method: "POST", isSystemApi: true + }, + warehouse: { + search: { + path: "stock.warehouse.search", + auth: true, + method: "POST", + isSystemApi: true + } } }, print: { diff --git a/core/store/modules/user.js b/core/store/modules/user.js index bb4f48c..1a5acc7 100644 --- a/core/store/modules/user.js +++ b/core/store/modules/user.js @@ -145,14 +145,22 @@ const actions = { commit, state },path) { - let has = false; - console.log("所有菜单",state.menus); - for(let i =0;i String(target) + .trim() + .replace(/^\/+/, '') + .replace(/\.vue$/i, ''); + + const targetPath = normalizePath(path); + if (!targetPath) { + return false; } - return has; + + console.log("所有菜单", state.menus); + return (state.menus || []).some(menu => { + const componentPath = normalizePath(menu?.component || ''); + const menuPath = normalizePath(menu?.path || ''); + return componentPath === targetPath || menuPath === targetPath; + }); }, login({ commit, diff --git a/pages.json b/pages.json index 1ef84eb..937e43c 100644 --- a/pages.json +++ b/pages.json @@ -1,14 +1,5 @@ -{ - // "condition": { //模式配置,仅开发期间生效 - // "current": 0, //当前激活的模式(list 的索引项) - // "list": [{ - // "name": "test", //模式名称 - // "path": "pages/componentsA/test/test", //启动页面,必选 - // "query": "" //启动参数,在页面的onLoad函数里面得到 - // }] - // }, - "pages": [ //pages数组中第一项表示应用启动页,参考:https://uniapp.dcloud.io/collocation/pages - +{ + "pages": [ { "path": "pages/login/index", @@ -129,6 +120,13 @@ { "titleNView": false } + }, + { + "path" : "pages/work/product/query", + "style" : + { + "titleNView": false + } } ], diff --git a/pages/home/edit-quick-actions.vue b/pages/home/edit-quick-actions.vue index e4bfe45..0d6812a 100644 --- a/pages/home/edit-quick-actions.vue +++ b/pages/home/edit-quick-actions.vue @@ -311,7 +311,14 @@ this.activeNav = group.initial || '全部'; }, toPath(item) { - if (!item || !item.component) { + const menuName = String(item?.name || '').trim(); + const isGoodsQuery = menuName === '商品查询' || (menuName.includes('商品') && menuName.includes('查询')); + const rawPath = item?.component || item?.path || ''; + const targetPath = isGoodsQuery + ? '/pages/work/product/query' + : (rawPath ? (rawPath.startsWith('/') ? rawPath : `/${rawPath}`) : ''); + + if (!targetPath) { uni.showToast({ title: '功能暂未开放', icon: 'none' @@ -320,7 +327,7 @@ } uni.navigateTo({ - url: item.component.startsWith('/') ? item.component : `/${item.component}`, + url: targetPath, animationType: 'slide-in-right' }); }, diff --git a/pages/index/index.vue b/pages/index/index.vue index c01743f..67ee18e 100644 --- a/pages/index/index.vue +++ b/pages/index/index.vue @@ -334,7 +334,14 @@ }, toPath(item) { - if (!item || !item.component) { + const menuName = String(item?.name || '').trim(); + const isGoodsQuery = menuName === '商品查询' || (menuName.includes('商品') && menuName.includes('查询')); + const rawPath = item?.component || item?.path || ''; + const targetPath = isGoodsQuery + ? '/pages/work/product/query' + : (rawPath ? (rawPath.startsWith('/') ? rawPath : `/${rawPath}`) : ''); + + if (!targetPath) { uni.showToast({ title: '功能暂未开放', icon: 'none', @@ -344,7 +351,7 @@ } uni.navigateTo({ - url: item.component.startsWith('/') ? item.component : `/${item.component}`, + url: targetPath, animationType: 'slide-in-right' }); }, diff --git a/pages/work/storage/receiving/receivingDetail.vue b/pages/work/storage/receiving/receivingDetail.vue index a9ee6de..ee8b0dd 100644 --- a/pages/work/storage/receiving/receivingDetail.vue +++ b/pages/work/storage/receiving/receivingDetail.vue @@ -597,7 +597,7 @@ if(!this.selectedDetail){ return false; } - const stocks = await this.$http("stock.search", { + const stocks = await this.$http("stock.warehouse.search", { keyword: data, store_id: this.receivingInfo.store_id });