feat: userPanel
This commit is contained in:
parent
f7135008a2
commit
86a84784b1
Binary file not shown.
After Width: | Height: | Size: 6.9 KiB |
Binary file not shown.
After Width: | Height: | Size: 2.1 KiB |
Binary file not shown.
After Width: | Height: | Size: 9.9 KiB |
|
@ -66,9 +66,8 @@ function getRoutes() {
|
||||||
const moduleDef = routes.find(
|
const moduleDef = routes.find(
|
||||||
(route) => toLowerCamel(route.name) === item.module
|
(route) => toLowerCamel(route.name) === item.module
|
||||||
);
|
);
|
||||||
item.children = [];
|
|
||||||
|
|
||||||
if (!moduleDef) continue;
|
if (!moduleDef) continue;
|
||||||
|
item.children = [];
|
||||||
|
|
||||||
addChildren(item.module, moduleDef, item.children);
|
addChildren(item.module, moduleDef, item.children);
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,7 +21,7 @@ const itemComputed = computed(() => {
|
||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
<QItem
|
<QItem
|
||||||
active-class="bg-hover"
|
active-class="bg-vn-hover"
|
||||||
class="min-height"
|
class="min-height"
|
||||||
:to="{ name: itemComputed.name }"
|
:to="{ name: itemComputed.name }"
|
||||||
clickable
|
clickable
|
||||||
|
|
|
@ -1,21 +1,19 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { onMounted, ref } from 'vue';
|
import { onMounted, ref } from 'vue';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
import { useSession } from 'src/composables/useSession';
|
|
||||||
import { useState } from 'src/composables/useState';
|
import { useState } from 'src/composables/useState';
|
||||||
import { useStateStore } from 'stores/useStateStore';
|
import { useStateStore } from 'stores/useStateStore';
|
||||||
import { useQuasar } from 'quasar';
|
import { useQuasar } from 'quasar';
|
||||||
import PinnedModules from './PinnedModules.vue';
|
import PinnedModules from './PinnedModules.vue';
|
||||||
import UserPanel from 'components/UserPanel.vue';
|
import UserPanel from 'components/UserPanel.vue';
|
||||||
import VnBreadcrumbs from './common/VnBreadcrumbs.vue';
|
import VnBreadcrumbs from './common/VnBreadcrumbs.vue';
|
||||||
|
import VnImg from 'src/components/ui/VnImg.vue';
|
||||||
|
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const stateStore = useStateStore();
|
const stateStore = useStateStore();
|
||||||
const quasar = useQuasar();
|
const quasar = useQuasar();
|
||||||
const state = useState();
|
const state = useState();
|
||||||
const user = state.getUser();
|
const user = state.getUser();
|
||||||
const { getTokenMultimedia } = useSession();
|
|
||||||
const token = getTokenMultimedia();
|
|
||||||
const appName = 'Lilium';
|
const appName = 'Lilium';
|
||||||
|
|
||||||
onMounted(() => stateStore.setMounted());
|
onMounted(() => stateStore.setMounted());
|
||||||
|
@ -83,11 +81,12 @@ const pinnedModulesRef = ref();
|
||||||
id="user"
|
id="user"
|
||||||
>
|
>
|
||||||
<QAvatar size="lg">
|
<QAvatar size="lg">
|
||||||
<QImg
|
<VnImg
|
||||||
:src="`/api/Images/user/160x160/${user.id}/download?access_token=${token}`"
|
:id="user.id"
|
||||||
spinner-color="primary"
|
collection="user"
|
||||||
>
|
size="160x160"
|
||||||
</QImg>
|
:zoom-size="null"
|
||||||
|
/>
|
||||||
</QAvatar>
|
</QAvatar>
|
||||||
<QTooltip bottom>
|
<QTooltip bottom>
|
||||||
{{ t('globals.userPanel') }}
|
{{ t('globals.userPanel') }}
|
||||||
|
|
|
@ -12,6 +12,7 @@ import VnRow from 'components/ui/VnRow.vue';
|
||||||
import FetchData from 'components/FetchData.vue';
|
import FetchData from 'components/FetchData.vue';
|
||||||
import { useClipboard } from 'src/composables/useClipboard';
|
import { useClipboard } from 'src/composables/useClipboard';
|
||||||
import VnImg from 'src/components/ui/VnImg.vue';
|
import VnImg from 'src/components/ui/VnImg.vue';
|
||||||
|
import { useRole } from 'src/composables/useRole';
|
||||||
|
|
||||||
const state = useState();
|
const state = useState();
|
||||||
const session = useSession();
|
const session = useSession();
|
||||||
|
@ -99,6 +100,7 @@ function saveUserData(param, value) {
|
||||||
axios.post('UserConfigs/setUserConfig', { [param]: value });
|
axios.post('UserConfigs/setUserConfig', { [param]: value });
|
||||||
localUserData();
|
localUserData();
|
||||||
}
|
}
|
||||||
|
const isEmployee = computed(() => useRole().isEmployee());
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
@ -109,12 +111,14 @@ function saveUserData(param, value) {
|
||||||
auto-load
|
auto-load
|
||||||
/>
|
/>
|
||||||
<FetchData
|
<FetchData
|
||||||
|
v-if="isEmployee"
|
||||||
url="Companies"
|
url="Companies"
|
||||||
order="name"
|
order="name"
|
||||||
@on-fetch="(data) => (companiesData = data)"
|
@on-fetch="(data) => (companiesData = data)"
|
||||||
auto-load
|
auto-load
|
||||||
/>
|
/>
|
||||||
<FetchData
|
<FetchData
|
||||||
|
v-if="isEmployee"
|
||||||
url="Accountings"
|
url="Accountings"
|
||||||
order="name"
|
order="name"
|
||||||
@on-fetch="(data) => (accountBankData = data)"
|
@on-fetch="(data) => (accountBankData = data)"
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { ref, computed, onMounted } from 'vue';
|
import { ref, computed } from 'vue';
|
||||||
import { useSession } from 'src/composables/useSession';
|
import { useSession } from 'src/composables/useSession';
|
||||||
|
|
||||||
const $props = defineProps({
|
const $props = defineProps({
|
||||||
|
@ -28,21 +28,29 @@ const $props = defineProps({
|
||||||
const show = ref(false);
|
const show = ref(false);
|
||||||
const token = useSession().getTokenMultimedia();
|
const token = useSession().getTokenMultimedia();
|
||||||
const timeStamp = ref(`timestamp=${Date.now()}`);
|
const timeStamp = ref(`timestamp=${Date.now()}`);
|
||||||
const url = computed(
|
import noImage from '/no-user.png';
|
||||||
() =>
|
import { useRole } from 'src/composables/useRole';
|
||||||
`/api/${$props.storage}/${$props.collection}/${$props.size}/${$props.id}/download?access_token=${token}&${timeStamp.value}`
|
const url = computed(() => {
|
||||||
);
|
const isEmployee = useRole().isEmployee();
|
||||||
|
return isEmployee
|
||||||
|
? `/api/${$props.storage}/${$props.collection}/${$props.size}/${$props.id}/download?access_token=${token}&${timeStamp.value}`
|
||||||
|
: noImage;
|
||||||
|
});
|
||||||
const reload = () => {
|
const reload = () => {
|
||||||
timeStamp.value = `timestamp=${Date.now()}`;
|
timeStamp.value = `timestamp=${Date.now()}`;
|
||||||
};
|
};
|
||||||
defineExpose({
|
defineExpose({
|
||||||
reload,
|
reload,
|
||||||
});
|
});
|
||||||
|
|
||||||
onMounted(() => {});
|
|
||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
<QImg :src="url" v-bind="$attrs" @click="show = !show" spinner-color="primary" />
|
<QImg
|
||||||
|
:class="{ zoomIn: $props.zoomSize }"
|
||||||
|
:src="url"
|
||||||
|
v-bind="$attrs"
|
||||||
|
@click="show = !show"
|
||||||
|
spinner-color="primary"
|
||||||
|
/>
|
||||||
<QDialog v-model="show" v-if="$props.zoomSize">
|
<QDialog v-model="show" v-if="$props.zoomSize">
|
||||||
<QImg
|
<QImg
|
||||||
:src="url"
|
:src="url"
|
||||||
|
@ -56,7 +64,9 @@ onMounted(() => {});
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
.q-img {
|
.q-img {
|
||||||
|
&.zoomIn {
|
||||||
cursor: zoom-in;
|
cursor: zoom-in;
|
||||||
|
}
|
||||||
min-width: 50px;
|
min-width: 50px;
|
||||||
}
|
}
|
||||||
.rounded {
|
.rounded {
|
||||||
|
|
|
@ -27,8 +27,12 @@ export function useRole() {
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
function isEmployee() {
|
||||||
|
return hasAny(['employee']);
|
||||||
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
isEmployee,
|
||||||
fetch,
|
fetch,
|
||||||
hasAny,
|
hasAny,
|
||||||
state,
|
state,
|
||||||
|
|
Loading…
Reference in New Issue