topfans/frontend/pages/ai-dazi/index.vue

415 lines
8.0 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<template>
<view class="ai-dazi-container">
<!-- 背景图 -->
<image class="bg-image" src="/static/AIimg/beijing.png" mode="aspectFill" />
<!-- 左上角关闭按钮 -->
<view class="close-btn" @click="handleClose">
<image class="nav-back-icon" src="/static/icon/back.png" mode="aspectFit"></image>
</view>
<!-- 功能按钮区域 -->
<view class="action-buttons">
<!-- 装扮按钮 -->
<view class="action-btn dressup-btn" @click="handleDressup">
<image class="btn-icon" src="/static/AIimg/zhuanban.png" mode="aspectFit" />
<view class="btn-label-wrap">
<image class="btn-label-bg" src="/static/nft/dingbutubiao_an.png" mode="aspectFit" />
<text class="btn-label-text">装扮</text>
</view>
</view>
<!-- 场景按钮 -->
<view class="action-btn scene-btn" @click="handleScene">
<image class="btn-icon" src="/static/AIimg/changjing.png" mode="aspectFit" />
<view class="btn-label-wrap">
<image class="btn-label-bg" src="/static/nft/dingbutubiao_an.png" mode="aspectFit" />
<text class="btn-label-text">场景</text>
</view>
</view>
<!-- 追星历程按钮 -->
<view class="action-btn history-btn" @click="handleHistory">
<image class="btn-icon" src="/static/AIimg/zhuixinglicheng.png" mode="aspectFit" />
<view class="btn-label-wrap">
<image class="btn-label-bg" src="/static/nft/dingbutubiao_an.png" mode="aspectFit" />
<text class="btn-label-text">追星历程</text>
</view>
</view>
</view>
<!-- AI角色对话气泡 -->
<view class="dialog-area">
<view class="dialog-bubble">
<image class="bubble-bg" src="/static/AIimg/duihuakuang.png" mode="widthFix" style="width: 320rpx;" />
<text class="bubble-text">亲爱的你来辣 ~~</text>
</view>
</view>
<!-- AI角色毛绒小怪兽占位区域 -->
<view class="character-area">
<!-- 角色图片如有可替换为实际角色图 -->
<view class="character-placeholder">
<text class="character-emoji">🐾</text>
</view>
</view>
<!-- 底部输入框 -->
<view class="bottom-bar">
<view class="input-wrapper">
<input
class="chat-input"
v-model="inputText"
placeholder="发送消息给角角"
placeholder-class="input-placeholder"
confirm-type="send"
@confirm="handleSend"
/>
<view
class="send-btn"
:class="{ 'send-btn-disabled': !inputText.trim() }"
@click="inputText.trim() && handleSend()"
>
<text class="send-icon">发送</text>
</view>
</view>
<!-- <view class="add-btn" @click="handleAdd">
<text class="add-icon">+</text>
</view> -->
</view>
</view>
</template>
<script setup>
import { ref } from 'vue';
const inputText = ref('');
const handleClose = () => {
// 获取页面栈
const pages = getCurrentPages();
if (pages.length > 1) {
// 有上一页,执行返回
uni.navigateBack();
} else {
// 没有上一页跳转到square页面
uni.reLaunch({
url: '/pages/square/square'
});
}
};
const handleDressup = () => {
uni.showToast({ title: '装扮功能开发中', icon: 'none' });
};
const handleScene = () => {
uni.showToast({ title: '场景功能开发中', icon: 'none' });
};
const handleHistory = () => {
uni.showToast({ title: '追星历程开发中', icon: 'none' });
};
const handleSend = () => {
if (!inputText.value.trim()) return;
uni.showToast({ title: `发送:${inputText.value}`, icon: 'none' });
inputText.value = '';
};
const handleAdd = () => {
uni.showToast({ title: '更多功能开发中', icon: 'none' });
};
</script>
<style scoped>
/* 整体容器 */
.ai-dazi-container {
position: relative;
width: 100vw;
height: 100vh;
overflow: hidden;
background: #f9c8d9;
}
/* 背景图 */
.bg-image {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
z-index: 0;
}
/* 关闭按钮 */
.close-btn {
position: absolute;
top: 60rpx;
left: 30rpx;
z-index: 100;
width: 80rpx;
height: 80rpx;
/* border-radius: 50%; */
display: flex;
align-items: center;
justify-content: center;
/* border: 3rpx solid rgba(255, 255, 255, 0.6); */
}
.nav-back-icon {
width: 80rpx;
height: 80rpx;
}
/* 浮动装饰物 */
.decorations {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 60%;
z-index: 10;
pointer-events: none;
}
.deco {
position: absolute;
}
/* 左侧装饰(帽子/书本叠放) */
.deco-1 {
top: 100rpx;
left: 20rpx;
width: 220rpx;
height: 220rpx;
transform: rotate(-10deg);
filter: drop-shadow(0 8rpx 16rpx rgba(180, 100, 220, 0.3));
}
/* 右侧装饰(彩虹房子) */
.deco-2 {
top: 80rpx;
right: 30rpx;
width: 180rpx;
height: 180rpx;
transform: rotate(8deg);
filter: drop-shadow(0 8rpx 16rpx rgba(180, 100, 220, 0.3));
}
/* 功能按钮区域 */
.action-buttons {
position: absolute;
top: 280rpx;
left: 0;
width: 100%;
z-index: 20;
}
.action-btn {
position: absolute;
display: flex;
flex-direction: column;
align-items: center;
}
.btn-icon {
width: 144rpx;
height: 144rpx;
}
.btn-label {
width: 120rpx;
height: 60rpx;
margin-top: 8rpx;
}
.btn-label-wrap {
position: relative;
display: flex;
align-items: center;
justify-content: center;
width: 128rpx;
height: 70rpx;
}
.btn-label-bg {
position: absolute;
width: 100%;
height: 100%;
}
.btn-label-text {
position: relative;
z-index: 1;
font-size: 16rpx;
color: #fff;
font-weight: 600;
line-height: 70rpx;
text-shadow: 0 1rpx 4rpx rgba(150, 50, 150, 0.5);
}
/* 装扮按钮 - 左侧中部 */
.dressup-btn {
left: 120rpx;
top: 0;
}
/* 场景按钮 - 右侧 */
.scene-btn {
right: 120rpx;
top: 100rpx;
}
/* 追星历程按钮 - 左侧下方 */
.history-btn {
left: 120rpx;
top: 296rpx;
}
/* 对话气泡区域 */
.dialog-area {
position: absolute;
top: 776rpx;
right: 72rpx;
z-index: 20;
display: flex;
justify-content: flex-end;
}
.dialog-bubble {
position: relative;
display: flex;
align-items: center;
justify-content: center;
}
.bubble-bg {
width: auto;
height: 128rpx;
max-width: 500rpx;
}
.bubble-text {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
font-size: 26rpx;
color: #fff;
font-weight: 600;
text-align: center;
letter-spacing: 1rpx;
line-height: 1.4;
white-space: nowrap;
padding: 0 40rpx;
text-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.5);
}
/* 角色区域 */
.character-area {
position: absolute;
bottom: 160rpx;
left: 50%;
transform: translateX(-50%);
z-index: 15;
display: flex;
align-items: center;
justify-content: center;
}
.character-placeholder {
width: 200rpx;
height: 200rpx;
display: flex;
align-items: center;
justify-content: center;
}
.character-emoji {
font-size: 120rpx;
filter: drop-shadow(0 8rpx 20rpx rgba(200, 100, 200, 0.4));
}
/* 底部输入栏 */
.bottom-bar {
position: absolute;
bottom: 0;
left: 0;
right: 0;
z-index: 50;
display: flex;
align-items: center;
padding: 48rpx 24rpx;
background: rgba(249, 200, 217, 0.5);
border-top: 4rpx solid #ff9de2;
border-radius: 50rpx 50rpx 0 0;
gap: 16rpx;
}
.input-wrapper {
flex: 1;
display: flex;
align-items: center;
background: rgba(255, 255, 255, 0.85);
border-radius: 50rpx;
padding: 10rpx 16rpx 10rpx 24rpx;
box-shadow: 0 4rpx 20rpx rgba(200, 100, 200, 0.2);
border: 2rpx solid rgba(255, 255, 255, 0.8);
}
.send-btn {
width: 100rpx;
height: 60rpx;
border-radius: 30rpx;
background: linear-gradient(135deg, #ff9de2, #c97bff);
display: flex;
align-items: center;
justify-content: center;
flex-shrink: 0;
}
.send-btn-disabled {
background: #ccc;
}
.send-icon {
color: #fff;
font-size: 28rpx;
}
.chat-input {
width: 100%;
height: 60rpx;
font-size: 32rpx;
color: #5a3060;
background: transparent;
line-height: 60rpx;
}
.input-placeholder {
color: #c9a0d0;
font-size: 32rpx;
}
.add-btn {
width: 80rpx;
height: 80rpx;
border-radius: 50%;
background: linear-gradient(135deg, #ff9de2, #c97bff);
display: flex;
align-items: center;
justify-content: center;
box-shadow: 0 4rpx 16rpx rgba(200, 100, 200, 0.5);
flex-shrink: 0;
}
.add-icon {
color: #fff;
font-size: 48rpx;
font-weight: 300;
line-height: 1;
margin-top: -4rpx;
}
</style>