添加页面及完善二级页面

This commit is contained in:
zhengw
2026-03-09 14:21:52 +08:00
parent aa1294f997
commit 9033acc56d
30 changed files with 611 additions and 32 deletions

View File

@@ -3,7 +3,15 @@
* YangXB 2021.11.24
* */
import { base, http } from './config';
import { getStorage, goIndexPage, isArray, setStorage, toArray, toastError } from './util';
import {
getCurrentPage,
getStorage,
goIndexPage,
isArray,
setStorage,
toArray,
toastError,
} from './util';
/**
* 请求
*/
@@ -50,10 +58,11 @@ const request = (url: string, options: any, config = { showLoading: true, showEr
});
}
if (request.data.err_code == 110000) {
const pages = getCurrentPages();
const currentPage = getCurrentPage();
console.log(currentPage);
if (
!['pages/index/index', 'pages/processEntry/processEntry', 'pages/my/my'].includes(
pages[pages.length - 1].route,
currentPage.route,
)
) {
goIndexPage();
@@ -182,7 +191,7 @@ export const loginStatusPage = (that: WechatMiniprogram.Page.Instance<any, any>)
})
.catch((err) => {
that.setData({ isLogin: false, loading: false });
reject();
reject(err);
console.log('调用登录状态请求失败', err);
});
});

View File

@@ -112,6 +112,7 @@ export const menuConfig = [
icon: 'grid-view',
iconColor: iconColor,
children: [
{ title: '仓库信息', url: '/pages/base/depot/depot', auth: 'SF_ERP_DEPOT_VIEW' },
{ title: '供应商', url: '/pages/base/supplier/supplier', auth: 'SF_ERP_SUPPLIER_VIEW' },
{ title: '经销商', url: '/pages/base/customer/customer', auth: 'SF_ERP_CUSTOMER_VIEW' },
{ title: '结算账户', url: '/pages/base/account/account', auth: 'SF_ERP_ACCOUNT_VIEW' },

View File

@@ -54,10 +54,13 @@ export const isObject = (data: any) => {
export const toObject = (data: any) => (isObject(data) ? data : {});
export const reloadPage = () => {
export const getCurrentPage = () => {
let pages = getCurrentPages(); //获取加载的页面
let currentPage = pages[pages.length - 1]; //获取当前页面的对象
let url = currentPage.route; //当前页面url
return pages[pages.length - 1];
};
export const reloadPage = () => {
let url = getCurrentPage().route; //当前页面url
// 关闭当前页面,跳转到应用内的某个页面。但是不允许跳转到 tabbar 页面。
wx.redirectTo({ url: '/' + url });
};
@@ -326,9 +329,7 @@ export const removeStorage = (key: string) => {
* 获取当前页面路由
*/
export const getCurrentPageRoute = () => {
const pages = getCurrentPages(); // 获取页面栈
const currentPage = pages[pages.length - 1]; // 获取当前页面对象
return `/${currentPage.route}`; // 获取当前页面路径
return `/${getCurrentPage().route}`; // 获取当前页面路径
};
/** 价格保留位数 */