tg style
This commit is contained in:
parent
f29e667561
commit
5f027e2066
|
@ -1,13 +1,16 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
const config = useRuntimeConfig()
|
|
||||||
console.log(config.public.tgbot)
|
|
||||||
import { telegramLoginTemp } from 'vue3-telegram-login'
|
import { telegramLoginTemp } from 'vue3-telegram-login'
|
||||||
|
|
||||||
|
const config = useRuntimeConfig()
|
||||||
const items = ref()
|
const items = ref()
|
||||||
const page = ref(1)
|
const page = ref(1)
|
||||||
const pagination = ref({ total: 10, pageCount: 10 })
|
const pagination = ref({ total: 10, pageCount: 10 })
|
||||||
|
|
||||||
const user_id = ref()
|
const user_id = ref()
|
||||||
|
|
||||||
|
if (process.env.NODE_ENV == 'development') {
|
||||||
|
user_id.value = ''
|
||||||
|
}
|
||||||
|
|
||||||
const loadData = async () => {
|
const loadData = async () => {
|
||||||
const items_data = await apiCall<ApiPaged<TgItem>>(`tgbot/?page=${page.value}&user_id=${user_id.value || ''}`)
|
const items_data = await apiCall<ApiPaged<TgItem>>(`tgbot/?page=${page.value}&user_id=${user_id.value || ''}`)
|
||||||
const res = items_data.results
|
const res = items_data.results
|
||||||
|
@ -39,7 +42,6 @@ const columns = [
|
||||||
]
|
]
|
||||||
|
|
||||||
const testCallback = (user: any) => {
|
const testCallback = (user: any) => {
|
||||||
console.log(user)
|
|
||||||
user_id.value = user.id
|
user_id.value = user.id
|
||||||
loadData()
|
loadData()
|
||||||
}
|
}
|
||||||
|
@ -48,10 +50,15 @@ const testCallback = (user: any) => {
|
||||||
<div class="col-span-12 page-header">
|
<div class="col-span-12 page-header">
|
||||||
<h1>Проведенные инвентаризации</h1>
|
<h1>Проведенные инвентаризации</h1>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-span-12" v-if="!user_id">
|
<div class="col-span-12" v-if="user_id == undefined">
|
||||||
|
<UCard>
|
||||||
|
<template #header>
|
||||||
|
Необходимо залогиниться
|
||||||
|
</template>
|
||||||
<telegramLoginTemp mode="callback" :telegram-login="config.public.tgbot" @callback="testCallback" />
|
<telegramLoginTemp mode="callback" :telegram-login="config.public.tgbot" @callback="testCallback" />
|
||||||
|
</UCard>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-span-12" v-if="user_id">
|
<div class="col-span-12" v-else>
|
||||||
<UTable :rows="items" :columns="columns" :ui="{ td: { base: 'whitespace-normal max-w-sm align-top' } }">
|
<UTable :rows="items" :columns="columns" :ui="{ td: { base: 'whitespace-normal max-w-sm align-top' } }">
|
||||||
<template #name-data="{ row }">
|
<template #name-data="{ row }">
|
||||||
<h3>
|
<h3>
|
||||||
|
|
Loading…
Reference in New Issue