Files
YGChatCS/src/pages-aigc/home/components/GiftPointsToast/index.vue
T
duanshuwen bfebed44b0 chore: remove recharge and switch to test mode
Remove all recharge-related pages, components, and API endpoints.
Update developVersion flag to enable test environment with 400 free credits for all users.
Revise PointInsufficientDialog to reflect closed recharge channel, update button text and actions.
Remove recharge actions from all top bars and generate confirmation panels.
Add new user agreement page for service terms, update related API calls.
Restyle AigcConsentDialog to use sectioned content layout.
Fix visibility timing logic in GiftPointsToast component.
2026-07-20 14:50:14 +08:00

83 lines
1.7 KiB
Vue

<template>
<view v-if="displayVisible" class="gift-points-toast" role="status">
<text class="gift-points-badge">{{ title }}</text>
<text class="gift-points-message">{{ message }}</text>
<view class="gift-points-close" @tap="handleClose">
<uni-icons type="closeempty" size="20" color="#ffffff" />
</view>
</view>
</template>
<script setup>
import { onBeforeUnmount, onMounted, ref, watch } from "vue";
const props = defineProps({
visible: {
type: Boolean,
default: true,
},
delay: {
type: Number,
default: 3000,
},
title: {
type: String,
default: "400积分已到账",
},
message: {
type: String,
default: "新用户权益已发放,可用于图片版或动效视频版内容升级。",
},
});
const emit = defineEmits(["close", "update:visible"]);
const displayVisible = ref(false);
const mounted = ref(false);
let showTimer = null;
const clearShowTimer = () => {
if (showTimer) {
clearTimeout(showTimer);
showTimer = null;
}
};
const syncVisible = (visible) => {
clearShowTimer();
displayVisible.value = false;
if (!visible || !mounted.value) return;
showTimer = setTimeout(() => {
showTimer = null;
displayVisible.value = props.visible;
}, Math.max(0, props.delay));
};
const handleClose = () => {
clearShowTimer();
displayVisible.value = false;
emit("update:visible", false);
emit("close");
};
watch(
() => props.visible,
(visible) => {
syncVisible(visible);
}
);
onMounted(() => {
mounted.value = true;
syncVisible(props.visible);
});
onBeforeUnmount(() => {
clearShowTimer();
});
</script>
<style scoped lang="scss">
@import "./styles/index.scss";
</style>