TEST UPD
- add test page
This commit is contained in:
64
frontend/src/pages/Test.vue
Normal file
64
frontend/src/pages/Test.vue
Normal file
@@ -0,0 +1,64 @@
|
||||
<template>
|
||||
<div class="p-6">
|
||||
|
||||
<!-- Загрузка -->
|
||||
<div v-if="loading">Загружаем...</div>
|
||||
|
||||
<!-- Ошибка -->
|
||||
<div v-else-if="error">
|
||||
Ошибка загрузки: {{ error.message }}
|
||||
</div>
|
||||
|
||||
<!-- Когда данные есть -->
|
||||
<div v-else>
|
||||
<h2 class="text-xl font-semibold">Пользователь: {{ userInfo.full_name }}</h2>
|
||||
|
||||
<p class="mt-3 text-gray-700">
|
||||
Email: {{ userInfo.email }}
|
||||
</p>
|
||||
|
||||
<p class="mt-3 font-medium">Роли:</p>
|
||||
<ul class="list-disc ml-6 text-gray-800">
|
||||
<li v-for="role in userInfo.roles" :key="role">{{ role }}</li>
|
||||
</ul>
|
||||
|
||||
<p class="mt-6 text-sm opacity-70">
|
||||
Is Student? — {{ userInfo.is_student }}
|
||||
</p>
|
||||
<p class="text-sm opacity-70">
|
||||
Is Instructor? — {{ userInfo.is_instructor }}
|
||||
</p>
|
||||
<p class="text-sm opacity-70">
|
||||
Is Moderator? — {{ userInfo.is_moderator }}
|
||||
</p>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, onMounted } from "vue"
|
||||
|
||||
const userInfo = ref(null)
|
||||
const loading = ref(true)
|
||||
const error = ref(null)
|
||||
|
||||
async function loadUserInfo() {
|
||||
try {
|
||||
const { message } = await frappe.call({
|
||||
method: "lms.api.get_user_info",
|
||||
})
|
||||
|
||||
userInfo.value = message
|
||||
} catch (err) {
|
||||
console.error("Ошибка загрузки пользователя:", err)
|
||||
error.value = err
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
loadUserInfo()
|
||||
})
|
||||
</script>
|
||||
@@ -10,6 +10,11 @@ const routes = [
|
||||
component: () => import('@/pages/Home/Home.vue'),
|
||||
},
|
||||
//Test of page
|
||||
{
|
||||
path: '/test',
|
||||
name: 'Test',
|
||||
component: () => import('@/pages/Test.vue'),
|
||||
},
|
||||
{
|
||||
path: '/schoolchildren',
|
||||
name: 'SchoolchildrenProfile',
|
||||
|
||||
Reference in New Issue
Block a user