a
This commit is contained in:
@@ -0,0 +1,138 @@
|
||||
<template>
|
||||
<view class="empty-container">
|
||||
<view class="empty-icon">
|
||||
<image
|
||||
v-if="icon"
|
||||
:src="icon"
|
||||
mode="aspectFit"
|
||||
class="icon-image"
|
||||
/>
|
||||
<text v-else class="icon-text">{{ defaultIcon }}</text>
|
||||
</view>
|
||||
<text class="empty-title">{{ title }}</text>
|
||||
<text class="empty-description" v-if="description">{{ description }}</text>
|
||||
<view class="empty-action" v-if="showAction">
|
||||
<button
|
||||
class="action-button"
|
||||
@click="handleAction"
|
||||
:type="actionType"
|
||||
size="mini"
|
||||
>
|
||||
{{ actionText }}
|
||||
</button>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: 'EmptyState',
|
||||
props: {
|
||||
// 图标(图片路径或文字)
|
||||
icon: {
|
||||
type: String,
|
||||
default: ''
|
||||
},
|
||||
// 标题
|
||||
title: {
|
||||
type: String,
|
||||
default: '暂无数据'
|
||||
},
|
||||
// 描述
|
||||
description: {
|
||||
type: String,
|
||||
default: ''
|
||||
},
|
||||
// 是否显示操作按钮
|
||||
showAction: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
// 操作按钮文本
|
||||
actionText: {
|
||||
type: String,
|
||||
default: '刷新'
|
||||
},
|
||||
// 操作按钮类型
|
||||
actionType: {
|
||||
type: String,
|
||||
default: 'primary'
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
defaultIcon: '📭'
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
handleAction() {
|
||||
this.$emit('action')
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.empty-container {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
padding: 80rpx 40rpx;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.empty-icon {
|
||||
margin-bottom: 40rpx;
|
||||
font-size: 120rpx;
|
||||
color: #ccc;
|
||||
}
|
||||
|
||||
.icon-image {
|
||||
width: 200rpx;
|
||||
height: 200rpx;
|
||||
}
|
||||
|
||||
.icon-text {
|
||||
font-size: 120rpx;
|
||||
line-height: 1;
|
||||
}
|
||||
|
||||
.empty-title {
|
||||
font-size: 32rpx;
|
||||
font-weight: 500;
|
||||
color: #333;
|
||||
margin-bottom: 16rpx;
|
||||
}
|
||||
|
||||
.empty-description {
|
||||
font-size: 28rpx;
|
||||
color: #666;
|
||||
line-height: 1.5;
|
||||
margin-bottom: 40rpx;
|
||||
max-width: 500rpx;
|
||||
}
|
||||
|
||||
.empty-action {
|
||||
margin-top: 20rpx;
|
||||
}
|
||||
|
||||
.action-button {
|
||||
min-width: 200rpx;
|
||||
height: 70rpx;
|
||||
line-height: 70rpx;
|
||||
border-radius: 35rpx;
|
||||
font-size: 28rpx;
|
||||
}
|
||||
|
||||
.action-button[type="primary"] {
|
||||
background-color: #3cc51f;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.action-button[type="default"] {
|
||||
background-color: #f8f8f8;
|
||||
color: #333;
|
||||
border: 1rpx solid #e5e5e5;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,99 @@
|
||||
<template>
|
||||
<view class="loading-container" v-if="visible">
|
||||
<view class="loading-content">
|
||||
<view class="loading-spinner">
|
||||
<view class="spinner"></view>
|
||||
</view>
|
||||
<text class="loading-text">{{ text }}</text>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: 'CommonLoading',
|
||||
props: {
|
||||
// 是否显示
|
||||
visible: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
// 加载文本
|
||||
text: {
|
||||
type: String,
|
||||
default: '加载中...'
|
||||
},
|
||||
// 背景是否透明
|
||||
transparent: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
// 是否全屏
|
||||
fullscreen: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.loading-container {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
z-index: 9999;
|
||||
background-color: rgba(255, 255, 255, 0.9);
|
||||
}
|
||||
|
||||
.loading-container.transparent {
|
||||
background-color: transparent;
|
||||
}
|
||||
|
||||
.loading-container.fullscreen {
|
||||
position: fixed;
|
||||
}
|
||||
|
||||
.loading-content {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
padding: 40rpx;
|
||||
background-color: #ffffff;
|
||||
border-radius: 16rpx;
|
||||
box-shadow: 0 4rpx 24rpx rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
|
||||
.loading-spinner {
|
||||
margin-bottom: 20rpx;
|
||||
}
|
||||
|
||||
.spinner {
|
||||
width: 60rpx;
|
||||
height: 60rpx;
|
||||
border: 6rpx solid #f3f3f3;
|
||||
border-top: 6rpx solid #3cc51f;
|
||||
border-radius: 50%;
|
||||
animation: spin 1s linear infinite;
|
||||
}
|
||||
|
||||
@keyframes spin {
|
||||
0% { transform: rotate(0deg); }
|
||||
100% { transform: rotate(360deg); }
|
||||
}
|
||||
|
||||
.loading-text {
|
||||
font-size: 28rpx;
|
||||
color: #666;
|
||||
text-align: center;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,205 @@
|
||||
<template>
|
||||
<view class="banner-container">
|
||||
<swiper
|
||||
class="banner-swiper"
|
||||
:indicator-dots="indicatorDots"
|
||||
:autoplay="autoplay"
|
||||
:interval="interval"
|
||||
:duration="duration"
|
||||
:circular="circular"
|
||||
@change="onSwiperChange"
|
||||
>
|
||||
<swiper-item
|
||||
v-for="(item, index) in bannerList"
|
||||
:key="item.id || index"
|
||||
class="banner-item"
|
||||
>
|
||||
<view class="banner-content" @click="handleBannerClick(item)">
|
||||
<image
|
||||
class="banner-image"
|
||||
:src="item.imagePath || item.image || item.pic"
|
||||
mode="aspectFill"
|
||||
lazy-load
|
||||
/>
|
||||
<view class="banner-mask" v-if="showTitle">
|
||||
<text class="banner-title">{{ item.title }}</text>
|
||||
</view>
|
||||
</view>
|
||||
</swiper-item>
|
||||
</swiper>
|
||||
|
||||
<!-- 指示器(自定义样式) -->
|
||||
<view class="custom-indicator" v-if="showCustomIndicator">
|
||||
<view
|
||||
class="indicator-dot"
|
||||
v-for="(item, index) in bannerList"
|
||||
:key="index"
|
||||
:class="{ active: currentIndex === index }"
|
||||
></view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: 'HomeBanner',
|
||||
props: {
|
||||
// Banner数据列表
|
||||
bannerList: {
|
||||
type: Array,
|
||||
default: () => []
|
||||
},
|
||||
// 是否显示指示点
|
||||
indicatorDots: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
},
|
||||
// 是否自动播放
|
||||
autoplay: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
},
|
||||
// 自动切换时间间隔(ms)
|
||||
interval: {
|
||||
type: Number,
|
||||
default: 3000
|
||||
},
|
||||
// 滑动动画时长(ms)
|
||||
duration: {
|
||||
type: Number,
|
||||
default: 500
|
||||
},
|
||||
// 是否采用衔接滑动
|
||||
circular: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
},
|
||||
// 是否显示标题
|
||||
showTitle: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
},
|
||||
// 是否显示自定义指示器
|
||||
showCustomIndicator: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
currentIndex: 0
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
onSwiperChange(e) {
|
||||
this.currentIndex = e.detail.current
|
||||
this.$emit('change', {
|
||||
index: this.currentIndex,
|
||||
item: this.bannerList[this.currentIndex]
|
||||
})
|
||||
},
|
||||
|
||||
handleBannerClick(item) {
|
||||
this.$emit('click', item)
|
||||
|
||||
// 处理Banner点击跳转
|
||||
if (item.url) {
|
||||
// 如果是外部链接
|
||||
if (item.url.startsWith('http')) {
|
||||
uni.navigateTo({
|
||||
url: `/pages/webview/webview?url=${encodeURIComponent(item.url)}`
|
||||
})
|
||||
}
|
||||
} else if (item.link) {
|
||||
// 处理内部链接
|
||||
this.handleInternalLink(item.link)
|
||||
}
|
||||
},
|
||||
|
||||
handleInternalLink(link) {
|
||||
// 这里可以根据link格式处理不同的跳转逻辑
|
||||
console.log('Banner内部链接:', link)
|
||||
// 可以扩展处理不同的链接类型
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.banner-container {
|
||||
position: relative;
|
||||
width: 100%;
|
||||
height: 350rpx;
|
||||
}
|
||||
|
||||
.banner-swiper {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.banner-item {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.banner-content {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
position: relative;
|
||||
border-radius: 16rpx;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.banner-image {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.banner-mask {
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
padding: 30rpx 40rpx;
|
||||
background: linear-gradient(transparent, rgba(0, 0, 0, 0.7));
|
||||
}
|
||||
|
||||
.banner-title {
|
||||
font-size: 32rpx;
|
||||
font-weight: 500;
|
||||
color: #fff;
|
||||
line-height: 1.4;
|
||||
display: -webkit-box;
|
||||
-webkit-box-orient: vertical;
|
||||
-webkit-line-clamp: 2;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
|
||||
/* 自定义指示器 */
|
||||
.custom-indicator {
|
||||
position: absolute;
|
||||
bottom: 30rpx;
|
||||
left: 0;
|
||||
right: 0;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
z-index: 10;
|
||||
}
|
||||
|
||||
.indicator-dot {
|
||||
width: 16rpx;
|
||||
height: 16rpx;
|
||||
border-radius: 50%;
|
||||
background-color: rgba(255, 255, 255, 0.5);
|
||||
margin: 0 8rpx;
|
||||
transition: all 0.3s ease;
|
||||
}
|
||||
|
||||
.indicator-dot.active {
|
||||
width: 32rpx;
|
||||
border-radius: 8rpx;
|
||||
background-color: #fff;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,142 @@
|
||||
<template>
|
||||
<view class="category-tabs-container">
|
||||
<scroll-view
|
||||
class="category-scroll"
|
||||
scroll-x
|
||||
:scroll-left="scrollLeft"
|
||||
:scroll-with-animation="true"
|
||||
:show-scrollbar="false"
|
||||
>
|
||||
<view class="category-list">
|
||||
<view
|
||||
v-for="(category, index) in categories"
|
||||
:key="category.id"
|
||||
class="category-item"
|
||||
:class="{ active: activeCategory?.id === category.id }"
|
||||
@click="handleCategoryClick(category, index)"
|
||||
>
|
||||
<text class="category-name">{{ category.name }}</text>
|
||||
<view class="category-indicator" v-if="activeCategory?.id === category.id"></view>
|
||||
</view>
|
||||
</view>
|
||||
</scroll-view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: 'ProjectCategoryTabs',
|
||||
props: {
|
||||
// 分类列表
|
||||
categories: {
|
||||
type: Array,
|
||||
default: () => []
|
||||
},
|
||||
// 当前选中的分类
|
||||
activeCategory: {
|
||||
type: Object,
|
||||
default: null
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
scrollLeft: 0
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
activeCategory: {
|
||||
handler(newVal) {
|
||||
if (newVal && this.categories.length > 0) {
|
||||
this.scrollToActiveCategory()
|
||||
}
|
||||
},
|
||||
immediate: true
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
handleCategoryClick(category, index) {
|
||||
this.$emit('change', category)
|
||||
|
||||
// 滚动到选中的分类
|
||||
this.scrollToIndex(index)
|
||||
},
|
||||
|
||||
scrollToIndex(index) {
|
||||
// 计算需要滚动的距离
|
||||
// 这里简化处理,实际可以根据元素宽度计算
|
||||
const itemWidth = 120 // 每个分类项的预估宽度(rpx)
|
||||
const scrollViewWidth = 750 // scroll-view宽度(rpx)
|
||||
const targetLeft = index * itemWidth - scrollViewWidth / 2 + itemWidth / 2
|
||||
|
||||
this.scrollLeft = Math.max(0, targetLeft)
|
||||
},
|
||||
|
||||
scrollToActiveCategory() {
|
||||
const index = this.categories.findIndex(cat => cat.id === this.activeCategory?.id)
|
||||
if (index !== -1) {
|
||||
this.scrollToIndex(index)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.category-tabs-container {
|
||||
width: 100%;
|
||||
background-color: #fff;
|
||||
border-bottom: 1rpx solid #f0f0f0;
|
||||
}
|
||||
|
||||
.category-scroll {
|
||||
width: 100%;
|
||||
white-space: nowrap;
|
||||
height: 90rpx;
|
||||
}
|
||||
|
||||
.category-list {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
height: 100%;
|
||||
padding: 0 30rpx;
|
||||
}
|
||||
|
||||
.category-item {
|
||||
position: relative;
|
||||
padding: 0 30rpx;
|
||||
height: 100%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.category-name {
|
||||
font-size: 30rpx;
|
||||
color: #666;
|
||||
font-weight: 400;
|
||||
transition: all 0.3s ease;
|
||||
}
|
||||
|
||||
.category-item.active .category-name {
|
||||
color: #3cc51f;
|
||||
font-weight: 500;
|
||||
font-size: 32rpx;
|
||||
}
|
||||
|
||||
.category-indicator {
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
left: 50%;
|
||||
transform: translateX(-50%);
|
||||
width: 40rpx;
|
||||
height: 4rpx;
|
||||
background-color: #3cc51f;
|
||||
border-radius: 2rpx;
|
||||
}
|
||||
|
||||
/* 点击效果 */
|
||||
.category-item:active {
|
||||
opacity: 0.7;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,362 @@
|
||||
<template>
|
||||
<view class="category-tree-container">
|
||||
<!-- 搜索栏 -->
|
||||
<view class="search-section" v-if="showSearch">
|
||||
<view class="search-input" @click="handleSearchClick">
|
||||
<text class="search-icon">🔍</text>
|
||||
<text class="search-placeholder">搜索体系分类...</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 分类树 -->
|
||||
<scroll-view
|
||||
class="category-scroll"
|
||||
scroll-y
|
||||
:scroll-with-animation="true"
|
||||
:show-scrollbar="false"
|
||||
>
|
||||
<!-- 空状态 -->
|
||||
<empty-state
|
||||
v-if="!loading && categories.length === 0"
|
||||
:title="'暂无分类'"
|
||||
:description="'暂无体系分类数据'"
|
||||
:show-action="true"
|
||||
:action-text="'刷新'"
|
||||
@action="$emit('refresh')"
|
||||
/>
|
||||
|
||||
<!-- 分类列表 -->
|
||||
<view v-else class="category-list">
|
||||
<view
|
||||
v-for="category in categories"
|
||||
:key="category.id"
|
||||
class="category-item"
|
||||
:class="{
|
||||
'category-level-1': true,
|
||||
'expanded': category.expanded,
|
||||
'selected': selectedCategory?.id === category.id
|
||||
}"
|
||||
>
|
||||
<!-- 一级分类 -->
|
||||
<view
|
||||
class="category-header"
|
||||
@click="handleCategoryClick(category)"
|
||||
>
|
||||
<view class="category-info">
|
||||
<text class="category-icon">📚</text>
|
||||
<text class="category-name">{{ category.name }}</text>
|
||||
<text class="category-count" v-if="category.children.length > 0">
|
||||
({{ category.children.length }})
|
||||
</text>
|
||||
</view>
|
||||
|
||||
<view class="category-actions">
|
||||
<!-- 展开/收起箭头 -->
|
||||
<text
|
||||
class="expand-icon"
|
||||
v-if="category.children.length > 0"
|
||||
@click.stop="toggleCategoryExpand(category)"
|
||||
>
|
||||
{{ category.expanded ? '▼' : '▶' }}
|
||||
</text>
|
||||
|
||||
<!-- 选中标记 -->
|
||||
<text
|
||||
class="selected-icon"
|
||||
v-if="selectedCategory?.id === category.id"
|
||||
>
|
||||
✓
|
||||
</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 二级分类(子分类) -->
|
||||
<view
|
||||
class="subcategory-list"
|
||||
v-if="category.expanded && category.children.length > 0"
|
||||
>
|
||||
<view
|
||||
v-for="child in category.children"
|
||||
:key="child.id"
|
||||
class="subcategory-item"
|
||||
:class="{
|
||||
'category-level-2': true,
|
||||
'selected': selectedCategory?.id === child.id
|
||||
}"
|
||||
@click="handleSubcategoryClick(child, category)"
|
||||
>
|
||||
<view class="subcategory-info">
|
||||
<text class="subcategory-icon">📖</text>
|
||||
<text class="subcategory-name">{{ child.name }}</text>
|
||||
</view>
|
||||
|
||||
<text
|
||||
class="selected-icon"
|
||||
v-if="selectedCategory?.id === child.id"
|
||||
>
|
||||
✓
|
||||
</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</scroll-view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import EmptyState from '@/components/common/empty-state.vue'
|
||||
|
||||
export default {
|
||||
name: 'CategoryTree',
|
||||
components: {
|
||||
EmptyState
|
||||
},
|
||||
props: {
|
||||
// 分类数据
|
||||
categories: {
|
||||
type: Array,
|
||||
default: () => []
|
||||
},
|
||||
// 选中的分类
|
||||
selectedCategory: {
|
||||
type: Object,
|
||||
default: null
|
||||
},
|
||||
// 是否显示搜索
|
||||
showSearch: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
},
|
||||
// 加载状态
|
||||
loading: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
// 本地状态
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
// 处理分类点击
|
||||
handleCategoryClick(category) {
|
||||
this.$emit('category-click', category)
|
||||
},
|
||||
|
||||
// 处理子分类点击
|
||||
handleSubcategoryClick(childCategory, parentCategory) {
|
||||
this.$emit('subcategory-click', {
|
||||
...childCategory,
|
||||
parentCategory: {
|
||||
id: parentCategory.id,
|
||||
name: parentCategory.name
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
// 切换分类展开状态
|
||||
toggleCategoryExpand(category) {
|
||||
this.$emit('toggle-expand', {
|
||||
...category,
|
||||
expanded: !category.expanded
|
||||
})
|
||||
},
|
||||
|
||||
// 处理搜索点击
|
||||
handleSearchClick() {
|
||||
this.$emit('search-click')
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.category-tree-container {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
height: 100%;
|
||||
background-color: #f8f8f8;
|
||||
}
|
||||
|
||||
/* 搜索栏 */
|
||||
.search-section {
|
||||
padding: 20rpx 30rpx;
|
||||
background-color: #fff;
|
||||
border-bottom: 1rpx solid #f0f0f0;
|
||||
}
|
||||
|
||||
.search-input {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding: 20rpx 30rpx;
|
||||
background-color: #f8f8f8;
|
||||
border-radius: 50rpx;
|
||||
border: 1rpx solid #e5e5e5;
|
||||
}
|
||||
|
||||
.search-icon {
|
||||
font-size: 32rpx;
|
||||
margin-right: 16rpx;
|
||||
color: #999;
|
||||
}
|
||||
|
||||
.search-placeholder {
|
||||
font-size: 28rpx;
|
||||
color: #999;
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
/* 分类滚动区域 */
|
||||
.category-scroll {
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
/* 分类列表 */
|
||||
.category-list {
|
||||
padding: 20rpx 0;
|
||||
}
|
||||
|
||||
/* 一级分类 */
|
||||
.category-item {
|
||||
margin-bottom: 10rpx;
|
||||
background-color: #fff;
|
||||
border-radius: 16rpx;
|
||||
overflow: hidden;
|
||||
transition: all 0.3s ease;
|
||||
}
|
||||
|
||||
.category-item.selected {
|
||||
background-color: #f0f9ff;
|
||||
border-left: 6rpx solid #3cc51f;
|
||||
}
|
||||
|
||||
.category-header {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
padding: 30rpx;
|
||||
cursor: pointer;
|
||||
transition: all 0.3s ease;
|
||||
}
|
||||
|
||||
.category-header:active {
|
||||
background-color: #f8f8f8;
|
||||
}
|
||||
|
||||
.category-info {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.category-icon {
|
||||
font-size: 36rpx;
|
||||
margin-right: 20rpx;
|
||||
color: #3cc51f;
|
||||
}
|
||||
|
||||
.category-name {
|
||||
font-size: 32rpx;
|
||||
font-weight: 600;
|
||||
color: #333;
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.category-count {
|
||||
font-size: 24rpx;
|
||||
color: #999;
|
||||
margin-left: 12rpx;
|
||||
}
|
||||
|
||||
.category-actions {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 20rpx;
|
||||
}
|
||||
|
||||
.expand-icon {
|
||||
font-size: 24rpx;
|
||||
color: #999;
|
||||
padding: 10rpx;
|
||||
transition: transform 0.3s ease;
|
||||
}
|
||||
|
||||
.expand-icon:active {
|
||||
color: #3cc51f;
|
||||
}
|
||||
|
||||
.selected-icon {
|
||||
font-size: 28rpx;
|
||||
color: #3cc51f;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
/* 二级分类列表 */
|
||||
.subcategory-list {
|
||||
background-color: #fafafa;
|
||||
border-top: 1rpx solid #f0f0f0;
|
||||
padding: 0 30rpx;
|
||||
}
|
||||
|
||||
.subcategory-item {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
padding: 25rpx 0;
|
||||
border-bottom: 1rpx solid #f0f0f0;
|
||||
cursor: pointer;
|
||||
transition: all 0.3s ease;
|
||||
}
|
||||
|
||||
.subcategory-item:last-child {
|
||||
border-bottom: none;
|
||||
}
|
||||
|
||||
.subcategory-item:active {
|
||||
background-color: #f5f5f5;
|
||||
}
|
||||
|
||||
.subcategory-item.selected {
|
||||
background-color: #f0f9ff;
|
||||
}
|
||||
|
||||
.subcategory-info {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.subcategory-icon {
|
||||
font-size: 28rpx;
|
||||
margin-right: 20rpx;
|
||||
color: #666;
|
||||
}
|
||||
|
||||
.subcategory-name {
|
||||
font-size: 28rpx;
|
||||
color: #666;
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
/* 动画效果 */
|
||||
.category-item.expanded .expand-icon {
|
||||
transform: rotate(90deg);
|
||||
}
|
||||
|
||||
/* 悬停效果(在支持hover的设备上) */
|
||||
@media (hover: hover) {
|
||||
.category-header:hover {
|
||||
background-color: #f8f8f8;
|
||||
}
|
||||
|
||||
.subcategory-item:hover {
|
||||
background-color: #f5f5f5;
|
||||
}
|
||||
|
||||
.expand-icon:hover {
|
||||
color: #3cc51f;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,113 @@
|
||||
<template>
|
||||
<view class="uni-load-more" @click="onClick">
|
||||
<view class="uni-load-more__content" :class="{'uni-load-more--loading': status === 'loading'}">
|
||||
<!-- 加载中 -->
|
||||
<view v-if="status === 'loading'" class="uni-load-more__loading">
|
||||
<view class="uni-load-more__loading-icon"></view>
|
||||
<text class="uni-load-more__loading-text">{{ contentText.contentrefresh }}</text>
|
||||
</view>
|
||||
|
||||
<!-- 加载更多 -->
|
||||
<view v-else-if="status === 'more'" class="uni-load-more__more">
|
||||
<text class="uni-load-more__more-text">{{ contentText.contentdown }}</text>
|
||||
</view>
|
||||
|
||||
<!-- 没有更多 -->
|
||||
<view v-else-if="status === 'noMore'" class="uni-load-more__nomore">
|
||||
<text class="uni-load-more__nomore-text">{{ contentText.contentnomore }}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: 'UniLoadMore',
|
||||
props: {
|
||||
// 状态:more, loading, noMore
|
||||
status: {
|
||||
type: String,
|
||||
default: 'more'
|
||||
},
|
||||
// 文本内容
|
||||
contentText: {
|
||||
type: Object,
|
||||
default: () => ({
|
||||
contentdown: '上拉显示更多',
|
||||
contentrefresh: '正在加载...',
|
||||
contentnomore: '没有更多数据了'
|
||||
})
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
onClick() {
|
||||
if (this.status === 'more') {
|
||||
this.$emit('clickLoadMore')
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.uni-load-more {
|
||||
padding: 40rpx 0;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.uni-load-more__content {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
/* 加载中样式 */
|
||||
.uni-load-more__loading {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.uni-load-more__loading-icon {
|
||||
width: 30rpx;
|
||||
height: 30rpx;
|
||||
border: 4rpx solid #f3f3f3;
|
||||
border-top: 4rpx solid #3cc51f;
|
||||
border-radius: 50%;
|
||||
animation: spin 1s linear infinite;
|
||||
margin-right: 16rpx;
|
||||
}
|
||||
|
||||
@keyframes spin {
|
||||
0% { transform: rotate(0deg); }
|
||||
100% { transform: rotate(360deg); }
|
||||
}
|
||||
|
||||
.uni-load-more__loading-text {
|
||||
font-size: 26rpx;
|
||||
color: #999;
|
||||
}
|
||||
|
||||
/* 加载更多样式 */
|
||||
.uni-load-more__more {
|
||||
padding: 20rpx 40rpx;
|
||||
background: #f0f0f0;
|
||||
border-radius: 30rpx;
|
||||
}
|
||||
|
||||
.uni-load-more__more-text {
|
||||
font-size: 26rpx;
|
||||
color: #666;
|
||||
}
|
||||
|
||||
/* 没有更多样式 */
|
||||
.uni-load-more__nomore {
|
||||
padding: 20rpx 0;
|
||||
}
|
||||
|
||||
.uni-load-more__nomore-text {
|
||||
font-size: 26rpx;
|
||||
color: #999;
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user