fix
This commit is contained in:
parent
43cc89dc15
commit
90fecfc8c9
@ -3,7 +3,6 @@ import App from "./App.vue";
|
|||||||
import uviewPlus from "uview-plus";
|
import uviewPlus from "uview-plus";
|
||||||
import globalComponents from "./components";
|
import globalComponents from "./components";
|
||||||
import VConsole from "vconsole";
|
import VConsole from "vconsole";
|
||||||
import permission from "../utils/permission.js";
|
|
||||||
|
|
||||||
if (import.meta.env.VITE_APP_MODE === "dev") {
|
if (import.meta.env.VITE_APP_MODE === "dev") {
|
||||||
new VConsole();
|
new VConsole();
|
||||||
@ -11,7 +10,6 @@ if (import.meta.env.VITE_APP_MODE === "dev") {
|
|||||||
export function createApp() {
|
export function createApp() {
|
||||||
const app = createSSRApp(App);
|
const app = createSSRApp(App);
|
||||||
globalComponents(app);
|
globalComponents(app);
|
||||||
permission(app);
|
|
||||||
app.use(uviewPlus);
|
app.use(uviewPlus);
|
||||||
return {
|
return {
|
||||||
app,
|
app,
|
||||||
|
@ -74,7 +74,7 @@
|
|||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { ref, reactive, onBeforeMount } from "vue";
|
import { ref, reactive, onBeforeMount } from "vue";
|
||||||
import { closeWebview } from "../../../utils/index.js";
|
import { closeWebview, hasPermission } from "../../../utils/index.js";
|
||||||
|
|
||||||
import { onLoad } from "@dcloudio/uni-app";
|
import { onLoad } from "@dcloudio/uni-app";
|
||||||
import useToast from "@/hooks/toast/useToast.js";
|
import useToast from "@/hooks/toast/useToast.js";
|
||||||
|
@ -87,6 +87,7 @@
|
|||||||
:loading="loading"
|
:loading="loading"
|
||||||
:disabled="isButtonDisabled"
|
:disabled="isButtonDisabled"
|
||||||
@click="doneSet"
|
@click="doneSet"
|
||||||
|
v-if="hasPermission('APP-scanAdd')"
|
||||||
>
|
>
|
||||||
{{ buttonText }}</up-button
|
{{ buttonText }}</up-button
|
||||||
>
|
>
|
||||||
@ -98,7 +99,7 @@ import { ref, reactive, onBeforeMount } from "vue";
|
|||||||
import useToast from "@/hooks/toast/useToast.js";
|
import useToast from "@/hooks/toast/useToast.js";
|
||||||
import { onLoad, onReachBottom } from "@dcloudio/uni-app";
|
import { onLoad, onReachBottom } from "@dcloudio/uni-app";
|
||||||
import { creChangepainting, add } from "@/api/login.js";
|
import { creChangepainting, add } from "@/api/login.js";
|
||||||
import { closeWebview } from "../../../utils/index";
|
import { closeWebview, hasPermission } from "../../../utils/index";
|
||||||
|
|
||||||
const { showMessage } = useToast();
|
const { showMessage } = useToast();
|
||||||
const loading = ref(false);
|
const loading = ref(false);
|
||||||
|
@ -245,10 +245,10 @@ const logining = async () => {
|
|||||||
loading.value = false;
|
loading.value = false;
|
||||||
};
|
};
|
||||||
const getBtngetRules = async () => {
|
const getBtngetRules = async () => {
|
||||||
const res = await getRules();
|
const res = await getRules({});
|
||||||
if (res.status === 0) {
|
if (res.status === 0) {
|
||||||
const ruleBtn =
|
const ruleBtn = res.data.MyButtonAuths?.map((button) => button.Url) || [];
|
||||||
res.data.data.MyButtonAuths?.map((button) => button.Url) || [];
|
console.log(123, ruleBtn);
|
||||||
uni.setStorageSync("ruleBtn", ruleBtn);
|
uni.setStorageSync("ruleBtn", ruleBtn);
|
||||||
} else {
|
} else {
|
||||||
showMessage({ type: "error", message: res.msg });
|
showMessage({ type: "error", message: res.msg });
|
||||||
|
@ -43,6 +43,7 @@
|
|||||||
@click="doneSet"
|
@click="doneSet"
|
||||||
:disabled="isButtonDisabled"
|
:disabled="isButtonDisabled"
|
||||||
:loading="loading"
|
:loading="loading"
|
||||||
|
v-if="hasPermission('APP-scanEnteringwarehouse')"
|
||||||
>{{ buttonText }}</up-button
|
>{{ buttonText }}</up-button
|
||||||
>
|
>
|
||||||
</view>
|
</view>
|
||||||
@ -53,7 +54,7 @@ import { ref, reactive, onBeforeMount } from "vue";
|
|||||||
import useToast from "@/hooks/toast/useToast.js";
|
import useToast from "@/hooks/toast/useToast.js";
|
||||||
import { onLoad } from "@dcloudio/uni-app";
|
import { onLoad } from "@dcloudio/uni-app";
|
||||||
import { freebox, bind, check_freebox, cancel } from "@/api/login.js";
|
import { freebox, bind, check_freebox, cancel } from "@/api/login.js";
|
||||||
import { closeWebview } from "../../../utils/index";
|
import { closeWebview, hasPermission } from "../../../utils/index";
|
||||||
const { showMessage } = useToast();
|
const { showMessage } = useToast();
|
||||||
const loading = ref(false);
|
const loading = ref(false);
|
||||||
const isButtonDisabled = ref(false);
|
const isButtonDisabled = ref(false);
|
||||||
@ -142,12 +143,12 @@ const check = async () => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
const runTimeEnv = () => {
|
const runTimeEnv = () => {
|
||||||
|
try {
|
||||||
if (plus) {
|
if (plus) {
|
||||||
const currentWebView = plus.webview.getWebviewById("wv");
|
const currentWebView = plus.webview.getWebviewById("wv");
|
||||||
return currentWebView.RunTime === "app";
|
return currentWebView.RunTime === "app";
|
||||||
} else {
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
} catch (e) {}
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
@ -24,3 +24,11 @@ export const OAorMc = () => {
|
|||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
export const hasPermission = (userPermission) => {
|
||||||
|
let userPermissionList = Array.isArray(userPermission)
|
||||||
|
? userPermission
|
||||||
|
: [userPermission];
|
||||||
|
// 当前用户的权限列表
|
||||||
|
let permissionList = Local.get("ruleBtn") ? Local.get("ruleBtn") : [];
|
||||||
|
return userPermissionList.some((e) => permissionList.includes(e));
|
||||||
|
};
|
||||||
|
@ -1,22 +0,0 @@
|
|||||||
export default (app) => {
|
|
||||||
// 按钮权限/show-btn
|
|
||||||
app.directive("permission", {
|
|
||||||
beforeMount(el, binding) {
|
|
||||||
const btnList = uni.getStorageSync("ruleBtn")
|
|
||||||
? uni.getStorageSync("ruleBtn")
|
|
||||||
: [];
|
|
||||||
if (
|
|
||||||
(binding.value &&
|
|
||||||
btnList.length > 0 &&
|
|
||||||
!btnList.includes(binding.value)) ||
|
|
||||||
btnList.length == 0
|
|
||||||
) {
|
|
||||||
// 解决进入页面按钮会闪一下再消失问题
|
|
||||||
el.style.display = "none";
|
|
||||||
setTimeout(() => {
|
|
||||||
el.parentNode.removeChild(el);
|
|
||||||
}, 0);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
});
|
|
||||||
};
|
|
Loading…
Reference in New Issue
Block a user