优化了样式,抽象出了 WXSS/JS 库
This commit is contained in:
@@ -25,38 +25,38 @@
|
||||
|
||||
<!-- 按钮区域(第一行:保存/刷新/生成海报) -->
|
||||
<view class="button-section">
|
||||
<view class="btn-group">
|
||||
<view class="btn save-btn" bindtap="saveToAlbum" wx:if="{{qrcodeUrl}}">
|
||||
<text class="btn-icon">📥</text>
|
||||
<text class="btn-text">保存二维码</text>
|
||||
<view class="pbtn-group">
|
||||
<view class="pbtn pbtn-save" bindtap="saveToAlbum" wx:if="{{qrcodeUrl}}">
|
||||
<text class="pbtn-icon">📥</text>
|
||||
<text class="pbtn-text">保存二维码</text>
|
||||
</view>
|
||||
<view class="btn refresh-btn" bindtap="refreshQRCode" wx:if="{{!isLoading}}">
|
||||
<text class="btn-icon">⟳</text>
|
||||
<text class="btn-text">{{qrcodeUrl ? '重新获取' : '获取二维码'}}</text>
|
||||
<view class="pbtn pbtn-refresh" bindtap="refreshQRCode" wx:if="{{!isLoading}}">
|
||||
<text class="pbtn-icon">⟳</text>
|
||||
<text class="pbtn-text">{{qrcodeUrl ? '重新获取' : '获取二维码'}}</text>
|
||||
</view>
|
||||
<view class="btn loading-btn" wx:else>
|
||||
<view class="pbtn pbtn-loading" wx:else>
|
||||
<view class="loading-spinner-small"></view>
|
||||
<text class="btn-text">生成中...</text>
|
||||
<text class="pbtn-text">生成中...</text>
|
||||
</view>
|
||||
<!-- 🔥【新增】生成我的专属海报按钮 -->
|
||||
<view class="btn poster-btn" bindtap="generateMyPoster" wx:if="{{qrcodeUrl && !showPosterCanvas}}">
|
||||
<text class="btn-icon">🎨</text>
|
||||
<text class="btn-text">生成我的专属海报</text>
|
||||
<!-- 生成我的专属海报按钮 -->
|
||||
<view class="pbtn pbtn-poster" bindtap="generateMyPoster" wx:if="{{qrcodeUrl && !showPosterCanvas}}">
|
||||
<text class="pbtn-icon">🎨</text>
|
||||
<text class="pbtn-text">生成我的专属海报</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 🔥【新增】专属海报展示区(当 showPosterCanvas 为 true 时显示) -->
|
||||
<!-- 专属海报展示区(当 showPosterCanvas 为 true 时显示) -->
|
||||
<view class="poster-section" wx:if="{{showPosterCanvas}}">
|
||||
<canvas canvas-id="posterCanvas" class="poster-canvas"></canvas>
|
||||
<view class="poster-actions">
|
||||
<view class="btn save-poster-btn" bindtap="savePoster">
|
||||
<text class="btn-icon">📥</text>
|
||||
<text class="btn-text">保存海报</text>
|
||||
<view class="pbtn pbtn-save-poster" bindtap="savePoster">
|
||||
<text class="pbtn-icon">📥</text>
|
||||
<text class="pbtn-text">保存海报</text>
|
||||
</view>
|
||||
<view class="btn back-btn" bindtap="hidePoster">
|
||||
<text class="btn-icon">↩️</text>
|
||||
<text class="btn-text">返回</text>
|
||||
<view class="pbtn pbtn-back" bindtap="hidePoster">
|
||||
<text class="pbtn-icon">↩️</text>
|
||||
<text class="pbtn-text">返回</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
@@ -68,4 +68,4 @@
|
||||
</view>
|
||||
|
||||
<global-notification id="global-notification" />
|
||||
</view>
|
||||
</view>
|
||||
|
||||
@@ -1,269 +1,237 @@
|
||||
/* 机甲风格推广海报页面(含新增专属海报样式) */
|
||||
/* 推广海报页面 */
|
||||
|
||||
page {
|
||||
background: #0a0e17;
|
||||
min-height: 100vh;
|
||||
font-family: 'Avenir', 'PingFang SC', 'Helvetica Neue', sans-serif;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
/* 背景网格 */
|
||||
.grid-bg {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background-image:
|
||||
linear-gradient(rgba(0, 160, 255, 0.05) 1px, transparent 1px),
|
||||
linear-gradient(90deg, rgba(0, 160, 255, 0.05) 1px, transparent 1px);
|
||||
background-size: 50rpx 50rpx;
|
||||
pointer-events: none;
|
||||
z-index: 0;
|
||||
}
|
||||
|
||||
.page-container {
|
||||
position: relative;
|
||||
z-index: 2;
|
||||
min-height: 100vh;
|
||||
padding: 30rpx 25rpx;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
/* 机械装饰线条 */
|
||||
.mech-line {
|
||||
position: absolute;
|
||||
pointer-events: none;
|
||||
z-index: 1;
|
||||
}
|
||||
.line-h {
|
||||
top: 200rpx;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 2rpx;
|
||||
background: linear-gradient(90deg, transparent, #00a6ff, transparent);
|
||||
}
|
||||
.line-v {
|
||||
right: 50rpx;
|
||||
top: 100rpx;
|
||||
width: 2rpx;
|
||||
height: 300rpx;
|
||||
background: linear-gradient(180deg, transparent, #00a6ff, transparent);
|
||||
}
|
||||
|
||||
.content {
|
||||
position: relative;
|
||||
z-index: 3;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
min-height: 100vh;
|
||||
padding: 40rpx 0;
|
||||
}
|
||||
|
||||
/* 标题区域 */
|
||||
.title-section {
|
||||
text-align: center;
|
||||
margin-bottom: 60rpx;
|
||||
}
|
||||
.title {
|
||||
font-size: 44rpx;
|
||||
font-weight: bold;
|
||||
color: #fff;
|
||||
text-shadow: 0 0 30rpx #00a6ff;
|
||||
letter-spacing: 2rpx;
|
||||
display: block;
|
||||
margin-bottom: 20rpx;
|
||||
}
|
||||
.subtitle {
|
||||
font-size: 28rpx;
|
||||
color: #9cf;
|
||||
opacity: 0.9;
|
||||
letter-spacing: 1rpx;
|
||||
}
|
||||
|
||||
/* 二维码区域(方形,无斜切) */
|
||||
.qrcode-section {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
margin-bottom: 60rpx;
|
||||
}
|
||||
.qrcode-wrapper {
|
||||
position: relative;
|
||||
width: 400rpx;
|
||||
height: 400rpx;
|
||||
background: rgba(0, 20, 40, 0.8);
|
||||
border: 4rpx solid #00a6ff;
|
||||
/* 移除 clip-path,保持方形 */
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
box-shadow: 0 0 80rpx rgba(0, 166, 255, 0.4);
|
||||
animation: qrcodePulse 2s infinite alternate;
|
||||
}
|
||||
.qrcode-img {
|
||||
width: 90%;
|
||||
height: 90%;
|
||||
object-fit: contain;
|
||||
}
|
||||
.qrcode-glow {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background: radial-gradient(circle at 30% 30%, rgba(0, 166, 255, 0.2), transparent 70%);
|
||||
pointer-events: none;
|
||||
}
|
||||
.empty-qrcode {
|
||||
width: 400rpx;
|
||||
height: 400rpx;
|
||||
background: rgba(0, 20, 40, 0.8);
|
||||
border: 4rpx dashed #00a6ff;
|
||||
/* 方形 */
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
.empty-icon {
|
||||
font-size: 80rpx;
|
||||
color: #00a6ff;
|
||||
margin-bottom: 20rpx;
|
||||
opacity: 0.5;
|
||||
}
|
||||
.empty-text {
|
||||
font-size: 26rpx;
|
||||
color: #9cf;
|
||||
text-align: center;
|
||||
padding: 0 40rpx;
|
||||
}
|
||||
|
||||
/* 按钮区域(机甲斜切风格) */
|
||||
.button-section {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
margin-bottom: 40rpx;
|
||||
}
|
||||
.btn-group {
|
||||
display: flex;
|
||||
gap: 20rpx;
|
||||
flex-wrap: wrap;
|
||||
justify-content: center;
|
||||
}
|
||||
.btn {
|
||||
width: 220rpx;
|
||||
height: 80rpx;
|
||||
background: rgba(0, 30, 60, 0.8);
|
||||
border: 2rpx solid #00a6ff;
|
||||
border-right: none;
|
||||
border-bottom: none;
|
||||
clip-path: polygon(0 0, 100% 0, 90% 100%, 0 100%);
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
position: relative;
|
||||
transition: 0.2s;
|
||||
cursor: pointer;
|
||||
}
|
||||
.btn:active {
|
||||
transform: scale(0.96);
|
||||
box-shadow: 0 0 40rpx #00a6ff;
|
||||
}
|
||||
.save-btn {
|
||||
border-color: #00a6ff;
|
||||
}
|
||||
.refresh-btn {
|
||||
border-color: #ffaa00;
|
||||
}
|
||||
.refresh-btn .btn-icon {
|
||||
color: #ffaa00;
|
||||
}
|
||||
/* 🔥【新增】生成海报按钮样式 */
|
||||
.poster-btn {
|
||||
border-color: #ffaa00;
|
||||
}
|
||||
.poster-btn .btn-icon {
|
||||
color: #ffaa00;
|
||||
}
|
||||
.loading-btn {
|
||||
opacity: 0.7;
|
||||
pointer-events: none;
|
||||
}
|
||||
.btn-icon {
|
||||
font-size: 36rpx;
|
||||
margin-right: 8rpx;
|
||||
}
|
||||
.btn-text {
|
||||
font-size: 26rpx;
|
||||
font-weight: 500;
|
||||
color: #fff;
|
||||
}
|
||||
.loading-spinner-small {
|
||||
width: 30rpx;
|
||||
height: 30rpx;
|
||||
border: 4rpx solid rgba(255,255,255,0.2);
|
||||
border-top: 4rpx solid #fff;
|
||||
border-radius: 50%;
|
||||
animation: spin 1s linear infinite;
|
||||
margin-right: 10rpx;
|
||||
}
|
||||
|
||||
/* 🔥【新增】专属海报展示区 */
|
||||
.poster-section {
|
||||
margin-top: 40rpx;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
width: 100%;
|
||||
}
|
||||
.poster-canvas {
|
||||
width: 600rpx;
|
||||
height: 900rpx;
|
||||
background: #1a1f2e; /* 占位色 */
|
||||
border: 4rpx solid #00a6ff;
|
||||
box-shadow: 0 0 60rpx #00a6ff;
|
||||
/* 保持方形,无斜切 */
|
||||
}
|
||||
.poster-actions {
|
||||
display: flex;
|
||||
gap: 30rpx;
|
||||
margin-top: 30rpx;
|
||||
justify-content: center;
|
||||
}
|
||||
.save-poster-btn {
|
||||
background: linear-gradient(45deg, #0066cc, #00a6ff);
|
||||
border-color: #00a6ff;
|
||||
}
|
||||
.back-btn {
|
||||
background: rgba(0, 30, 60, 0.8);
|
||||
border-color: #00a6ff;
|
||||
}
|
||||
|
||||
/* 使用说明(保留) */
|
||||
.instruction {
|
||||
margin-top: 30rpx;
|
||||
padding: 20rpx 40rpx;
|
||||
background: rgba(0, 30, 50, 0.5);
|
||||
border-left: 4rpx solid #00a6ff;
|
||||
clip-path: polygon(0 0, 100% 0, 98% 100%, 0 100%);
|
||||
}
|
||||
.instruction-text {
|
||||
font-size: 24rpx;
|
||||
color: #9cf;
|
||||
line-height: 1.6;
|
||||
}
|
||||
|
||||
/* 动画 */
|
||||
@keyframes qrcodePulse {
|
||||
0% { box-shadow: 0 0 40rpx rgba(0, 166, 255, 0.3); }
|
||||
100% { box-shadow: 0 0 100rpx rgba(0, 166, 255, 0.6); }
|
||||
}
|
||||
@keyframes spin {
|
||||
0% { transform: rotate(0deg); }
|
||||
100% { transform: rotate(360deg); }
|
||||
}
|
||||
background: #0a0e17;
|
||||
min-height: 100vh;
|
||||
font-family: 'Avenir', 'PingFang SC', 'Helvetica Neue', sans-serif;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
/* 背景网格 */
|
||||
.grid-bg {
|
||||
position: fixed;
|
||||
top: 0; left: 0;
|
||||
width: 100%; height: 100%;
|
||||
background-image:
|
||||
linear-gradient(rgba(0, 160, 255, 0.05) 1px, transparent 1px),
|
||||
linear-gradient(90deg, rgba(0, 160, 255, 0.05) 1px, transparent 1px);
|
||||
background-size: 50rpx 50rpx;
|
||||
pointer-events: none;
|
||||
z-index: 0;
|
||||
}
|
||||
|
||||
.page-container {
|
||||
position: relative;
|
||||
z-index: 2;
|
||||
min-height: 100vh;
|
||||
padding: 30rpx 25rpx;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
/* 机械装饰线条 */
|
||||
.mech-line {
|
||||
position: absolute;
|
||||
pointer-events: none;
|
||||
z-index: 1;
|
||||
}
|
||||
.line-h {
|
||||
top: 200rpx; left: 0;
|
||||
width: 100%; height: 2rpx;
|
||||
background: linear-gradient(90deg, transparent, #00a6ff, transparent);
|
||||
}
|
||||
.line-v {
|
||||
right: 50rpx; top: 100rpx;
|
||||
width: 2rpx; height: 300rpx;
|
||||
background: linear-gradient(180deg, transparent, #00a6ff, transparent);
|
||||
}
|
||||
|
||||
.content {
|
||||
position: relative;
|
||||
z-index: 3;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
min-height: 100vh;
|
||||
padding: 40rpx 0;
|
||||
}
|
||||
|
||||
/* 标题区域 */
|
||||
.title-section {
|
||||
text-align: center;
|
||||
margin-bottom: 60rpx;
|
||||
}
|
||||
.title {
|
||||
font-size: 44rpx;
|
||||
font-weight: bold;
|
||||
color: #fff;
|
||||
text-shadow: 0 0 30rpx #00a6ff;
|
||||
letter-spacing: 2rpx;
|
||||
display: block;
|
||||
margin-bottom: 20rpx;
|
||||
}
|
||||
.subtitle {
|
||||
font-size: 28rpx;
|
||||
color: #9cf;
|
||||
opacity: 0.9;
|
||||
letter-spacing: 1rpx;
|
||||
}
|
||||
|
||||
/* 二维码区域 */
|
||||
.qrcode-section {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
margin-bottom: 60rpx;
|
||||
}
|
||||
.qrcode-wrapper {
|
||||
position: relative;
|
||||
width: 400rpx; height: 400rpx;
|
||||
background: rgba(0, 20, 40, 0.8);
|
||||
border: 4rpx solid #00a6ff;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
box-shadow: 0 0 80rpx rgba(0, 166, 255, 0.4);
|
||||
animation: qrcodePulse 2s infinite alternate;
|
||||
}
|
||||
.qrcode-img {
|
||||
width: 90%; height: 90%;
|
||||
object-fit: contain;
|
||||
}
|
||||
.qrcode-glow {
|
||||
position: absolute;
|
||||
top: 0; left: 0;
|
||||
width: 100%; height: 100%;
|
||||
background: radial-gradient(circle at 30% 30%, rgba(0, 166, 255, 0.2), transparent 70%);
|
||||
pointer-events: none;
|
||||
}
|
||||
.empty-qrcode {
|
||||
width: 400rpx; height: 400rpx;
|
||||
background: rgba(0, 20, 40, 0.8);
|
||||
border: 4rpx dashed #00a6ff;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
.empty-icon {
|
||||
font-size: 80rpx;
|
||||
color: #00a6ff;
|
||||
margin-bottom: 20rpx;
|
||||
opacity: 0.5;
|
||||
}
|
||||
.empty-text {
|
||||
font-size: 26rpx;
|
||||
color: #9cf;
|
||||
text-align: center;
|
||||
padding: 0 40rpx;
|
||||
}
|
||||
|
||||
/* 按钮区域 */
|
||||
.button-section {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
margin-bottom: 40rpx;
|
||||
}
|
||||
.pbtn-group {
|
||||
display: flex;
|
||||
gap: 20rpx;
|
||||
flex-wrap: wrap;
|
||||
justify-content: center;
|
||||
}
|
||||
.pbtn {
|
||||
width: 220rpx;
|
||||
height: 80rpx;
|
||||
background: rgba(0, 30, 60, 0.8);
|
||||
border: 2rpx solid #00a6ff;
|
||||
border-right: none;
|
||||
border-bottom: none;
|
||||
clip-path: polygon(0 0, 100% 0, 90% 100%, 0 100%);
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
position: relative;
|
||||
transition: 0.2s;
|
||||
}
|
||||
.pbtn:active {
|
||||
transform: scale(0.96);
|
||||
box-shadow: 0 0 40rpx #00a6ff;
|
||||
}
|
||||
.pbtn-save { border-color: #00a6ff; }
|
||||
.pbtn-refresh { border-color: #ffaa00; }
|
||||
.pbtn-refresh .pbtn-icon { color: #ffaa00; }
|
||||
.pbtn-poster { border-color: #ffaa00; }
|
||||
.pbtn-poster .pbtn-icon { color: #ffaa00; }
|
||||
.pbtn-loading {
|
||||
opacity: 0.7;
|
||||
pointer-events: none;
|
||||
}
|
||||
.pbtn-icon {
|
||||
font-size: 36rpx;
|
||||
margin-right: 8rpx;
|
||||
}
|
||||
.pbtn-text {
|
||||
font-size: 26rpx;
|
||||
font-weight: 500;
|
||||
color: #fff;
|
||||
}
|
||||
.loading-spinner-small {
|
||||
width: 30rpx; height: 30rpx;
|
||||
border: 4rpx solid rgba(255,255,255,0.2);
|
||||
border-top: 4rpx solid #fff;
|
||||
border-radius: 50%;
|
||||
animation: spin 1s linear infinite;
|
||||
margin-right: 10rpx;
|
||||
}
|
||||
|
||||
/* 专属海报展示区 */
|
||||
.poster-section {
|
||||
margin-top: 40rpx;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
width: 100%;
|
||||
}
|
||||
.poster-canvas {
|
||||
width: 600rpx; height: 900rpx;
|
||||
background: #1a1f2e;
|
||||
border: 4rpx solid #00a6ff;
|
||||
box-shadow: 0 0 60rpx #00a6ff;
|
||||
}
|
||||
.poster-actions {
|
||||
display: flex;
|
||||
gap: 30rpx;
|
||||
margin-top: 30rpx;
|
||||
justify-content: center;
|
||||
}
|
||||
.pbtn-save-poster {
|
||||
background: linear-gradient(45deg, #0066cc, #00a6ff);
|
||||
border-color: #00a6ff;
|
||||
}
|
||||
.pbtn-back {
|
||||
background: rgba(0, 30, 60, 0.8);
|
||||
border-color: #00a6ff;
|
||||
}
|
||||
|
||||
/* 使用说明 */
|
||||
.instruction {
|
||||
margin-top: 30rpx;
|
||||
padding: 20rpx 40rpx;
|
||||
background: rgba(0, 30, 50, 0.5);
|
||||
border-left: 4rpx solid #00a6ff;
|
||||
clip-path: polygon(0 0, 100% 0, 98% 100%, 0 100%);
|
||||
}
|
||||
.instruction-text {
|
||||
font-size: 24rpx;
|
||||
color: #9cf;
|
||||
line-height: 1.6;
|
||||
}
|
||||
|
||||
/* 动画 */
|
||||
@keyframes qrcodePulse {
|
||||
0% { box-shadow: 0 0 40rpx rgba(0, 166, 255, 0.3); }
|
||||
100% { box-shadow: 0 0 100rpx rgba(0, 166, 255, 0.6); }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user