feat(pwuniapp): 在HBuilderX原生工程中实现电竞暗夜流光全套静态UI页面及4位门票核销
这个提交包含在:
560
pwuniapp/pages/index/index.vue
普通文件
560
pwuniapp/pages/index/index.vue
普通文件
@@ -0,0 +1,560 @@
|
||||
<template>
|
||||
<view class="index-container">
|
||||
<!-- 顶部搜索栏 -->
|
||||
<view class="header-search">
|
||||
<view class="search-box">
|
||||
<text class="search-icon">🔍</text>
|
||||
<input class="search-input" placeholder="搜索陪玩大神、游戏昵称或项目" placeholder-class="placeholder-text" />
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 游戏分类滑动栏 -->
|
||||
<scroll-view scroll-x class="category-scroll" :show-scrollbar="false">
|
||||
<view class="category-list">
|
||||
<view
|
||||
v-for="item in games"
|
||||
:key="item.id"
|
||||
class="category-item btn-active"
|
||||
:class="{ active: currentCategory === item.id }"
|
||||
@click="selectCategory(item.id)"
|
||||
>
|
||||
<text class="cat-icon">{{ item.icon }}</text>
|
||||
<text class="cat-name">{{ item.name }}</text>
|
||||
<view v-if="item.hot" class="cat-badge">HOT</view>
|
||||
</view>
|
||||
</view>
|
||||
</scroll-view>
|
||||
|
||||
<!-- 精彩活动横幅轮播 -->
|
||||
<swiper class="banner-swiper" circular autoplay interval="4000" indicator-dots indicator-color="rgba(255,255,255,0.2)" indicator-active-color="#6366F1">
|
||||
<swiper-item v-for="banner in banners" :key="banner.id" class="banner-item" @click="goToActivity">
|
||||
<view class="banner-card" :style="{ background: banner.bg }">
|
||||
<view class="banner-tag">{{ banner.tag }}</view>
|
||||
<view class="banner-title">{{ banner.title }}</view>
|
||||
<view class="banner-sub">点击立即参与 ⚡</view>
|
||||
</view>
|
||||
</swiper-item>
|
||||
</swiper>
|
||||
|
||||
<!-- 快捷功能金刚区 -->
|
||||
<view class="quick-grid">
|
||||
<view class="quick-item btn-active" @click="navTo('/pages/activity/list')">
|
||||
<view class="quick-icon-bg bg-purple">🔥</view>
|
||||
<text class="quick-title">组队开黑</text>
|
||||
<text class="quick-sub">AA制五排</text>
|
||||
</view>
|
||||
<view class="quick-item btn-active" @click="navTo('/pages/activity/my-ticket')">
|
||||
<view class="quick-icon-bg bg-green">🎟️</view>
|
||||
<text class="quick-title">我的门票</text>
|
||||
<text class="quick-sub">4位核销码</text>
|
||||
</view>
|
||||
<view class="quick-item btn-active" @click="navTo('/pages/order/list')">
|
||||
<view class="quick-icon-bg bg-blue">⚡</view>
|
||||
<text class="quick-title">服务订单</text>
|
||||
<text class="quick-sub">状态实时看</text>
|
||||
</view>
|
||||
<view class="quick-item btn-active" @click="navTo('/pages/user/index')">
|
||||
<view class="quick-icon-bg bg-orange">👑</view>
|
||||
<text class="quick-title">大神中心</text>
|
||||
<text class="quick-sub">双身份切换</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 陪玩大神瀑布流 -->
|
||||
<view class="section-title-wrap">
|
||||
<view class="section-title">
|
||||
<view class="title-line"></view>
|
||||
<text>精选在线大神</text>
|
||||
</view>
|
||||
<text class="section-more">实时在线</text>
|
||||
</view>
|
||||
|
||||
<view class="expert-grid">
|
||||
<view
|
||||
v-for="expert in filteredExperts"
|
||||
:key="expert.id"
|
||||
class="expert-card card-active"
|
||||
@click="goToExpert(expert.id)"
|
||||
>
|
||||
<!-- 封面图 -->
|
||||
<view class="card-cover-wrap">
|
||||
<image class="card-cover" :src="expert.avatar" mode="aspectFill" />
|
||||
<view class="status-tag" :class="expert.isOnline ? 'online' : 'offline'">
|
||||
<view class="pulse-dot" v-if="expert.isOnline"></view>
|
||||
<text>{{ expert.isOnline ? '在线' : '离线' }}</text>
|
||||
</view>
|
||||
<view class="game-badge">{{ expert.game }}</view>
|
||||
</view>
|
||||
|
||||
<!-- 信息区 -->
|
||||
<view class="card-body">
|
||||
<view class="row-nickname">
|
||||
<text class="nickname">{{ expert.nickname }}</text>
|
||||
<text class="gender-tag" :class="expert.gender">{{ expert.gender === 'female' ? '♀' : '♂' }}</text>
|
||||
</view>
|
||||
<view class="rank-badge">{{ expert.rankTag }}</view>
|
||||
|
||||
<!-- 语音试听条 -->
|
||||
<view class="voice-bar btn-active" @click.stop="toggleVoice(expert.id)">
|
||||
<text class="voice-icon">{{ playingId === expert.id ? '🔊' : '▶' }}</text>
|
||||
<text class="voice-text">{{ playingId === expert.id ? '试听中...' : expert.voiceDuration + 's 语音' }}</text>
|
||||
<view class="wave-lines" v-if="playingId === expert.id">
|
||||
<view class="wave-item w1"></view>
|
||||
<view class="wave-item w2"></view>
|
||||
<view class="wave-item w3"></view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="card-footer">
|
||||
<view class="price-wrap">
|
||||
<text class="price-symbol">¥</text>
|
||||
<text class="price-val">{{ expert.price }}</text>
|
||||
<text class="price-unit">/时</text>
|
||||
</view>
|
||||
<text class="order-count">{{ expert.orderCount }}单</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, computed } from 'vue';
|
||||
import { GAMES_LIST, BANNERS, EXPERTS_LIST } from '@/common/mock.js';
|
||||
|
||||
const games = ref(GAMES_LIST);
|
||||
const banners = ref(BANNERS);
|
||||
const experts = ref(EXPERTS_LIST);
|
||||
const currentCategory = ref('all');
|
||||
const playingId = ref(null);
|
||||
|
||||
const filteredExperts = computed(() => {
|
||||
if (currentCategory.value === 'all') return experts.value;
|
||||
const gameMap = {
|
||||
wzry: '王者荣耀',
|
||||
hpjy: '和平精英',
|
||||
lol: '英雄联盟',
|
||||
val: '无畏契约'
|
||||
};
|
||||
const target = gameMap[currentCategory.value];
|
||||
return target ? experts.value.filter(e => e.game === target) : experts.value;
|
||||
});
|
||||
|
||||
const selectCategory = (id) => {
|
||||
currentCategory.value = id;
|
||||
};
|
||||
|
||||
const toggleVoice = (id) => {
|
||||
if (playingId.value === id) {
|
||||
playingId.value = null;
|
||||
} else {
|
||||
playingId.value = id;
|
||||
uni.showToast({ title: '正在试听打招呼语音', icon: 'none' });
|
||||
setTimeout(() => {
|
||||
if (playingId.value === id) playingId.value = null;
|
||||
}, 4000);
|
||||
}
|
||||
};
|
||||
|
||||
const goToExpert = (id) => {
|
||||
uni.navigateTo({
|
||||
url: `/pages/expert/detail?id=${id}`
|
||||
});
|
||||
};
|
||||
|
||||
const goToActivity = () => {
|
||||
uni.switchTab({
|
||||
url: '/pages/activity/list'
|
||||
});
|
||||
};
|
||||
|
||||
const navTo = (url) => {
|
||||
if (url === '/pages/activity/list' || url === '/pages/order/list' || url === '/pages/user/index') {
|
||||
uni.switchTab({ url });
|
||||
} else {
|
||||
uni.navigateTo({ url });
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.index-container {
|
||||
min-height: 100vh;
|
||||
background-color: #0A0F1D;
|
||||
padding-bottom: 140rpx;
|
||||
}
|
||||
|
||||
.header-search {
|
||||
padding: 20rpx 32rpx;
|
||||
background-color: #0A0F1D;
|
||||
position: sticky;
|
||||
top: 0;
|
||||
z-index: 50;
|
||||
|
||||
.search-box {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
background-color: #151D30;
|
||||
height: 80rpx;
|
||||
border-radius: 40rpx;
|
||||
padding: 0 28rpx;
|
||||
border: 1px solid rgba(255, 255, 255, 0.08);
|
||||
|
||||
.search-icon {
|
||||
font-size: 28rpx;
|
||||
margin-right: 16rpx;
|
||||
}
|
||||
.search-input {
|
||||
flex: 1;
|
||||
font-size: 26rpx;
|
||||
color: #F8FAFC;
|
||||
}
|
||||
.placeholder-text {
|
||||
color: #64748B;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.category-scroll {
|
||||
white-space: nowrap;
|
||||
padding: 10rpx 32rpx 20rpx;
|
||||
|
||||
.category-list {
|
||||
display: flex;
|
||||
gap: 16rpx;
|
||||
}
|
||||
|
||||
.category-item {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
padding: 14rpx 28rpx;
|
||||
background-color: #151D30;
|
||||
border-radius: 32rpx;
|
||||
border: 1px solid rgba(255, 255, 255, 0.06);
|
||||
position: relative;
|
||||
|
||||
.cat-icon {
|
||||
font-size: 26rpx;
|
||||
margin-right: 8rpx;
|
||||
}
|
||||
.cat-name {
|
||||
font-size: 24rpx;
|
||||
color: #94A3B8;
|
||||
font-weight: 500;
|
||||
}
|
||||
.cat-badge {
|
||||
position: absolute;
|
||||
top: -8rpx;
|
||||
right: -8rpx;
|
||||
background: #EF4444;
|
||||
color: #FFF;
|
||||
font-size: 16rpx;
|
||||
padding: 2rpx 8rpx;
|
||||
border-radius: 12rpx;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
&.active {
|
||||
background: linear-gradient(135deg, #6366F1 0%, #8B5CF6 100%);
|
||||
border-color: #818CF8;
|
||||
box-shadow: 0 4rpx 16rpx rgba(99, 102, 241, 0.4);
|
||||
|
||||
.cat-name {
|
||||
color: #FFFFFF;
|
||||
font-weight: 600;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.banner-swiper {
|
||||
height: 200rpx;
|
||||
margin: 10rpx 32rpx 24rpx;
|
||||
|
||||
.banner-card {
|
||||
height: 100%;
|
||||
border-radius: 20rpx;
|
||||
padding: 28rpx 32rpx;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
box-shadow: 0 8rpx 24rpx rgba(0, 0, 0, 0.4);
|
||||
|
||||
.banner-tag {
|
||||
align-self: flex-start;
|
||||
background: rgba(0, 0, 0, 0.25);
|
||||
backdrop-filter: blur(8px);
|
||||
padding: 4rpx 14rpx;
|
||||
border-radius: 8rpx;
|
||||
font-size: 20rpx;
|
||||
color: #FFF;
|
||||
margin-bottom: 8rpx;
|
||||
}
|
||||
.banner-title {
|
||||
font-size: 30rpx;
|
||||
font-weight: 700;
|
||||
color: #FFF;
|
||||
margin-bottom: 6rpx;
|
||||
}
|
||||
.banner-sub {
|
||||
font-size: 22rpx;
|
||||
color: rgba(255, 255, 255, 0.85);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.quick-grid {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
margin: 0 32rpx 32rpx;
|
||||
background-color: #151D30;
|
||||
border-radius: 24rpx;
|
||||
padding: 24rpx 16rpx;
|
||||
border: 1px solid rgba(255, 255, 255, 0.06);
|
||||
|
||||
.quick-item {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
|
||||
.quick-icon-bg {
|
||||
width: 76rpx;
|
||||
height: 76rpx;
|
||||
border-radius: 22rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
font-size: 34rpx;
|
||||
margin-bottom: 12rpx;
|
||||
|
||||
&.bg-purple { background: rgba(139, 92, 246, 0.2); }
|
||||
&.bg-green { background: rgba(16, 185, 129, 0.2); }
|
||||
&.bg-blue { background: rgba(99, 102, 241, 0.2); }
|
||||
&.bg-orange { background: rgba(245, 158, 11, 0.2); }
|
||||
}
|
||||
|
||||
.quick-title {
|
||||
font-size: 24rpx;
|
||||
color: #F8FAFC;
|
||||
font-weight: 600;
|
||||
margin-bottom: 4rpx;
|
||||
}
|
||||
.quick-sub {
|
||||
font-size: 18rpx;
|
||||
color: #64748B;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.section-title-wrap {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
padding: 0 32rpx 20rpx;
|
||||
|
||||
.section-title {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
font-size: 30rpx;
|
||||
font-weight: 700;
|
||||
color: #F8FAFC;
|
||||
|
||||
.title-line {
|
||||
width: 8rpx;
|
||||
height: 28rpx;
|
||||
background: linear-gradient(180deg, #6366F1, #8B5CF6);
|
||||
border-radius: 4rpx;
|
||||
margin-right: 14rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.section-more {
|
||||
font-size: 22rpx;
|
||||
color: #10B981;
|
||||
background: rgba(16, 185, 129, 0.15);
|
||||
padding: 4rpx 14rpx;
|
||||
border-radius: 16rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.expert-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(2, 1fr);
|
||||
gap: 20rpx;
|
||||
padding: 0 32rpx;
|
||||
|
||||
.expert-card {
|
||||
background-color: #151D30;
|
||||
border-radius: 20rpx;
|
||||
overflow: hidden;
|
||||
border: 1px solid rgba(255, 255, 255, 0.06);
|
||||
|
||||
.card-cover-wrap {
|
||||
position: relative;
|
||||
height: 320rpx;
|
||||
|
||||
.card-cover {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.status-tag {
|
||||
position: absolute;
|
||||
top: 14rpx;
|
||||
left: 14rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 6rpx;
|
||||
padding: 4rpx 12rpx;
|
||||
border-radius: 20rpx;
|
||||
font-size: 18rpx;
|
||||
font-weight: 600;
|
||||
|
||||
&.online {
|
||||
background: rgba(16, 185, 129, 0.85);
|
||||
color: #FFF;
|
||||
}
|
||||
&.offline {
|
||||
background: rgba(100, 116, 139, 0.8);
|
||||
color: #FFF;
|
||||
}
|
||||
|
||||
.pulse-dot {
|
||||
width: 10rpx;
|
||||
height: 10rpx;
|
||||
border-radius: 50%;
|
||||
background: #FFF;
|
||||
animation: pulse 1.5s infinite;
|
||||
}
|
||||
}
|
||||
|
||||
.game-badge {
|
||||
position: absolute;
|
||||
bottom: 14rpx;
|
||||
right: 14rpx;
|
||||
background: rgba(0, 0, 0, 0.65);
|
||||
backdrop-filter: blur(4px);
|
||||
font-size: 18rpx;
|
||||
color: #E2E8F0;
|
||||
padding: 4rpx 10rpx;
|
||||
border-radius: 8rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.card-body {
|
||||
padding: 18rpx;
|
||||
|
||||
.row-nickname {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
margin-bottom: 8rpx;
|
||||
|
||||
.nickname {
|
||||
font-size: 26rpx;
|
||||
font-weight: 600;
|
||||
color: #F8FAFC;
|
||||
max-width: 200rpx;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.gender-tag {
|
||||
font-size: 20rpx;
|
||||
padding: 2rpx 8rpx;
|
||||
border-radius: 8rpx;
|
||||
|
||||
&.female {
|
||||
background: rgba(236, 72, 153, 0.2);
|
||||
color: #F472B6;
|
||||
}
|
||||
&.male {
|
||||
background: rgba(59, 130, 246, 0.2);
|
||||
color: #60A5FA;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.rank-badge {
|
||||
font-size: 20rpx;
|
||||
color: #F59E0B;
|
||||
background: rgba(245, 158, 11, 0.12);
|
||||
padding: 4rpx 10rpx;
|
||||
border-radius: 6rpx;
|
||||
display: inline-block;
|
||||
margin-bottom: 12rpx;
|
||||
}
|
||||
|
||||
.voice-bar {
|
||||
background: rgba(99, 102, 241, 0.15);
|
||||
border: 1px solid rgba(99, 102, 241, 0.3);
|
||||
height: 48rpx;
|
||||
border-radius: 24rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding: 0 16rpx;
|
||||
margin-bottom: 16rpx;
|
||||
|
||||
.voice-icon {
|
||||
font-size: 20rpx;
|
||||
color: #818CF8;
|
||||
margin-right: 8rpx;
|
||||
}
|
||||
.voice-text {
|
||||
font-size: 20rpx;
|
||||
color: #818CF8;
|
||||
font-weight: 600;
|
||||
}
|
||||
.wave-lines {
|
||||
display: flex;
|
||||
align-items: flex-end;
|
||||
gap: 4rpx;
|
||||
margin-left: 8rpx;
|
||||
|
||||
.wave-item {
|
||||
width: 4rpx;
|
||||
background: #818CF8;
|
||||
border-radius: 2rpx;
|
||||
|
||||
&.w1 { height: 14rpx; animation: bounce 0.6s infinite ease-in-out; }
|
||||
&.w2 { height: 22rpx; animation: bounce 0.6s infinite ease-in-out 0.2s; }
|
||||
&.w3 { height: 10rpx; animation: bounce 0.6s infinite ease-in-out 0.4s; }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.card-footer {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: baseline;
|
||||
|
||||
.price-wrap {
|
||||
color: #10B981;
|
||||
.price-symbol { font-size: 22rpx; font-weight: 600; }
|
||||
.price-val { font-size: 32rpx; font-weight: 700; margin: 0 2rpx; }
|
||||
.price-unit { font-size: 20rpx; color: #64748B; }
|
||||
}
|
||||
|
||||
.order-count {
|
||||
font-size: 20rpx;
|
||||
color: #64748B;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes pulse {
|
||||
0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.7); }
|
||||
70% { transform: scale(1); box-shadow: 0 0 0 8rpx rgba(255, 255, 255, 0); }
|
||||
100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(255, 255, 255, 0); }
|
||||
}
|
||||
|
||||
@keyframes bounce {
|
||||
0%, 100% { transform: scaleY(0.4); }
|
||||
50% { transform: scaleY(1); }
|
||||
}
|
||||
</style>
|
||||
在新工单中引用
屏蔽一个用户