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