แสดงรูป Profile
This commit is contained in:
parent
acf7986a41
commit
f3d275df0a
3 changed files with 43 additions and 12 deletions
|
|
@ -1,9 +1,13 @@
|
||||||
import env from './index'
|
import env from './index'
|
||||||
const leave = `${env.API_URI}/leave`
|
const leave = `${env.API_URI}/leave`
|
||||||
|
const urlFile = `${env.API_URI}/salary`
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
checkin: () => `${leave}/check-in`,
|
checkin: () => `${leave}/check-in`,
|
||||||
checkTime: () => `${leave}/check-time`,
|
checkTime: () => `${leave}/check-time`,
|
||||||
|
|
||||||
keycloakLogSSO: `${env.API_URI}/org/keycloak/log/sso`,
|
keycloakLogSSO: `${env.API_URI}/org/keycloak/log/sso`,
|
||||||
|
keycloakPosition: () => `${env.API_URI}/org/profile/keycloak/position`,
|
||||||
|
fileByFile: (name: string, group: string, id: string, fileName: string) =>
|
||||||
|
`${urlFile}/file/${name}/${group}/${id}/${fileName}`,
|
||||||
}
|
}
|
||||||
|
|
|
||||||
BIN
src/assets/avatar_user.jpg
Normal file
BIN
src/assets/avatar_user.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 13 KiB |
|
|
@ -5,6 +5,7 @@ import { useRouter } from 'vue-router'
|
||||||
|
|
||||||
import http from '@/plugins/http'
|
import http from '@/plugins/http'
|
||||||
import config from '@/app.config'
|
import config from '@/app.config'
|
||||||
|
import avatar from '@/assets/avatar_user.jpg'
|
||||||
import { logout, tokenParsed } from '@/plugins/auth'
|
import { logout, tokenParsed } from '@/plugins/auth'
|
||||||
import { useCounterMixin } from '@/stores/mixin'
|
import { useCounterMixin } from '@/stores/mixin'
|
||||||
|
|
||||||
|
|
@ -153,6 +154,33 @@ function getLandingUrl() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** ฟังก์ชันเรียกข้อมูลผู้ใช่งาน*/
|
||||||
|
async function fetchKeycloakPosition() {
|
||||||
|
await http
|
||||||
|
.get(config.API.keycloakPosition())
|
||||||
|
.then(async (res) => {
|
||||||
|
const data = await res.data.result
|
||||||
|
//เช็คว่ามีรูปไหม ถ้ามีรูปเรียกข้อมูลรูป
|
||||||
|
if (data.avatarName) {
|
||||||
|
await getImg(data.profileId, data.avatarName)
|
||||||
|
} else {
|
||||||
|
profileImg.value = avatar
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch((err) => {
|
||||||
|
messageError($q, err)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
const profileImg = ref<string>('')
|
||||||
|
async function getImg(id: string, pathName: string) {
|
||||||
|
await http
|
||||||
|
.get(config.API.fileByFile('ทะเบียนประวัติ', 'โปรไฟล์', id, pathName))
|
||||||
|
.then((res) => {
|
||||||
|
profileImg.value = res.data.downloadUrl
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
watch(
|
watch(
|
||||||
() => notiTrigger.value,
|
() => notiTrigger.value,
|
||||||
() => {
|
() => {
|
||||||
|
|
@ -169,6 +197,7 @@ watch(
|
||||||
|
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
fetchTotolNotificate()
|
fetchTotolNotificate()
|
||||||
|
fetchKeycloakPosition()
|
||||||
const checkTokenParsed = await tokenParsed()
|
const checkTokenParsed = await tokenParsed()
|
||||||
if (checkTokenParsed != null) {
|
if (checkTokenParsed != null) {
|
||||||
fullName.value = checkTokenParsed.name
|
fullName.value = checkTokenParsed.name
|
||||||
|
|
@ -318,20 +347,18 @@ onMounted(async () => {
|
||||||
</div>
|
</div>
|
||||||
</q-menu>
|
</q-menu>
|
||||||
</q-btn>
|
</q-btn>
|
||||||
<q-btn
|
|
||||||
round
|
<q-btn round dense color="white" flat style="font-size: 16px">
|
||||||
dense
|
<q-avatar size="30px">
|
||||||
color="white"
|
<q-img :src="profileImg" spinner-color="white" />
|
||||||
flat
|
</q-avatar>
|
||||||
icon="account_circle"
|
|
||||||
style="font-size: 16px"
|
|
||||||
>
|
|
||||||
<q-menu style="width: 250px">
|
<q-menu style="width: 250px">
|
||||||
<div class="column items-center col-12 q-py-md" color="grey-3">
|
<div class="column items-center col-12 q-py-md" color="grey-3">
|
||||||
<!-- <q-avatar size="72px" color="grey-4"> -->
|
<q-avatar size="72px" color="grey-4">
|
||||||
<q-icon color="primary" name="account_circle" size="32px" />
|
<!-- <q-icon color="primary" name="account_circle" size="32px" /> -->
|
||||||
<!-- <img :src="require('@/assets/logo.png')" /> -->
|
<q-img :src="profileImg" spinner-color="black" />
|
||||||
<!-- </q-avatar> -->
|
<!-- <img :src="require('@/assets/logo.png')" /> -->
|
||||||
|
</q-avatar>
|
||||||
<div class="text-subtitle2 q-mt-md q-mb-xs text-center">
|
<div class="text-subtitle2 q-mt-md q-mb-xs text-center">
|
||||||
{{ fullName }}
|
{{ fullName }}
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue