|
|
|
@ -110,6 +110,21 @@
|
|
|
|
|
negative-text="取消"
|
|
|
|
|
@positive-click="execStickAction"
|
|
|
|
|
/>
|
|
|
|
|
<!-- 修改可见度确认 -->
|
|
|
|
|
<n-modal
|
|
|
|
|
v-model:show="showVisibilityModal"
|
|
|
|
|
:mask-closable="false"
|
|
|
|
|
preset="dialog"
|
|
|
|
|
title="提示"
|
|
|
|
|
:content="
|
|
|
|
|
'确定将该泡泡动态可见度修改为' +
|
|
|
|
|
(tempVisibility == 0 ? '公开' : (tempVisibility == 1 ? '私密' : '好友可见')) +
|
|
|
|
|
'吗?'
|
|
|
|
|
"
|
|
|
|
|
positive-text="确认"
|
|
|
|
|
negative-text="取消"
|
|
|
|
|
@positive-click="execVisibilityAction"
|
|
|
|
|
/>
|
|
|
|
|
</template>
|
|
|
|
|
<div v-if="post.texts.length > 0">
|
|
|
|
|
<span
|
|
|
|
@ -201,7 +216,9 @@ import {
|
|
|
|
|
deletePost,
|
|
|
|
|
lockPost,
|
|
|
|
|
stickPost,
|
|
|
|
|
visibilityPost
|
|
|
|
|
} from '@/api/post';
|
|
|
|
|
import type { DropdownOption } from 'naive-ui';
|
|
|
|
|
|
|
|
|
|
const store = useStore();
|
|
|
|
|
const router = useRouter();
|
|
|
|
@ -216,7 +233,9 @@ const props = withDefaults(
|
|
|
|
|
const showDelModal = ref(false);
|
|
|
|
|
const showLockModal = ref(false);
|
|
|
|
|
const showStickModal = ref(false);
|
|
|
|
|
const showVisibilityModal = ref(false);
|
|
|
|
|
const loading = ref(false);
|
|
|
|
|
const tempVisibility = ref<0 | 1 | 2>(0);
|
|
|
|
|
|
|
|
|
|
const emit = defineEmits<{
|
|
|
|
|
(e: 'reload'): void;
|
|
|
|
@ -265,7 +284,7 @@ const post = computed({
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
const adminOptions = computed(() => {
|
|
|
|
|
let options = [
|
|
|
|
|
let options: DropdownOption[] = [
|
|
|
|
|
{
|
|
|
|
|
label: '删除',
|
|
|
|
|
key: 'delete',
|
|
|
|
@ -295,6 +314,34 @@ const adminOptions = computed(() => {
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (post.value.visibility === 0) {
|
|
|
|
|
options.push({
|
|
|
|
|
label: '公开',
|
|
|
|
|
key: 'vpublic',
|
|
|
|
|
children: [
|
|
|
|
|
{ label: '私密', key: 'vprivate' }
|
|
|
|
|
, { label: '好友可见', key: 'vfriend' }
|
|
|
|
|
]
|
|
|
|
|
})
|
|
|
|
|
} else if (post.value.visibility === 1) {
|
|
|
|
|
options.push({
|
|
|
|
|
label: '私密',
|
|
|
|
|
key: 'vprivate',
|
|
|
|
|
children: [
|
|
|
|
|
{ label: '公开', key: 'vpublic' }
|
|
|
|
|
, { label: '好友可见', key: 'vfriend' }
|
|
|
|
|
]
|
|
|
|
|
})
|
|
|
|
|
} else {
|
|
|
|
|
options.push({
|
|
|
|
|
label: '好友可见',
|
|
|
|
|
key: 'vfriend',
|
|
|
|
|
children: [
|
|
|
|
|
{ label: '公开', key: 'vpublic' }
|
|
|
|
|
, { label: '私密', key: 'vprivate' }
|
|
|
|
|
]
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
return options;
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
@ -333,16 +380,34 @@ const doClickText = (e: MouseEvent, id: number) => {
|
|
|
|
|
goPostDetail(id);
|
|
|
|
|
};
|
|
|
|
|
const handlePostAction = (
|
|
|
|
|
item: 'delete' | 'lock' | 'unlock' | 'stick' | 'unstick'
|
|
|
|
|
item: 'delete' | 'lock' | 'unlock' | 'stick' | 'unstick' | 'vpublic' | 'vprivate' | 'vfriend'
|
|
|
|
|
) => {
|
|
|
|
|
if (item === 'delete') {
|
|
|
|
|
showDelModal.value = true;
|
|
|
|
|
}
|
|
|
|
|
if (item === 'lock' || item === 'unlock') {
|
|
|
|
|
showLockModal.value = true;
|
|
|
|
|
}
|
|
|
|
|
if (item === 'stick' || item === 'unstick') {
|
|
|
|
|
showStickModal.value = true;
|
|
|
|
|
switch (item) {
|
|
|
|
|
case 'delete':
|
|
|
|
|
showDelModal.value = true;
|
|
|
|
|
break;
|
|
|
|
|
case 'lock':
|
|
|
|
|
case 'unlock':
|
|
|
|
|
showLockModal.value = true;
|
|
|
|
|
break;
|
|
|
|
|
case 'stick':
|
|
|
|
|
case 'unstick':
|
|
|
|
|
showStickModal.value = true;
|
|
|
|
|
break;
|
|
|
|
|
case 'vpublic':
|
|
|
|
|
tempVisibility.value = 0;
|
|
|
|
|
showVisibilityModal.value = true;
|
|
|
|
|
break;
|
|
|
|
|
case 'vprivate':
|
|
|
|
|
tempVisibility.value = 1;
|
|
|
|
|
showVisibilityModal.value = true;
|
|
|
|
|
break;
|
|
|
|
|
case 'vfriend':
|
|
|
|
|
tempVisibility.value = 2;
|
|
|
|
|
showVisibilityModal.value = true;
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
const execDelAction = () => {
|
|
|
|
@ -393,6 +458,19 @@ const execStickAction = () => {
|
|
|
|
|
loading.value = false;
|
|
|
|
|
});
|
|
|
|
|
};
|
|
|
|
|
const execVisibilityAction = () => {
|
|
|
|
|
visibilityPost({
|
|
|
|
|
id: post.value.id,
|
|
|
|
|
visibility: tempVisibility.value
|
|
|
|
|
})
|
|
|
|
|
.then((res) => {
|
|
|
|
|
emit('reload');
|
|
|
|
|
window.$message.success('修改可见性成功');
|
|
|
|
|
})
|
|
|
|
|
.catch((err) => {
|
|
|
|
|
loading.value = false;
|
|
|
|
|
});
|
|
|
|
|
};
|
|
|
|
|
const handlePostStar = () => {
|
|
|
|
|
postStar({
|
|
|
|
|
id: post.value.id,
|
|
|
|
|