store-management-app/utils/index.js

39 lines
1021 B
JavaScript
Raw Normal View History

2024-10-17 05:36:41 +00:00
// export const runTimeEnv = () => {
// if (plus) {
// const currentWebView = plus.webview.getWebviewById("wv");
// return currentWebView.RunTime === "app";
// } else {
// return false;
// }
// };\
2024-10-15 08:45:54 +00:00
export const closeWebview = () => {
2024-10-17 05:36:41 +00:00
try {
const currentWebView = plus.webview.getWebviewById("wv");
currentWebView.close();
} catch (e) {
return () => {};
}
2024-10-15 08:45:54 +00:00
};
2024-10-17 09:46:46 +00:00
// 判断是oa还是墨册
export const OAorMc = () => {
2024-10-24 07:21:06 +00:00
if (window.plus) {
2024-10-22 07:02:54 +00:00
const currentWebView = plus.webview.getWebviewById("wv");
2024-10-24 07:21:06 +00:00
console.log("currentWebView.type", currentWebView.type);
2024-10-22 07:02:54 +00:00
return currentWebView.type;
2024-10-24 07:21:06 +00:00
} else {
2024-10-22 10:42:21 +00:00
return "MC";
2024-10-17 09:46:46 +00:00
}
};
2024-10-18 02:19:37 +00:00
export const hasPermission = (userPermission) => {
let userPermissionList = Array.isArray(userPermission)
? userPermission
: [userPermission];
// 当前用户的权限列表
2024-10-18 02:21:53 +00:00
let permissionList = uni.getStorageSync("ruleBtn")
? uni.getStorageSync("ruleBtn")
: [];
2024-10-18 02:19:37 +00:00
return userPermissionList.some((e) => permissionList.includes(e));
};