pukaad-ui-lib 1.235.0 → 1.237.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/module.json +1 -1
- package/dist/runtime/components/card/card-user-blog.d.vue.ts +3 -1
- package/dist/runtime/components/card/card-user-blog.vue +25 -5
- package/dist/runtime/components/card/card-user-blog.vue.d.ts +3 -1
- package/dist/runtime/components/drawer/drawer-post-blog.d.vue.ts +2 -1
- package/dist/runtime/components/drawer/drawer-post-blog.vue.d.ts +2 -1
- package/dist/runtime/components/picker/picker-option-menu/picker-option-menu-user.d.vue.ts +2 -2
- package/dist/runtime/components/picker/picker-option-menu/picker-option-menu-user.vue.d.ts +2 -2
- package/package.json +1 -1
package/dist/module.json
CHANGED
|
@@ -7,7 +7,7 @@ interface User {
|
|
|
7
7
|
}
|
|
8
8
|
interface CardUserBlogProps {
|
|
9
9
|
id: string;
|
|
10
|
-
|
|
10
|
+
is_pinned?: boolean;
|
|
11
11
|
user: User;
|
|
12
12
|
view_count: number;
|
|
13
13
|
create_at: string;
|
|
@@ -25,8 +25,10 @@ type __VLS_Props = {
|
|
|
25
25
|
};
|
|
26
26
|
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
|
|
27
27
|
"blog-updated": () => any;
|
|
28
|
+
"blog-deleted": () => any;
|
|
28
29
|
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
29
30
|
"onBlog-updated"?: (() => any) | undefined;
|
|
31
|
+
"onBlog-deleted"?: (() => any) | undefined;
|
|
30
32
|
}>, {
|
|
31
33
|
isMyProfile: boolean;
|
|
32
34
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
@@ -39,6 +39,7 @@
|
|
|
39
39
|
@blog-unpin="onBlogUnpin"
|
|
40
40
|
@blog-pin="onBlogPin"
|
|
41
41
|
@blog-edit="onBlogEdit"
|
|
42
|
+
@blog-delete="onBlogDelete"
|
|
42
43
|
/>
|
|
43
44
|
</div>
|
|
44
45
|
<div class="flex flex-col gap-[16px] cursor-pointer" @click="onBlogClick">
|
|
@@ -91,19 +92,19 @@ import { useNuxtApp } from "nuxt/app";
|
|
|
91
92
|
import { useConvert } from "@/runtime/composables/useConvert";
|
|
92
93
|
import { useApi } from "../../composables/useApi";
|
|
93
94
|
const { convertNumber, convertDateTorelativeText } = useConvert();
|
|
94
|
-
const { $toast } = useNuxtApp();
|
|
95
|
+
const { $toast, $alert } = useNuxtApp();
|
|
95
96
|
const api = useApi();
|
|
96
97
|
const props = defineProps({
|
|
97
98
|
item: { type: Object, required: true },
|
|
98
99
|
isMyProfile: { type: Boolean, required: false, default: false }
|
|
99
100
|
});
|
|
100
101
|
const router = useRouter();
|
|
101
|
-
const emit = defineEmits(["blog-updated"]);
|
|
102
|
-
const isPinned = ref(props.item.
|
|
102
|
+
const emit = defineEmits(["blog-updated", "blog-deleted"]);
|
|
103
|
+
const isPinned = ref(props.item.is_pinned);
|
|
103
104
|
const isEditDrawerOpen = ref(false);
|
|
104
105
|
const editBlogItem = ref(null);
|
|
105
106
|
watch(
|
|
106
|
-
() => props.item.
|
|
107
|
+
() => props.item.is_pinned,
|
|
107
108
|
(val) => {
|
|
108
109
|
isPinned.value = !!val;
|
|
109
110
|
}
|
|
@@ -136,7 +137,8 @@ const onBlogEdit = async () => {
|
|
|
136
137
|
try {
|
|
137
138
|
const res = await api(`/blogs/${props.item.id}`, { method: "GET" });
|
|
138
139
|
const blog = res.data;
|
|
139
|
-
const
|
|
140
|
+
const rawContent = blog.content;
|
|
141
|
+
const content = rawContent?.ops ? { ops: rawContent.ops } : Array.isArray(rawContent) ? { ops: rawContent } : { ops: [] };
|
|
140
142
|
editBlogItem.value = {
|
|
141
143
|
id: blog.id,
|
|
142
144
|
title: blog.title,
|
|
@@ -153,4 +155,22 @@ const onBlogEdit = async () => {
|
|
|
153
155
|
const onEditSuccess = () => {
|
|
154
156
|
emit("blog-updated");
|
|
155
157
|
};
|
|
158
|
+
const onBlogDelete = async () => {
|
|
159
|
+
const { isConfirmed } = await $alert.show({
|
|
160
|
+
type: "warning",
|
|
161
|
+
title: "\u0E25\u0E1A\u0E1A\u0E17\u0E04\u0E27\u0E32\u0E21\u0E19\u0E35\u0E49?",
|
|
162
|
+
description: "\u0E1A\u0E17\u0E04\u0E27\u0E32\u0E21\u0E08\u0E30\u0E16\u0E39\u0E01\u0E25\u0E1A\u0E16\u0E32\u0E27\u0E23\u0E41\u0E25\u0E30\u0E44\u0E21\u0E48\u0E2A\u0E32\u0E21\u0E32\u0E23\u0E16\u0E01\u0E39\u0E49\u0E04\u0E37\u0E19\u0E44\u0E14\u0E49",
|
|
163
|
+
confirmText: "\u0E25\u0E1A",
|
|
164
|
+
cancelText: "\u0E22\u0E01\u0E40\u0E25\u0E34\u0E01",
|
|
165
|
+
showCancelBtn: true
|
|
166
|
+
});
|
|
167
|
+
if (!isConfirmed) return;
|
|
168
|
+
try {
|
|
169
|
+
await api(`/blogs/${props.item.id}`, { method: "DELETE" });
|
|
170
|
+
$toast.success("\u0E25\u0E1A\u0E1A\u0E17\u0E04\u0E27\u0E32\u0E21\u0E2A\u0E33\u0E40\u0E23\u0E47\u0E08");
|
|
171
|
+
emit("blog-deleted");
|
|
172
|
+
} catch (e) {
|
|
173
|
+
$toast.error(e?.data?.message?.description || "\u0E44\u0E21\u0E48\u0E2A\u0E32\u0E21\u0E32\u0E23\u0E16\u0E25\u0E1A\u0E1A\u0E17\u0E04\u0E27\u0E32\u0E21\u0E44\u0E14\u0E49");
|
|
174
|
+
}
|
|
175
|
+
};
|
|
156
176
|
</script>
|
|
@@ -7,7 +7,7 @@ interface User {
|
|
|
7
7
|
}
|
|
8
8
|
interface CardUserBlogProps {
|
|
9
9
|
id: string;
|
|
10
|
-
|
|
10
|
+
is_pinned?: boolean;
|
|
11
11
|
user: User;
|
|
12
12
|
view_count: number;
|
|
13
13
|
create_at: string;
|
|
@@ -25,8 +25,10 @@ type __VLS_Props = {
|
|
|
25
25
|
};
|
|
26
26
|
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
|
|
27
27
|
"blog-updated": () => any;
|
|
28
|
+
"blog-deleted": () => any;
|
|
28
29
|
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
29
30
|
"onBlog-updated"?: (() => any) | undefined;
|
|
31
|
+
"onBlog-deleted"?: (() => any) | undefined;
|
|
30
32
|
}>, {
|
|
31
33
|
isMyProfile: boolean;
|
|
32
34
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
@@ -4,12 +4,12 @@ declare const __VLS_export: import("vue").DefineComponent<PickerOptionMenuUserPr
|
|
|
4
4
|
"blog-unpin": () => any;
|
|
5
5
|
"blog-pin": () => any;
|
|
6
6
|
"blog-edit": () => any;
|
|
7
|
+
"blog-delete": () => any;
|
|
7
8
|
"profile-name-updated": (name: string) => any;
|
|
8
9
|
"profile-edit": () => any;
|
|
9
10
|
"profile-share": () => any;
|
|
10
11
|
"profile-follower-delete": () => any;
|
|
11
12
|
"profile-block": () => any;
|
|
12
|
-
"blog-delete": () => any;
|
|
13
13
|
"report-blog": () => any;
|
|
14
14
|
"report-place": () => any;
|
|
15
15
|
"report-profile": () => any;
|
|
@@ -23,12 +23,12 @@ declare const __VLS_export: import("vue").DefineComponent<PickerOptionMenuUserPr
|
|
|
23
23
|
"onBlog-unpin"?: (() => any) | undefined;
|
|
24
24
|
"onBlog-pin"?: (() => any) | undefined;
|
|
25
25
|
"onBlog-edit"?: (() => any) | undefined;
|
|
26
|
+
"onBlog-delete"?: (() => any) | undefined;
|
|
26
27
|
"onProfile-name-updated"?: ((name: string) => any) | undefined;
|
|
27
28
|
"onProfile-edit"?: (() => any) | undefined;
|
|
28
29
|
"onProfile-share"?: (() => any) | undefined;
|
|
29
30
|
"onProfile-follower-delete"?: (() => any) | undefined;
|
|
30
31
|
"onProfile-block"?: (() => any) | undefined;
|
|
31
|
-
"onBlog-delete"?: (() => any) | undefined;
|
|
32
32
|
"onReport-blog"?: (() => any) | undefined;
|
|
33
33
|
"onReport-place"?: (() => any) | undefined;
|
|
34
34
|
"onReport-profile"?: (() => any) | undefined;
|
|
@@ -4,12 +4,12 @@ declare const __VLS_export: import("vue").DefineComponent<PickerOptionMenuUserPr
|
|
|
4
4
|
"blog-unpin": () => any;
|
|
5
5
|
"blog-pin": () => any;
|
|
6
6
|
"blog-edit": () => any;
|
|
7
|
+
"blog-delete": () => any;
|
|
7
8
|
"profile-name-updated": (name: string) => any;
|
|
8
9
|
"profile-edit": () => any;
|
|
9
10
|
"profile-share": () => any;
|
|
10
11
|
"profile-follower-delete": () => any;
|
|
11
12
|
"profile-block": () => any;
|
|
12
|
-
"blog-delete": () => any;
|
|
13
13
|
"report-blog": () => any;
|
|
14
14
|
"report-place": () => any;
|
|
15
15
|
"report-profile": () => any;
|
|
@@ -23,12 +23,12 @@ declare const __VLS_export: import("vue").DefineComponent<PickerOptionMenuUserPr
|
|
|
23
23
|
"onBlog-unpin"?: (() => any) | undefined;
|
|
24
24
|
"onBlog-pin"?: (() => any) | undefined;
|
|
25
25
|
"onBlog-edit"?: (() => any) | undefined;
|
|
26
|
+
"onBlog-delete"?: (() => any) | undefined;
|
|
26
27
|
"onProfile-name-updated"?: ((name: string) => any) | undefined;
|
|
27
28
|
"onProfile-edit"?: (() => any) | undefined;
|
|
28
29
|
"onProfile-share"?: (() => any) | undefined;
|
|
29
30
|
"onProfile-follower-delete"?: (() => any) | undefined;
|
|
30
31
|
"onProfile-block"?: (() => any) | undefined;
|
|
31
|
-
"onBlog-delete"?: (() => any) | undefined;
|
|
32
32
|
"onReport-blog"?: (() => any) | undefined;
|
|
33
33
|
"onReport-place"?: (() => any) | undefined;
|
|
34
34
|
"onReport-profile"?: (() => any) | undefined;
|