fix: youhua
This commit is contained in:
@@ -161,11 +161,12 @@
|
||||
|
||||
<!-- 成功特效弹窗 -->
|
||||
<SuccessPopup ref="successPopupRef" />
|
||||
<LoginPopup ref="loginPopupRef" @logind="handleLoginSuccess" />
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { reactive, ref } from "vue";
|
||||
import { computed, reactive, ref } from "vue";
|
||||
import { onLoad } from "@dcloudio/uni-app";
|
||||
import { getStatusBarHeight } from "@/utils/system";
|
||||
import { releaseTopic, fetchTopicCategories } from "@/api/topic";
|
||||
@@ -175,10 +176,15 @@ import {
|
||||
chooseAndUploadImage,
|
||||
} from "@/utils/common.js";
|
||||
import SuccessPopup from "@/components/SuccessPopup/SuccessPopup.vue";
|
||||
import LoginPopup from "@/components/LoginPopup/LoginPopup.vue";
|
||||
import { FILE_BASE_URL } from "@/utils/constants";
|
||||
import { useUserStore } from "@/stores/user";
|
||||
|
||||
const userStore = useUserStore();
|
||||
const successPopupRef = ref(null);
|
||||
const loginPopupRef = ref(null);
|
||||
const statusBarHeight = ref(getStatusBarHeight() || 0);
|
||||
const isLoggedIn = computed(() => !!userStore.token || !!userStore.userInfo?.nickName);
|
||||
|
||||
const categories = ref([]);
|
||||
|
||||
@@ -229,7 +235,21 @@ const goBack = () => {
|
||||
smartNavigateBack();
|
||||
};
|
||||
|
||||
const openLoginPopup = (message = "请先登录后再操作") => {
|
||||
loginPopupRef.value?.open();
|
||||
if (message) {
|
||||
uni.showToast({
|
||||
title: message,
|
||||
icon: "none",
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
const handlePreview = () => {
|
||||
if (!isLoggedIn.value) {
|
||||
openLoginPopup("请先登录后再预览");
|
||||
return;
|
||||
}
|
||||
uni.showToast({
|
||||
title: "预览功能待接入",
|
||||
icon: "none",
|
||||
@@ -248,6 +268,10 @@ const chooseCover = async () => {
|
||||
};
|
||||
|
||||
const chooseParticipantAvatar = async (index) => {
|
||||
if (!isLoggedIn.value) {
|
||||
openLoginPopup("请先登录后再上传头像");
|
||||
return;
|
||||
}
|
||||
try {
|
||||
const urls = await chooseAndUploadImage({ count: 1 });
|
||||
if (urls && urls.length > 0) {
|
||||
@@ -304,6 +328,10 @@ const removeParticipant = (id) => {
|
||||
};
|
||||
|
||||
const handleSubmit = async () => {
|
||||
if (!isLoggedIn.value) {
|
||||
openLoginPopup("请先登录后再发起评分");
|
||||
return;
|
||||
}
|
||||
if (!formData.title.trim()) {
|
||||
uni.showToast({ title: '请输入话题', icon: 'none' });
|
||||
return;
|
||||
@@ -378,6 +406,12 @@ const handleSubmit = async () => {
|
||||
console.error("发布失败:", error);
|
||||
}
|
||||
};
|
||||
|
||||
const handleLoginSuccess = () => {
|
||||
if (categories.value.length === 0) {
|
||||
loadCategories();
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
|
||||
Reference in New Issue
Block a user