This commit is contained in:
@@ -108,7 +108,7 @@
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, reactive, computed, onMounted } from 'vue';
|
||||
import { ref, reactive, computed, onMounted, onUnmounted } from 'vue';
|
||||
import { popupApi, notificationApi } from '@/api/index.js';
|
||||
import { handledPopupNotificationIds } from '@/utils/popup.js';
|
||||
import {
|
||||
@@ -333,6 +333,8 @@
|
||||
emit('close', 'done');
|
||||
};
|
||||
|
||||
let mounted = true;
|
||||
onUnmounted(() => { mounted = false; });
|
||||
onMounted(async () => {
|
||||
if (!props.identifier) {
|
||||
emit('close', 'empty');
|
||||
@@ -341,6 +343,7 @@
|
||||
|
||||
try {
|
||||
const data = await popupApi.getCandidate(props.page, props.identifier);
|
||||
if (!mounted) return;
|
||||
const item = (data && data.candidate) || null;
|
||||
if (!item || !item.notification_id || handledPopupNotificationIds.has(item.notification_id)) {
|
||||
emit('close', 'empty');
|
||||
@@ -353,6 +356,7 @@
|
||||
resetForm();
|
||||
visible.value = true;
|
||||
} catch (e) {
|
||||
if (!mounted) return;
|
||||
// 资源不可见(400/code=1180)与接口异常统一静默关闭,不做 UI 分支
|
||||
console.error('查询弹窗候选失败', e);
|
||||
emit('close', 'invisible');
|
||||
|
||||
Reference in New Issue
Block a user