change user to uuid
This commit is contained in:
parent
50cbf94ee5
commit
4c5d132de8
17 changed files with 86 additions and 93 deletions
|
@ -1,7 +1,7 @@
|
||||||
<template>
|
<template>
|
||||||
<div class="grow flex flex-col gap-2 overflow-hidden">
|
<div class="grow flex flex-col gap-2 overflow-hidden">
|
||||||
<div v-if="useSearch" class="relative self-end flex flex-row items-center gap-2">
|
<div v-if="useSearch" class="relative self-end flex flex-row items-center gap-2">
|
||||||
<Spinner v-if="deferingSearch" />
|
<Spinner v-if="deferingSearch" />
|
||||||
<input
|
<input
|
||||||
type="text"
|
type="text"
|
||||||
class="!max-w-64 !w-64 rounded-md shadow-sm relative block px-3 py-2 pr-5 border border-gray-300 placeholder-gray-500 text-gray-900 rounded-b-md focus:outline-none focus:ring-indigo-500 focus:border-indigo-500 focus:z-10 sm:text-sm"
|
class="!max-w-64 !w-64 rounded-md shadow-sm relative block px-3 py-2 pr-5 border border-gray-300 placeholder-gray-500 text-gray-900 rounded-b-md focus:outline-none focus:ring-indigo-500 focus:border-indigo-500 focus:z-10 sm:text-sm"
|
||||||
|
@ -82,27 +82,30 @@ const props = defineProps({
|
||||||
});
|
});
|
||||||
|
|
||||||
const slots = defineSlots<{
|
const slots = defineSlots<{
|
||||||
pageRow(props: { row: T }): void;
|
pageRow(props: { row: T; key: number }): void;
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
const timer = ref(undefined) as undefined | any;
|
const timer = ref(undefined) as undefined | any;
|
||||||
const currentPage = ref(0);
|
const currentPage = ref(0);
|
||||||
const searchString = ref("");
|
const searchString = ref("");
|
||||||
const deferingSearch = ref(false)
|
const deferingSearch = ref(false);
|
||||||
|
|
||||||
watch(searchString, async () => {
|
watch(searchString, async () => {
|
||||||
deferingSearch.value = true
|
deferingSearch.value = true;
|
||||||
clearTimeout(timer.value);
|
clearTimeout(timer.value);
|
||||||
timer.value = setTimeout(() => {
|
timer.value = setTimeout(() => {
|
||||||
currentPage.value = 0;
|
currentPage.value = 0;
|
||||||
deferingSearch.value = false
|
deferingSearch.value = false;
|
||||||
emit("search", searchString.value);
|
emit("search", searchString.value);
|
||||||
}, 600);
|
}, 600);
|
||||||
});
|
});
|
||||||
|
|
||||||
watch(() => props.totalCount, async () => {
|
watch(
|
||||||
currentPage.value = 0;
|
() => props.totalCount,
|
||||||
});
|
async () => {
|
||||||
|
currentPage.value = 0;
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
const emit = defineEmits({
|
const emit = defineEmits({
|
||||||
submit(id: number) {
|
submit(id: number) {
|
||||||
|
@ -159,7 +162,7 @@ const loadPage = (newPage: number | ".") => {
|
||||||
if (pageEnd > entryCount.value) pageEnd = entryCount.value;
|
if (pageEnd > entryCount.value) pageEnd = entryCount.value;
|
||||||
|
|
||||||
let loadedElementCount = filterData(props.items, searchString.value, pageStart, pageEnd).length;
|
let loadedElementCount = filterData(props.items, searchString.value, pageStart, pageEnd).length;
|
||||||
|
|
||||||
if (loadedElementCount < props.maxEntriesPerPage && (pageEnd != props.totalCount || loadedElementCount == 0))
|
if (loadedElementCount < props.maxEntriesPerPage && (pageEnd != props.totalCount || loadedElementCount == 0))
|
||||||
emit("loadData", pageStart, props.maxEntriesPerPage, searchString.value);
|
emit("loadData", pageStart, props.maxEntriesPerPage, searchString.value);
|
||||||
|
|
||||||
|
|
|
@ -93,7 +93,7 @@ import Spinner from "../Spinner.vue";
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
props: {
|
props: {
|
||||||
modelValue: {
|
modelValue: {
|
||||||
type: Array as PropType<Array<number>>,
|
type: Array as PropType<Array<string>>,
|
||||||
default: [],
|
default: [],
|
||||||
},
|
},
|
||||||
title: String,
|
title: String,
|
||||||
|
@ -133,7 +133,7 @@ export default defineComponent({
|
||||||
get() {
|
get() {
|
||||||
return this.modelValue;
|
return this.modelValue;
|
||||||
},
|
},
|
||||||
set(val: Array<number>) {
|
set(val: Array<string>) {
|
||||||
this.$emit("update:model-value", val);
|
this.$emit("update:model-value", val);
|
||||||
if (this.modelValue.length < val.length) {
|
if (this.modelValue.length < val.length) {
|
||||||
let diff = difference(val, this.modelValue);
|
let diff = difference(val, this.modelValue);
|
||||||
|
@ -166,7 +166,7 @@ export default defineComponent({
|
||||||
this.loading = false;
|
this.loading = false;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
getMemberFromSearch(id: number) {
|
getMemberFromSearch(id: string) {
|
||||||
return this.filtered.find((f) => f.id == id);
|
return this.filtered.find((f) => f.id == id);
|
||||||
},
|
},
|
||||||
loadMembersInitial() {
|
loadMembersInitial() {
|
||||||
|
|
|
@ -178,12 +178,12 @@ export default defineComponent({
|
||||||
if (!this.permissionUpdate[section]) {
|
if (!this.permissionUpdate[section]) {
|
||||||
this.permissionUpdate[section] = {};
|
this.permissionUpdate[section] = {};
|
||||||
}
|
}
|
||||||
this.permissionUpdate[section].all = permissions;
|
this.permissionUpdate[section]!.all = permissions;
|
||||||
} else {
|
} else {
|
||||||
if (!this.permissionUpdate[section]) {
|
if (!this.permissionUpdate[section]) {
|
||||||
this.permissionUpdate[section] = {};
|
this.permissionUpdate[section] = {};
|
||||||
}
|
}
|
||||||
this.permissionUpdate[section][modul] = permissions;
|
this.permissionUpdate[section]![modul] = permissions;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
reset() {
|
reset() {
|
||||||
|
|
|
@ -14,7 +14,7 @@ export const useMemberStore = defineStore("member", {
|
||||||
members: [] as Array<MemberViewModel & { tab_pos: number }>,
|
members: [] as Array<MemberViewModel & { tab_pos: number }>,
|
||||||
totalCount: 0 as number,
|
totalCount: 0 as number,
|
||||||
loading: "loading" as "loading" | "fetched" | "failed",
|
loading: "loading" as "loading" | "fetched" | "failed",
|
||||||
activeMember: null as number | null,
|
activeMember: null as string | null,
|
||||||
activeMemberObj: null as MemberViewModel | null,
|
activeMemberObj: null as MemberViewModel | null,
|
||||||
activeMemberStatistics: null as MemberStatisticsViewModel | null,
|
activeMemberStatistics: null as MemberStatisticsViewModel | null,
|
||||||
loadingActive: "loading" as "loading" | "fetched" | "failed",
|
loadingActive: "loading" as "loading" | "fetched" | "failed",
|
||||||
|
@ -50,7 +50,7 @@ export const useMemberStore = defineStore("member", {
|
||||||
return { ...res, data: res.data.members };
|
return { ...res, data: res.data.members };
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
async getMembersByIds(ids: Array<number>): Promise<AxiosResponse<any, any>> {
|
async getMembersByIds(ids: Array<string>): Promise<AxiosResponse<any, any>> {
|
||||||
return await http.get(`/admin/member?ids=${ids.join(",")}&noLimit=true`).then((res) => {
|
return await http.get(`/admin/member?ids=${ids.join(",")}&noLimit=true`).then((res) => {
|
||||||
return { ...res, data: res.data.members };
|
return { ...res, data: res.data.members };
|
||||||
});
|
});
|
||||||
|
@ -72,7 +72,7 @@ export const useMemberStore = defineStore("member", {
|
||||||
this.loadingActive = "failed";
|
this.loadingActive = "failed";
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
fetchMemberById(id: number) {
|
fetchMemberById(id: string) {
|
||||||
return http.get(`/admin/member/${id}`);
|
return http.get(`/admin/member/${id}`);
|
||||||
},
|
},
|
||||||
fetchMemberStatisticsByActiveId() {
|
fetchMemberStatisticsByActiveId() {
|
||||||
|
@ -83,7 +83,7 @@ export const useMemberStore = defineStore("member", {
|
||||||
})
|
})
|
||||||
.catch((err) => {});
|
.catch((err) => {});
|
||||||
},
|
},
|
||||||
fetchMemberStatisticsById(id: number) {
|
fetchMemberStatisticsById(id: string) {
|
||||||
return http.get(`/admin/member/${id}/statistics`);
|
return http.get(`/admin/member/${id}/statistics`);
|
||||||
},
|
},
|
||||||
async createMember(member: CreateMemberViewModel): Promise<AxiosResponse<any, any>> {
|
async createMember(member: CreateMemberViewModel): Promise<AxiosResponse<any, any>> {
|
||||||
|
|
|
@ -12,8 +12,8 @@ export const useNewsletterRecipientsStore = defineStore("newsletterRecipients",
|
||||||
state: () => {
|
state: () => {
|
||||||
return {
|
return {
|
||||||
initialized: false as boolean,
|
initialized: false as boolean,
|
||||||
recipients: [] as Array<number>,
|
recipients: [] as Array<string>,
|
||||||
origin: [] as Array<number>,
|
origin: [] as Array<string>,
|
||||||
loading: "loading" as "loading" | "fetched" | "failed",
|
loading: "loading" as "loading" | "fetched" | "failed",
|
||||||
syncingNewsletterRecipients: "synced" as "synced" | "syncing" | "detectedChanges" | "failed",
|
syncingNewsletterRecipients: "synced" as "synced" | "syncing" | "detectedChanges" | "failed",
|
||||||
};
|
};
|
||||||
|
|
|
@ -22,8 +22,8 @@ export const useProtocolPresenceStore = defineStore("protocolPresence", {
|
||||||
getters: {
|
getters: {
|
||||||
detectedChangeProtocolPresence: (state) =>
|
detectedChangeProtocolPresence: (state) =>
|
||||||
!isEqual(
|
!isEqual(
|
||||||
state.origin.sort((a: ProtocolPresenceViewModel, b: ProtocolPresenceViewModel) => a.memberId - b.memberId),
|
state.origin, //.sort((a: ProtocolPresenceViewModel, b: ProtocolPresenceViewModel) => a.memberId - b.memberId),
|
||||||
state.presence.sort((a: ProtocolPresenceViewModel, b: ProtocolPresenceViewModel) => a.memberId - b.memberId)
|
state.presence //.sort((a: ProtocolPresenceViewModel, b: ProtocolPresenceViewModel) => a.memberId - b.memberId)
|
||||||
) && state.syncingProtocolPresence != "syncing",
|
) && state.syncingProtocolPresence != "syncing",
|
||||||
},
|
},
|
||||||
actions: {
|
actions: {
|
||||||
|
|
|
@ -24,47 +24,37 @@ export const useUserStore = defineStore("user", {
|
||||||
this.loading = "failed";
|
this.loading = "failed";
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
fetchUserById(id: number): Promise<AxiosResponse<any, any>> {
|
fetchUserById(id: string): Promise<AxiosResponse<any, any>> {
|
||||||
return http.get(`/admin/user/${id}`);
|
return http.get(`/admin/user/${id}`);
|
||||||
},
|
},
|
||||||
updateActiveUser(user: UpdateUserViewModel): Promise<AxiosResponse<any, any>> {
|
async updateActiveUser(user: UpdateUserViewModel): Promise<AxiosResponse<any, any>> {
|
||||||
return http
|
const result = await http.patch(`/admin/user/${user.id}`, {
|
||||||
.patch(`/admin/user/${user.id}`, {
|
username: user.username,
|
||||||
username: user.username,
|
firstname: user.firstname,
|
||||||
firstname: user.firstname,
|
lastname: user.lastname,
|
||||||
lastname: user.lastname,
|
mail: user.mail,
|
||||||
mail: user.mail,
|
|
||||||
})
|
|
||||||
.then((result) => {
|
|
||||||
this.fetchUsers();
|
|
||||||
return result;
|
|
||||||
});
|
|
||||||
},
|
|
||||||
updateActiveUserPermissions(user: number, permission: PermissionObject): Promise<AxiosResponse<any, any>> {
|
|
||||||
return http
|
|
||||||
.patch(`/admin/user/${user}/permissions`, {
|
|
||||||
permissions: permission,
|
|
||||||
})
|
|
||||||
.then((result) => {
|
|
||||||
this.fetchUsers();
|
|
||||||
return result;
|
|
||||||
});
|
|
||||||
},
|
|
||||||
updateActiveUserRoles(user: number, roles: Array<number>): Promise<AxiosResponse<any, any>> {
|
|
||||||
return http
|
|
||||||
.patch(`/admin/user/${user}/roles`, {
|
|
||||||
roleIds: roles,
|
|
||||||
})
|
|
||||||
.then((result) => {
|
|
||||||
this.fetchUsers();
|
|
||||||
return result;
|
|
||||||
});
|
|
||||||
},
|
|
||||||
deleteUser(user: number): Promise<AxiosResponse<any, any>> {
|
|
||||||
return http.delete(`/admin/user/${user}`).then((result) => {
|
|
||||||
this.fetchUsers();
|
|
||||||
return result;
|
|
||||||
});
|
});
|
||||||
|
this.fetchUsers();
|
||||||
|
return result;
|
||||||
|
},
|
||||||
|
async updateActiveUserPermissions(userId: string, permission: PermissionObject): Promise<AxiosResponse<any, any>> {
|
||||||
|
const result = await http.patch(`/admin/user/${userId}/permissions`, {
|
||||||
|
permissions: permission,
|
||||||
|
});
|
||||||
|
this.fetchUsers();
|
||||||
|
return result;
|
||||||
|
},
|
||||||
|
async updateActiveUserRoles(userId: string, roles: Array<number>): Promise<AxiosResponse<any, any>> {
|
||||||
|
const result = await http.patch(`/admin/user/${userId}/roles`, {
|
||||||
|
roleIds: roles,
|
||||||
|
});
|
||||||
|
this.fetchUsers();
|
||||||
|
return result;
|
||||||
|
},
|
||||||
|
async deleteUser(userId: string): Promise<AxiosResponse<any, any>> {
|
||||||
|
const result = await http.delete(`/admin/user/${userId}`);
|
||||||
|
this.fetchUsers();
|
||||||
|
return result;
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
|
@ -3,7 +3,7 @@ import type { MembershipViewModel } from "./membership.models";
|
||||||
import type { SalutationViewModel } from "../../settings/salutation.models";
|
import type { SalutationViewModel } from "../../settings/salutation.models";
|
||||||
|
|
||||||
export interface MemberViewModel {
|
export interface MemberViewModel {
|
||||||
id: number;
|
id: string;
|
||||||
salutation: SalutationViewModel;
|
salutation: SalutationViewModel;
|
||||||
firstname: string;
|
firstname: string;
|
||||||
lastname: string;
|
lastname: string;
|
||||||
|
@ -18,7 +18,7 @@ export interface MemberViewModel {
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface MemberStatisticsViewModel {
|
export interface MemberStatisticsViewModel {
|
||||||
id: number;
|
id: string;
|
||||||
salutation: string;
|
salutation: string;
|
||||||
firstname: string;
|
firstname: string;
|
||||||
lastname: string;
|
lastname: string;
|
||||||
|
@ -39,7 +39,7 @@ export interface CreateMemberViewModel {
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface UpdateMemberViewModel {
|
export interface UpdateMemberViewModel {
|
||||||
id: number;
|
id: string;
|
||||||
salutationId: number;
|
salutationId: number;
|
||||||
firstname: string;
|
firstname: string;
|
||||||
lastname: string;
|
lastname: string;
|
||||||
|
|
|
@ -2,10 +2,10 @@ import type { MemberViewModel } from "../member/member.models";
|
||||||
|
|
||||||
export interface NewsletterRecipientsViewModel {
|
export interface NewsletterRecipientsViewModel {
|
||||||
newsletterId: number;
|
newsletterId: number;
|
||||||
memberId: number;
|
memberId: string;
|
||||||
member: MemberViewModel;
|
member: MemberViewModel;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface SyncNewsletterRecipientsViewModel {
|
export interface SyncNewsletterRecipientsViewModel {
|
||||||
memberId: number;
|
memberId: string;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
export interface ProtocolPresenceViewModel {
|
export interface ProtocolPresenceViewModel {
|
||||||
memberId: number;
|
memberId: string;
|
||||||
absent: boolean;
|
absent: boolean;
|
||||||
excused: boolean;
|
excused: boolean;
|
||||||
protocolId: number;
|
protocolId: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface SyncProtocolPresenceViewModel {
|
export interface SyncProtocolPresenceViewModel {
|
||||||
memberIds: Array<number>;
|
memberIds: Array<string>;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,7 @@ import type { PermissionObject } from "@/types/permissionTypes";
|
||||||
import type { RoleViewModel } from "./role.models";
|
import type { RoleViewModel } from "./role.models";
|
||||||
|
|
||||||
export interface UserViewModel {
|
export interface UserViewModel {
|
||||||
id: number;
|
id: string;
|
||||||
username: string;
|
username: string;
|
||||||
mail: string;
|
mail: string;
|
||||||
firstname: string;
|
firstname: string;
|
||||||
|
@ -21,7 +21,7 @@ export interface CreateUserViewModel {
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface UpdateUserViewModel {
|
export interface UpdateUserViewModel {
|
||||||
id: number;
|
id: string;
|
||||||
username: string;
|
username: string;
|
||||||
mail: string;
|
mail: string;
|
||||||
firstname: string;
|
firstname: string;
|
||||||
|
|
|
@ -154,7 +154,7 @@ export default defineComponent({
|
||||||
...mapActions(useNewsletterRecipientsStore, ["fetchNewsletterRecipients"]),
|
...mapActions(useNewsletterRecipientsStore, ["fetchNewsletterRecipients"]),
|
||||||
...mapActions(useQueryStoreStore, ["fetchQueries"]),
|
...mapActions(useQueryStoreStore, ["fetchQueries"]),
|
||||||
...mapActions(useQueryBuilderStore, ["sendQuery"]),
|
...mapActions(useQueryBuilderStore, ["sendQuery"]),
|
||||||
removeSelected(id: number) {
|
removeSelected(id: string) {
|
||||||
let index = this.recipients.findIndex((s) => s == id);
|
let index = this.recipients.findIndex((s) => s == id);
|
||||||
if (index != -1) {
|
if (index != -1) {
|
||||||
this.recipients.splice(index, 1);
|
this.recipients.splice(index, 1);
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
:model-value="presence.map((p) => p.memberId)"
|
:model-value="presence.map((p) => p.memberId)"
|
||||||
:disabled="!can('create', 'club', 'protocol')"
|
:disabled="!can('create', 'club', 'protocol')"
|
||||||
@add:difference="
|
@add:difference="
|
||||||
(id: number) =>
|
(id: string) =>
|
||||||
presence.push({ memberId: id, absent: false, excused: true, protocolId: parseInt(protocolId ?? '') })
|
presence.push({ memberId: id, absent: false, excused: true, protocolId: parseInt(protocolId ?? '') })
|
||||||
"
|
"
|
||||||
@add:member="(s) => members.push(s)"
|
@add:member="(s) => members.push(s)"
|
||||||
|
@ -78,7 +78,7 @@ export default defineComponent({
|
||||||
...mapWritableState(useProtocolPresenceStore, ["presence", "loading"]),
|
...mapWritableState(useProtocolPresenceStore, ["presence", "loading"]),
|
||||||
...mapState(useAbilityStore, ["can"]),
|
...mapState(useAbilityStore, ["can"]),
|
||||||
getMember() {
|
getMember() {
|
||||||
return (memberId: number) => {
|
return (memberId: string) => {
|
||||||
return this.members.find((m) => memberId == m.id);
|
return this.members.find((m) => memberId == m.id);
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
@ -86,7 +86,7 @@ export default defineComponent({
|
||||||
mounted() {},
|
mounted() {},
|
||||||
methods: {
|
methods: {
|
||||||
...mapActions(useProtocolPresenceStore, ["fetchProtocolPresence"]),
|
...mapActions(useProtocolPresenceStore, ["fetchProtocolPresence"]),
|
||||||
removeSelected(id: number) {
|
removeSelected(id: string) {
|
||||||
let index = this.presence.findIndex((s) => s.memberId == id);
|
let index = this.presence.findIndex((s) => s.memberId == id);
|
||||||
if (index != -1) {
|
if (index != -1) {
|
||||||
this.presence.splice(index, 1);
|
this.presence.splice(index, 1);
|
||||||
|
|
|
@ -95,7 +95,7 @@ export default defineComponent({
|
||||||
this.user = cloneDeep(this.origin);
|
this.user = cloneDeep(this.origin);
|
||||||
},
|
},
|
||||||
fetchItem() {
|
fetchItem() {
|
||||||
this.fetchUserById(parseInt(this.id ?? ""))
|
this.fetchUserById(this.id ?? "")
|
||||||
.then((result) => {
|
.then((result) => {
|
||||||
this.user = result.data;
|
this.user = result.data;
|
||||||
this.origin = cloneDeep(result.data);
|
this.origin = cloneDeep(result.data);
|
||||||
|
|
|
@ -57,7 +57,7 @@ export default defineComponent({
|
||||||
methods: {
|
methods: {
|
||||||
...mapActions(useUserStore, ["fetchUserById", "updateActiveUserPermissions"]),
|
...mapActions(useUserStore, ["fetchUserById", "updateActiveUserPermissions"]),
|
||||||
fetchItem() {
|
fetchItem() {
|
||||||
this.fetchUserById(parseInt(this.id ?? ""))
|
this.fetchUserById(this.id ?? "")
|
||||||
.then((result) => {
|
.then((result) => {
|
||||||
this.user = result.data;
|
this.user = result.data;
|
||||||
this.loading = "fetched";
|
this.loading = "fetched";
|
||||||
|
|
|
@ -111,7 +111,7 @@ export default defineComponent({
|
||||||
this.assigned = this.origin?.roles.map((r) => r.id) ?? [];
|
this.assigned = this.origin?.roles.map((r) => r.id) ?? [];
|
||||||
},
|
},
|
||||||
fetchItem() {
|
fetchItem() {
|
||||||
this.fetchUserById(parseInt(this.id ?? ""))
|
this.fetchUserById(this.id ?? "")
|
||||||
.then((result) => {
|
.then((result) => {
|
||||||
this.origin = cloneDeep(result.data);
|
this.origin = cloneDeep(result.data);
|
||||||
this.assigned = this.origin?.roles.map((r) => r.id) ?? [];
|
this.assigned = this.origin?.roles.map((r) => r.id) ?? [];
|
||||||
|
|
|
@ -11,53 +11,53 @@
|
||||||
<component v-if="markdownComponent" :is="markdownComponent" />
|
<component v-if="markdownComponent" :is="markdownComponent" />
|
||||||
<p v-else>Diese Seite existiert nicht.</p>
|
<p v-else>Diese Seite existiert nicht.</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</MainTemplate>
|
</MainTemplate>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { defineAsyncComponent, defineComponent, markRaw} from "vue";
|
import { defineAsyncComponent, defineComponent, markRaw } from "vue";
|
||||||
import MainTemplate from "@/templates/Main.vue";
|
import MainTemplate from "@/templates/Main.vue";
|
||||||
import 'highlight.js/styles/atom-one-dark.css';
|
import "highlight.js/styles/atom-one-dark.css";
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
props: {
|
props: {
|
||||||
page: String
|
page: String,
|
||||||
},
|
},
|
||||||
watch:{
|
watch: {
|
||||||
page() {
|
page() {
|
||||||
this.loadPage()
|
this.loadPage();
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
markdownComponent: null,
|
markdownComponent: null as any,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
async mounted() {
|
async mounted() {
|
||||||
this.loadPage()
|
this.loadPage();
|
||||||
},
|
},
|
||||||
methods:{
|
methods: {
|
||||||
loadPage(){
|
loadPage() {
|
||||||
this.markdownComponent = null
|
this.markdownComponent = null;
|
||||||
this.markdownComponent = markRaw(defineAsyncComponent(() => import(`$/${this.page?.toLowerCase()}.md`)));
|
this.markdownComponent = markRaw(defineAsyncComponent(() => import(`$/${this.page?.toLowerCase()}.md`)));
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
.markdown-container {
|
.markdown-container {
|
||||||
font-family: 'Open Sans', sans-serif;
|
font-family: "Open Sans", sans-serif;
|
||||||
color: #555;
|
color: #555;
|
||||||
background-color: #f8f8f8;
|
background-color: #f8f8f8;
|
||||||
border: 2px solid gray;
|
border: 2px solid gray;
|
||||||
padding: 20px;
|
padding: 20px;
|
||||||
border-radius: 5px;
|
border-radius: 5px;
|
||||||
height: 100%
|
height: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
.markdown-container h1 {
|
.markdown-container h1 {
|
||||||
|
@ -84,4 +84,4 @@ export default defineComponent({
|
||||||
list-style-type: disc;
|
list-style-type: disc;
|
||||||
margin-left: 20px;
|
margin-left: 20px;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
Loading…
Add table
Reference in a new issue