Files
tk-mini-program-PC/src/components/Appaside.vue

485 lines
12 KiB
Vue
Raw Normal View History

2025-07-31 22:07:21 +08:00
<template>
<div class="app-aside">
<div class="logo">
<img class="logo-img" src="@/assets/logo.png" alt="logo"></img>
</div>
<div class="Navigation">
2025-08-12 22:05:06 +08:00
<div class="Navigation-card" v-for="(item, index) in NavigationModule" :key="index"
@click="handleClick(item.path, item.id)"
:style="{backgroundColor: item.id === activeId|| item.id === 5? '#ffffff' : '' ,
boxShadow: item.id === activeId|| item.id === 5? '5px 5px 5px rgba(0, 0, 0, 0.2)' : '',
backgroundImage: item.id === activeId? `url(${require('@/assets/selectSidebar.png')})` : ''}">
<img class="Navigation-card-icon-img" :src="item.id === activeId&& item.id !== 5? item.Selectedicon : item.icon" alt=""/>
<div class="Navigation-card-name" :style="{color: item.id === activeId? '#03ABA8' : '' ,}">{{ item.name }}</div>
2025-07-31 22:07:21 +08:00
</div>
</div>
2025-08-05 22:07:07 +08:00
<div class="Avatar" >
2025-08-12 22:05:06 +08:00
<el-popover placement="right-end" :width="200" trigger="click">-
2025-08-05 22:07:07 +08:00
<template #reference>
2025-08-12 22:05:06 +08:00
<img class="Avatar-img" :src="avatar" alt="logo"></img>
2025-08-05 22:07:07 +08:00
</template>
<div class="Avatar-content">
<!-- 点击头像弹出框内容 -->
<div class="Avatar-content-name">
来自世界上最长名的国家的某个人
</div>
<div class="Avatar-content-btn" style="overflow:auto;">
<div class="Avatar-list" v-for="(item, index) in Avatarlist" :key="index" @click="popoverClick(item.id)">
<div>{{ item.name }}</div>
</div>
</div>
</div>
</el-popover>
2025-07-31 22:07:21 +08:00
</div>
</div>
2025-08-05 22:07:07 +08:00
<!-- 添加新PK弹窗 -->
2025-08-12 22:05:06 +08:00
<el-drawer size="25%" :with-header="false" v-model="drawer">
2025-08-05 22:07:07 +08:00
<!-- 添加或修改主播 -->
<div class="demo-panel">
<div class="add-anchor-library">
<div class="title">发布新PK</div>
<!-- <div class="title">
修改PK信息
</div> -->
<div class="add-anchor-library-content">
<div class="input-name">
<!-- 主播名称 -->
<el-input
class="input-name-input"
v-model="anchorName"
size="large"
placeholder="请输入主播名称"
/>
<div class="myanchor">
<div class="myanchor-btn">选择我的主播</div>
</div>
</div>
<div class="country">
<!-- 国家 -->
<el-select-v2
v-model="countryvalue"
filterable
:options="country"
placeholder="请选择国家"
size="large"
style="vertical-align: middle"
class="select"
/>
</div>
<div class="gender">
<!-- 性别 -->
<el-select-v2
v-model="gendervalue"
filterable
:options="genderOptions"
size="large"
placeholder="请选择性别"
style="vertical-align: middle"
class="select"
/>
</div>
<div class="timeselect">
<el-date-picker
v-model="value1"
type="datetime"
placeholder="选择PK时间"
size="large"
style="width: 100%; height: 100%"
/>
</div>
<div class="Gold-sessions">
<div class="Goldcoinbox-right">
<div class="Goldcoinbox-text">金币数单位为K</div>
<el-input-number
v-model="maxnum"
controls-position="right"
@change="handleChange"
/>
</div>
<div class="Goldcoinbox-right">
<div class="Goldcoinbox-text">场次</div>
<el-input-number
v-model="maxnum"
controls-position="right"
@change="handleChange"
/>
</div>
</div>
<div class="Confirm">确认</div>
<div class="Reset">重置</div>
</div>
</div>
</div>
</el-drawer>
2025-07-31 22:07:21 +08:00
</template>
<script setup>
import { useRouter } from 'vue-router';
import { setStorage , getStorage } from '@/utils/storage.js';
2025-08-12 22:05:06 +08:00
import { UserStore } from '@/stores/notice'
2025-07-31 22:07:21 +08:00
const router = useRouter();
import {
ref, // 响应式基础
watch, // 侦听器
onMounted, // 组件挂载完成后执行
onBeforeMount, // 组件挂载前执行
onUpdated, // 组件更新后执行
onUnmounted, // 组件销毁前执行
2025-08-12 22:05:06 +08:00
reactive
2025-07-31 22:07:21 +08:00
} from "vue";
2025-08-05 22:07:07 +08:00
import { getCountryNamesArray } from "../utils/countryUtil";
2025-07-31 22:07:21 +08:00
2025-08-12 22:05:06 +08:00
const info = ref(null); // 用户信息
const avatar = ref(null); //头像
2025-08-05 22:07:07 +08:00
const country = ref([]);
country.value = getCountryNamesArray(); //国家条目
const genderOptions = [
{ value: 1, label: "男" },
{ value: 2, label: "女" },
]; // 性别选项
const gendervalue = ref(null); // 性别值
const countryvalue = ref(null); //国家
const anchorName = ref(null); // 主播名称
const Avatarlist = [
{
name: '设置',
id: 1,
},
{
name: '联系客服',
id: 2,
},
{
name: '退出登录',
id: 3,
}
]
2025-07-31 22:07:21 +08:00
const NavigationModule = [
{
name: 'PK',
id: 1,
path: '/nav/PK',
2025-08-12 22:05:06 +08:00
icon: 'https://vv-1317974657.cos.ap-shanghai.myqcloud.com/util/Pk.png',
Selectedicon:'https://vv-1317974657.cos.ap-shanghai.myqcloud.com/util/SelectPKpage.png'
2025-07-31 22:07:21 +08:00
},
{
name: '站内信',
id: 2,
path: '/nav/Forum',
2025-08-12 22:05:06 +08:00
icon: 'https://vv-1317974657.cos.ap-shanghai.myqcloud.com/util/Forum.png',
Selectedicon:'https://vv-1317974657.cos.ap-shanghai.myqcloud.com/util/Selectinsitemessagepage.png'
2025-07-31 22:07:21 +08:00
},
{
name: '消息',
id: 3,
path: '/nav/Message',
2025-08-12 22:05:06 +08:00
icon: 'https://vv-1317974657.cos.ap-shanghai.myqcloud.com/util/Message.png',
Selectedicon:'https://vv-1317974657.cos.ap-shanghai.myqcloud.com/util/Selectmessagepage.png'
2025-07-31 22:07:21 +08:00
},
{
name: '我的',
id: 4,
path: '/nav/Mine',
2025-08-12 22:05:06 +08:00
icon: 'https://vv-1317974657.cos.ap-shanghai.myqcloud.com/util/Mine.png',
Selectedicon:'https://vv-1317974657.cos.ap-shanghai.myqcloud.com/util/Mypagehasbeenselected.png'
2025-07-31 22:07:21 +08:00
},
{
id: 5,
2025-08-12 22:05:06 +08:00
icon: 'https://vv-1317974657.cos.ap-shanghai.myqcloud.com/util/push.png',
Selectedicon:'https://vv-1317974657.cos.ap-shanghai.myqcloud.com/util/Pk.png',
2025-07-31 22:07:21 +08:00
}
]
2025-08-05 22:07:07 +08:00
const drawer = ref(false)
const activeId = ref(null);
2025-07-31 22:07:21 +08:00
function handleClick(path, id) {
if (id === 5) {
2025-08-05 22:07:07 +08:00
drawer.value = true;
2025-07-31 22:07:21 +08:00
}else{
activeId.value = id;
2025-08-05 22:07:07 +08:00
setStorage('activeId', id);
2025-07-31 22:07:21 +08:00
router.push(path);
}
}
2025-08-05 22:07:07 +08:00
function popoverClick(id) {
}
2025-07-31 22:07:21 +08:00
const refname = ref('');
watch(refname, async (newQuestion, oldQuestion) => {
// 变化后执行
});
onMounted(() => {
2025-08-12 22:05:06 +08:00
activeId.value = getStorage('activeId') || 1;
info.value = getStorage('user')
avatar.value = info.value.headerIcon;
2025-07-31 22:07:21 +08:00
});
onBeforeMount(()=>{
// 组件挂载前执行
});
onUpdated(() => {
// 组件更新后执行
});
onUnmounted(() => {
// 组件销毁前执行
});
</script>
<style scoped lang="less">
.app-aside{
width: 100%;
height: 95%;
display: flex;
flex-direction: column;
align-items: center;
justify-content:space-between;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
}
.logo{
width: 60px;
height: 60px;
margin-top: 20px;
border-radius: 10px;
}
.logo-img{
width: 60px;
height: 60px;
border-radius: 10px;
}
.Avatar{
width: 60px;
height: 60px;
border-radius: 50px;
2025-08-05 22:07:07 +08:00
background-color: #ffffff;
transition: all 0.3s ease;
display: flex;
align-items: center;
}
.Avatar:hover{
box-shadow: 5px 5px 15px rgba(0, 0, 0, 0.3);
transform: scale(1.08);
opacity: 0.8;
}
.Avatar-content{
width: 100%;
height: 200px;
}
.Avatar-content-name{
width: 100%;
height: 50px;
color: @font-color;
font-size: 16px;
text-align: center;
line-height: 50px;
font-weight: bold;
border-bottom: 1px solid @border-color;
white-space: nowrap; /* 防止换行 */
overflow: hidden; /* 隐藏溢出内容 */
text-overflow: ellipsis;
}
.Avatar-content-btn{
width: 100%;
height: calc(100% - 50px);
}
.Avatar-list{
width: 100%;
height: 50px;
display: flex;
justify-content: center;
align-items: center;
transition: all 0.3s ease;
color: @Prompt-text-color;
font-size: 16px;
}
.Avatar-list:hover{
background-color: #f5f5f5;
2025-07-31 22:07:21 +08:00
}
.Avatar-img{
width: 60px;
height: 60px;
border-radius: 50px;
transition: all 0.3s ease;
}
.Avatar-img:hover{
box-shadow: 5px 5px 15px rgba(0, 0, 0, 0.3);
2025-08-05 22:07:07 +08:00
transform: scale(1.08);
2025-07-31 22:07:21 +08:00
opacity: 0.8;
}
.Navigation{
width: 100%;
height: 75%;
display: flex;
flex-direction: column;
align-items: center;
}
.Navigation-card{
width: 60px;
height: 60px;
border-radius: 10px;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
margin-top: 30px;
transition: all 0.3s ease;
2025-08-12 22:05:06 +08:00
background-size: 100% 100%;
2025-07-31 22:07:21 +08:00
}
.Navigation-card-icon{
width: 20px;
height: 20px;
}
.Navigation-card-icon-img{
width: 20px;
height: 20px;
}
.Navigation-card-name{
font-size: 12px;
color:@Prompt-text-color;
margin-top: 5px;
}
.Navigation-card:hover{
transform: scale(1.1);
opacity: 0.8;
background-color: #ffffff;
}
2025-08-05 22:07:07 +08:00
.demo-panel {
width: 100%;
height: 100%;
}
.add-anchor-library {
width: 100%;
height: 100%;
display: flex;
flex-direction: column;
align-items: center;
}
.title {
width: 100%;
height: 70px;
font-size: 24px;
font-weight: bold;
color: #333333;
text-align: center;
line-height: 70px;
}
.add-anchor-library-content {
width: 100%;
height: calc(100% - 70px);
display: flex;
flex-direction: column;
align-items: center;
}
.input-name {
2025-08-12 22:05:06 +08:00
width: 85%;
2025-08-05 22:07:07 +08:00
height: 50px;
margin-top: 20px;
display: flex;
}
.input-name-input {
2025-08-12 22:05:06 +08:00
width: 60%;
2025-08-05 22:07:07 +08:00
height: 40px;
}
.myanchor {
2025-08-12 22:05:06 +08:00
width: 40%;
2025-08-05 22:07:07 +08:00
height: 40px;
display: flex;
justify-content: center;
align-items: center;
}
.myanchor-btn {
2025-08-12 22:05:06 +08:00
width: 85%;
height: 40px;
2025-08-05 22:07:07 +08:00
border-radius: 5px;
2025-08-12 22:05:06 +08:00
font-size: 14px;
background: linear-gradient(to right, #4FCACD, #5FDBDE);
2025-08-05 22:07:07 +08:00
text-align: center;
2025-08-12 22:05:06 +08:00
line-height: 40px;
2025-08-05 22:07:07 +08:00
transition: all 0.4s ease;
2025-08-12 22:05:06 +08:00
color: #ffffff;
2025-08-05 22:07:07 +08:00
}
.myanchor-btn:hover {
2025-08-12 22:05:06 +08:00
box-shadow: 0px 0px 10px rgba(0, 0, 0, 0.3);
transform: scale(1.05);
2025-08-05 22:07:07 +08:00
}
.country {
2025-08-12 22:05:06 +08:00
width: 85%;
2025-08-05 22:07:07 +08:00
height: 50px;
margin-top: 20px;
}
.gender {
2025-08-12 22:05:06 +08:00
width: 85%;
2025-08-05 22:07:07 +08:00
height: 50px;
margin-top: 20px;
}
.select {
width: 100%;
}
.timeselect {
2025-08-12 22:05:06 +08:00
width: 85%;
2025-08-05 22:07:07 +08:00
height: 40px;
margin-top: 20px;
}
.Gold-sessions {
2025-08-12 22:05:06 +08:00
width: 85%;
2025-08-05 22:07:07 +08:00
height: 50px;
margin-top: 20px;
display: flex;
justify-content: space-between;
align-items: center;
}
.Goldcoinbox-right{
display: flex;
flex-direction: column;
}
.Goldcoinbox-text {
font-size: 12px;
color: @Prompt-text-color;
}
.Confirm {
2025-08-12 22:05:06 +08:00
width: 85%;
2025-08-05 22:07:07 +08:00
height: 50px;
margin-top: 100px;
text-align: center;
line-height: 50px;
2025-08-12 22:05:06 +08:00
background: linear-gradient(0deg, #4FCACD, #5FDBDE);
color: #ffffff;
2025-08-05 22:07:07 +08:00
font-size: 20px;
transition: all 0.4s ease;
2025-08-12 22:05:06 +08:00
border-radius: 100px;
2025-08-05 22:07:07 +08:00
}
.Confirm:hover {
2025-08-12 22:05:06 +08:00
box-shadow: 0px 0px 10px rgba(0, 0, 0, 0.3);
2025-08-05 22:07:07 +08:00
transform: scale(1.1);
opacity: 0.8;
}
.Reset {
2025-08-12 22:05:06 +08:00
width: 85%;
2025-08-05 22:07:07 +08:00
height: 50px;
margin-top: 30px;
text-align: center;
line-height: 50px;
2025-08-12 22:05:06 +08:00
background: linear-gradient(0deg, #E4FFFF, #ffffff);
color:#03ABA8;
2025-08-05 22:07:07 +08:00
font-size: 20px;
transition: all 0.4s ease;
2025-08-12 22:05:06 +08:00
border-radius: 100px;
border: 1px solid #4FCACD;
2025-08-05 22:07:07 +08:00
}
.Reset:hover {
2025-08-12 22:05:06 +08:00
box-shadow: 0px 0px 10px rgba(0, 0, 0, 0.3);
2025-08-05 22:07:07 +08:00
transform: scale(1.1);
opacity: 0.8;
}
2025-07-31 22:07:21 +08:00
</style>