Files
medical-mall/pages/mall/admin/decoration/material-management/index.uvue
2026-03-18 08:36:49 +08:00

287 lines
8.0 KiB
Plaintext

<template>
<view class="admin-main">
<!-- 顶部标签页 -->
<view class="top-tabs">
<view
class="tab-item"
:class="{ active: activeTab === 'image' }"
@click="activeTab = 'image'"
>
<text>图片管理</text>
</view>
<view
class="tab-item"
:class="{ active: activeTab === 'video' }"
@click="activeTab = 'video'"
>
<text>视频管理</text>
</view>
</view>
<view class="main-content">
<!-- 左侧分类树 -->
<view class="category-sidebar">
<view class="add-cat-btn">
<text class="plus">+</text>
<text>添加分类</text>
</view>
<scroll-view class="cat-list" scroll-y="true">
<view
v-for="cat in categories"
:key="cat.id"
class="cat-item"
:class="{ active: selectedCatId === cat.id }"
@click="selectedCatId = cat.id"
>
<text class="folder">📁</text>
<text class="name">{{ cat.name }}</text>
<text class="more">...</text>
</view>
</scroll-view>
</view>
<!-- 右侧素材区 -->
<view class="material-area">
<!-- 工具栏 -->
<view class="toolbar">
<view class="left-btns">
<button class="tool-btn primary" type="primary" size="mini">上传图片</button>
<button class="tool-btn outline" size="mini">删除图片</button>
<view class="dropdown">
<text>图片移动至</text>
<text class="arrow">▼</text>
</view>
</view>
<view class="right-tools">
<view class="search-box">
<input type="text" placeholder="请输入图片名" />
<text class="search-ic">🔍</text>
</view>
<view class="view-toggle">
<text class="vt active">▦</text>
<text class="vt">☰</text>
</view>
</view>
</view>
<!-- 素材网格 -->
<scroll-view class="grid-scroll" scroll-y="true">
<view class="material-grid">
<view class="material-item" v-for="(item, index) in materials" :key="index">
<view class="img-wrapper">
<view class="placeholder-img">{{ item.name.charAt(0) }}</view>
<view class="check-box"></view>
</view>
<text class="material-name">{{ item.name }}</text>
</view>
</view>
<!-- 分页 -->
<view class="pagination">
<text class="total">共 270 条</text>
<text class="page-btn"><</text>
<text class="page-num active">1</text>
<text class="page-num">2</text>
<text class="page-num">3</text>
<text class="page-num">4</text>
<text class="page-num">...</text>
<text class="page-num">13</text>
<text class="page-btn">></text>
<view class="page-size">
<text>15条/页</text>
<text class="arrow">▼</text>
</view>
</view>
</scroll-view>
</view>
</view>
</view>
</template>
<script setup lang="uts">
import { ref } from 'vue'
const activeTab = ref('image')
const selectedCatId = ref(1)
const categories = ref([
{ id: 1, name: '全部图片' },
{ id: 2, name: '系统图片' },
{ id: 3, name: '节日图标' },
{ id: 4, name: '首页装修' },
{ id: 5, name: 'banner' },
{ id: 6, name: '金刚区图标' },
{ id: 7, name: '底部菜单' }
])
const materials = ref([
{ name: 'Scre...s.jpg' },
{ name: 'IMG_....jpeg' },
{ name: '10.png' },
{ name: '9.png' },
{ name: '8.png' },
{ name: '7.png' },
{ name: '6.png' },
{ name: '5.png' },
{ name: '4.png' },
{ name: '3.png' },
{ name: '2.png' },
{ name: '1.png' },
{ name: '我的-选中.png' },
{ name: '我的-未选中.png' },
{ name: '首页-选中.png' },
{ name: '首页-未选中.png' },
{ name: '门店-选中.png' },
{ name: '门店-未选中.png' }
])
</script>
<style scoped>
.admin-main {
height: 100vh;
display: flex;
flex-direction: column;
background-color: #f5f7f9;
}
.top-tabs {
display: flex;
flex-direction: row;
background-color: #fff;
padding: 0 20px;
border-bottom: 1px solid #f0f0f0;
}
.tab-item {
padding: 15px 25px;
cursor: pointer;
font-size: 14px;
color: #666;
border-bottom: 2px solid transparent;
}
.tab-item.active {
color: #1890ff;
border-bottom-color: #1890ff;
}
.main-content {
flex: 1;
display: flex;
flex-direction: row;
overflow: hidden;
}
.category-sidebar {
width: 200px;
background-color: #fff;
border-right: 1px solid #f0f0f0;
display: flex;
flex-direction: column;
}
.add-cat-btn {
padding: 15px;
display: flex;
flex-direction: row;
align-items: center;
color: #1890ff;
font-size: 14px;
cursor: pointer;
border-bottom: 1px solid #f5f5f5;
}
.plus { font-size: 20px; margin-right: 8px; }
.cat-list { flex: 1; }
.cat-item {
display: flex;
flex-direction: row;
align-items: center;
padding: 12px 15px;
font-size: 13px;
color: #606266;
cursor: pointer;
}
.cat-item.active { background-color: #e6f7ff; color: #1890ff; border-right: 2px solid #1890ff; }
.folder { margin-right: 8px; font-size: 14px; }
.name { flex: 1; }
.more { color: #999; }
.material-area { flex: 1; display: flex; flex-direction: column; background-color: #fff; margin: 15px; border-radius: 4px; }
.toolbar {
padding: 15px;
display: flex;
flex-direction: row;
justify-content: space-between;
border-bottom: 1px solid #f0f0f0;
}
.left-btns { display: flex; flex-direction: row; gap: 10px; align-items: center; }
.tool-btn { margin: 0; }
.dropdown { border: 1px solid #dcdfe6; padding: 4px 10px; border-radius: 4px; font-size: 12px; display: flex; align-items: center; gap: 5px; color: #606266; }
.arrow { font-size: 10px; color: #ccc; }
.right-tools { display: flex; flex-direction: row; gap: 15px; align-items: center; }
.search-box { position: relative; width: 220px; }
.search-box input { width: 100%; border: 1px solid #dcdfe6; border-radius: 4px; padding: 4px 30px 4px 10px; font-size: 12px; }
.search-ic { position: absolute; right: 10px; top: 6px; color: #999; }
.view-toggle { display: flex; border: 1px solid #dcdfe6; border-radius: 4px; overflow: hidden; }
.vt { padding: 4px 10px; font-size: 14px; color: #666; cursor: pointer; }
.vt.active { background-color: #1890ff; color: #fff; }
.grid-scroll { flex: 1; padding: 15px; }
.material-grid {
display: flex;
flex-direction: row;
flex-wrap: wrap;
gap: 15px;
}
.material-item {
width: 120px;
display: flex;
flex-direction: column;
align-items: center;
margin-bottom: 15px;
}
.img-wrapper {
width: 120px;
height: 120px;
background-color: #f5f5f5;
border: 1px solid #f0f0f0;
border-radius: 4px;
margin-bottom: 8px;
display: flex;
align-items: center;
justify-content: center;
position: relative;
}
.placeholder-img { font-size: 40px; color: #ccc; }
.check-box { position: absolute; top: 5px; left: 5px; width: 16px; height: 16px; border: 1px solid #dcdfe6; background: #fff; border-radius: 2px; }
.material-name { font-size: 12px; color: #606266; text-align: center; width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pagination {
padding: 20px 0;
display: flex;
flex-direction: row;
justify-content: flex-end;
align-items: center;
gap: 10px;
}
.total { font-size: 13px; color: #606266; margin-right: 10px; }
.page-btn { border: 1px solid #dcdfe6; padding: 4px 10px; border-radius: 4px; color: #666; cursor: pointer; }
.page-num { border: 1px solid #dcdfe6; padding: 4px 10px; border-radius: 4px; cursor: pointer; font-size: 13px; color: #606266; }
.page-num.active { background-color: #1890ff; color: #fff; border-color: #1890ff; }
.page-size { border: 1px solid #dcdfe6; padding: 4px 10px; border-radius: 4px; font-size: 13px; color: #606266; display: flex; align-items: center; gap: 5px; }
</style>