This commit is contained in:
Viet An
2026-06-09 11:43:27 +07:00
parent 5325168248
commit bb05320d65
19 changed files with 418 additions and 1008 deletions

View File

@@ -121,12 +121,12 @@
</template>
<script setup>
import Avatarbox from "~/components/common/Avatarbox.vue";
import { watch } from "vue";
const router = useRouter();
const route = useRoute();
const emit = defineEmits(["changeTab"]);
const { $find, $filter, $store, $snackbar } = useNuxtApp();
const lang = ref($store.lang);
const lang = computed(() => $store.lang);
const menu = $filter($store.common, { category: "topmenu" });
// if($store.rights.length>0) {
// menu = menu.filter(v=>$findIndex($store.rights, {setting: v.id})>=0)
@@ -148,7 +148,7 @@ const currentTab = ref(leftmenu[0]);
const subTab = ref();
const tabConfig = $find(menu, { code: "configuration" });
const avatar = ref();
const isAdmin = ref();
const isAdmin = computed(() => $store.login.type__code === "admin");
function toggleBurger() {
const target = document.getElementById("burger");
@@ -174,8 +174,8 @@ function changeTab(tab, subtab) {
subTab.value = subtab;
emit("changeTab", tab, subtab);
closeMenu();
let query = subtab ? { tab: tab.code, subtab: subtab.code } : { tab: tab.code };
router.push({ query: query });
const query = subtab ? { tab: tab.code, subtab: subtab.code } : { tab: tab.code };
router.push({ query });
}
function openProfile() {
$store.commit("showmodal", {
@@ -187,6 +187,7 @@ function openProfile() {
}
const found = route.query.tab && $find(menu, { code: route.query.tab });
if (found || currentTab.value) changeTab(found || currentTab.value);
onMounted(() => {
if (!$store.login) return;
avatar.value = {
@@ -195,7 +196,6 @@ onMounted(() => {
size: "two",
type: "findata",
};
isAdmin.value = $store.login.type__code === "admin";
});
watch(
() => $store.login,
@@ -207,8 +207,6 @@ watch(
size: "two",
type: "findata",
};
isAdmin.value = $store.login.type__code === "admin";
lang.value = $store.lang;
},
);
</script>