feat: #7648 handle NavBar
This commit is contained in:
parent
e26ef0bf66
commit
e418a647be
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 |
|
@ -8,6 +8,7 @@ import { useQuasar } from 'quasar';
|
|||
import PinnedModules from './PinnedModules.vue';
|
||||
import UserPanel from 'components/UserPanel.vue';
|
||||
import VnBreadcrumbs from './common/VnBreadcrumbs.vue';
|
||||
import VnImg from 'src/components/ui/VnImg.vue';
|
||||
|
||||
const { t } = useI18n();
|
||||
const stateStore = useStateStore();
|
||||
|
@ -83,11 +84,12 @@ const pinnedModulesRef = ref();
|
|||
id="user"
|
||||
>
|
||||
<QAvatar size="lg">
|
||||
<QImg
|
||||
:src="`/api/Images/user/160x160/${user.id}/download?access_token=${token}`"
|
||||
spinner-color="primary"
|
||||
>
|
||||
</QImg>
|
||||
<VnImg
|
||||
:id="user.id"
|
||||
collection="user"
|
||||
size="160x160"
|
||||
:zoom-size="null"
|
||||
/>
|
||||
</QAvatar>
|
||||
<QTooltip bottom>
|
||||
{{ t('globals.userPanel') }}
|
||||
|
|
|
@ -11,12 +11,15 @@ import VnSelect from 'src/components/common/VnSelect.vue';
|
|||
import VnRow from 'components/ui/VnRow.vue';
|
||||
import FetchData from 'components/FetchData.vue';
|
||||
import { useClipboard } from 'src/composables/useClipboard';
|
||||
import VnImg from 'src/components/ui/VnImg.vue';
|
||||
import { useRole } from 'src/composables/useRole';
|
||||
|
||||
const state = useState();
|
||||
const session = useSession();
|
||||
const router = useRouter();
|
||||
const { t, locale } = useI18n();
|
||||
const { copyText } = useClipboard();
|
||||
|
||||
const userLocale = computed({
|
||||
get() {
|
||||
return locale.value;
|
||||
|
@ -99,6 +102,7 @@ function saveUserData(param, value) {
|
|||
axios.post('UserConfigs/setUserConfig', { [param]: value });
|
||||
localUserData();
|
||||
}
|
||||
const isEmployee = computed(() => useRole().hasAny(['employee']));
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
@ -109,12 +113,14 @@ function saveUserData(param, value) {
|
|||
auto-load
|
||||
/>
|
||||
<FetchData
|
||||
v-if="isEmployee"
|
||||
url="Companies"
|
||||
order="name"
|
||||
@on-fetch="(data) => (companiesData = data)"
|
||||
auto-load
|
||||
/>
|
||||
<FetchData
|
||||
v-if="isEmployee"
|
||||
url="Accountings"
|
||||
order="name"
|
||||
@on-fetch="(data) => (accountBankData = data)"
|
||||
|
@ -149,10 +155,11 @@ function saveUserData(param, value) {
|
|||
|
||||
<div class="col column items-center q-mb-sm">
|
||||
<QAvatar size="80px">
|
||||
<QImg
|
||||
<VnImg :id="user.id" size="160x160" />
|
||||
<!-- <QImg
|
||||
:src="`/api/Images/user/160x160/${user.id}/download?access_token=${token}`"
|
||||
spinner-color="white"
|
||||
/>
|
||||
/> -->
|
||||
</QAvatar>
|
||||
|
||||
<div class="text-subtitle1 q-mt-md">
|
||||
|
|
|
@ -0,0 +1,78 @@
|
|||
<script setup>
|
||||
import { ref, computed } from 'vue';
|
||||
import { useSession } from 'src/composables/useSession';
|
||||
|
||||
const $props = defineProps({
|
||||
storage: {
|
||||
type: [String, Number],
|
||||
default: 'Images',
|
||||
},
|
||||
collection: {
|
||||
type: String,
|
||||
default: 'catalog',
|
||||
},
|
||||
size: {
|
||||
type: String,
|
||||
default: '200x200',
|
||||
},
|
||||
zoomSize: {
|
||||
type: String,
|
||||
required: false,
|
||||
default: 'lg',
|
||||
},
|
||||
id: {
|
||||
type: Number,
|
||||
required: true,
|
||||
},
|
||||
});
|
||||
const show = ref(false);
|
||||
const token = useSession().getTokenMultimedia();
|
||||
const timeStamp = ref(`timestamp=${Date.now()}`);
|
||||
import noImage from '/public/no-user.png';
|
||||
import { useRole } from 'src/composables/useRole';
|
||||
const url = computed(() => {
|
||||
const isEmployee = useRole().hasAny(['employee']);
|
||||
return isEmployee
|
||||
? `/api/${$props.storage}/${$props.collection}/${$props.size}/${$props.id}/download?access_token=${token}&${timeStamp.value}`
|
||||
: noImage;
|
||||
});
|
||||
const reload = () => {
|
||||
timeStamp.value = `timestamp=${Date.now()}`;
|
||||
};
|
||||
defineExpose({
|
||||
reload,
|
||||
});
|
||||
</script>
|
||||
<template>
|
||||
<QImg
|
||||
:class="{ zoomIn: $props.zoomSize }"
|
||||
:src="url"
|
||||
v-bind="$attrs"
|
||||
@click="show = !show"
|
||||
spinner-color="primary"
|
||||
/>
|
||||
<QDialog v-model="show" v-if="$props.zoomSize">
|
||||
<QImg
|
||||
:src="url"
|
||||
size="full"
|
||||
class="img_zoom"
|
||||
v-bind="$attrs"
|
||||
spinner-color="primary"
|
||||
/>
|
||||
</QDialog>
|
||||
</template>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.q-img {
|
||||
&.zoomIn {
|
||||
cursor: zoom-in;
|
||||
}
|
||||
min-width: 50px;
|
||||
}
|
||||
.rounded {
|
||||
border-radius: 50%;
|
||||
}
|
||||
.img_zoom {
|
||||
border-radius: 0%;
|
||||
}
|
||||
</style>
|
|
@ -27,8 +27,12 @@ export function useRole() {
|
|||
|
||||
return false;
|
||||
}
|
||||
function isEmployee() {
|
||||
return !hasAny(['employee']);
|
||||
}
|
||||
|
||||
return {
|
||||
isEmployee,
|
||||
fetch,
|
||||
hasAny,
|
||||
state,
|
||||
|
|
Loading…
Reference in New Issue