Compare commits
No commits in common. "c74032d1d047fc862f197a62757c795af1e96a2b" and "a811644585e52ea7de81e222680f1d330225e3ac" have entirely different histories.
c74032d1d0
...
a811644585
19 changed files with 67 additions and 761 deletions
|
|
@ -1,27 +0,0 @@
|
||||||
<script setup>
|
|
||||||
const props = defineProps({
|
|
||||||
color: {
|
|
||||||
type: String,
|
|
||||||
default: '#EF2D56FF'
|
|
||||||
},
|
|
||||||
bg_color: {
|
|
||||||
type: String,
|
|
||||||
default: '#FFFFFF'
|
|
||||||
}
|
|
||||||
})
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<template>
|
|
||||||
<span class="color-dot" :style="{ borderColor: color, backgroundColor: bg_color }"></span>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<style scoped>
|
|
||||||
.color-dot {
|
|
||||||
display: inline-block;
|
|
||||||
width: 8px;
|
|
||||||
height: 8px;
|
|
||||||
border-radius: 50%;
|
|
||||||
border: 1px solid; /* чтобы border-color работал */
|
|
||||||
vertical-align: middle;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
|
|
@ -1,45 +0,0 @@
|
||||||
<script setup>
|
|
||||||
const props = defineProps({
|
|
||||||
text: {
|
|
||||||
type: String,
|
|
||||||
required: true,
|
|
||||||
default: 'label'
|
|
||||||
},
|
|
||||||
color: {
|
|
||||||
type: String,
|
|
||||||
default: '#EF2D56FF'
|
|
||||||
},
|
|
||||||
bg_color: {
|
|
||||||
type: String,
|
|
||||||
default: '#FFFFFF'
|
|
||||||
}
|
|
||||||
})
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<template>
|
|
||||||
<label class="custom_label"
|
|
||||||
:style="{color: color, backgroundColor: bg_color, borderColor: color}"
|
|
||||||
>
|
|
||||||
{{ text }}
|
|
||||||
</label>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<style scoped>
|
|
||||||
.custom_label {
|
|
||||||
font-family: 'Heebo', sans-serif;
|
|
||||||
font-size: 0.75rem;
|
|
||||||
font-weight: 500;
|
|
||||||
letter-spacing: 0.025rem;
|
|
||||||
font-style: normal;
|
|
||||||
text-transform: uppercase;
|
|
||||||
border-radius: 1.25rem;
|
|
||||||
-webkit-border-radius: 1.25rem;
|
|
||||||
-moz-border-radius: 1.25rem;
|
|
||||||
padding: 0.35rem 0.75rem;
|
|
||||||
border-style: solid;
|
|
||||||
border-width: 0.125rem;
|
|
||||||
-webkit-box-shadow: none;
|
|
||||||
-moz-box-shadow: none;
|
|
||||||
-box-shadow: none;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
|
|
@ -1,7 +0,0 @@
|
||||||
<template>
|
|
||||||
<n-button type="primary">
|
|
||||||
<router-link :to="{ name: 'labels' }" class="router-link-button">
|
|
||||||
Manage labels
|
|
||||||
</router-link>
|
|
||||||
</n-button>
|
|
||||||
</template>
|
|
||||||
|
|
@ -28,7 +28,6 @@ const authMenu = computed(() => {
|
||||||
}
|
}
|
||||||
|
|
||||||
return [
|
return [
|
||||||
{ label: 'Labels', key: 'labels' },
|
|
||||||
{ label: 'Personal', key: 'personal' },
|
{ label: 'Personal', key: 'personal' },
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
|
|
@ -138,7 +137,7 @@ const renderLabel = (option) => {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
margin-left: auto;
|
margin-left: auto;
|
||||||
min-width: 250px;
|
min-width: 150px;
|
||||||
padding-right: 16px;
|
padding-right: 16px;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,6 @@ import ParsersView from '@/views/ParsersView.vue'
|
||||||
import PersonalView from '@/views/PersonalView.vue'
|
import PersonalView from '@/views/PersonalView.vue'
|
||||||
import AddMerchView from '@/views/AddMerchView.vue'
|
import AddMerchView from '@/views/AddMerchView.vue'
|
||||||
import DetailsView from '@/views/DetailsView.vue'
|
import DetailsView from '@/views/DetailsView.vue'
|
||||||
import LabelsView from '@/views/LabelsView.vue'
|
|
||||||
|
|
||||||
const router = createRouter({
|
const router = createRouter({
|
||||||
history: createWebHistory(import.meta.env.BASE_URL),
|
history: createWebHistory(import.meta.env.BASE_URL),
|
||||||
|
|
@ -53,11 +52,6 @@ const router = createRouter({
|
||||||
component: DetailsView,
|
component: DetailsView,
|
||||||
props: true,
|
props: true,
|
||||||
},
|
},
|
||||||
{
|
|
||||||
path: '/labels',
|
|
||||||
name: 'labels',
|
|
||||||
component: LabelsView,
|
|
||||||
},
|
|
||||||
],
|
],
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,23 +6,23 @@ let isRefreshing = false
|
||||||
let refreshPromise = null
|
let refreshPromise = null
|
||||||
|
|
||||||
function createConfig(options = {}) {
|
function createConfig(options = {}) {
|
||||||
const token = localStorage.getItem('accessToken');
|
const authStore = useAuthStore()
|
||||||
const headers = {
|
const headers = {
|
||||||
'Content-Type': 'application/json',
|
'Content-Type': 'application/json',
|
||||||
...options.headers,
|
...options.headers,
|
||||||
};
|
}
|
||||||
|
|
||||||
if (token) {
|
if (authStore.accessToken) {
|
||||||
headers['Authorization'] = `Bearer ${token}`;
|
headers['Authorization'] = `Bearer ${authStore.accessToken}`
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
headers,
|
headers,
|
||||||
|
credentials: 'include',
|
||||||
...options,
|
...options,
|
||||||
};
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
async function refreshAccessToken() {
|
async function refreshAccessToken() {
|
||||||
const authStore = useAuthStore()
|
const authStore = useAuthStore()
|
||||||
|
|
||||||
|
|
@ -53,8 +53,7 @@ async function refreshAccessToken() {
|
||||||
})
|
})
|
||||||
|
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
console.error('Refresh error:', error)
|
throw error
|
||||||
throw new Error('REFRESH_FAILED')
|
|
||||||
})
|
})
|
||||||
|
|
||||||
.finally(() => {
|
.finally(() => {
|
||||||
|
|
@ -67,32 +66,29 @@ async function refreshAccessToken() {
|
||||||
|
|
||||||
async function request(url, options = {}, isRetry = false) {
|
async function request(url, options = {}, isRetry = false) {
|
||||||
const config = createConfig(options)
|
const config = createConfig(options)
|
||||||
|
|
||||||
const response = await fetch(`${BASE_URL}${url}`, config)
|
const response = await fetch(`${BASE_URL}${url}`, config)
|
||||||
|
|
||||||
if (response.status === 401 && !isRetry) {
|
if (response.status === 401 && !isRetry) {
|
||||||
try {
|
try {
|
||||||
const data = await refreshAccessToken()
|
const data = await refreshAccessToken()
|
||||||
const token = data.access_token
|
|
||||||
if (!token) throw new Error('Refresh response did not contain access_token')
|
|
||||||
|
|
||||||
|
const token = data.access_token
|
||||||
|
if (!token) {
|
||||||
|
throw new Error('Refresh response did not contain access_token')
|
||||||
|
}
|
||||||
|
|
||||||
const newOptions = {
|
const newOptions = {
|
||||||
...options,
|
...options,
|
||||||
headers: {
|
headers: {
|
||||||
...options.headers,
|
...options.headers,
|
||||||
Authorization: `Bearer ${token}`,
|
'Authorization': `Bearer ${token}`,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
return await request(url, newOptions, true)
|
return await request(url, newOptions, true)
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
if (e.message === 'REFRESH_FAILED') {
|
|
||||||
const authStore = useAuthStore()
|
const authStore = useAuthStore()
|
||||||
authStore.forceLogout()
|
authStore.forceLogout()
|
||||||
console.warn('Force logout (refresh failed)', url)
|
|
||||||
} else {
|
|
||||||
console.error('Unexpected error during refresh', e)
|
|
||||||
}
|
|
||||||
throw e
|
throw e
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -104,14 +100,8 @@ async function request(url, options = {}, isRetry = false) {
|
||||||
} catch {
|
} catch {
|
||||||
errorData = {}
|
errorData = {}
|
||||||
}
|
}
|
||||||
|
throw new Error(errorData.message || `HTTP Error: ${response.status}`)
|
||||||
return {
|
|
||||||
status: response.status,
|
|
||||||
ok: false,
|
|
||||||
error: errorData.message || `HTTP Error: ${response.status}`,
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
let data = null
|
let data = null
|
||||||
const contentType = response.headers.get('content-type')
|
const contentType = response.headers.get('content-type')
|
||||||
|
|
@ -123,7 +113,11 @@ async function request(url, options = {}, isRetry = false) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return { status: response.status, ok: response.ok, data }
|
return {
|
||||||
|
status: response.status,
|
||||||
|
ok: response.ok,
|
||||||
|
data,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export const apiClient = {
|
export const apiClient = {
|
||||||
|
|
@ -138,7 +132,9 @@ export const apiClient = {
|
||||||
return request(url, {
|
return request(url, {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
body: isFormData ? data : JSON.stringify(data),
|
body: isFormData ? data : JSON.stringify(data),
|
||||||
// headers: isFormData ? {} : { 'Content-Type': 'application/json' }
|
headers: isFormData
|
||||||
|
? {}
|
||||||
|
: { 'Content-Type': 'application/json' }
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
put: (url, data) => request(url, {
|
put: (url, data) => request(url, {
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
import { defineStore } from 'pinia'
|
import { defineStore } from 'pinia'
|
||||||
import { computed, nextTick, ref } from 'vue'
|
import { computed, ref } from 'vue'
|
||||||
import { apiClient } from '@/services/apiClient'
|
import { apiClient } from '@/services/apiClient'
|
||||||
import router from '@/router/index.js'
|
import router from '@/router/index.js'
|
||||||
|
|
||||||
|
|
@ -54,7 +54,6 @@ export const useAuthStore = defineStore('auth', () => {
|
||||||
try {
|
try {
|
||||||
const response = await apiClient.post('/user/auth/login', { email, password })
|
const response = await apiClient.post('/user/auth/login', { email, password })
|
||||||
setToken(response.data.access_token)
|
setToken(response.data.access_token)
|
||||||
await nextTick()
|
|
||||||
router.push({ name: 'collection'})
|
router.push({ name: 'collection'})
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('Login error:', error)
|
console.error('Login error:', error)
|
||||||
|
|
|
||||||
|
|
@ -1,107 +0,0 @@
|
||||||
import { defineStore } from 'pinia'
|
|
||||||
import { apiClient } from '@/services/apiClient.js'
|
|
||||||
import { ref } from 'vue'
|
|
||||||
|
|
||||||
function safeParseJSON(str, fallback = []) {
|
|
||||||
if (str === null || str === undefined || str === 'null' || str === '') {
|
|
||||||
return fallback
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
const parsed = JSON.parse(str)
|
|
||||||
return Array.isArray(parsed) ? parsed : fallback
|
|
||||||
} catch (e) {
|
|
||||||
console.warn('Failed to parse localStorage item "labels", using fallback:', e)
|
|
||||||
return fallback
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export const useLabelsStore = defineStore('labels', () => {
|
|
||||||
//state
|
|
||||||
const labels = ref(safeParseJSON(localStorage.getItem('labels'), []))
|
|
||||||
|
|
||||||
//getters
|
|
||||||
|
|
||||||
//action
|
|
||||||
const createLabel = async (newLabel) => {
|
|
||||||
try {
|
|
||||||
await apiClient.post('/merch/labels', newLabel)
|
|
||||||
await getLabels()
|
|
||||||
} catch (error) {
|
|
||||||
console.error('Failed to create label:', error)
|
|
||||||
throw error
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const getLabels = async () => {
|
|
||||||
try {
|
|
||||||
const response = await apiClient.get('/merch/labels')
|
|
||||||
const labelList = Array.isArray(response.data) ? response.data : []
|
|
||||||
labels.value = labelList
|
|
||||||
localStorage.setItem('labels', JSON.stringify(labelList))
|
|
||||||
} catch (error) {
|
|
||||||
console.error('Failed to fetch labels:', error)
|
|
||||||
labels.value = []
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const updateLabel = async (uuid, updatedData) => {
|
|
||||||
try {
|
|
||||||
await apiClient.put(`/merch/labels/${uuid}`, updatedData)
|
|
||||||
await getLabels()
|
|
||||||
} catch (error) {
|
|
||||||
console.error('Failed to update label:', error)
|
|
||||||
throw error
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const deleteLabel = async (uuid) => {
|
|
||||||
try {
|
|
||||||
await apiClient.delete(`/merch/labels/${uuid}`)
|
|
||||||
await getLabels()
|
|
||||||
} catch (error) {
|
|
||||||
console.error('Failed to delete label:', error)
|
|
||||||
throw error
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const attachLabel = async (merchUuid, labelUuid) => {
|
|
||||||
try {
|
|
||||||
const payload = { merch_uuid: merchUuid, label_uuid: labelUuid }
|
|
||||||
await apiClient.post('/merch/labels/attach', payload)
|
|
||||||
} catch (error) {
|
|
||||||
console.error('Failed to attach label:', error)
|
|
||||||
throw error
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const detachLabel = async (merchUuid, labelUuid) => {
|
|
||||||
try {
|
|
||||||
const payload = { merch_uuid: merchUuid, label_uuid: labelUuid }
|
|
||||||
await apiClient.post('/merch/labels/detach', payload)
|
|
||||||
} catch (error) {
|
|
||||||
console.error('Failed to detach label:', error)
|
|
||||||
throw error
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const getMerchLabels = async (merchUuid) => {
|
|
||||||
try {
|
|
||||||
const response = await apiClient.get(`/merch/labels/${merchUuid}`)
|
|
||||||
return response
|
|
||||||
} catch (error) {
|
|
||||||
console.error('Failed to get merch labels:', error)
|
|
||||||
throw error
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return {
|
|
||||||
labels,
|
|
||||||
createLabel,
|
|
||||||
getLabels,
|
|
||||||
updateLabel,
|
|
||||||
deleteLabel,
|
|
||||||
attachLabel,
|
|
||||||
detachLabel,
|
|
||||||
getMerchLabels,
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
@ -2,10 +2,6 @@
|
||||||
margin-top: 10px;
|
margin-top: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.mt-20 {
|
|
||||||
margin-top: 20px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.mb-10 {
|
.mb-10 {
|
||||||
margin-bottom: 10px;
|
margin-bottom: 10px;
|
||||||
}
|
}
|
||||||
|
|
@ -170,30 +166,3 @@ body,
|
||||||
max-height: 70vh;
|
max-height: 70vh;
|
||||||
object-fit: contain;
|
object-fit: contain;
|
||||||
}
|
}
|
||||||
|
|
||||||
.router-link-button{
|
|
||||||
color: inherit;
|
|
||||||
text-decoration: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
.label-container {
|
|
||||||
display: flex;
|
|
||||||
flex-direction: row;
|
|
||||||
justify-content: space-between;
|
|
||||||
}
|
|
||||||
|
|
||||||
.label-column {
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
}
|
|
||||||
|
|
||||||
.label-row {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
gap: 10px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.label-preview {
|
|
||||||
justify-content: center;
|
|
||||||
margin-bottom: 20px;
|
|
||||||
}
|
|
||||||
|
|
|
||||||
|
|
@ -4,14 +4,12 @@ import CollectionMerchCard from '@/views/CollectionView/CollectionMerchCard.vue'
|
||||||
import { computed, onMounted, ref } from 'vue'
|
import { computed, onMounted, ref } from 'vue'
|
||||||
import { useMerchApi } from '@/api/merch.js'
|
import { useMerchApi } from '@/api/merch.js'
|
||||||
import ScrollToTopButton from '@/components/ScrollToTopButton.vue'
|
import ScrollToTopButton from '@/components/ScrollToTopButton.vue'
|
||||||
import { useLabelsStore } from '@/stores/labelsStore'
|
|
||||||
|
|
||||||
const merchList = ref(null)
|
const merchList = ref(null)
|
||||||
const loading = ref(true)
|
const loading = ref(true)
|
||||||
const error = ref(null)
|
const error = ref(null)
|
||||||
|
|
||||||
const { getMerchList } = useMerchApi()
|
const { getMerchList } = useMerchApi()
|
||||||
const { getLabels } = useLabelsStore()
|
|
||||||
|
|
||||||
const fetchMerch = async () => {
|
const fetchMerch = async () => {
|
||||||
try {
|
try {
|
||||||
|
|
@ -27,39 +25,27 @@ const fetchMerch = async () => {
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
fetchMerch()
|
fetchMerch()
|
||||||
getLabels()
|
|
||||||
})
|
})
|
||||||
|
|
||||||
const searchQuery = ref('')
|
const searchQuery = ref('')
|
||||||
const selectedLabelUuids = ref([])
|
|
||||||
|
|
||||||
const filteredMerch = computed(() => {
|
const filteredMerch = computed(() => {
|
||||||
let result = merchList.value || []
|
if (!searchQuery.value.trim()) {
|
||||||
|
return merchList.value
|
||||||
if (searchQuery.value.trim()) {
|
}
|
||||||
const q = searchQuery.value.toLowerCase()
|
const q = searchQuery.value.toLowerCase()
|
||||||
result = result.filter((item) => item.name.toLowerCase().includes(q))
|
return merchList.value.filter((item) => item.name.toLowerCase().includes(q))
|
||||||
}
|
|
||||||
|
|
||||||
if (selectedLabelUuids.value.length > 0) {
|
|
||||||
const selectedSet = new Set(selectedLabelUuids.value)
|
|
||||||
result = result.filter((item) => {
|
|
||||||
return item.labels && item.labels.some((labelUuid) => selectedSet.has(labelUuid))
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
return result
|
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div class="sticky-search-container">
|
<div class="sticky-search-container">
|
||||||
<CollectionToolbar v-model="searchQuery" v-model:labelUuids="selectedLabelUuids" />
|
<CollectionToolbar v-model="searchQuery" />
|
||||||
</div>
|
</div>
|
||||||
<n-grid responsive="screen" cols="2 s:3 m:4 l:5 xl:6 2xl:7" class="grid-main">
|
<n-grid responsive="screen" cols="2 s:3 m:4 l:5 xl:6 2xl:7" class="grid-main">
|
||||||
<n-gi class="grid-item" v-for="item in filteredMerch" :key="item.merch_uuid">
|
<n-gi class="grid-item" v-for="item in filteredMerch" :key="item.merch_uuid">
|
||||||
<router-link :to="`/details/${item.merch_uuid}`" class="card-link">
|
<router-link :to="`/details/${item.merch_uuid}`" class="card-link">
|
||||||
<CollectionMerchCard :merch="item" :labels="item.labels" />
|
<CollectionMerchCard :merch="item" />
|
||||||
</router-link>
|
</router-link>
|
||||||
</n-gi>
|
</n-gi>
|
||||||
</n-grid>
|
</n-grid>
|
||||||
|
|
|
||||||
|
|
@ -1,33 +1,14 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import BoxIcon from '@/components/icons/BoxIcon.vue'
|
import BoxIcon from '@/components/icons/BoxIcon.vue'
|
||||||
import { useMerchImagesApi } from '@/api/merchImages.js'
|
import { useMerchImagesApi } from '@/api/merchImages.js'
|
||||||
import { computed, onMounted, ref } from 'vue'
|
import { onMounted, ref } from 'vue'
|
||||||
import LabelDotTemplate from '@/components/LabelDotTemplate.vue'
|
|
||||||
import { useLabelsStore } from '@/stores/labelsStore.js'
|
|
||||||
const { getImageUrl } = useMerchImagesApi()
|
const { getImageUrl } = useMerchImagesApi()
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
merch: {
|
merch: {
|
||||||
type: Object,
|
type: Object,
|
||||||
required: true,
|
required: true,
|
||||||
},
|
|
||||||
labels: {
|
|
||||||
type: Array,
|
|
||||||
default: () => [],
|
|
||||||
},
|
|
||||||
})
|
|
||||||
|
|
||||||
const store = useLabelsStore()
|
|
||||||
|
|
||||||
const resolvedLabelDots = computed(() => {
|
|
||||||
const labelMap = new Map()
|
|
||||||
for (const label of store.labels) {
|
|
||||||
labelMap.set(label.label_uuid, label)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return props.labels
|
|
||||||
.map(uuid => labelMap.get(uuid))
|
|
||||||
.filter(Boolean)
|
|
||||||
})
|
})
|
||||||
|
|
||||||
const fileList = ref([])
|
const fileList = ref([])
|
||||||
|
|
@ -63,14 +44,6 @@ onMounted(async () => {
|
||||||
<n-card class="responsive-card">
|
<n-card class="responsive-card">
|
||||||
<template #header>
|
<template #header>
|
||||||
<h3 class="card-title">{{ merch.name }}</h3>
|
<h3 class="card-title">{{ merch.name }}</h3>
|
||||||
<div v-if="resolvedLabelDots.length > 0" class="label-dots">
|
|
||||||
<LabelDotTemplate
|
|
||||||
v-for="label in resolvedLabelDots"
|
|
||||||
:key="label.label_uuid"
|
|
||||||
:color="label.color"
|
|
||||||
:bg_color="label.bg_color"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</template>
|
</template>
|
||||||
<template #cover>
|
<template #cover>
|
||||||
<div class="cover-wrapper">
|
<div class="cover-wrapper">
|
||||||
|
|
@ -128,11 +101,4 @@ onMounted(async () => {
|
||||||
height: auto;
|
height: auto;
|
||||||
max-width: 80%;
|
max-width: 80%;
|
||||||
}
|
}
|
||||||
|
|
||||||
.label-dots {
|
|
||||||
display: flex;
|
|
||||||
gap: 6px;
|
|
||||||
flex-wrap: wrap;
|
|
||||||
justify-content: right;
|
|
||||||
}
|
|
||||||
</style>
|
</style>
|
||||||
|
|
|
||||||
|
|
@ -1,59 +1,47 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { computed, ref, watch } from 'vue'
|
import { ref, watch } from 'vue'
|
||||||
import router from '@/router/index.js'
|
import router from '@/router/index.js'
|
||||||
import { useLabelsStore } from '@/stores/labelsStore.js'
|
|
||||||
|
|
||||||
const store = useLabelsStore()
|
|
||||||
|
const value = ref(null)
|
||||||
|
const options = [
|
||||||
|
{ label: 'Placeholder 1', value: 'Placeholder 1' },
|
||||||
|
{ label: 'Placeholder 2', value: 'Placeholder 2' },
|
||||||
|
]
|
||||||
|
|
||||||
|
const addMerch = () => {
|
||||||
|
router.push({ name: 'addMerch' })
|
||||||
|
}
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
modelValue: {
|
modelValue: {
|
||||||
type: String,
|
type: String,
|
||||||
default: '',
|
default: '',
|
||||||
},
|
},
|
||||||
labelUuids: {
|
|
||||||
type: Array,
|
|
||||||
default: () => [],
|
|
||||||
},
|
|
||||||
})
|
})
|
||||||
const emit = defineEmits(['update:modelValue', 'update:labelUuids'])
|
|
||||||
|
|
||||||
const addMerch = () => {
|
const emit = defineEmits(['update:modelValue'])
|
||||||
router.push({ name: 'addMerch' })
|
|
||||||
}
|
|
||||||
|
|
||||||
|
const localValue = ref(props.modelValue)
|
||||||
|
|
||||||
const localSearch = computed({
|
watch(
|
||||||
get() {
|
() => props.modelValue,
|
||||||
return props.modelValue
|
(newVal) => {
|
||||||
},
|
localValue.value = newVal
|
||||||
set(value) {
|
|
||||||
emit('update:modelValue', value)
|
|
||||||
}
|
}
|
||||||
})
|
)
|
||||||
|
|
||||||
const selectedLabelUuids = computed({
|
watch(localValue, (newVal) => {
|
||||||
get() {
|
emit('update:modelValue', newVal)
|
||||||
return props.labelUuids
|
|
||||||
},
|
|
||||||
set(value) {
|
|
||||||
emit('update:labelUuids', value)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
const labelOptions = computed(() => {
|
|
||||||
return store.labels.map((label) => ({
|
|
||||||
label: label.name,
|
|
||||||
value: label.label_uuid,
|
|
||||||
}))
|
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div class="toolbar">
|
<div class="toolbar">
|
||||||
<n-button type="primary" class="toolbar-item" @click="addMerch"> Add merch</n-button>
|
<n-button type="primary" class="toolbar-item" @click="addMerch"> Add merch </n-button>
|
||||||
|
|
||||||
<div class="search-wrapper toolbar-item">
|
<div class="search-wrapper toolbar-item">
|
||||||
<n-input v-model:value="localSearch" placeholder="Search..." clearable />
|
<n-input v-model:value="localValue" placeholder="Search..." clearable />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="selector toolbar-item">
|
<div class="selector toolbar-item">
|
||||||
|
|
@ -61,10 +49,9 @@ const labelOptions = computed(() => {
|
||||||
placeholder="Select label"
|
placeholder="Select label"
|
||||||
clearable
|
clearable
|
||||||
multiple
|
multiple
|
||||||
v-model:value="selectedLabelUuids"
|
v-model:value="value"
|
||||||
:options="labelOptions"
|
:options="options"
|
||||||
class="mobile-full-width"
|
class="mobile-full-width" />
|
||||||
/>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,6 @@ import { useChartsApi } from '@/api/charts.js'
|
||||||
import EditLink from '@/views/DetailsView/EditLink.vue'
|
import EditLink from '@/views/DetailsView/EditLink.vue'
|
||||||
import CopyToClipboard from '@/components/CopyToClipboard.vue'
|
import CopyToClipboard from '@/components/CopyToClipboard.vue'
|
||||||
import DetailsViewImages from '@/views/DetailsView/DetailsViewImages.vue'
|
import DetailsViewImages from '@/views/DetailsView/DetailsViewImages.vue'
|
||||||
import AttachLabel from '@/views/DetailsView/AttachLabel.vue'
|
|
||||||
|
|
||||||
const { getMerchDetails, deleteMerch } = useMerchApi()
|
const { getMerchDetails, deleteMerch } = useMerchApi()
|
||||||
const { getDistinctPrices } = useChartsApi()
|
const { getDistinctPrices } = useChartsApi()
|
||||||
|
|
@ -108,7 +107,6 @@ onMounted(() => {
|
||||||
<div>
|
<div>
|
||||||
<p><strong>Uuid:</strong> {{ merchDetails.merch_uuid }}</p>
|
<p><strong>Uuid:</strong> {{ merchDetails.merch_uuid }}</p>
|
||||||
<p><strong>Name:</strong> {{ merchDetails.name }}</p>
|
<p><strong>Name:</strong> {{ merchDetails.name }}</p>
|
||||||
<AttachLabel :merch-uuid="props.merch_uuid" />
|
|
||||||
</div>
|
</div>
|
||||||
<DetailsViewImages :merch-uuid="merchDetails.merch_uuid"/>
|
<DetailsViewImages :merch-uuid="merchDetails.merch_uuid"/>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -1,147 +0,0 @@
|
||||||
<script setup>
|
|
||||||
import { computed, onMounted, ref } from 'vue'
|
|
||||||
import { useLabelsStore } from '@/stores/labelsStore.js'
|
|
||||||
import { useMessage } from 'naive-ui'
|
|
||||||
import LabelTemplate from '@/components/LabelTemplate.vue'
|
|
||||||
|
|
||||||
const store = useLabelsStore()
|
|
||||||
const messages = useMessage()
|
|
||||||
|
|
||||||
const props = defineProps({
|
|
||||||
merchUuid: {
|
|
||||||
type: String,
|
|
||||||
default: '',
|
|
||||||
},
|
|
||||||
})
|
|
||||||
|
|
||||||
const attachedLabels = ref([])
|
|
||||||
const selectedLabelUuids = ref([])
|
|
||||||
const loading = ref(false)
|
|
||||||
|
|
||||||
const labelOptions = computed(() => {
|
|
||||||
const attachedUuids = new Set(attachedLabels.value.map(l => l.label_uuid))
|
|
||||||
return store.labels
|
|
||||||
.filter(label => !attachedUuids.has(label.label_uuid))
|
|
||||||
.map(label => ({
|
|
||||||
label: label.name,
|
|
||||||
value: label.label_uuid,
|
|
||||||
}))
|
|
||||||
})
|
|
||||||
|
|
||||||
const fetchAttachedLabels = async () => {
|
|
||||||
if (!props.merchUuid) return
|
|
||||||
|
|
||||||
loading.value = true
|
|
||||||
try {
|
|
||||||
const response = await store.getMerchLabels(props.merchUuid)
|
|
||||||
const uuids = response.data || []
|
|
||||||
|
|
||||||
if (!Array.isArray(uuids)) {
|
|
||||||
attachedLabels.value = []
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
const labelMap = new Map()
|
|
||||||
for (const label of store.labels) {
|
|
||||||
labelMap.set(label.label_uuid, label)
|
|
||||||
}
|
|
||||||
|
|
||||||
attachedLabels.value = uuids
|
|
||||||
.map(uuid => labelMap.get(uuid))
|
|
||||||
.filter(Boolean)
|
|
||||||
} catch (error) {
|
|
||||||
messages.error('Failed to load attached labels: ' + error)
|
|
||||||
attachedLabels.value = []
|
|
||||||
} finally {
|
|
||||||
loading.value = false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const handleAttach = async () => {
|
|
||||||
if (!props.merchUuid) {
|
|
||||||
messages.error('Merch UUID is missing')
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if (selectedLabelUuids.value.length === 0) {
|
|
||||||
messages.warning('No labels selected')
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
await Promise.all(
|
|
||||||
selectedLabelUuids.value.map(labelUuid =>
|
|
||||||
store.attachLabel(props.merchUuid, labelUuid)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
messages.success('Label(s) attached successfully')
|
|
||||||
selectedLabelUuids.value = []
|
|
||||||
await fetchAttachedLabels()
|
|
||||||
} catch (error) {
|
|
||||||
messages.error('Failed to attach label(s): ' + error)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const handleDetach = async (labelUuid) => {
|
|
||||||
if (!props.merchUuid) {
|
|
||||||
messages.error('Merch UUID is missing')
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
await store.detachLabel(props.merchUuid, labelUuid)
|
|
||||||
messages.success('Label detached successfully')
|
|
||||||
await fetchAttachedLabels()
|
|
||||||
} catch (error) {
|
|
||||||
messages.error('Failed to detach label: ' + error)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
onMounted(() => {
|
|
||||||
fetchAttachedLabels()
|
|
||||||
})
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<template>
|
|
||||||
<p><strong>Select labels to attach:</strong></p>
|
|
||||||
<div class="label-row">
|
|
||||||
<n-select
|
|
||||||
v-model:value="selectedLabelUuids"
|
|
||||||
multiple
|
|
||||||
:options="labelOptions"
|
|
||||||
:loading="loading"
|
|
||||||
/>
|
|
||||||
<n-button
|
|
||||||
type="primary"
|
|
||||||
@click="handleAttach"
|
|
||||||
:disabled="selectedLabelUuids.length === 0 || loading"
|
|
||||||
style="width: 100px; margin-left: 12px"
|
|
||||||
>
|
|
||||||
Attach
|
|
||||||
</n-button>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<p><strong>Attached labels. Click label to detach it.</strong></p>
|
|
||||||
<div v-if="attachedLabels.length > 0" class="mt-10 label-row">
|
|
||||||
<LabelTemplate
|
|
||||||
v-for="label in attachedLabels"
|
|
||||||
:key="label.label_uuid"
|
|
||||||
:text="label.name"
|
|
||||||
:color="label.color"
|
|
||||||
:bg_color="label.bg_color"
|
|
||||||
@click="handleDetach(label.label_uuid)"
|
|
||||||
style="cursor: pointer"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="mt-20">
|
|
||||||
<router-link :to="{ name: 'labels' }">
|
|
||||||
<n-button type="primary">
|
|
||||||
Manage labels
|
|
||||||
</n-button>
|
|
||||||
</router-link>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<style scoped>
|
|
||||||
|
|
||||||
</style>
|
|
||||||
|
|
@ -1,78 +0,0 @@
|
||||||
<script setup>
|
|
||||||
import { useLabelsStore } from '@/stores/labelsStore.js'
|
|
||||||
import LabelCard from '@/views/LabelsView/LabelCard.vue'
|
|
||||||
import { NModal, useMessage } from 'naive-ui'
|
|
||||||
import LabelForm from '@/views/LabelsView/LabelForm.vue'
|
|
||||||
import { ref } from 'vue'
|
|
||||||
import ScrollToTopButton from '@/components/ScrollToTopButton.vue'
|
|
||||||
|
|
||||||
const store = useLabelsStore()
|
|
||||||
const messages = useMessage()
|
|
||||||
|
|
||||||
const editForm = ref({
|
|
||||||
name: '',
|
|
||||||
color: '#EF2D56FF',
|
|
||||||
bg_color: '#FFFFFF',
|
|
||||||
})
|
|
||||||
|
|
||||||
const handleCreate = async () => {
|
|
||||||
try {
|
|
||||||
const name = editForm.value.name?.trim() || 'preview'
|
|
||||||
|
|
||||||
await store.createLabel({
|
|
||||||
name,
|
|
||||||
color: editForm.value.color,
|
|
||||||
bg_color: editForm.value.bg_color,
|
|
||||||
})
|
|
||||||
|
|
||||||
editForm.value = {
|
|
||||||
name: '',
|
|
||||||
color: '#EF2D56FF',
|
|
||||||
bg_color: '#FFFFFF',
|
|
||||||
}
|
|
||||||
|
|
||||||
showCreateModal.value = false
|
|
||||||
messages.success('Label created.')
|
|
||||||
} catch (error) {
|
|
||||||
messages.error(error)
|
|
||||||
console.error('Failed to create label in component:', error)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const showCreateModal = ref(false)
|
|
||||||
|
|
||||||
const cancelCreate = () => {
|
|
||||||
showCreateModal.value = false
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<template>
|
|
||||||
<h3>Manage labels</h3>
|
|
||||||
<n-divider title-placement="left">Create label</n-divider>
|
|
||||||
<n-modal v-model:show="showCreateModal" preset="dialog" title="Create new label">
|
|
||||||
<template #default>
|
|
||||||
<p>Enter new values to create label.</p>
|
|
||||||
<LabelForm :edit-form="editForm" />
|
|
||||||
</template>
|
|
||||||
<template #action>
|
|
||||||
<n-button @click="handleCreate" type="primary">Create</n-button>
|
|
||||||
<n-button @click="cancelCreate">Cancel</n-button>
|
|
||||||
</template>
|
|
||||||
</n-modal>
|
|
||||||
<div class="mt-10 c-center">
|
|
||||||
<n-button type="primary" @click="showCreateModal=true" :loading="false" class="w360">
|
|
||||||
Create Label
|
|
||||||
</n-button>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<n-divider title-placement="left">Current labels</n-divider>
|
|
||||||
<h4 class="text-center">Tip: click on a record to edit / delete label.</h4>
|
|
||||||
|
|
||||||
<div v-for="label in store.labels" :key="label.label_uuid">
|
|
||||||
<LabelCard :label-uuid="label.label_uuid" />
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<ScrollToTopButton />
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<style scoped></style>
|
|
||||||
|
|
@ -1,143 +0,0 @@
|
||||||
<script setup>
|
|
||||||
import { computed, ref, watch } from 'vue'
|
|
||||||
import { NModal, useMessage } from 'naive-ui'
|
|
||||||
import { useLabelsStore } from '@/stores/labelsStore.js'
|
|
||||||
import LabelTemplate from '@/components/LabelTemplate.vue'
|
|
||||||
import LabelDotTemplate from '@/components/LabelDotTemplate.vue'
|
|
||||||
import LabelForm from '@/views/LabelsView/LabelForm.vue'
|
|
||||||
|
|
||||||
const store = useLabelsStore()
|
|
||||||
const message = useMessage()
|
|
||||||
|
|
||||||
const props = defineProps({
|
|
||||||
labelUuid: {
|
|
||||||
type: String,
|
|
||||||
required: true,
|
|
||||||
},
|
|
||||||
})
|
|
||||||
|
|
||||||
const labelData = computed(() => {
|
|
||||||
return store.labels.find((label) => label.label_uuid === props.labelUuid)
|
|
||||||
})
|
|
||||||
|
|
||||||
const editForm = ref({})
|
|
||||||
|
|
||||||
const showEditModal = ref(false)
|
|
||||||
|
|
||||||
const editLabelRecordHandler = () => {
|
|
||||||
if (!labelData.value) return
|
|
||||||
editForm.value = { ...labelData.value }
|
|
||||||
showEditModal.value = true
|
|
||||||
}
|
|
||||||
|
|
||||||
const cancelEdit = () => {
|
|
||||||
showEditModal.value = false
|
|
||||||
}
|
|
||||||
|
|
||||||
const handleUpdate = async () => {
|
|
||||||
try {
|
|
||||||
await store.updateLabel(editForm.value.label_uuid, {
|
|
||||||
name: editForm.value.name,
|
|
||||||
color: editForm.value.color,
|
|
||||||
bg_color: editForm.value.bg_color,
|
|
||||||
})
|
|
||||||
showEditModal.value = false
|
|
||||||
message.success('Label updated successfully.')
|
|
||||||
} catch (error) {
|
|
||||||
message.error(error.message)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const confirmDelete = ref(false)
|
|
||||||
|
|
||||||
const handleDelete = async () => {
|
|
||||||
if (!confirmDelete.value) return
|
|
||||||
try {
|
|
||||||
await store.deleteLabel(props.labelUuid)
|
|
||||||
showEditModal.value = false
|
|
||||||
message.success('Label deleted successfully.')
|
|
||||||
} catch (error) {
|
|
||||||
message.error(error.message)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//на случай изменений извне, хотя таких быть не должно
|
|
||||||
watch(
|
|
||||||
() => props.labelData,
|
|
||||||
(newVal) => {
|
|
||||||
if (showEditModal.value) return
|
|
||||||
Object.assign(editForm.value, newVal)
|
|
||||||
},
|
|
||||||
{ deep: true },
|
|
||||||
)
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<template>
|
|
||||||
<n-list hoverable clickable class="bottom-border">
|
|
||||||
<n-list-item @click="editLabelRecordHandler">
|
|
||||||
<div class="label-container">
|
|
||||||
<div>
|
|
||||||
<n-thing>Name: {{ labelData.name }}</n-thing>
|
|
||||||
<n-thing>UUID: {{ labelData.label_uuid }}</n-thing>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="label-column">
|
|
||||||
<n-thing>
|
|
||||||
<div class="label-row">
|
|
||||||
<LabelDotTemplate :color="labelData.color" :bg_color="labelData.bg_color" />
|
|
||||||
|
|
||||||
<LabelTemplate
|
|
||||||
:text="labelData.name"
|
|
||||||
:color="labelData.color"
|
|
||||||
:bg_color="labelData.bg_color"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</n-thing>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</n-list-item>
|
|
||||||
</n-list>
|
|
||||||
|
|
||||||
<n-modal v-model:show="showEditModal" preset="dialog" title="Manage label record">
|
|
||||||
<template #default>
|
|
||||||
<p>Enter new values to update. Or hit delete button to delete record.</p>
|
|
||||||
<LabelForm :edit-form="editForm" />
|
|
||||||
</template>
|
|
||||||
<template #action>
|
|
||||||
<div class="modal-actions">
|
|
||||||
<div class="checkbox-row">
|
|
||||||
<n-checkbox v-model:checked="confirmDelete"> Check to confirm delete </n-checkbox>
|
|
||||||
</div>
|
|
||||||
<div class="buttons-row">
|
|
||||||
<n-button @click="handleUpdate" type="warning">Update</n-button>
|
|
||||||
<n-button @click="handleDelete" type="error" :disabled="!confirmDelete">Delete</n-button>
|
|
||||||
<n-button @click="cancelEdit">Cancel</n-button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
</n-modal>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<style scoped>
|
|
||||||
.bottom-border {
|
|
||||||
border-bottom: rgba(24, 160, 88, 0.25) solid 1px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.modal-actions {
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
gap: 12px;
|
|
||||||
width: 100%;
|
|
||||||
}
|
|
||||||
|
|
||||||
.checkbox-row,
|
|
||||||
.buttons-row {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
.buttons-row {
|
|
||||||
justify-content: flex-end;
|
|
||||||
gap: 8px;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
|
|
@ -1,36 +0,0 @@
|
||||||
<!-- LabelForm.vue -->
|
|
||||||
<script setup>
|
|
||||||
import LabelDotTemplate from '@/components/LabelDotTemplate.vue'
|
|
||||||
import LabelTemplate from '@/components/LabelTemplate.vue'
|
|
||||||
|
|
||||||
defineProps({
|
|
||||||
editForm: {
|
|
||||||
type: Object,
|
|
||||||
required: true
|
|
||||||
}
|
|
||||||
})
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<template>
|
|
||||||
<div class="label-row label-preview">
|
|
||||||
<span>Preview: </span>
|
|
||||||
<LabelDotTemplate :color="editForm.color" :bg_color="editForm.bg_color" />
|
|
||||||
<LabelTemplate
|
|
||||||
:text="editForm.name || 'preview'"
|
|
||||||
:color="editForm.color"
|
|
||||||
:bg_color="editForm.bg_color"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<n-form :model="editForm" label-placement="left" label-width="100">
|
|
||||||
<n-form-item label="Name" path="name">
|
|
||||||
<n-input v-model:value="editForm.name" />
|
|
||||||
</n-form-item>
|
|
||||||
<n-form-item label="Border and text color" path="color">
|
|
||||||
<n-color-picker v-model:value="editForm.color" />
|
|
||||||
</n-form-item>
|
|
||||||
<n-form-item label="Background color" path="bg_color">
|
|
||||||
<n-color-picker v-model:value="editForm.bg_color" />
|
|
||||||
</n-form-item>
|
|
||||||
</n-form>
|
|
||||||
</template>
|
|
||||||
|
|
@ -14,26 +14,27 @@ onMounted(() => {
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<n-divider title-placement="left">Main</n-divider>
|
<n-card :bordered="false" title="Main">
|
||||||
<n-list hoverable clickable>
|
<n-list hoverable clickable>
|
||||||
<n-list-item>
|
<n-list-item>
|
||||||
<n-thing title="Email" class="mt-10">
|
<n-thing title="Email" content-style="margin-top: 10px;">
|
||||||
{{ userData?.email || '---' }}
|
{{ userData?.email || '---' }}
|
||||||
</n-thing>
|
</n-thing>
|
||||||
</n-list-item>
|
</n-list-item>
|
||||||
|
|
||||||
<n-list-item>
|
<n-list-item>
|
||||||
<n-thing title="Username" class="mt-10">
|
<n-thing title="Username" content-style="margin-top: 10px;">
|
||||||
{{ userData?.username || '---' }}
|
{{ userData?.username || '---' }}
|
||||||
</n-thing>
|
</n-thing>
|
||||||
</n-list-item>
|
</n-list-item>
|
||||||
|
|
||||||
<n-list-item>
|
<n-list-item>
|
||||||
<n-thing title="Created At" class="mt-10">
|
<n-thing title="Created At" content-style="margin-top: 10px;">
|
||||||
{{ userData?.created_at || '---' }}
|
{{ userData?.created_at || '---' }}
|
||||||
</n-thing>
|
</n-thing>
|
||||||
</n-list-item>
|
</n-list-item>
|
||||||
</n-list>
|
</n-list>
|
||||||
|
</n-card>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style scoped></style>
|
<style scoped></style>
|
||||||
|
|
|
||||||
|
|
@ -35,16 +35,16 @@ const onLogout = () => {
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<n-divider title-placement="left">Session</n-divider>
|
<n-card :bordered="false" title="Session">
|
||||||
<n-list hoverable clickable>
|
<n-list hoverable clickable>
|
||||||
<n-list-item>
|
<n-list-item>
|
||||||
<n-thing title="Session id" class="mt-10">
|
<n-thing title="Session id" content-style="margin-top: 10px;">
|
||||||
{{ currentSession?.uuid || '---' }}
|
{{ currentSession?.uuid || '---' }}
|
||||||
</n-thing>
|
</n-thing>
|
||||||
</n-list-item>
|
</n-list-item>
|
||||||
|
|
||||||
<n-list-item>
|
<n-list-item>
|
||||||
<n-thing title="Expires at" class="mt-10">
|
<n-thing title="Expires at" content-style="margin-top: 10px;">
|
||||||
{{ formattedDate }}
|
{{ formattedDate }}
|
||||||
</n-thing>
|
</n-thing>
|
||||||
</n-list-item>
|
</n-list-item>
|
||||||
|
|
@ -52,6 +52,7 @@ const onLogout = () => {
|
||||||
<n-button type="info" class="center-button" @click="onLogout">Log out</n-button>
|
<n-button type="info" class="center-button" @click="onLogout">Log out</n-button>
|
||||||
</div>
|
</div>
|
||||||
</n-list>
|
</n-list>
|
||||||
|
</n-card>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue