store-management-app/utils/index.js
2024-10-24 13:35:48 +08:00

39 lines
1011 B
JavaScript

// export const runTimeEnv = () => {
// if (plus) {
// const currentWebView = plus.webview.getWebviewById("wv");
// return currentWebView.RunTime === "app";
// } else {
// return false;
// }
// };\
export const closeWebview = () => {
try {
const currentWebView = plus.webview.getWebviewById("wv");
currentWebView.close();
} catch (e) {
return () => {};
}
};
// 判断是oa还是墨册
export const OAorMc = () => {
try {
const currentWebView = plus.webview.getWebviewById("wv");
console.log('currentWebView.type',currentWebView.type)
return currentWebView.type;
} catch (e) {
return "MC";
}
};
export const hasPermission = (userPermission) => {
let userPermissionList = Array.isArray(userPermission)
? userPermission
: [userPermission];
// 当前用户的权限列表
let permissionList = uni.getStorageSync("ruleBtn")
? uni.getStorageSync("ruleBtn")
: [];
return userPermissionList.some((e) => permissionList.includes(e));
};