hldy_app/component/public/exit.vue

151 lines
3.1 KiB
Vue
Raw Normal View History

2025-07-31 17:26:06 +08:00
<template>
<!-- 通过 v-show 控制显隐并根据 show 添加 is-active 类触发 CSS 过渡 -->
<view :class="['neuro-wrapper', donghua ? 'is-active' : '']" v-show="show">
<!-- 遮罩层点击触发关闭 -->
<view class="neuro-mask" @click="handleClose"></view>
<!-- 拟态框阻止冒泡点击 -->
<view class="neuro-box" @click.stop>
<view class="button-father">
<view class="button-white" @click="handleClose">取消</view>
<view class="button" @click="go">确定</view>
</view>
<view class="title">退出登录</view>
<view class="card-font">
确定要注销155******76账户吗
</view>
</view>
</view>
</template>
<script setup>
import {
ref,
watch
} from 'vue'
// 接收 show 属性并支持 update:show 事件
const props = defineProps({
show: {
type: Boolean,
default: true
},
});
// 区分首次渲染与动态添加
const donghua = ref(false);
watch(
() => props.show,
(newVal, oldVal) => {
if (!oldVal && newVal) {
donghua.value = false
setTimeout(()=>donghua.value = true,50)
}
}
)
const emit = defineEmits(["close"]);
// 关闭方法,通知父组件更新 show
function handleClose() {
emit('close');
}
const go = () => {
uni.setStorageSync('token', 1);
plus.runtime.quit();
}
</script>
<style lang="scss" scoped>
/* 容器默认隐藏,透明度为 0不接受点击 */
.neuro-wrapper {
position: fixed;
inset: 0;
display: flex;
justify-content: center;
align-items: center;
z-index: 999;
opacity: 0;
pointer-events: none;
transition: opacity 0.3s ease;
}
/* 显示时透明度过渡到 1可接受点击 */
.neuro-wrapper.is-active {
opacity: 1;
pointer-events: auto;
}
/* 遮罩层,半透明黑色 */
.neuro-mask {
position: absolute;
inset: 0;
background-color: rgba(0, 0, 0, 0.3);
}
/* 拟态框 固定尺寸 + 阴影样式 + 相对定位于 wrapper */
.neuro-box {
position: relative;
width: 600rpx;
height: 450rpx;
border-radius: 30rpx;
background-color: #fff;
display: flex;
flex-direction: column;
// justify-content: center;
align-items: center;
background-image: url('https://www.focusnu.com/media/directive/index/whitepeople.png');
// background-size: 100% auto;
background-position: top center;
background-repeat: no-repeat;
z-index: 1;
padding: 0 10%;
}
.button {
width: 47%;
background: linear-gradient(to left, #00C9FF, #0076FF);
display: flex;
justify-content: center;
align-items: center;
color: #fff;
font-size: 25rpx;
border-radius: 30rpx;
}
.title {
margin-top: 70rpx;
}
.card-font {
margin-top: 70rpx;
width: 600rpx;
justify-content: center;
display: flex;
}
.button-white {
width: 47%;
border: 2rpx solid #c3cacd;
background: linear-gradient(to bottom, #f3f3f5, #dee4e9);
display: flex;
justify-content: center;
align-items: center;
font-size: 25rpx;
border-radius: 30rpx;
}
.button-father {
position: absolute;
bottom: 60rpx;
left: 50%;
transform: translateX(-50%);
width: 100%;
height: 70rpx;
display: flex;
justify-content: space-between;
padding: 0 50rpx;
}
</style>