mirror of https://github.com/halo-dev/halo-admin
parent
cd338f0b1f
commit
ae4da4784c
|
@ -16,12 +16,13 @@ import {
|
||||||
VSpace,
|
VSpace,
|
||||||
VTag,
|
VTag,
|
||||||
} from "@halo-dev/components";
|
} from "@halo-dev/components";
|
||||||
import { ref } from "vue";
|
import { onMounted, ref } from "vue";
|
||||||
import { users } from "@/modules/system/users/users-mock";
|
|
||||||
import vueFilePond from "vue-filepond";
|
import vueFilePond from "vue-filepond";
|
||||||
import "filepond/dist/filepond.min.css";
|
import "filepond/dist/filepond.min.css";
|
||||||
import FilePondPluginImagePreview from "filepond-plugin-image-preview";
|
import FilePondPluginImagePreview from "filepond-plugin-image-preview";
|
||||||
import "filepond-plugin-image-preview/dist/filepond-plugin-image-preview.min.css";
|
import "filepond-plugin-image-preview/dist/filepond-plugin-image-preview.min.css";
|
||||||
|
import type { User } from "@/types/extension";
|
||||||
|
import { axiosInstance } from "@halo-dev/admin-shared";
|
||||||
|
|
||||||
const viewTypes = [
|
const viewTypes = [
|
||||||
{
|
{
|
||||||
|
@ -43,6 +44,7 @@ const attachmentSelectVisible = ref(false);
|
||||||
const uploadVisible = ref(false);
|
const uploadVisible = ref(false);
|
||||||
const detailVisible = ref(false);
|
const detailVisible = ref(false);
|
||||||
const checkAll = ref(false);
|
const checkAll = ref(false);
|
||||||
|
const users = ref<User[]>([]);
|
||||||
|
|
||||||
const strategies = ref([
|
const strategies = ref([
|
||||||
{
|
{
|
||||||
|
@ -76,6 +78,19 @@ const attachments = Array.from(new Array(50), (_, index) => index).map(
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const handleFetchUsers = async () => {
|
||||||
|
try {
|
||||||
|
const { data } = await axiosInstance.get("/api/v1alpha1/users");
|
||||||
|
users.value = data;
|
||||||
|
} catch (e) {
|
||||||
|
console.error(e);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
handleFetchUsers();
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
<VPageHeader title="附件库">
|
<VPageHeader title="附件库">
|
||||||
|
@ -455,8 +470,8 @@ const attachments = Array.from(new Array(50), (_, index) => index).map(
|
||||||
</div>
|
</div>
|
||||||
<div class="flex-shrink-0">
|
<div class="flex-shrink-0">
|
||||||
<img
|
<img
|
||||||
:alt="user.name"
|
:alt="user.spec.displayName"
|
||||||
:src="user.avatar"
|
:src="user.spec.avatar"
|
||||||
class="h-10 w-10 rounded"
|
class="h-10 w-10 rounded"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
@ -464,10 +479,10 @@ const attachments = Array.from(new Array(50), (_, index) => index).map(
|
||||||
<p
|
<p
|
||||||
class="truncate text-sm font-medium text-gray-900"
|
class="truncate text-sm font-medium text-gray-900"
|
||||||
>
|
>
|
||||||
{{ user.name }}
|
{{ user.spec.displayName }}
|
||||||
</p>
|
</p>
|
||||||
<p class="truncate text-sm text-gray-500">
|
<p class="truncate text-sm text-gray-500">
|
||||||
@{{ user.username }}
|
@{{ user.metadata.name }}
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
|
|
|
@ -12,10 +12,11 @@ import {
|
||||||
VTabbar,
|
VTabbar,
|
||||||
VTag,
|
VTag,
|
||||||
} from "@halo-dev/components";
|
} from "@halo-dev/components";
|
||||||
import { ref } from "vue";
|
import { onMounted, ref } from "vue";
|
||||||
import { users } from "@/modules/system/users/users-mock";
|
|
||||||
import type { PagesPublicState } from "@halo-dev/admin-shared";
|
import type { PagesPublicState } from "@halo-dev/admin-shared";
|
||||||
|
import { axiosInstance } from "@halo-dev/admin-shared";
|
||||||
import { useExtensionPointsState } from "@/composables/usePlugins";
|
import { useExtensionPointsState } from "@/composables/usePlugins";
|
||||||
|
import type { User } from "@/types/extension";
|
||||||
|
|
||||||
const pagesRef = ref([
|
const pagesRef = ref([
|
||||||
{
|
{
|
||||||
|
@ -38,6 +39,8 @@ const pagesRef = ref([
|
||||||
},
|
},
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
const users = ref<User[]>([]);
|
||||||
|
|
||||||
const activeId = ref("functional");
|
const activeId = ref("functional");
|
||||||
const checkAll = ref(false);
|
const checkAll = ref(false);
|
||||||
const pagesPublicState = ref<PagesPublicState>({
|
const pagesPublicState = ref<PagesPublicState>({
|
||||||
|
@ -45,6 +48,19 @@ const pagesPublicState = ref<PagesPublicState>({
|
||||||
});
|
});
|
||||||
|
|
||||||
useExtensionPointsState("PAGES", pagesPublicState);
|
useExtensionPointsState("PAGES", pagesPublicState);
|
||||||
|
|
||||||
|
const handleFetchUsers = async () => {
|
||||||
|
try {
|
||||||
|
const { data } = await axiosInstance.get("/api/v1alpha1/users");
|
||||||
|
users.value = data;
|
||||||
|
} catch (e) {
|
||||||
|
console.error(e);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
handleFetchUsers();
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
<VPageHeader title="页面">
|
<VPageHeader title="页面">
|
||||||
|
@ -173,8 +189,8 @@ useExtensionPointsState("PAGES", pagesPublicState);
|
||||||
</div>
|
</div>
|
||||||
<div class="flex-shrink-0">
|
<div class="flex-shrink-0">
|
||||||
<img
|
<img
|
||||||
:alt="user.name"
|
:alt="user.spec.displayName"
|
||||||
:src="user.avatar"
|
:src="user.spec.avatar"
|
||||||
class="h-10 w-10 rounded"
|
class="h-10 w-10 rounded"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
@ -182,10 +198,10 @@ useExtensionPointsState("PAGES", pagesPublicState);
|
||||||
<p
|
<p
|
||||||
class="truncate text-sm font-medium text-gray-900"
|
class="truncate text-sm font-medium text-gray-900"
|
||||||
>
|
>
|
||||||
{{ user.name }}
|
{{ user.spec.displayName }}
|
||||||
</p>
|
</p>
|
||||||
<p class="truncate text-sm text-gray-500">
|
<p class="truncate text-sm text-gray-500">
|
||||||
@{{ user.username }}
|
@{{ user.metadata.name }}
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
|
|
|
@ -19,10 +19,11 @@ import {
|
||||||
VTextarea,
|
VTextarea,
|
||||||
} from "@halo-dev/components";
|
} from "@halo-dev/components";
|
||||||
import { posts } from "./posts-mock";
|
import { posts } from "./posts-mock";
|
||||||
import { computed, ref } from "vue";
|
import { computed, onMounted, ref } from "vue";
|
||||||
import { useRouter } from "vue-router";
|
import { useRouter } from "vue-router";
|
||||||
import type { Post } from "@halo-dev/admin-api";
|
import type { Post } from "@halo-dev/admin-api";
|
||||||
import { users } from "@/modules/system/users/users-mock";
|
import { axiosInstance } from "@halo-dev/admin-shared";
|
||||||
|
import type { User } from "@/types/extension";
|
||||||
|
|
||||||
const postsRef = ref(
|
const postsRef = ref(
|
||||||
// eslint-disable-next-line
|
// eslint-disable-next-line
|
||||||
|
@ -41,11 +42,21 @@ const settingActiveId = ref("general");
|
||||||
// eslint-disable-next-line
|
// eslint-disable-next-line
|
||||||
const selected = ref<Post | Record<string, any>>({});
|
const selected = ref<Post | Record<string, any>>({});
|
||||||
const saving = ref(false);
|
const saving = ref(false);
|
||||||
|
const users = ref<User[]>([]);
|
||||||
|
|
||||||
const checkedCount = computed(() => {
|
const checkedCount = computed(() => {
|
||||||
return postsRef.value.filter((post) => post.checked).length;
|
return postsRef.value.filter((post) => post.checked).length;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const handleFetchUsers = async () => {
|
||||||
|
try {
|
||||||
|
const { data } = await axiosInstance.get("/api/v1alpha1/users");
|
||||||
|
users.value = data;
|
||||||
|
} catch (e) {
|
||||||
|
console.error(e);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
const handleCheckAll = () => {
|
const handleCheckAll = () => {
|
||||||
postsRef.value.forEach((item) => {
|
postsRef.value.forEach((item) => {
|
||||||
item.checked = checkAll.value;
|
item.checked = checkAll.value;
|
||||||
|
@ -81,6 +92,10 @@ const handleRouteToEditor = (post: any) => {
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
handleFetchUsers();
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
<VModal v-model:visible="postSettings" :width="680" title="文章设置">
|
<VModal v-model:visible="postSettings" :width="680" title="文章设置">
|
||||||
|
@ -452,8 +467,8 @@ const handleRouteToEditor = (post: any) => {
|
||||||
</div>
|
</div>
|
||||||
<div class="flex-shrink-0">
|
<div class="flex-shrink-0">
|
||||||
<img
|
<img
|
||||||
:alt="user.name"
|
:alt="user.spec.displayName"
|
||||||
:src="user.avatar"
|
:src="user.spec.avatar"
|
||||||
class="h-10 w-10 rounded"
|
class="h-10 w-10 rounded"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
@ -461,10 +476,10 @@ const handleRouteToEditor = (post: any) => {
|
||||||
<p
|
<p
|
||||||
class="truncate text-sm font-medium text-gray-900"
|
class="truncate text-sm font-medium text-gray-900"
|
||||||
>
|
>
|
||||||
{{ user.name }}
|
{{ user.spec.displayName }}
|
||||||
</p>
|
</p>
|
||||||
<p class="truncate text-sm text-gray-500">
|
<p class="truncate text-sm text-gray-500">
|
||||||
@{{ user.username }}
|
@{{ user.metadata.name }}
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
|
|
|
@ -1,6 +1,22 @@
|
||||||
<script lang="ts" name="RecentLoginWidget" setup>
|
<script lang="ts" name="RecentLoginWidget" setup>
|
||||||
import { VCard } from "@halo-dev/components";
|
import { VCard } from "@halo-dev/components";
|
||||||
import { users } from "@/modules/system/users/users-mock";
|
import { onMounted, ref } from "vue";
|
||||||
|
import type { User } from "@/types/extension";
|
||||||
|
import { axiosInstance } from "@halo-dev/admin-shared";
|
||||||
|
|
||||||
|
const users = ref<User[]>([]);
|
||||||
|
|
||||||
|
const handleFetchUsers = async () => {
|
||||||
|
try {
|
||||||
|
const { data } = await axiosInstance.get("/api/v1alpha1/users");
|
||||||
|
users.value = data;
|
||||||
|
} catch (e) {
|
||||||
|
console.error(e);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
onMounted(() => {
|
||||||
|
handleFetchUsers();
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
<VCard
|
<VCard
|
||||||
|
@ -18,16 +34,18 @@ import { users } from "@/modules/system/users/users-mock";
|
||||||
<div class="flex items-center space-x-4">
|
<div class="flex items-center space-x-4">
|
||||||
<div class="flex-shrink-0">
|
<div class="flex-shrink-0">
|
||||||
<img
|
<img
|
||||||
:alt="user.name"
|
:alt="user.spec.displayName"
|
||||||
:src="user.avatar"
|
:src="user.spec.avatar"
|
||||||
class="h-10 w-10 rounded"
|
class="h-10 w-10 rounded"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div class="min-w-0 flex-1">
|
<div class="min-w-0 flex-1">
|
||||||
<p class="truncate text-sm font-medium text-gray-900">
|
<p class="truncate text-sm font-medium text-gray-900">
|
||||||
{{ user.name }}
|
{{ user.spec.displayName }}
|
||||||
|
</p>
|
||||||
|
<p class="truncate text-sm text-gray-500">
|
||||||
|
@{{ user.metadata.name }}
|
||||||
</p>
|
</p>
|
||||||
<p class="truncate text-sm text-gray-500">@{{ user.username }}</p>
|
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<time class="text-sm text-gray-500" datetime="2020-01-07 20:00">
|
<time class="text-sm text-gray-500" datetime="2020-01-07 20:00">
|
||||||
|
|
|
@ -11,12 +11,12 @@ import {
|
||||||
} from "@halo-dev/components";
|
} from "@halo-dev/components";
|
||||||
import { useRoute, useRouter } from "vue-router";
|
import { useRoute, useRouter } from "vue-router";
|
||||||
import { onMounted, ref } from "vue";
|
import { onMounted, ref } from "vue";
|
||||||
import { users } from "@/modules/system/users/users-mock";
|
|
||||||
import { axiosInstance } from "@halo-dev/admin-shared";
|
import { axiosInstance } from "@halo-dev/admin-shared";
|
||||||
import type { Role } from "@/types/extension";
|
import type { Role, User } from "@/types/extension";
|
||||||
|
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
|
|
||||||
|
const users = ref<User[]>([]);
|
||||||
const role = ref<Role>();
|
const role = ref<Role>();
|
||||||
const roleActiveId = ref("detail");
|
const roleActiveId = ref("detail");
|
||||||
|
|
||||||
|
@ -31,14 +31,24 @@ const handleFetchRole = async () => {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const handleFetchUsers = async () => {
|
||||||
|
try {
|
||||||
|
const { data } = await axiosInstance.get("/api/v1alpha1/users");
|
||||||
|
users.value = data;
|
||||||
|
} catch (e) {
|
||||||
|
console.error(e);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
|
||||||
const handleRouteToUser = (username: string) => {
|
const handleRouteToUser = (name: string) => {
|
||||||
router.push({ name: "UserDetail", params: { username } });
|
router.push({ name: "UserDetail", params: { name } });
|
||||||
};
|
};
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
handleFetchRole();
|
handleFetchRole();
|
||||||
|
handleFetchUsers();
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
|
@ -132,7 +142,7 @@ onMounted(() => {
|
||||||
v-for="(user, index) in users"
|
v-for="(user, index) in users"
|
||||||
:key="index"
|
:key="index"
|
||||||
class="block cursor-pointer hover:bg-gray-50"
|
class="block cursor-pointer hover:bg-gray-50"
|
||||||
@click="handleRouteToUser(user.username)"
|
@click="handleRouteToUser(user.metadata.name)"
|
||||||
>
|
>
|
||||||
<div class="flex items-center px-4 py-4">
|
<div class="flex items-center px-4 py-4">
|
||||||
<div class="flex min-w-0 flex-1 items-center">
|
<div class="flex min-w-0 flex-1 items-center">
|
||||||
|
@ -142,8 +152,8 @@ onMounted(() => {
|
||||||
class="overflow-hidden rounded border bg-white hover:shadow-sm"
|
class="overflow-hidden rounded border bg-white hover:shadow-sm"
|
||||||
>
|
>
|
||||||
<img
|
<img
|
||||||
:alt="user.name"
|
:alt="user.spec.displayName"
|
||||||
:src="user.avatar"
|
:src="user.spec.avatar"
|
||||||
class="h-full w-full"
|
class="h-full w-full"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
@ -156,11 +166,11 @@ onMounted(() => {
|
||||||
<p
|
<p
|
||||||
class="truncate text-sm font-medium text-gray-900"
|
class="truncate text-sm font-medium text-gray-900"
|
||||||
>
|
>
|
||||||
{{ user.name }}
|
{{ user.spec.displayName }}
|
||||||
</p>
|
</p>
|
||||||
<p class="mt-2 flex items-center">
|
<p class="mt-2 flex items-center">
|
||||||
<span class="text-xs text-gray-500">
|
<span class="text-xs text-gray-500">
|
||||||
{{ user.username }}
|
{{ user.metadata.name }}
|
||||||
</span>
|
</span>
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -1,53 +0,0 @@
|
||||||
export const users = [
|
|
||||||
{
|
|
||||||
id: 1,
|
|
||||||
name: "Ryan Wang",
|
|
||||||
username: "ryanwang",
|
|
||||||
role: "Super Administrator",
|
|
||||||
email: "i@ryanc.cc",
|
|
||||||
avatar: "https://ryanc.cc/avatar",
|
|
||||||
cover: "from-gray-800 to-red-500",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 2,
|
|
||||||
name: "JohnNiang",
|
|
||||||
username: "johnniang",
|
|
||||||
role: "Super Administrator",
|
|
||||||
email: "johnniang@halo.run",
|
|
||||||
avatar: "https://johnniang.me/avatar",
|
|
||||||
cover: "from-gray-800 to-green-500",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 3,
|
|
||||||
name: "guqing",
|
|
||||||
username: "guqing",
|
|
||||||
role: "Super Administrator",
|
|
||||||
email: "guqing@halo.run",
|
|
||||||
avatar: "https://guqing.xyz/avatar",
|
|
||||||
cover: "from-gray-800 to-blue-500",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 4,
|
|
||||||
name: "Johnson",
|
|
||||||
username: "johnson",
|
|
||||||
role: "Administrator",
|
|
||||||
email: "",
|
|
||||||
avatar: "https://i.pravatar.cc/300?name=johnson",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 5,
|
|
||||||
name: "Mary Jane",
|
|
||||||
username: "maryjane",
|
|
||||||
role: "Editor",
|
|
||||||
email: "",
|
|
||||||
avatar: "https://i.pravatar.cc/300?name=maryjane",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 5,
|
|
||||||
name: "Berry Allen",
|
|
||||||
username: "flash",
|
|
||||||
role: "Guest",
|
|
||||||
email: "",
|
|
||||||
avatar: "https://i.pravatar.cc/300?name=flash",
|
|
||||||
},
|
|
||||||
];
|
|
Loading…
Reference in New Issue