<template>
|
|
<view class="subscription-popup" :class="{'dark-mode': isDarkMode}">
|
|
<uv-popup ref="popup" mode="center" :closeOnClickOverlay="true" :customStyle="popupStyle">
|
|
<view class="content theme-transition">
|
|
<view class="popup-title theme-transition">{{ title }}</view>
|
|
<view class="popup-desc theme-transition">{{ description }}</view>
|
|
<view class="popup-btns">
|
|
<button class="popup-btn theme-transition" @click="handleSubscribe">订阅本章</button>
|
|
<button class="popup-btn popup-btn-video theme-transition">观看视频解锁</button>
|
|
<button class="popup-btn popup-btn-batch theme-transition">批量订阅</button>
|
|
</view>
|
|
</view>
|
|
</uv-popup>
|
|
</view>
|
|
</template>
|
|
|
|
<script>
|
|
import themeMixin from '@/mixins/themeMode.js'
|
|
|
|
export default {
|
|
name: 'subscriptionPopup',
|
|
mixins: [themeMixin],
|
|
props: {
|
|
title: {
|
|
type: String,
|
|
default: '这是付费章节 需要订阅后才能阅读'
|
|
},
|
|
description: {
|
|
type: String,
|
|
default: '订阅后可继续阅读本章内容'
|
|
}
|
|
},
|
|
data() {
|
|
return {
|
|
popupShown: false, // 是否已显示过
|
|
}
|
|
},
|
|
computed: {
|
|
popupStyle() {
|
|
return {
|
|
'background': this.isDarkMode ? '#232323' : '#fff',
|
|
'padding': '48rpx 32rpx',
|
|
'text-align': 'center',
|
|
'border-radius': '24rpx',
|
|
'min-width': '500rpx'
|
|
}
|
|
}
|
|
},
|
|
methods: {
|
|
// 打开弹窗
|
|
open() {
|
|
if (!this.popupShown) {
|
|
this.$refs.popup.open();
|
|
this.popupShown = true;
|
|
}
|
|
},
|
|
|
|
// 关闭弹窗
|
|
close() {
|
|
this.$refs.popup.close();
|
|
},
|
|
|
|
// 重置状态,允许再次显示
|
|
reset() {
|
|
this.popupShown = false;
|
|
},
|
|
|
|
// 处理订阅按钮点击
|
|
handleSubscribe() {
|
|
this.$emit('subscribe');
|
|
this.close();
|
|
}
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style lang="scss" scoped>
|
|
.subscription-popup {
|
|
.content {
|
|
.popup-title {
|
|
font-size: 32rpx;
|
|
font-weight: bold;
|
|
color: #222;
|
|
margin-bottom: 24rpx;
|
|
word-wrap: break-word;
|
|
white-space: normal;
|
|
}
|
|
|
|
.popup-desc {
|
|
font-size: 26rpx;
|
|
color: #999;
|
|
margin-bottom: 40rpx;
|
|
word-wrap: break-word;
|
|
white-space: normal;
|
|
}
|
|
|
|
.popup-btns {
|
|
display: flex;
|
|
flex-wrap: wrap;
|
|
justify-content: center;
|
|
gap: 24rpx;
|
|
|
|
.popup-btn {
|
|
background: #ff9800;
|
|
color: #fff;
|
|
border-radius: 32rpx;
|
|
font-size: 28rpx;
|
|
padding: 0 32rpx;
|
|
border: none;
|
|
margin-bottom: 16rpx;
|
|
word-break: keep-all;
|
|
|
|
&.popup-btn-video {
|
|
background: #fff3e0;
|
|
color: #ff9800;
|
|
border: 1px solid #ff9800;
|
|
}
|
|
|
|
&.popup-btn-batch {
|
|
background: #fff;
|
|
color: #ff9800;
|
|
border: 1px solid #ff9800;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
&.dark-mode {
|
|
.content {
|
|
.popup-title {
|
|
color: $dark-text-color-primary;
|
|
}
|
|
|
|
.popup-desc {
|
|
color: $dark-text-color-tertiary;
|
|
}
|
|
|
|
.popup-btns {
|
|
.popup-btn {
|
|
background: #ff9800;
|
|
color: #fff;
|
|
|
|
&.popup-btn-video {
|
|
background: rgba(255, 152, 0, 0.1);
|
|
color: #ff9800;
|
|
border: 1px solid #ff9800;
|
|
}
|
|
|
|
&.popup-btn-batch {
|
|
background: $dark-bg-color-secondary;
|
|
color: #ff9800;
|
|
border: 1px solid #ff9800;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
</style>
|