优化代码

This commit is contained in:
pengxiaolong
2025-08-12 22:05:06 +08:00
parent b260caa2bd
commit 784a19bdda
39 changed files with 2258 additions and 525 deletions

View File

@@ -4,7 +4,12 @@
<!-- 登录切换 -->
<div class="Switch">
<div class="Switch-content" @click="fuSWitch">
<img v-if="refSwitch" class="Switchimg" src="../assets/switchEmail.png" alt="" />
<img
v-if="refSwitch"
class="Switchimg"
src="../assets/switchEmail.png"
alt=""
/>
<img v-if="!refSwitch" class="Switchimg" src="../assets/switchvx.png" alt="" />
</div>
</div>
@@ -15,66 +20,98 @@
<div class="input-Email">
<img class="Emailimg" src="../assets/Email.png" alt="" />
<div class="vertical"></div>
<input
<el-input
type="Email"
size="large"
class="input-text"
v-model="refEmail"
placeholder="请输入邮箱"
placeholder-class="input-placeholder"
@input=""
/>
</div>
<div class="input-Password">
<img class="Passwordimg" src="../assets/Password.png" alt="" />
<div class="vertical"></div>
<input
<el-input
type="Password"
size="large"
class="input-text"
v-model="refpassword"
show-password
placeholder="请输入密码"
type="password"
placeholder-class="input-placeholder"
@input=""
/>
</div>
<div class="login-btn">登录</div>
<div class="login-btn" @click="EmailLogin">登录</div>
</div>
<!-- 微信登录 -->
<div v-if="refSwitch" class="container">
<div class="title">微信小程序登录</div>
<div class="striping"></div>
<img class="qrcode" :src="Qrcode.qrcode" alt="">
<img class="qrcode" :src="Qrcode.qrcode" alt="" />
<div class="qrcode-text">使用微信小程序扫描二维码登录</div>
</div>
</div>
<div class="register" v-if="!refSwitch">
<div class="register-text">还没有账号</div>
<div class="register-btn" @click="register">注册</div>
</div>
</div>
</template>
<script setup>
import { ref, watch, onMounted, onUnmounted } from "vue";
import { getVxQrcode,getScanResult } from "@/api/account"; // 导入登录接口
import { getVxQrcode, getScanResult, login } from "@/api/account"; // 导入登录接口
import { useRouter } from "vue-router";
import { ElMessage } from "element-plus";
import { tokenStore, UserStore } from '@/stores/notice'
import { setStorage , getStorage } from '@/utils/storage.js';
const router = useRouter();
const refname = ref("");
const refEmail = ref(""); // 邮箱
const refpassword = ref(""); // 密码
const refSwitch = ref(false); // 登录切换/true:微信登录/false:邮箱登录
const Qrcode = ref(""); // 二维码
const token = tokenStore()
const user = UserStore()
// 登录
function EmailLogin() {
// 邮箱验证
const emailRegex = /^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/;
if (!emailRegex.test(refEmail.value)) {
ElMessage.error("请输入有效的邮箱地址");
return;
}
// 密码验证
const passwordRegex = /^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)[a-zA-Z\d]{6,16}$/;
if (!passwordRegex.test(refpassword.value)) {
ElMessage.error("密码必须包含大小写字母和数字长度6-16位");
return;
}
login({
email: refEmail.value,
password: refpassword.value,
}).then((res) => {
console.log(res);
token.setToken(res.token);
setStorage("token", res.token);
user.setUser(res);
setStorage("user", res);
router.push("/nav");
});
}
// 登录切换
let vxloginstatus;
function fuSWitch() {
refSwitch.value = !refSwitch.value;
if (refSwitch.value) {
vxloginstatus =setInterval(checkLogin, 2000);
vxloginstatus = setInterval(checkLogin, 2000);
} else {
console.log("邮箱登录");
clearInterval(vxloginstatus);
console.log("邮箱登录");
clearInterval(vxloginstatus);
}
}
// 验证邮箱地址
function isValidEmail(email) {
// 邮箱地址的正则表达式
const emailRegex = /^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/;
return emailRegex.test(email);
function register() {
router.push("/emailRegistration");
}
// 获取二维码
@@ -87,10 +124,20 @@ function fetchQrcode() {
//查询微信扫码是否成功
function checkLogin() {
getScanResult(Qrcode.value.uuid).then((res) => {
if (res.token) {
token.setToken(res.token);
setStorage("token", res.token);
user.setUser(res);
setStorage("user", res);
pollstop();
router.push("/nav");
}
});
}
// 轮询查询登录状态
function pollstop() {
clearInterval(vxloginstatus);
}
// 轮询查询登录状态
let pollInterval;
watch(refname, async (newQuestion, oldQuestion) => {
@@ -101,7 +148,7 @@ onMounted(() => {
// 初始化获取二维码
fetchQrcode();
// 设置每两分钟轮询一次
pollInterval = setInterval(fetchQrcode, 120000);
pollInterval = setInterval(fetchQrcode, 90000);
});
onUnmounted(() => {
@@ -120,6 +167,7 @@ onUnmounted(() => {
background-image: url(../assets/bg.png);
background-size: 100% 100%;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
}
@@ -138,6 +186,26 @@ onUnmounted(() => {
flex-direction: column;
align-items: center;
}
.register {
width: 627px;
height: 40px;
display: flex;
justify-content: flex-end;
}
.register-text {
font-size: 18px;
color: #333333;
font-weight: bold;
margin-right: 10px;
}
.register-btn {
font-size: 18px;
color: #5fdbde;
font-weight: bold;
margin-right: 10px;
cursor: pointer;
}
.Switch {
width: 100%;
height: 100px;
@@ -166,12 +234,12 @@ onUnmounted(() => {
background-color: #0aaeab;
margin-top: 10px;
}
.qrcode{
.qrcode {
width: 200px;
height: 200px;
margin-top: 50px;
}
.qrcode-text{
.qrcode-text {
color: #333333;
font-size: 18px;
margin-top: 40px;
@@ -206,6 +274,13 @@ onUnmounted(() => {
font-size: 20px;
color: #999999;
}
:deep(.el-input__wrapper) {
box-shadow: none !important;
background-color: transparent !important;
}
:deep(.el-input__wrapper.is-focus) {
box-shadow: none !important;
}
.input-text:focus {
outline: none; /* 移除默认蓝色边框 */
}

View File

@@ -1,12 +1,51 @@
<template>
<div class="email-registration">
<div class="stepBar">
<el-steps
style="background-color: #f5f5f500"
:active="active"
finish-status="success"
simple
>
<el-step title="账号信息" />
<el-step title="邮箱验证" />
</el-steps>
</div>
<!-- 账号信息 -->
<div class="form" v-if="active === 0">
<div class="title">注册</div>
<div class="Email">
<el-input type="text" size="large" class="input-item" v-model="Email" placeholder="请输入邮箱" />
</div>
<div class="Password">
<el-input type="Password" size="large" class="input-item" v-model="Password" show-password placeholder="请输入密码" />
<text class="password-tip">您的密码必须包含大小字母和数字长度在6-16位之间</text>
</div>
<div class="ConfirmPassword">
<el-input type="Password" size="large" class="input-item" v-model="ConfirmPassword" show-password placeholder="请再次输入密码" />
</div>
<div class="btn">
<div class="Return" @click="Return">返回</div>
<div class="nextStep"@click="nextStep">下一步</div>
</div>
</div>
<!-- 完成注册 -->
<div class="form" v-if="active === 1">
<div class="title">邮箱验证</div>
<div class="Hint">
已向您的{{Email}}邮箱发送了一封验证邮件请点击邮件中的链接完成注册
</div>
<div class="ResendEmail" @click="ResendEmail">
重发邮件
</div>
</div>
</div>
</template>
<script setup>
import { register,checkStatus,resendEmail} from "@/api/account"; // 导入登录接口
import { tokenStore, UserStore } from '@/stores/notice'
import { setStorage , getStorage } from '@/utils/storage.js';
import {
ref, // 响应式基础
watch, // 侦听器
@@ -14,10 +53,75 @@ import {
onUpdated, // 组件更新后执行
onUnmounted, // 组件销毁前执行
} from "vue";
const refname = ref('');
watch(refname, async (newQuestion, oldQuestion) => {
// 变化后执行
});
import { ElMessage } from "element-plus";
import { useRouter } from 'vue-router'
const router = useRouter()
const active = ref(0);// 当前步骤
const Email = ref("");// 邮箱
const Password = ref("");// 密码
const ConfirmPassword = ref("");// 确认密码
const token = tokenStore()
const user = UserStore()
//下一步
function nextStep() {
// 邮箱验证
const emailRegex = /^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/;
if (!emailRegex.test(Email.value)) {
ElMessage.error('请输入有效的邮箱地址');
return;
}
// 密码验证
const passwordRegex = /^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)[a-zA-Z\d]{6,16}$/;
if (!passwordRegex.test(Password.value)) {
ElMessage.error('密码必须包含大小写字母和数字长度6-16位');
return;
}
// 确认密码验证
if (Password.value !== ConfirmPassword.value) {
ElMessage.error('两次输入的密码不一致');
return;
}
register({password: Password.value, email: Email.value, nickName: '用户' + Math.floor(Math.random() * 1000000),headerIcon:'181754562968_.pic_hd.jpg'}).then(res => {
active.value = active.value + 1;
check(res.id);
token.setToken(res.token);
setStorage('token', res.token)
}).catch(err => {});
}
//检查验证
let poll;
function check(id) {
poll = setInterval(() => {
checkStatus({id: id}).then(res => {
if (res.status === 0) {
user.setUser(res)
setStorage('user', res)
pollstop()
router.push('/nav')
}
})
}, 2000);
}
function pollstop() {
clearInterval(poll)
}
/// 重发邮件
function ResendEmail() {
resendEmail({mailAddress: Email.value,type:1}).then(res => {
ElMessage.success('邮件已重新发送');
}).catch(err => {});
}
//返回登录页
function Return() {
router.push('/')
}
// watch(refname, async (newQuestion, oldQuestion) => {
// // 变化后执行
// });
onMounted(() => {
// 组件挂载完成后执行
});
@@ -30,5 +134,194 @@ onUnmounted(() => {
</script>
<style scoped>
/* 样式定义 */
</style>
.email-registration {
padding: 0;
margin: 0;
width: 100vw;
height: 100vh;
background-image: url(../assets/bg.png);
background-size: 100% 100%;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
}
.stepBar {
width: 900px;
}
.form {
margin-top: 30px;
width: 900px;
height: 600px;
background-image: linear-gradient(180deg, #dbf0f1, #ffffff);
border-radius: 10px;
border: 1px solid #4fcacd;
display: flex;
flex-direction: column;
align-items: center;
}
.title{
font-size: 30px;
color: #4fcacd;
margin-top: 70px;
text-align: center;
font-weight: bold;
}
.Hint{
width: 900px;
height: 400px;
color:#4fcacd;
font-size: 20px;
text-align: center;
line-height: 500px;
margin-top: -50px;
}
.ResendEmail{
width: 200px;
height: 40px;
background-image: linear-gradient(0deg, #4fcacd, #5fdbde);
border-radius: 10px;
color: #ffffff;
font-size: 16px;
text-align: center;
line-height: 40px;
cursor: pointer;
transition: all 0.3s ease;
margin-top: 50px;
}
.ResendEmail:hover{
box-shadow: 5px 5px 15px rgba(0, 0, 0, 0.3);
transform: scale(1.08);
opacity: 0.8;
}
.Email{
margin-top: 70px;
width: 90%;
display: flex;
justify-content: center;
align-items: center;
}
.Password{
margin-top: 50px;
width: 90%;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
}
.ConfirmPassword{
margin-top: 50px;
width: 90%;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
}
.password-tip{
font-size: 12px;
color: #8c939d;
margin-top: 10px;
}
.btn{
width: 70%;
margin-top: 70px;
display: flex;
justify-content: space-between;
align-items: center;
}
.Return{
width: 200px;
height: 40px;
background-image: linear-gradient(0deg, #4fcacd, #5fdbde);
border-radius: 10px;
color: #ffffff;
font-size: 16px;
text-align: center;
line-height: 40px;
cursor: pointer;
transition: all 0.3s ease;
}
.Return:hover{
box-shadow: 5px 5px 15px rgba(0, 0, 0, 0.3);
transform: scale(1.08);
opacity: 0.8;
}
.nextStep{
width: 200px;
height: 40px;
background-image: linear-gradient(0deg, #4fcacd, #5fdbde);
border-radius: 10px;
color: #ffffff;
font-size: 16px;
text-align: center;
line-height: 40px;
cursor: pointer;
transition: all 0.3s ease;
}
.nextStep:hover{
box-shadow: 5px 5px 15px rgba(0, 0, 0, 0.3);
transform: scale(1.08);
opacity: 0.8;
}
.avatar {
width: 90%;
margin-top: 30px;
height: 178px;
}
.input {
width: 90%;
margin-top: 100px;
height: 50px;
}
.input-item {
border: none;
width: 80%;
height: 100%;
background-color: #ffffff00;
border-bottom: 1px solid #4fcacd;
}
:deep(.el-input__wrapper) {
box-shadow: none !important;
background-color: transparent !important;
}
:deep(.el-input__wrapper.is-focus) {
box-shadow: none !important;
}
.avatar-uploader {
width: 178px;
height: 178px;
border: 3px solid #4fcacd;
border-radius: 10px;
}
.avatar-uploader .avatar {
width: 178px;
height: 178px;
display: block;
}
.avatar-uploader .el-upload {
border: 1px dashed var(--el-border-color);
border-radius: 6px;
cursor: pointer;
position: relative;
overflow: hidden;
transition: var(--el-transition-duration-fast);
}
.avatar-uploader .el-upload:hover {
border-color: var(--el-color-primary);
}
.el-icon.avatar-uploader-icon {
font-size: 28px;
color: #8c939d;
width: 178px;
height: 178px;
text-align: center;
}
.avatar-tip {
width: 178px;
text-align: center;
font-size: 12px;
color: #8c939d;
}
</style>

View File

@@ -3,16 +3,18 @@
<div class="forum">
<div v-infinite-scroll="load" class="infinite-list" style="overflow: auto">
<el-card style="width: 90%">
<el-card style="width: 90%" class="card" v-for="(item, index) in NoticeList" :key="index">
<template #header>
<div class="card-header">
<span>Card name</span>
<span>{{ item.title }}</span>
</div>
</template>
<p v-for="o in 2" :key="o" class="text item">{{ "List item " + o }}</p>
<div class="card-body">
{{ item.content }}
</div>
<template #footer>
<div class="card-footer">
<span>Card footer</span>
<span>{{ item.time }}</span>
</div>
</template>
</el-card>
@@ -29,7 +31,10 @@ import {
onUpdated, // 组件更新后执行
onUnmounted, // 组件销毁前执行
} from "vue";
import { getNoticeList } from "@/api/account";
const refname = ref("");
const NoticeList = ref([]);
function load() {
// 加载更多数据
}
@@ -37,7 +42,9 @@ watch(refname, async (newQuestion, oldQuestion) => {
// 变化后执行
});
onMounted(() => {
// 组件挂载完成后执行
getNoticeList({page: 0, size: 10}).then((res) => {
NoticeList.value = res;
});
});
onUpdated(() => {
// 组件更新后执行
@@ -62,6 +69,11 @@ onUnmounted(() => {
flex-direction: column;
align-items: center;
}
.card{
border-radius: 16px;
border: 1px solid #4FCACD;
background-image: linear-gradient(180deg, #E4FFFF, #FFFFFF);
}
.card-header{
font-size: 18px;
font-weight: bold;
@@ -75,4 +87,8 @@ onUnmounted(() => {
justify-content:flex-end;
align-items: center;
}
.card-body{
color: #333333;
font-size: 24px;
}
</style>

View File

@@ -118,6 +118,8 @@ onUnmounted(() => {
.message {
width: 100%;
height: 100%;
border-radius: 16px;
background-color: #ffffff;
}
.demo-panel {
display: flex;
@@ -129,6 +131,8 @@ onUnmounted(() => {
width: 100%;
height: 100%;
background-color: #ffffff;
border-top-left-radius: 16px;
border-bottom-left-radius: 16px;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;

View File

@@ -2,22 +2,22 @@
<!-- 我的 -->
<div class="mine">
<div class="custom-style">
<el-segmented v-model="segmentedvalue" :options="options" block>
<template #default="scope">
<div class="flex flex-col items-center gap-2 p-2">
<el-icon size="1.5vw">
<component :is="scope.item.icon" />
</el-icon>
<div>{{ scope.item.label }}</div>
<div class="Selector" v-for="item in options">
<div class="card" @click="SelectorClick(item.value)" :class="{ 'active': item.value === segmentedvalue }">
<div class="card-icon">
<img class="icon" :class="{ 'pk-info-icon': item.value === 2 , 'PointsList-icon': item.value === 4 }" :src="item.icon" alt=""/>
</div>
<div class="card-content">
<div class="card-title" :class="{'active-text': item.value === segmentedvalue}">{{item.label}}</div>
</div>
</div>
</template>
</el-segmented>
</div>
</div>
<div class="mine-content">
<PointsList v-show="segmentedvalue === 4" />
<PKRecord v-show="segmentedvalue === 3" />
<PKmessage v-show="segmentedvalue === 2" />
<AnchorLibrary v-show="segmentedvalue === 1" />
<PointsList v-if="segmentedvalue === 4" />
<PKRecord v-if="segmentedvalue === 3" />
<PKmessage v-if="segmentedvalue === 2" />
<AnchorLibrary v-if="segmentedvalue === 1" />
</div>
</div>
</template>
@@ -31,12 +31,7 @@ import {
onUnmounted, // 组件销毁前执行
} from "vue";
const refname = ref('');
import {
Document,
Mic,
Coin,
List
} from '@element-plus/icons-vue';
import PointsList from "@/components/mineSubComponent/PointsList";
import PKRecord from "@/components/mineSubComponent/PKRecord";
import PKmessage from "@/components/mineSubComponent/PKmessage";
@@ -48,24 +43,33 @@ const options = [
{
label: '主播库',
value: 1,
icon: Coin,
icon: require("@/assets/AnchorLibrary.png"),
},
{
label: 'PK信息',
value: 2,
icon: Mic,
icon: require("@/assets/PKInformation.png"),
},
{
label: '我的PK记录',
value: 3,
icon: List,
value: 3,
icon: require("@/assets/PKRecord.png"),
},
{
label: '积分列表',
value: 4,
icon: Document,
icon: require("@/assets/PointsList.png"),
},
]
import { throttle } from 'lodash-es';
const throttledUpdate = throttle((value) => {
segmentedvalue.value = value;
}, 500);
function SelectorClick(value) {
throttledUpdate(value);
}
const segmentedvalue = ref(1);
watch(refname, async (newQuestion, oldQuestion) => {
@@ -89,18 +93,62 @@ onUnmounted(() => {
display: flex;
flex-direction: column;
}
.custom-style .el-segmented {
height: 70px;
--el-segmented-item-selected-color: var(--el-text-color-primary);
--el-segmented-item-selected-bg-color: @border-color;
--el-border-radius-base: 20px;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
.custom-style{
width: 100%;
height: 100px;
display: flex;
align-items: center;
justify-content:space-between;
}
.Selector{
width: 420px;
height: 110px;
}
.card{
width: 100%;
height: 90px;
border-radius: 24px;
background-color: #CEF1EB;
border: 2px solid #ffffff;
display: flex;
align-items: center;
justify-content: center;
}
.card-icon{
height: 100%;
display: flex;
align-items: center;
}
.mine-content{
width: 100%;
height: calc(100% - 70px);
height: calc(100% - 110px);
background-color: #ffffff;
border-radius: 16px;
}
.icon{
width:65px;
height: 65px;
}
.card-content{
margin-left: 62px;
}
.card-title{
font-size: 24px;
color: #636363;
}
.pk-info-icon {
width:50px;
height:72px;
}
.PointsList-icon{
width: 65px;
height: 69px;
}
.active{
background-image: linear-gradient(90deg, #E4FFFF, #FFFFFF);
border: 1px solid #03ABA8;
}
.active-text{
color: #03ABA8;
}
</style>

View File

@@ -9,31 +9,22 @@
<!-- 顶部面板 -->
<div class="demo-panel">
<div class="controlPanel">
<!-- 选择今日PK还是PK大厅 -->
<div
class="today"
@click="PKistodayorhall = true"
:style="{
boxShadow: PKistodayorhall
? '0px 0px 10px rgba(0, 0, 0, 0.4)'
: 'none',
color: PKistodayorhall ? '#6c757d' : '',
}"
@touchstart="handleTouchStart"
@touchmove="handleTouchMove"
@touchend="handleTouchEnd"
>
PK大厅
<div class="today-text" @click="Switch">PK大厅</div>
<div class="today-text" @click="Switch">今日PK</div>
<!-- 滑块 -->
<div class="slider">
{{ PKistodayorhall ? "PK大厅" : "今日PK" }}
</div>
</div>
<div
class="hall"
@click="PKistodayorhall = false"
:style="{
boxShadow: PKistodayorhall
? 'none'
: '0px 0px 10px rgba(0, 0, 0, 0.4)',
color: PKistodayorhall ? '' : '#6c757d',
}"
>
今日PK
</div>
<div class="selectbox" :style="{flexDirection: PKistodayorhall? 'column' : 'row'}">
<div class="selectbox">
<!-- 国家 -->
<el-select-v2
v-model="countryvalue"
@@ -51,7 +42,6 @@
placeholder="请选择性别"
style="vertical-align: middle"
class="select"
:style="{marginLeft: PKistodayorhall? '0px' : '30px'}"
/>
</div>
<!-- 最大最小金币 -->
@@ -82,20 +72,37 @@
range-separator=""
start-placeholder="最小PK时间"
end-placeholder="最大PK时间"
format="YYYY/MM/DD hh:mm"
value-format="x"
/>
</div>
<div class="btnbox" :style="{flexDirection: PKistodayorhall? 'column' : 'row',width: PKistodayorhall? '80px' : '190px'}">
<div
class="btnbox"
:style="{
flexDirection: PKistodayorhall ? 'column' : 'row',
width: PKistodayorhall ? '5%' : '14%',
}"
>
<!-- 搜索按钮 -->
<div
class="primary search"
class="search"
@click="search"
:style="{
backgroundColor: searchStatus ? '#5a6268' : '',
color: searchStatus ? '#ffffff' : '',
transform: searchStatus ? 'scale(1.1)' : '',
boxShadow: searchStatus
? '5px 5px 5px rgba(0, 0, 0, 0.5)'
: 'none',
}"
>
搜索
</div>
<div class="primary" @click="reset" :style="{marginLeft: PKistodayorhall? '0px' : '30px'}">重置</div>
></div>
<!-- 重置按钮 -->
<div
class="primary"
@click="reset"
:style="{
marginLeft: PKistodayorhall ? '0px' : '30px',
marginTop: PKistodayorhall ? '10px' : '0px',
}"
></div>
</div>
</div>
</div>
@@ -118,20 +125,37 @@
>
<div class="infinite-card">
<!-- 头像 -->
<div class="Avatar"></div>
<div class="Avatar">
<img
style="width: 100%; height: 100%; border-radius: 500px"
:src="item.anchorIcon"
mode="scaleToFill"
/>
</div>
<div class="Information">
<!-- 个人信息 -->
<div class="Information-Personal">
<div class="Information-name">
来自世界上最长名的国家的某个人
{{ item.disPlayId }}
</div>
<div
class="Information-gender"
:style="{
background: item.sex == 1 ? '#59D8DB' : '#F3876F',
}"
>
{{ item.sex == 1 ? "男" : "女" }}
</div>
<div class="Information-gender"></div>
<div class="Information-Country">
来自世界上最长名的国家的某个人
{{ item.country }}
</div>
</div>
<!-- 时间 -->
<div class="time">PK时间北京时间:2025-08-09 01:00</div>
<div class="time">
PK时间本地时间:{{
TimestamptolocalTime(item.pkTime * 1000)
}}
</div>
<!--PK信息 -->
<div class="Information-PK">
<img
@@ -139,17 +163,17 @@
src="https://vv-1317974657.cos.ap-shanghai.myqcloud.com/util/gold.png"
alt=""
/>
<div class="gold">金币9999k</div>
<div class="gold">金币{{ item.coin }}K</div>
<img
class="sessionimg"
src="https://vv-1317974657.cos.ap-shanghai.myqcloud.com/util/session.png"
alt=""
/>
<div class="Session">场次100</div>
<div class="Session">场次{{ item.pkNumber }}</div>
</div>
<!-- 备注信息 -->
<div class="Information-Remarks">
这是一条备注信息他很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很
{{ item.remark }}
</div>
</div>
</div>
@@ -162,17 +186,35 @@
<div class="demo-panel">
<div class="chat">
<div class="chat-name">来自世界上最长名的国家的某个人</div>
<!-- 聊天列表 -->
<div class="chat-content"></div>
<!-- 聊天输入框 -->
<div class="chat-input">
<div class="chat-input-Controls"></div>
<!-- 控件 -->
<div class="chat-input-Controls">
<!-- 其他的消息 -->
<div class="chat-input-Other">
<div class="messageModule"></div>
</div>
<!-- 发送 -->
<div class="chat-input-Send">发送</div>
</div>
<!-- 输入框 -->
<div class="chat-input-Textarea">
<el-input
v-model="textarea"
style="width:100%"
:rows="4"
type="textarea"
placeholder="请输入内容"
/>
<div class="demo-panel">
<div class="inputBox">
<div class="Console">
<div class="Console-content"></div>
</div>
<div class="input">
<textarea
v-model="textarea"
class="textarea"
style="width: 100%; height: 100%"
/>
</div>
</div>
</div>
</div>
</div>
</div>
@@ -195,50 +237,266 @@ import {
onMounted, // 组件挂载完成后执行
onUpdated, // 组件更新后执行
onUnmounted, // 组件销毁前执行
computed, // 计算属性
} from "vue";
import { getCountryNamesArray } from "../../utils/countryUtil";
import { time } from "echarts";
import { getPkList } from "@/api/account";
import { setStorage, getStorage, getPromiseStorage } from "@/utils/storage.js";
import { TimestamptolocalTime } from "@/utils/timeConversion.js";
import { ElMessage } from "element-plus";
const country = ref([]);
country.value = getCountryNamesArray(); //国家条目
const PKistodayorhall = ref(true); // 选择今日PK还是PK大厅/false 今日PK/true PK大厅
const genderOptions = [
{ value: 1, label: "男" },
{ value: 2, label: "女" },
]; // 性别选项
const searchStatus = ref(false); // 搜索状态
const countryvalue = ref(null); //选中的国家
const gendervalue = ref(null); // 选中的性别
const minnum = ref(null); // 最小金币
const maxnum = ref(null); // 最大金币
const timevalue = ref(null); // 时间
const textarea = ref(""); // 聊天输入框
const list = ref([]); // 列表数据
const HallList = ref([]); // PK大厅列表数据
const TodayList = ref([]); // PK列表数据
const page = ref(0); // 页码
const user = ref({}); // 用户信息
const genderOptions = [
{ value: 1, label: "男" },
{ value: 2, label: "女" },
]; // 性别选项
const list = ref([{}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}]); // 列表数据
// 获取pk列表
function PkList(body) {
getPkList(body).then((res) => {
if (body.condition.type == 2 || body.condition.type == undefined) {
HallList.value.push(...res);
if (PKistodayorhall.value) {
list.value = HallList.value;
}
} else {
TodayList.value.push(...res);
if (!PKistodayorhall.value) {
list.value = TodayList.value;
}
}
});
}
// 加载更多
function load() {
page.value++;
if (searchStatus.value) {
const body = {
status: 0,
page: page.value,
size: 10,
userId: user.value.id,
condition: {},
};
if (timevalue.value == null) {
if (PKistodayorhall.value) {
body.condition.type = 2;
} else {
body.condition.type = 2;
}
} else {
if (PKistodayorhall.value) {
} else {
body.condition.type = 1;
}
}
if (countryvalue.value != null) {
body.condition.country = countryvalue.value;
}
if (gendervalue.value != null) {
body.condition.sex = gendervalue.value;
}
//搜索按钮
function search() {
searchStatus.value = true;
if (minnum.value != null && maxnum.value != null) {
body.condition.coin = {
start: minnum.value,
end: maxnum.value,
};
} else if (minnum.value != null && maxnum.value == null) {
ElMessage.error("请输入最大金币数");
return;
} else if (minnum.value == null && maxnum.value != null) {
ElMessage.error("请输入最小金币数");
return;
}
if (timevalue.value != null) {
const currentTime = Date.now();
if (timevalue.value[0] < currentTime) {
ElMessage.error("开始时间不能小于当前时间");
return;
}
body.condition.pkTime = {
start: timevalue.value[0] / 1000,
end: timevalue.value[1] / 1000,
};
}
PkList(body);
} else {
const body = {
status: 0,
page: page.value,
size: 10,
userId: user.value.id,
condition: {},
};
if (timevalue.value == null) {
if (PKistodayorhall.value) {
body.condition.type = 2;
} else {
body.condition.type = 2;
}
} else {
if (PKistodayorhall.value) {
} else {
body.condition.type = 1;
}
}
PkList(body);
}
}
// 切换今日PK还是PK大厅
function Switch() {
searchStatus.value = false;
PKistodayorhall.value = !PKistodayorhall.value;
if (PKistodayorhall.value) {
list.value = HallList.value;
} else {
list.value = TodayList.value;
}
}
//搜索按钮
function search(data) {
const body = {
status: 0,
size: 10,
userId: user.value.id,
condition: {},
};
if (timevalue.value == null) {
if (PKistodayorhall.value) {
body.condition.type = 2;
} else {
body.condition.type = 2;
}
} else {
if (PKistodayorhall.value) {
} else {
body.condition.type = 1;
}
}
if (countryvalue.value != null) {
body.condition.country = countryvalue.value;
}
if (gendervalue.value != null) {
body.condition.sex = gendervalue.value;
}
if (minnum.value != null && maxnum.value != null) {
body.condition.coin = {
start: minnum.value,
end: maxnum.value,
};
} else if (minnum.value != null && maxnum.value == null) {
ElMessage.error("请输入最大金币数");
return;
} else if (minnum.value == null && maxnum.value != null) {
ElMessage.error("请输入最小金币数");
return;
}
if (timevalue.value != null) {
const currentTime = Date.now();
if (timevalue.value[0] < currentTime) {
ElMessage.error("开始时间不能小于当前时间");
return;
}
body.condition.pkTime = {
start: timevalue.value[0] / 1000,
end: timevalue.value[1] / 1000,
};
}
if (PKistodayorhall) {
HallList.value = [];
} else {
TodayList.value = [];
}
body.page = 0;
page.value = 0;
list.value = [];
if (data = 'Refresh') {
searchStatus.value = false;
}else{
searchStatus.value = true;
}
PkList(body);
}
//重置按钮
function reset() {
searchStatus.value = false;
countryvalue.value = null;
gendervalue.value = null;
minnum.value = null;
maxnum.value = null;
countryvalue.value = null;
timevalue.value = null;
page.value = 0;
search('Refresh');
}
function load() {} // 加载更多
// 计算滑块位置
const sliderPosition = computed(() => {
return PKistodayorhall.value ? "1%" : "13%";
});
// 触摸事件处理
const touchStartX = ref(0);
const touchEndX = ref(0);
function handleTouchStart(e) {
touchStartX.value = e.touches[0].clientX;
}
function handleTouchMove(e) {
touchEndX.value = e.touches[0].clientX;
}
function handleTouchEnd() {
const diff = touchStartX.value - touchEndX.value;
if (Math.abs(diff) > 50) {
// 滑动阈值
PKistodayorhall.value = diff > 0;
}
}
const refname = ref(""); //
watch(refname, async (newQuestion, oldQuestion) => {
// 变化后执行
});
onMounted(() => {
// 组件挂载完成后执行
getPromiseStorage("user")
.then((res) => {
user.value = res;
PkList({
status: 0,
page: 1,
size: 10,
userId: user.value.id,
condition: {
type: 1,
},
});
PkList({
status: 0,
page: 1,
size: 10,
userId: user.value.id,
condition: {
type: 2,
},
});
})
.catch((err) => {
console.log(err);
});
});
onUpdated(() => {
// 组件更新后执行
@@ -270,35 +528,39 @@ onUnmounted(() => {
.controlPanel {
width: 100%;
height: 100%;
background-image: linear-gradient(
30deg,
@bg-Sidebar-color-bottom,
@bg-Sidebar-color-top
);
display: flex;
align-items: center;
justify-content: space-around;
}
.today {
width: 150px;
height: 50px;
background-color: #ffffff;
border-radius: 50px;
transition: all 0.4s ease;
color: #e9e8e8;
font-size: 20px;
font-weight: bold;
width: 320px;
height: 60px;
background-color: #4fcacd;
border-radius: 30px;
box-shadow: -5px 5px 6px #45aaac inset;
display: flex;
justify-content: space-around;
}
.today-text {
width: 50%;
height: 60px;
text-align: center;
line-height: 50px;
letter-spacing: 3px;
color: #ffffff;
font-size: 24px;
line-height: 60px;
}
.today:hover {
box-shadow: 5px 5px 15px rgba(0, 0, 0, 0.3);
transform: scale(1.1);
opacity: 0.8;
}
.today:active {
transform: scale(1.1) rotate(10deg);
.slider {
position: absolute;
width: 160px;
height: 60px;
border-radius: 30px;
color: #03aba8;
text-align: center;
line-height: 60px;
font-size: 24px;
background-image: linear-gradient(180deg, #e4ffff, #ffffff);
left: v-bind(sliderPosition);
transition: left 0.3s ease;
}
.hall {
width: 150px;
@@ -329,10 +591,12 @@ onUnmounted(() => {
.select {
width: 150px;
margin-top: 10px;
margin-left: 50px;
}
.Goldcoinbox {
width: 330px;
display: flex;
margin-top: -5px;
align-items: center;
justify-content: space-between;
}
@@ -355,8 +619,11 @@ onUnmounted(() => {
}
.timebox {
width: 410px;
margin-top: 10px;
}
.btnbox {
padding-left: 20px;
padding-right: 20px;
height: 100%;
display: flex;
justify-content: center;
@@ -365,28 +632,31 @@ onUnmounted(() => {
.primary {
width: 80px;
height: 30px;
background-color: #e9e7e7;
border-radius: 10px;
color: @Supplementary-text-color;
font-size: 12px;
font-weight: bold;
text-align: center;
line-height: 30px;
letter-spacing: 2px;
border-radius: 5px;
background-image: url(../../assets/Reset.png);
background-size: 100% 100%;
transition: all 0.4s ease;
}
.search {
margin-bottom: 20px;
width: 80px;
height: 30px;
border-radius: 5px;
background-image: url(../../assets/Search.png);
background-size: 100% 100%;
transition: all 0.4s ease;
}
.search:hover {
transform: scale(1.2);
opacity: 0.8;
}
.primary:hover {
background-color: #5a6268;
color: #ffffff;
transform: scale(1.1);
transform: scale(1.2);
opacity: 0.8;
}
.infinite-list {
width: 100%;
height: 100%;
border-radius: 16px;
background-color: #ffffff;
}
.infinite-list-item {
@@ -405,13 +675,14 @@ onUnmounted(() => {
align-items: center;
justify-content: space-between;
background-image: linear-gradient(0deg, @bg-Sidebar-color-top, @bg-color);
border-radius: 20px;
box-shadow: 0px 0px 10px rgba(0, 0, 0, 0.3);
border-radius: 11px;
background-image: url(../../assets/PKbackground.png);
background-size: 100% 100%;
transition: all 0.4s ease;
}
.infinite-card:hover {
box-shadow: 0px 0px 10px rgba(0, 0, 0, 0.8);
transform: scale(1.1);
box-shadow: 0px 0px 10px rgba(0, 0, 0, 0.3);
transform: scale(1.05);
opacity: 0.8;
}
.Avatar {
@@ -423,7 +694,7 @@ onUnmounted(() => {
}
.Information {
width: calc(100% - 160px);
height: 90%;
height: 80%;
display: flex;
flex-direction: column;
justify-content: space-between;
@@ -443,7 +714,7 @@ onUnmounted(() => {
height: 20px;
background-color: #e9e7e7;
border-radius: 10px;
color: @Prompt-text-color;
color: #ffffff;
font-size: 12px;
font-weight: bold;
text-align: center;
@@ -454,9 +725,9 @@ onUnmounted(() => {
.Information-Country {
width: auto;
height: 20px;
background-color: #e9e7e7;
background-color: #e4f9f9;
border-radius: 10px;
color: @Prompt-text-color;
color: #03aba8;
font-size: 12px;
font-weight: bold;
text-align: center;
@@ -500,11 +771,15 @@ onUnmounted(() => {
.chat {
width: 100%;
height: 100%;
background-color: #ffffff;
border-top-right-radius: 16px;
border-left: 1px solid #03aba82f;
}
.chat-name {
width: 100%;
height: 50px;
background-color: #ffffff;
border-radius: 16px;
// border-bottom: 3px solid #b9b9b9;
color: @Prompt-text-color;
font-size: 16px;
@@ -518,21 +793,88 @@ onUnmounted(() => {
}
.chat-content {
width: 100%;
height: calc(100% - 200px);
height: calc(100% - 170px);
}
.chat-input {
width: 100%;
height: 150px;
// border-top: 3px solid #b9b9b9;
height: 110px;
// border-top: 1px solid #03aba8;
// background-color: #dfdfdf;
}
.chat-input-Controls {
width: 100%;
height: 50px;
background-color: @border-color;
display: flex;
align-items: center;
justify-content: space-between;
}
.chat-input-Other {
width: auto;
height: 100%;
display: flex;
align-items: center;
}
.messageModule {
width: 50px;
height: 50px;
background-color: #03aba8;
}
.chat-input-Send {
width: 20%;
height: 70%;
text-align: center;
line-height: 35px;
font-size: 16px;
color: #03aba8;
border-radius: 10px;
margin-right: 6px;
transition: all 0.4s ease;
}
.chat-input-Send:hover {
box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.3);
background-color: #03aba82d;
// color: #ffffff;
}
.chat-input-Textarea {
width: 100%;
height: 80px;
// background-color: #ffffff;
height: 60px;
}
.inputBox {
width: 100%;
height: 100%;
border-top: 2px solid #03aba82f;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}
.input {
width: 98%;
height: 100%;
display: flex;
align-items: center;
justify-content: center;
margin-top: 10px;
}
.textarea {
width: 90%;
height: 90%;
max-height: 90%;
border: none;
outline: none;
overflow: hidden;
background-color: #ff000000;
font-size: 12px;
margin-left: 5px;
margin-right: 5px;
color: #000000;
letter-spacing: 1px;
resize: none;
}
</style>
<style>
.el-splitter-bar__disable:before {
background-color: #ffffff00 !important;
}
</style>

View File

@@ -30,16 +30,17 @@ html {
.common-layout {
width: 100vw;
height: 100vh;
background-image: url(../assets/bg.png);
background-size: 100% 100%;
}
.nav-main {
width: 95vw;
height: 100vh;
background-color:@bg-color;
}
.nav-aside {
width: 5vw;
height: 100vh;
background-image: linear-gradient(0deg, @bg-Sidebar-color-top, @bg-color);
border: 2px solid @border-color;
// background-image: linear-gradient(0deg, @bg-Sidebar-color-top, @bg-color);
// border: 2px solid @border-color;
}
</style>