|
|
@ -59,11 +59,30 @@
|
|
|
|
:mask-closable="false"
|
|
|
|
:mask-closable="false"
|
|
|
|
preset="dialog"
|
|
|
|
preset="dialog"
|
|
|
|
title="提示"
|
|
|
|
title="提示"
|
|
|
|
content="确定锁定该泡泡动态吗?"
|
|
|
|
:content="
|
|
|
|
|
|
|
|
'确定' +
|
|
|
|
|
|
|
|
(post.is_lock ? '解锁' : '锁定') +
|
|
|
|
|
|
|
|
'该泡泡动态吗?'
|
|
|
|
|
|
|
|
"
|
|
|
|
positive-text="确认"
|
|
|
|
positive-text="确认"
|
|
|
|
negative-text="取消"
|
|
|
|
negative-text="取消"
|
|
|
|
@positive-click="execLockAction"
|
|
|
|
@positive-click="execLockAction"
|
|
|
|
/>
|
|
|
|
/>
|
|
|
|
|
|
|
|
<!-- 置顶确认 -->
|
|
|
|
|
|
|
|
<n-modal
|
|
|
|
|
|
|
|
v-model:show="showStickModal"
|
|
|
|
|
|
|
|
:mask-closable="false"
|
|
|
|
|
|
|
|
preset="dialog"
|
|
|
|
|
|
|
|
title="提示"
|
|
|
|
|
|
|
|
:content="
|
|
|
|
|
|
|
|
'确定' +
|
|
|
|
|
|
|
|
(post.is_top ? '取消置顶' : '置顶') +
|
|
|
|
|
|
|
|
'该泡泡动态吗?'
|
|
|
|
|
|
|
|
"
|
|
|
|
|
|
|
|
positive-text="确认"
|
|
|
|
|
|
|
|
negative-text="取消"
|
|
|
|
|
|
|
|
@positive-click="execStickAction"
|
|
|
|
|
|
|
|
/>
|
|
|
|
</template>
|
|
|
|
</template>
|
|
|
|
<div v-if="post.texts.length > 0">
|
|
|
|
<div v-if="post.texts.length > 0">
|
|
|
|
<span
|
|
|
|
<span
|
|
|
@ -154,21 +173,26 @@ import {
|
|
|
|
postCollection,
|
|
|
|
postCollection,
|
|
|
|
deletePost,
|
|
|
|
deletePost,
|
|
|
|
lockPost,
|
|
|
|
lockPost,
|
|
|
|
|
|
|
|
stickPost,
|
|
|
|
} from '@/api/post';
|
|
|
|
} from '@/api/post';
|
|
|
|
|
|
|
|
|
|
|
|
const store = useStore();
|
|
|
|
const store = useStore();
|
|
|
|
const router = useRouter();
|
|
|
|
const router = useRouter();
|
|
|
|
const hasStarred = ref(false);
|
|
|
|
const hasStarred = ref(false);
|
|
|
|
const hasCollected = ref(false);
|
|
|
|
const hasCollected = ref(false);
|
|
|
|
const props = withDefaults(defineProps<{
|
|
|
|
const props = withDefaults(
|
|
|
|
post: Item.PostProps,
|
|
|
|
defineProps<{
|
|
|
|
}>(), {});
|
|
|
|
post: Item.PostProps;
|
|
|
|
|
|
|
|
}>(),
|
|
|
|
|
|
|
|
{}
|
|
|
|
|
|
|
|
);
|
|
|
|
const showDelModal = ref(false);
|
|
|
|
const showDelModal = ref(false);
|
|
|
|
const showLockModal = ref(false);
|
|
|
|
const showLockModal = ref(false);
|
|
|
|
|
|
|
|
const showStickModal = ref(false);
|
|
|
|
const loading = ref(false);
|
|
|
|
const loading = ref(false);
|
|
|
|
|
|
|
|
|
|
|
|
const emit = defineEmits<{
|
|
|
|
const emit = defineEmits<{
|
|
|
|
(e: "reload"): void
|
|
|
|
(e: 'reload'): void;
|
|
|
|
}>();
|
|
|
|
}>();
|
|
|
|
|
|
|
|
|
|
|
|
const post = computed({
|
|
|
|
const post = computed({
|
|
|
@ -232,16 +256,17 @@ const adminOptions = computed(() => {
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (store.state.userInfo.is_admin) {
|
|
|
|
if (store.state.userInfo.is_admin) {
|
|
|
|
options.push(
|
|
|
|
if (post.value.is_top === 0) {
|
|
|
|
{
|
|
|
|
options.push({
|
|
|
|
label: '置顶',
|
|
|
|
label: '置顶',
|
|
|
|
key: 'top',
|
|
|
|
key: 'stick',
|
|
|
|
},
|
|
|
|
});
|
|
|
|
{
|
|
|
|
} else {
|
|
|
|
label: '精华',
|
|
|
|
options.push({
|
|
|
|
key: 'essence',
|
|
|
|
label: '取消置顶',
|
|
|
|
}
|
|
|
|
key: 'unstick',
|
|
|
|
);
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return options;
|
|
|
|
return options;
|
|
|
|
});
|
|
|
|
});
|
|
|
@ -280,13 +305,18 @@ const doClickText = (e: MouseEvent, id: number) => {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
goPostDetail(id);
|
|
|
|
goPostDetail(id);
|
|
|
|
};
|
|
|
|
};
|
|
|
|
const handlePostAction = (item: "delete" | "lock" | "unlock") => {
|
|
|
|
const handlePostAction = (
|
|
|
|
|
|
|
|
item: 'delete' | 'lock' | 'unlock' | 'stick' | 'unstick'
|
|
|
|
|
|
|
|
) => {
|
|
|
|
if (item === 'delete') {
|
|
|
|
if (item === 'delete') {
|
|
|
|
showDelModal.value = true;
|
|
|
|
showDelModal.value = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (item === 'lock' || item === 'unlock') {
|
|
|
|
if (item === 'lock' || item === 'unlock') {
|
|
|
|
showLockModal.value = true;
|
|
|
|
showLockModal.value = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (item === 'stick' || item === 'unstick') {
|
|
|
|
|
|
|
|
showStickModal.value = true;
|
|
|
|
|
|
|
|
}
|
|
|
|
};
|
|
|
|
};
|
|
|
|
const execDelAction = () => {
|
|
|
|
const execDelAction = () => {
|
|
|
|
deletePost({
|
|
|
|
deletePost({
|
|
|
@ -320,6 +350,22 @@ const execLockAction = () => {
|
|
|
|
loading.value = false;
|
|
|
|
loading.value = false;
|
|
|
|
});
|
|
|
|
});
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
const execStickAction = () => {
|
|
|
|
|
|
|
|
stickPost({
|
|
|
|
|
|
|
|
id: post.value.id,
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
.then((res) => {
|
|
|
|
|
|
|
|
emit('reload');
|
|
|
|
|
|
|
|
if (res.top_status === 1) {
|
|
|
|
|
|
|
|
window.$message.success('置顶成功');
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
window.$message.success('取消置顶成功');
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
.catch((err) => {
|
|
|
|
|
|
|
|
loading.value = false;
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
};
|
|
|
|
const handlePostStar = () => {
|
|
|
|
const handlePostStar = () => {
|
|
|
|
postStar({
|
|
|
|
postStar({
|
|
|
|
id: post.value.id,
|
|
|
|
id: post.value.id,
|
|
|
|