feat: release

This commit is contained in:
zzc
2026-05-20 15:58:04 +08:00
parent 7a5afff119
commit 0143a08af7
3 changed files with 72 additions and 9 deletions

View File

@@ -159,6 +159,8 @@
<script setup>
import { reactive, ref } from "vue";
import { getStatusBarHeight } from "@/utils/system";
import { releaseTopic } from "@/api/release";
import { smartNavigateBack } from "@/utils/page";
const statusBarHeight = ref(getStatusBarHeight() || 0);
@@ -193,9 +195,7 @@ const participants = ref([
]);
const goBack = () => {
uni.navigateBack({
delta: 1,
});
smartNavigateBack();
};
const handlePreview = () => {
@@ -293,7 +293,7 @@ const removeParticipant = (id) => {
participants.value = participants.value.filter((item) => item.id !== id);
};
const handleSubmit = () => {
const handleSubmit = async () => {
if (!formData.topic.trim()) {
uni.showToast({ title: '请输入话题', icon: 'none' });
return;
@@ -311,16 +311,29 @@ const handleSubmit = () => {
}
uni.showLoading({ title: '发布中...' });
setTimeout(() => {
try {
const payload = {
...formData,
participants: participants.value,
};
await releaseTopic(payload);
uni.hideLoading();
uni.showToast({
title: "发布成功",
icon: "success",
});
setTimeout(() => {
uni.navigateBack();
}, 1500);
}, 1000);
smartNavigateBack({ delay: 1500 });
} catch (error) {
uni.hideLoading();
uni.showToast({
title: "发布失败,请重试",
icon: "none",
});
console.error("发布失败:", error);
}
};
</script>