Files
tra-app/src/components/touch-btn/style/popup.scss
T

330 lines
6.3 KiB
SCSS

.overlay-box {
display: flex;
flex-direction: column;
width: 100vw;
height: 100vh;
background-color: rgba(0, 0, 0, 0.85);
position: relative;
}
/* 1. 定义通用的向右移出动画(核心:添加时长,解决秒没) */
@keyframes moveRightOut {
0% {
right: 0; /* 初始位置 */
}
100% {
right: -400rpx; /* 目标位置:向右移出400rpx */
}
}
/* 2. 定义通用的向左移出动画(适配 btn-box-1) */
@keyframes moveLeftOut {
0% {
left: 0; /* 初始位置 */
}
100% {
left: -400rpx; /* 目标位置:向左移出400rpx */
}
}
/* 2. 定义通用的向左移出动画(适配 btn-box-1) */
@keyframes moveBottomOut {
0% {
transform: translateY(0%);
}
100% {
transform: translateY(130%);
}
}
@keyframes fadeIn {
0% {
opacity: 0;
}
100% {
opacity: 1;
}
}
.page-box {
position: relative;
height: 500rpx;
transition: margin-bottom 0.2s ease-out;
}
.page-1 {
position: absolute;
width: 100%;
bottom: 0;
&.voice_to_text,&.send_over {
.btn-box-1 {
animation: moveLeftOut 0.3s ease-out forwards;
}
.btn-box-2 {
animation: moveRightOut 0.3s ease-out forwards;
}
.circle-bg-box {
animation: moveBottomOut 0.3s ease-out forwards;
}
}
// 仅语音
&.voice-only {
.btn-box-1,
.btn-box-2 {
display: none;
}
.btn-box-3 {
display: block !important;
}
}
// 两侧按钮
.btns-box {
height: 240rpx;
width: 100%;
font-size: 28rpx;
display: flex;
z-index: 1200;
justify-content: space-around;
position: relative;
.btn-box {
position: absolute;
height: 164rpx;
transform: scale(1.2);
bottom: -10rpx;
}
.btn-box-1 {
transition: left 0.3s ease-out;
left: -40rpx;
}
.btn-box-2 {
transition: right 0.3s ease-out;
right: -40rpx;
}
.btn-box-3 {
position: absolute;
height: 124rpx;
transform: scale(1.2);
bottom: 30rpx;
display: none;
}
}
// 底部半圆
.circle-bg-box {
height: 234rpx;
background: url(@/static/images/course/talking.png) no-repeat;
background-size: cover;
position: relative;
.tips-box {
height: 40rpx;
line-height: 40rpx;
color: #c0c0c0;
text-align: center;
margin: 36rpx 0 12rpx 0;
font-weight: 600;
font-size: 34rpx;
color: #000000;
line-height: 46px;
}
}
}
.page-2 {
width: 100%;
overflow: hidden;
padding-bottom: 50rpx;
font-size: 28rpx;
text-align: center;
display: none;
z-index: 1200;
justify-content: space-around;
margin-bottom: 214rpx;
position: absolute;
bottom: 0;
opacity: 0;
visibility: hidden; // 初始不可见且不占交互位置
&.voice_to_text,&.send_over {
display: flex !important;
visibility: visible; // 激活后可见
animation: fadeIn 0.4s ease-out 0.1s forwards;
}
// 仅文字模式,隐藏发送原语音按钮
&.text-only>.trans-btn{
visibility: hidden;
}
.transVoiceIng {
width: 154rpx;
height: 154rpx;
overflow: visible;
position: relative;
z-index: 1200;
&.cancel-btn {
background: url(@/static/images/course/cancel-btn.png) no-repeat;
background-size: cover;
}
&.trans-btn {
background: url(@/static/images/course/trans-btn.png) no-repeat;
background-size: cover;
}
.btn-text {
position: absolute;
top: calc(100% + 15rpx); /* 按钮底部+10rpx间距,避免贴边 */
left: 50%;
transform: translateX(-50%);
/* 2. 强制显示 + 最高层级,防止被遮挡 */
display: block !important;
z-index: 10000;
color: rgb(163, 163, 163);
font-size: 28rpx;
white-space: nowrap;
}
}
.send-btn {
position: relative;
width: 262rpx;
height: 154rpx;
line-height: 154rpx;
overflow: hidden;
background-color: #d8d8d8;
border-radius: 77rpx;
font-size: 33rpx;
z-index: 1200;
display: flex;
align-items: center;
justify-content: center;
.send-btn-loading,
.send-btn-text {
display: none;
}
}
&.init > .send-btn {
pointer-events: none;
cursor: not-allowed;
.send-btn-loading {
display: block !important;
pointer-events: none;
cursor: not-allowed;
}
}
&.success > .send-btn > .send-btn-text {
display: block !important;
}
&.failed .send-btn,&.networkError .send-btn {
pointer-events: none;
cursor: not-allowed;
background-color: rgb(80, 80, 80);
color: rgb(106, 106, 106);
.send-btn-text {
display: block !important;
}
}
}
.talk-dialog-box {
position: relative;
// bottom: 560rpx;
width: 100%;
display: flex;
justify-content: center;
}
.talk-dialog-div {
width: 506rpx;
min-height: 234rpx;
background-color: #06f;
border-radius: 32rpx;
transition: width 0.3s ease;
// 滑动到离开变红
&.is-out {
background-color: #ff3e49;
&::after {
background-color: #ff3e49;
}
}
// 滑动到转文字变宽
&.is-translate {
width: 706rpx;
.gif-box {
display: none;
}
}
&::after {
content: '';
width: 44rpx;
height: 44rpx;
clip-path: polygon(50% 0%, 100% 50%, 50% 100%, 0% 50%);
background-color: #06f;
overflow: hidden;
position: absolute;
bottom: -22rpx;
left: 50%;
margin-left: -22rpx;
transition: left 0.3s ease-out; // 时长0.3秒,ease-out缓动(结束时变慢,更自然)
}
// 控制下边箭头指向发送
&.init::after,
&.success::after {
left: 78% !important;
}
&.failed,&.networkError {
width: 506rpx;
height: 114rpx;
min-height: 114rpx;
background-color: #ff3e49;
&::after {
background-color: #ff3e49;
}
// 激活错误提示框
.error-tip-div {
display: flex !important;
visibility: visible; // 激活后可见
// animation: fadeIn 0.4s ease-out 0.1s forwards;
}
.textarea {
visibility: hidden; // 初始不可见且不占交互位置
}
}
&.init{
.textarea {
visibility: hidden; // 初始不可见且不占交互位置
}
}
}
.talk-dialog {
width: 100%;
height: 100%;
overflow: hidden;
position: relative;
.text-div {
overflow-y: scroll;
max-height: 434rpx;
padding: 20rpx;
font-size: 32rpx;
color: #fff;
line-height: 40rpx;
}
.gif-box {
position: absolute;
width: 200rpx;
height: 80rpx;
left: 50%;
top: 50%;
transform: translate(-50%, -50%);
}
.error-tip-div {
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
position: absolute;
display: none;
visibility: hidden; // 初始不可见且不占交互位置
display: flex;
align-items: center;
color: #ffffff;
font-size: 24rpx;
font-weight: 400;
.img {
margin-right: 10rpx;
width: 26rpx;
height: 26rpx;
}
}
}