Merge remote-tracking branch 'origin/huangzhenbao-admin'

This commit is contained in:
not-like-juvenile
2026-03-18 17:14:05 +08:00
676 changed files with 25158 additions and 46646 deletions

View File

@@ -81,13 +81,13 @@ const handleSave = () => {
<style scoped>
.agreement-settings {
padding: 20px;
background-color: #f5f7f9;
/* 使用 AdminLayout 的统一内边距和背景色 */
min-height: 100%;
}
.admin-card {
background-color: #fff;
padding: 24px;
padding: var(--admin-card-padding);
border-radius: 8px;
}

View File

@@ -0,0 +1,310 @@
<template>
<view class="admin-page-container">
<view class="page-card">
<!-- 搜索栏 -->
<view class="search-wrap">
<view class="search-item">
<text class="label">状态:</text>
<picker mode="selector" :range="statusRange" @change="onStatusChange">
<view class="picker-input">{{ statusText }}</view>
</picker>
</view>
<view class="search-item">
<text class="label">搜索:</text>
<input class="input" placeholder="请输入姓名或者账号" v-model="searchKey" />
</view>
<button class="btn btn-primary" @click="onSearch">查询</button>
</view>
<view class="action-wrap">
<button class="btn btn-primary" @click="onAdd">添加管理员</button>
</view>
<!-- 表格区域 -->
<view class="table-wrap">
<view class="table-header">
<view class="th" style="flex: 2;">姓名</view>
<view class="th" style="flex: 2;">账号</view>
<view class="th" style="flex: 2;">身份</view>
<view class="th" style="flex: 3;">最后一次登录时间</view>
<view class="th" style="flex: 3;">最后一次登录ip</view>
<view class="th" style="flex: 1;">开启</view>
<view class="th" style="flex: 2;">操作</view>
</view>
<view class="table-body">
<view v-for="item in pagedList" :key="item.id" class="tr">
<view class="td" style="flex: 2;">{{ item.name }}</view>
<view class="td" style="flex: 2;">{{ item.account }}</view>
<view class="td" style="flex: 2;">{{ item.role }}</view>
<view class="td" style="flex: 3;">{{ item.lastLoginTime }}</view>
<view class="td" style="flex: 3;">{{ item.lastLoginIp }}</view>
<view class="td" style="flex: 1;">
<switch :checked="item.status" color="#1890ff" style="transform: scale(0.7);" />
</view>
<view class="td" style="flex: 2;">
<text class="action-btn" @click="onEdit(item)">编辑</text>
<text class="action-btn-del" @click="onDelete(item)">删除</text>
</view>
</view>
</view>
<CommonPagination
v-if="total > 0"
:total="total"
:loading="false"
:currentPage="currentPage"
:pageSize="pageSize"
:pageSizeOptionLabels="pageSizeOptionLabels"
:pageSizeIndex="pageSizeIndex"
:visiblePages="visiblePages"
:totalPage="totalPage"
:jumpPageInput="jumpPageInput"
@page-size-change="handlePageSizeChange"
@page-change="handlePageChange"
@update:jumpPageInput="(val: string) => { jumpPageInput.value = val }"
@jump-page="handleJumpPage"
/>
</view>
</view>
</view>
</template>
<script setup lang="uts">
import { ref, computed } from 'vue'
import CommonPagination from '@/components/CommonPagination/CommonPagination.uvue'
const searchKey = ref('')
const statusRange = ['所有', '启用', '禁用']
const statusIndex = ref(0)
const statusText = ref('请选择')
type AdminItem = {
id: number
name: string
account: string
role: string
lastLoginTime: string
lastLoginIp: string
status: boolean
}
// ========== MOCK DATA START ==========
// TODO: 接真实接口时替换此处 adminList 为 fetchAdminList() 调用
const adminList = ref<AdminItem[]>([
{ id: 20, name: '张三', account: 'zhangsan', role: '超级管理员', lastLoginTime: '2025-06-28 10:30:00', lastLoginIp: '192.168.1.1', status: true },
{ id: 19, name: '李四', account: 'lisi', role: '运营管理员', lastLoginTime: '2025-06-27 09:15:00', lastLoginIp: '192.168.1.2', status: true },
{ id: 18, name: '王五', account: 'wangwu', role: '财务管理员', lastLoginTime: '2025-06-26 14:20:00', lastLoginIp: '10.0.0.5', status: true },
{ id: 17, name: '赵六', account: 'zhaoliu', role: '客服专员', lastLoginTime: '2025-06-25 11:00:00', lastLoginIp: '10.0.0.6', status: false },
{ id: 16, name: '陈七', account: 'chenqi', role: '商品管理员', lastLoginTime: '2025-06-24 16:45:00', lastLoginIp: '172.16.0.1', status: true },
{ id: 15, name: '周八', account: 'zhouba', role: '订单管理员', lastLoginTime: '2025-06-23 08:30:00', lastLoginIp: '172.16.0.2', status: true },
{ id: 14, name: '吴九', account: 'wujiu', role: '营销专员', lastLoginTime: '2025-06-22 13:00:00', lastLoginIp: '192.168.2.1', status: true },
{ id: 13, name: '郑十', account: 'zhengshi', role: '内容管理员', lastLoginTime: '2025-06-21 10:00:00', lastLoginIp: '192.168.2.2', status: false },
{ id: 12, name: '马一一', account: 'mayiyi', role: '数据分析师', lastLoginTime: '2025-06-20 15:20:00', lastLoginIp: '10.0.1.1', status: true },
{ id: 11, name: '刘二二', account: 'liuerer', role: '技术支持', lastLoginTime: '2025-06-19 09:40:00', lastLoginIp: '10.0.1.2', status: true },
{ id: 10, name: '张三三', account: 'zhangsansan', role: '分销管理员', lastLoginTime: '2025-06-18 11:30:00', lastLoginIp: '172.16.1.1', status: true },
{ id: 9, name: '李四四', account: 'lisisi', role: '仓库管理员', lastLoginTime: '2025-06-17 14:00:00', lastLoginIp: '172.16.1.2', status: false },
{ id: 8, name: '王五五', account: 'wangwuwu', role: '客服小组长', lastLoginTime: '2025-06-16 10:10:00', lastLoginIp: '192.168.3.1', status: true },
{ id: 7, name: '赵六六', account: 'zhaoliuliu', role: '运营小组长', lastLoginTime: '2025-06-15 09:00:00', lastLoginIp: '192.168.3.2', status: true },
{ id: 6, name: '陈七七', account: 'chenqiqi', role: '商品小组长', lastLoginTime: '2025-06-14 16:00:00', lastLoginIp: '10.0.2.1', status: true },
{ id: 5, name: '周八八', account: 'zhoubaba', role: '订单小组长', lastLoginTime: '2025-06-13 15:00:00', lastLoginIp: '10.0.2.2', status: false },
{ id: 4, name: '吴九九', account: 'wujiujiu', role: '营销小组长', lastLoginTime: '2025-06-12 11:00:00', lastLoginIp: '172.16.2.1', status: true },
{ id: 3, name: '马小明', account: 'maxiaoming', role: '普通管理员', lastLoginTime: '2025-06-11 10:20:00', lastLoginIp: '172.16.2.2', status: true },
{ id: 2, name: '李小花', account: 'lixiaohua', role: '普通管理员', lastLoginTime: '2025-06-10 08:50:00', lastLoginIp: '192.168.4.1', status: true },
{ id: 1, name: 'admin', account: 'admin', role: '超级管理员', lastLoginTime: '2025-06-29 22:00:00', lastLoginIp: '127.0.0.1', status: true }
])
// ========== MOCK DATA END ==========
// ========== PAGINATION STATE ==========
const currentPage = ref(1)
const pageSize = ref(15)
const jumpPageInput = ref('')
const pageSizeOptions = [10, 15, 20, 30, 50]
const pageSizeOptionLabels = computed(() => pageSizeOptions.map((n: number) => `${n}条/页`))
const pageSizeIndex = computed(() => { const idx = pageSizeOptions.indexOf(pageSize.value); return idx >= 0 ? idx : 0 })
const total = computed(() => adminList.value.length)
const totalPage = computed(() => Math.max(1, Math.ceil(total.value / pageSize.value)))
const pagedList = computed(() => {
const start = (currentPage.value - 1) * pageSize.value
return adminList.value.slice(start, start + pageSize.value)
})
const visiblePages = computed((): number[] => {
const t = totalPage.value; const cur = currentPage.value
if (t <= 7) return Array.from({ length: t }, (_: any, i: number) => i + 1)
if (cur <= 4) return [1, 2, 3, 4, 5, -1, t]
if (cur >= t - 3) return [1, -1, t - 4, t - 3, t - 2, t - 1, t]
return [1, -1, cur - 1, cur, cur + 1, -1, t]
})
const handlePageChange = (p: number) => { currentPage.value = p }
const handlePageSizeChange = (e: any) => {
const idx = Number(e.detail.value)
pageSize.value = pageSizeOptions[idx] ?? pageSizeOptions[0]
currentPage.value = 1
}
const handleJumpPage = () => {
const p = parseInt(jumpPageInput.value)
if (!isNaN(p) && p >= 1 && p <= totalPage.value) currentPage.value = p
}
// ========== END PAGINATION STATE ==========
function onStatusChange(e: any) {
statusIndex.value = parseInt(e.detail.value.toString())
statusText.value = statusRange[statusIndex.value]
}
function onSearch() {
console.log('Search:', searchKey.value, statusText.value)
}
function onAdd() {
console.log('Add admin')
}
function onEdit(item: AdminItem) {
console.log('Edit admin:', item.account)
}
function onDelete(item: AdminItem) {
uni.showModal({
title: '提示',
content: '确定删除该管理员吗?',
success: (res) => {
if (res.confirm) {
uni.showToast({ title: '已删除', icon: 'success' })
}
}
})
}
</script>
<style scoped>
.admin-page-container {
/* 使用 Layout 的背景和内边距 */
padding: 0;
background-color: transparent;
min-height: auto;
}
.page-card {
background-color: #fff;
border-radius: 4px;
padding: 20px;
}
.search-wrap {
display: flex;
flex-direction: row;
align-items: center;
flex-wrap: wrap;
padding-bottom: 20px;
border-bottom: 1px solid #f0f0f0;
margin-bottom: 20px;
}
.search-item {
display: flex;
flex-direction: row;
align-items: center;
margin-right: 20px;
margin-bottom: 10px;
}
.label {
font-size: 14px;
color: #606266;
margin-right: 8px;
}
.picker-input {
width: 150px;
height: 32px;
line-height: 32px;
padding: 0 10px;
border: 1px solid #dcdfe6;
border-radius: 4px;
font-size: 14px;
color: #606266;
background-color: #fff;
}
.input {
width: 220px;
height: 32px;
padding: 0 10px;
border: 1px solid #dcdfe6;
border-radius: 4px;
font-size: 14px;
color: #606266;
}
.btn {
height: 32px;
line-height: 30px;
padding: 0 15px;
font-size: 14px;
border-radius: 4px;
border: none;
margin-bottom: 10px;
}
.btn-primary {
background-color: #1890ff;
color: #fff;
}
.action-wrap {
margin-bottom: 20px;
}
.table-wrap {
width: 100%;
border: 1px solid #f0f0f0;
}
.table-header {
display: flex;
flex-direction: row;
background-color: #f8f8f9;
}
.th {
padding: 12px 10px;
font-size: 14px;
font-weight: bold;
color: #515a6e;
border-bottom: 1px solid #f0f0f0;
text-align: center;
}
.table-body {
min-height: 100px;
}
.tr {
display: flex;
flex-direction: row;
align-items: center;
border-bottom: 1px solid #f0f0f0;
min-height: 54px;
}
.td {
display: flex;
flex-direction: row;
padding: 10px;
font-size: 13px;
color: #515a6e;
text-align: center;
}
.action-btn {
font-size: 13px;
color: #1890ff;
margin-right: 8px;
cursor: pointer;
}
.action-btn-del {
font-size: 13px;
color: #ed4014;
cursor: pointer;
}
</style>

View File

@@ -0,0 +1,189 @@
<template>
<view class="admin-page-container">
<view class="page-card">
<!-- 搜索栏 -->
<view class="search-wrap">
<view class="search-item">
<text class="label">按钮名称:</text>
<input class="input" placeholder="请输入按钮名称" v-model="searchKey" />
</view>
<button class="btn btn-primary" @click="onSearch">查询</button>
</view>
<!-- 表格区域 -->
<view class="table-wrap">
<view class="table-header">
<view class="th" style="flex: 4; text-align: left; padding-left: 20px;">按钮名称</view>
<view class="th" style="flex: 3;">类型</view>
<view class="th" style="flex: 2;">排序</view>
<view class="th" style="flex: 2;">是否显示</view>
<view class="th" style="flex: 2;">操作</view>
</view>
<view class="table-body">
<view v-for="item in permissionList" :key="item.id" class="tr">
<view class="td" style="flex: 4; text-align: left; padding-left: 20px;">
<text v-if="item.hasChildren" class="expand-icon">▶</text>
<text class="menu-name">{{ item.name }}</text>
</view>
<view class="td" style="flex: 3;">{{ item.type }}</view>
<view class="td" style="flex: 2;">{{ item.sort }}</view>
<view class="td" style="flex: 2;">
<switch :checked="item.isshow" color="#1890ff" @change="onToggleShow(item)" />
</view>
<view class="td" style="flex: 2;">
<text class="action-btn" @click="onEdit(item)">编辑</text>
</view>
</view>
</view>
</view>
</view>
</view>
</template>
<script setup lang="uts">
import { ref, reactive } from 'vue'
const searchKey = ref('')
type PermissionItem = {
id: number
name: string
type: string
sort: number
isshow: boolean
hasChildren: boolean
}
const permissionList = reactive<PermissionItem[]>([
{ id: 1, name: '主页', type: '菜单:/admin/index', sort: 127, isshow: true, hasChildren: false },
{ id: 2, name: '用户', type: '菜单:/admin/user', sort: 125, isshow: true, hasChildren: true },
{ id: 3, name: '订单', type: '菜单:/admin/order', sort: 120, isshow: true, hasChildren: true },
{ id: 4, name: '商品', type: '菜单:/admin/product', sort: 115, isshow: true, hasChildren: true },
{ id: 5, name: '营销', type: '菜单:/admin/marketing', sort: 110, isshow: true, hasChildren: true }
])
function onSearch() {
console.log('Search:', searchKey.value)
}
function onToggleShow(item: PermissionItem) {
item.isshow = !item.isshow
}
function onEdit(item: PermissionItem) {
console.log('Edit:', item.name)
}
</script>
<style scoped>
.admin-page-container {
/* 使用 Layout 的背景和内边距 */
padding: 0;
background-color: transparent;
min-height: auto;
}
.page-card {
background-color: #fff;
border-radius: 4px;
padding: 20px;
}
.search-wrap {
display: flex;
flex-direction: row;
align-items: center;
padding-bottom: 20px;
border-bottom: 1px solid #f0f0f0;
margin-bottom: 20px;
}
.search-item {
display: flex;
flex-direction: row;
align-items: center;
margin-right: 20px;
}
.label {
font-size: 14px;
color: #606266;
margin-right: 8px;
}
.input {
width: 200px;
height: 32px;
padding: 0 10px;
border: 1px solid #dcdfe6;
border-radius: 4px;
font-size: 14px;
color: #606266;
}
.btn {
height: 32px;
line-height: 30px;
padding: 0 15px;
font-size: 14px;
border-radius: 4px;
border: none;
}
.btn-primary {
background-color: #1890ff;
color: #fff;
}
.table-wrap {
width: 100%;
border: 1px solid #f0f0f0;
}
.table-header {
display: flex;
flex-direction: row;
background-color: #f8f8f9;
}
.th {
padding: 12px 10px;
font-size: 14px;
font-weight: bold;
color: #515a6e;
border-bottom: 1px solid #f0f0f0;
text-align: center;
}
.tr {
display: flex;
flex-direction: row;
border-bottom: 1px solid #f0f0f0;
}
.td {
padding: 12px 10px;
font-size: 14px;
color: #515a6e;
text-align: center;
display: flex;
align-items: center;
justify-content: center;
}
.expand-icon {
font-size: 12px;
color: #999;
margin-right: 5px;
}
.menu-name {
font-size: 14px;
}
.action-btn {
color: #1890ff;
font-size: 13px;
cursor: pointer;
}
</style>

View File

@@ -1,263 +0,0 @@
<template>
<view class="admin-page-container">
<view class="page-card">
<!-- 顶部操作栏 -->
<view class="action-wrap">
<button class="btn btn-primary" @click="onAdd(null)">添加顶级权限</button>
<button class="btn btn-ghost ml-10" @click="loadData">刷新</button>
</view>
<!-- 树形表格区域 -->
<view class="table-wrap border-shadow">
<view class="table-header">
<view class="th" style="flex: 4; text-align: left; padding-left: 20px;">菜单/按钮名称</view>
<view class="th" style="flex: 2;">编码</view>
<view class="th" style="flex: 2;">类型</view>
<view class="th" style="flex: 1;">排序</view>
<view class="th" style="flex: 1;">显示</view>
<view class="th" style="flex: 3;">操作</view>
</view>
<view class="table-body">
<view v-if="loading" class="loading-box">
<text>加载中...</text>
</view>
<view v-else-if="permissionList.length === 0" class="no-data">
<text class="no-data-text">暂无数据</text>
</view>
<!-- 递归渲染或平铺渲染 (这里采用平铺+缩进模拟树形) -->
<view v-else v-for="item in permissionList" :key="item.id" class="tr">
<view class="td" style="flex: 4; text-align: left; padding-left: 20px;">
<text class="menu-name">{{ item.name }}</text>
</view>
<view class="td" style="flex: 2;"><text class="td-txt-small">{{ item.code }}</text></view>
<view class="td" style="flex: 2;">
<text :class="['type-tag', item.type === 'menu' ? 'menu' : 'button']">
{{ item.type === 'menu' ? '菜单' : '按钮' }}
</text>
</view>
<view class="td" style="flex: 1;"><text class="td-txt">{{ item.sort_order }}</text></view>
<view class="td" style="flex: 1;">
<switch :checked="item.is_visible" color="#1890ff" scale="0.6" @change="onToggleVisible(item)" />
</view>
<view class="td" style="flex: 3;">
<view class="op-links">
<text class="action-btn" @click="onAdd(item.id)">新增子项</text>
<text class="op-split">|</text>
<text class="action-btn" @click="onEdit(item)">编辑</text>
<text class="op-split">|</text>
<text class="action-btn danger" @click="onDelete(item)">删除</text>
</view>
</view>
</view>
</view>
</view>
</view>
<!-- 添加/编辑 弹窗 -->
<view v-if="showModal" class="modal-overlay" @click="closeModal">
<view class="modal-card" @click.stop>
<view class="modal-header">
<text class="modal-title">{{ isEdit ? '编辑权限' : '添加权限' }}</text>
<text class="close-btn" @click="closeModal">×</text>
</view>
<view class="modal-body">
<scroll-view scroll-y="true" style="max-height: 500px;">
<view class="form-item">
<text class="f-label">父级ID</text>
<input class="f-input disabled" :value="form.parent_id || '顶级'" disabled />
</view>
<view class="form-item">
<text class="f-label">名称:</text>
<input class="f-input" v-model="form.name" placeholder="请输入菜单或按钮名称" />
</view>
<view class="form-item">
<text class="f-label">编码:</text>
<input class="f-input" v-model="form.code" placeholder="如: user_view" />
</view>
<view class="form-item">
<text class="f-label">类型:</text>
<radio-group class="radio-group" @change="(e : any) => form.type = e.detail.value">
<label class="radio-label"><radio value="menu" :checked="form.type === 'menu'" color="#1890ff" /> 菜单</label>
<label class="radio-label"><radio value="button" :checked="form.type === 'button'" color="#1890ff" /> 按钮</label>
</radio-group>
</view>
<view class="form-item" v-if="form.type === 'menu'">
<text class="f-label">路由路径:</text>
<input class="f-input" v-model="form.path" placeholder="请输入前端路由地址" />
</view>
<view class="form-item">
<text class="f-label">排序:</text>
<input class="f-input" type="number" v-model="form.sort_order" />
</view>
</scroll-view>
</view>
<view class="modal-footer">
<button class="btn" @click="closeModal">取消</button>
<button class="btn btn-primary" @click="handleSave">提交</button>
</view>
</view>
</view>
</view>
</template>
<script setup lang="uts">
import { ref, reactive, onMounted } from 'vue'
import { fetchPermissionList, savePermission, deletePermission, type AdminPermission } from '@/services/admin/authService.uts'
const permissionList = ref<AdminPermission[]>([])
const loading = ref(false)
const showModal = ref(false)
const isEdit = ref(false)
const form = reactive({
id: '' as string | null,
parent_id: '' as string | null,
name: '',
code: '',
type: 'menu',
path: '',
icon: '',
sort_order: 0,
is_visible: true
})
onMounted(() => {
loadData()
})
async function loadData() {
loading.value = true
try {
const res = await fetchPermissionList()
permissionList.value = res
} catch (e) {
uni.showToast({ title: '加载失败', icon: 'none' })
} finally {
loading.value = false
}
}
function onAdd(parentId : string | null) {
isEdit.value = false
form.id = null
form.parent_id = parentId
form.name = ''
form.code = ''
form.type = 'menu'
form.path = ''
form.sort_order = 0
form.is_visible = true
showModal.value = true
}
function onEdit(item : AdminPermission) {
isEdit.value = true
form.id = item.id
form.parent_id = item.parent_id
form.name = item.name
form.code = item.code
form.type = item.type
form.path = item.path || ''
form.sort_order = item.sort_order
form.is_visible = item.is_visible
showModal.value = true
}
async function onToggleVisible(item : AdminPermission) {
const nextVal = !item.is_visible
const ok = await savePermission({ ...item, is_visible: nextVal })
if (ok != null) {
item.is_visible = nextVal
uni.showToast({ title: '显示状态已更新' })
}
}
async function handleSave() {
if (!form.name || !form.code) {
uni.showToast({ title: '请填写必填项', icon: 'none' })
return
}
loading.value = true
try {
const resId = await savePermission(form)
if (resId != null) {
uni.showToast({ title: '保存成功' })
showModal.value = false
loadData()
}
} finally {
loading.value = false
}
}
async function onDelete(item : AdminPermission) {
uni.showModal({
title: '确认删除',
content: `确定要删除权限项 "${item.name}" 吗?此操作不可撤销。`,
success: async (res) => {
if (res.confirm) {
const ok = await deletePermission(item.id)
if (ok) {
uni.showToast({ title: '删除成功' })
loadData()
}
}
}
})
}
function closeModal() {
showModal.value = false
}
</script>
<style scoped lang="scss">
.admin-page-container { padding: 24px; background-color: #f5f7f9; min-height: 100vh; }
.page-card { background-color: #fff; border-radius: 4px; padding: 24px; }
.action-wrap { margin-bottom: 24px; display: flex; flex-direction: row; }
.btn { height: 32px; padding: 0 16px; font-size: 14px; border-radius: 4px; border: none; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.btn-primary { background-color: #1890ff; color: #fff; }
.btn-ghost { background-color: #fff; color: #666; border: 1px solid #dcdfe6; }
.ml-10 { margin-left: 10px; }
.table-wrap { border: 1px solid #f0f0f0; border-radius: 4px; }
.table-header { display: flex; flex-direction: row; background-color: #f8f8f9; }
.th { padding: 12px 10px; font-size: 14px; font-weight: bold; color: #515a6e; border-bottom: 1px solid #f0f0f0; text-align: center; }
.tr { display: flex; flex-direction: row; border-bottom: 1px solid #f0f0f0; min-height: 50px; align-items: center; }
.td { padding: 8px 10px; font-size: 13px; color: #606266; text-align: center; display: flex; align-items: center; justify-content: center; }
.menu-name { font-weight: 500; color: #333; }
.td-txt-small { font-size: 12px; color: #999; }
.type-tag { padding: 2px 8px; border-radius: 4px; font-size: 11px; }
.type-tag.menu { background-color: #e6f7ff; color: #1890ff; border: 1px solid #91d5ff; }
.type-tag.button { background-color: #f6ffed; color: #52c41a; border: 1px solid #b7eb8f; }
.op-links { display: flex; flex-direction: row; align-items: center; gap: 8px; }
.action-btn { color: #1890ff; font-size: 13px; cursor: pointer; }
.danger { color: #ff4d4f; }
.op-split { color: #eee; }
.loading-box, .no-data { padding: 60px 0; text-align: center; width: 100%; }
.no-data-text { font-size: 14px; color: #ccc; }
/* Modal */
.modal-overlay { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background-color: rgba(0,0,0,0.5); z-index: 1000; display: flex; align-items: center; justify-content: center; }
.modal-card { width: 500px; background-color: #fff; border-radius: 8px; overflow: hidden; }
.modal-header { padding: 16px 20px; border-bottom: 1px solid #f0f0f0; display: flex; flex-direction: row; justify-content: space-between; align-items: center; }
.modal-title { font-size: 16px; font-weight: bold; color: #333; }
.close-btn { font-size: 24px; color: #999; cursor: pointer; }
.modal-body { padding: 24px; }
.form-item { margin-bottom: 20px; display: flex; flex-direction: row; align-items: center; }
.align-start { align-items: flex-start; }
.f-label { width: 90px; font-size: 14px; color: #666; text-align: right; margin-right: 15px; }
.f-input { flex: 1; border: 1px solid #dcdfe6; height: 36px; padding: 0 12px; border-radius: 4px; font-size: 14px; }
.f-input.disabled { background-color: #f5f5f5; color: #999; }
.radio-group { display: flex; flex-direction: row; gap: 20px; }
.radio-label { display: flex; flex-direction: row; align-items: center; font-size: 14px; }
.modal-footer { padding: 16px 24px; border-top: 1px solid #f0f0f0; display: flex; flex-direction: row; justify-content: flex-end; gap: 12px; }
</style>

View File

@@ -0,0 +1,175 @@
<template>
<view class="admin-page-container">
<view class="page-card">
<!-- 搜索栏 -->
<view class="search-wrap">
<view class="search-item">
<text class="label">状态:</text>
<picker mode="selector" :range="statusRange" @change="onStatusChange">
<view class="picker-input">{{ statusText }}</view>
</picker>
</view>
<view class="search-item">
<text class="label">身份昵称:</text>
<input class="input" placeholder="请输入身份昵称" v-model="searchKey" />
</view>
<button class="btn btn-primary" @click="onSearch">查询</button>
</view>
<view class="action-wrap">
<button class="btn btn-primary" @click="onAdd">添加身份</button>
</view>
<!-- 表格区域 -->
<view class="table-wrap">
<view class="table-header">
<view class="th" style="flex: 1;">ID</view>
<view class="th" style="flex: 3;">身份昵称</view>
<view class="th" style="flex: 2;">状态</view>
<view class="th" style="flex: 2;">操作</view>
</view>
<view class="table-body">
<view class="no-data">
<text class="no-data-text">暂无数据</text>
</view>
</view>
</view>
</view>
</view>
</template>
<script setup lang="uts">
import { ref } from 'vue'
const searchKey = ref('')
const statusRange = ['所有', '启用', '禁用']
const statusIndex = ref(0)
const statusText = ref('请选择')
function onStatusChange(e: any) {
statusIndex.value = parseInt(e.detail.value.toString())
statusText.value = statusRange[statusIndex.value]
}
function onSearch() {
console.log('Search:', searchKey.value, statusText.value)
}
function onAdd() {
console.log('Add role')
}
</script>
<style scoped>
.admin-page-container {
/* 使用 Layout 的背景和内边距 */
padding: 0;
background-color: transparent;
min-height: auto;
}
.page-card {
background-color: #fff;
border-radius: 4px;
padding: 20px;
}
.search-wrap {
display: flex;
flex-direction: row;
align-items: center;
flex-wrap: wrap;
padding-bottom: 20px;
border-bottom: 1px solid #f0f0f0;
margin-bottom: 20px;
}
.search-item {
display: flex;
flex-direction: row;
align-items: center;
margin-right: 20px;
margin-bottom: 10px;
}
.label {
font-size: 14px;
color: #606266;
margin-right: 8px;
}
.picker-input {
width: 150px;
height: 32px;
line-height: 32px;
padding: 0 10px;
border: 1px solid #dcdfe6;
border-radius: 4px;
font-size: 14px;
color: #606266;
background-color: #fff;
}
.input {
width: 180px;
height: 32px;
padding: 0 10px;
border: 1px solid #dcdfe6;
border-radius: 4px;
font-size: 14px;
color: #606266;
}
.btn {
height: 32px;
line-height: 30px;
padding: 0 15px;
font-size: 14px;
border-radius: 4px;
border: none;
margin-bottom: 10px;
}
.btn-primary {
background-color: #1890ff;
color: #fff;
}
.action-wrap {
margin-bottom: 20px;
}
.table-wrap {
width: 100%;
border: 1px solid #f0f0f0;
}
.table-header {
display: flex;
flex-direction: row;
background-color: #f8f8f9;
}
.th {
padding: 12px 10px;
font-size: 14px;
font-weight: bold;
color: #515a6e;
border-bottom: 1px solid #f0f0f0;
text-align: center;
}
.table-body {
min-height: 100px;
}
.no-data {
padding: 40px 0;
text-align: center;
}
.no-data-text {
font-size: 14px;
color: #c5c8ce;
}
</style>

View File

@@ -1,272 +0,0 @@
<template>
<view class="admin-page-container">
<view class="page-card">
<!-- 搜索栏 -->
<view class="search-wrap">
<view class="search-item">
<text class="label">状态:</text>
<uni-data-select v-model="statusValue" :localdata="statusOptions" style="width: 120px;" @change="handleQuery" />
</view>
<view class="search-item">
<text class="label">身份昵称:</text>
<input class="input" placeholder="请输入身份昵称" v-model="searchKey" @confirm="handleQuery" />
</view>
<button class="btn btn-primary" @click="handleQuery">查询</button>
</view>
<view class="action-wrap">
<button class="btn btn-primary" @click="onAdd">添加身份</button>
</view>
<!-- 表格区域 -->
<view class="table-wrap border-shadow">
<view class="table-header">
<view class="th" style="flex: 1;">序号</view>
<view class="th" style="flex: 3;">身份昵称</view>
<view class="th" style="flex: 2;">状态</view>
<view class="th" style="flex: 2;">操作</view>
</view>
<view class="table-body">
<view v-if="loading" class="loading-box">
<text>加载中...</text>
</view>
<view v-else-if="roleList.length === 0" class="no-data">
<text class="no-data-text">暂无数据</text>
</view>
<view v-else v-for="(item, index) in roleList" :key="item.id" class="tr">
<view class="td" style="flex: 1;"><text class="td-txt">{{ (page - 1) * pageSize + index + 1 }}</text></view>
<view class="td" style="flex: 3;"><text class="td-txt">{{ item.name }} ({{ item.code }})</text></view>
<view class="td" style="flex: 2;">
<switch :checked="item.is_active" color="#1890ff" scale="0.7" @change="onToggleStatus(item)" />
</view>
<view class="td" style="flex: 2;">
<text class="action-btn" @click="onEdit(item)">编辑</text>
<view class="divider"></view>
<text class="action-btn danger" @click="onDelete(item)">删除</text>
</view>
</view>
</view>
</view>
<!-- 分页栏 -->
<view class="pagination-footer">
<text class="total-txt">共 {{ total }} 条</text>
<view class="page-btns">
<text :class="['p-btn', page <= 1 ? 'disabled' : '']" @click="prevPage"> < </text>
<text class="p-btn active">{{ page }}</text>
<text :class="['p-btn', roleList.length < pageSize ? 'disabled' : '']" @click="nextPage"> > </text>
</view>
</view>
</view>
<!-- 添加/编辑 弹窗 -->
<view v-if="showModal" class="modal-overlay" @click="closeModal">
<view class="modal-card" @click.stop>
<view class="modal-header">
<text class="modal-title">{{ isEdit ? '编辑身份' : '添加身份' }}</text>
<text class="close-btn" @click="closeModal">×</text>
</view>
<view class="modal-body">
<view class="form-item">
<text class="f-label">身份名称:</text>
<input class="f-input" v-model="form.name" placeholder="请输入身份名称" />
</view>
<view class="form-item">
<text class="f-label">身份编码:</text>
<input class="f-input" v-model="form.code" placeholder="如: super_admin" :disabled="isEdit" />
</view>
<view class="form-item">
<text class="f-label">描述:</text>
<textarea class="f-textarea" v-model="form.description" placeholder="请输入备注描述" />
</view>
</view>
<view class="modal-footer">
<button class="btn" @click="closeModal">取消</button>
<button class="btn btn-primary" @click="handleSave">保存</button>
</view>
</view>
</view>
</view>
</template>
<script setup lang="uts">
import { ref, reactive, onMounted } from 'vue'
import { fetchRolePage, saveRole, deleteRole, type AdminRole } from '@/services/admin/authService.uts'
const roleList = ref<AdminRole[]>([])
const loading = ref(false)
const total = ref(0)
const page = ref(1)
const pageSize = 15
const searchKey = ref('')
const statusValue = ref('all')
const statusOptions = [
{ value: 'all', text: '所有' },
{ value: '1', text: '启用' },
{ value: '0', text: '禁用' }
]
// 弹窗表单状态
const showModal = ref(false)
const isEdit = ref(false)
const form = reactive({
id: '' as string | null,
name: '',
code: '',
description: '',
is_active: true
})
onMounted(() => {
loadData()
})
async function loadData() {
loading.value = true
try {
const res = await fetchRolePage(page.value, pageSize, searchKey.value || null)
roleList.value = res.items
total.value = res.total
} catch (e) {
uni.showToast({ title: '加载失败', icon: 'none' })
} finally {
loading.value = false
}
}
function handleQuery() {
page.value = 1
loadData()
}
function onAdd() {
isEdit.value = false
form.id = null
form.name = ''
form.code = ''
form.description = ''
form.is_active = true
showModal.value = true
}
function onEdit(item : AdminRole) {
isEdit.value = true
form.id = item.id
form.name = item.name
form.code = item.code
form.description = item.description || ''
form.is_active = item.is_active
showModal.value = true
}
function closeModal() {
showModal.value = false
}
async function handleSave() {
if (!form.name || !form.code) {
uni.showToast({ title: '请完善必要信息', icon: 'none' })
return
}
loading.value = true
try {
const resId = await saveRole(form)
if (resId != null) {
uni.showToast({ title: '保存成功' })
closeModal()
loadData()
} else {
uni.showToast({ title: '保存失败', icon: 'none' })
}
} finally {
loading.value = false
}
}
async function onDelete(item : AdminRole) {
uni.showModal({
title: '删除确认',
content: `确定要删除角色 "${item.name}" 吗?\n\n⚠ 警告:该操作将同时解除所有关联管理员的身份并清空该角色的权限配置!`,
confirmText: '确认删除',
confirmColor: '#ff4d4f',
success: async (res) => {
if (res.confirm) {
try {
const ok = await deleteRole(item.id)
if (ok) {
uni.showToast({ title: '删除成功' })
loadData()
}
} catch (e: any) {
const errMsg = e?.message || '删除失败'
uni.showToast({ title: errMsg, icon: 'none', duration: 3000 })
}
}
}
})
}
async function onToggleStatus(item : AdminRole) {
const nextStatus = !item.is_active
const ok = await saveRole({ ...item, is_active: nextStatus })
if (ok != null) {
item.is_active = nextStatus
uni.showToast({ title: '状态已更新' })
}
}
function prevPage() { if (page.value > 1) { page.value--; loadData(); } }
function nextPage() { if (roleList.value.length >= pageSize) { page.value++; loadData(); } }
</script>
<style scoped lang="scss">
.admin-page-container { padding: 24px; background-color: #f5f7f9; min-height: 100vh; }
.page-card { background-color: #fff; border-radius: 4px; padding: 24px; }
.search-wrap { display: flex; flex-direction: row; align-items: center; padding-bottom: 24px; border-bottom: 1px solid #f0f0f0; margin-bottom: 24px; }
.search-item { display: flex; flex-direction: row; align-items: center; margin-right: 24px; }
.label { font-size: 14px; color: #606266; margin-right: 8px; }
.input { width: 200px; height: 32px; border: 1px solid #dcdfe6; border-radius: 4px; padding: 0 12px; font-size: 14px; }
.btn { height: 32px; padding: 0 20px; border-radius: 4px; border: none; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.btn-primary { background-color: #1890ff; color: #fff; font-size: 14px; }
.action-wrap { margin-bottom: 20px; }
.table-wrap { border: 1px solid #f0f0f0; border-radius: 4px; }
.table-header { display: flex; flex-direction: row; background-color: #f8f8f9; }
.th { padding: 12px 10px; font-size: 14px; font-weight: bold; color: #515a6e; border-bottom: 1px solid #f0f0f0; text-align: center; }
.tr { display: flex; flex-direction: row; border-bottom: 1px solid #f0f0f0; min-height: 54px; align-items: center; }
.td { padding: 10px; display: flex; align-items: center; justify-content: center; }
.td-txt { font-size: 13px; color: #606266; }
.action-btn { color: #1890ff; font-size: 13px; cursor: pointer; }
.danger { color: #ff4d4f; }
.divider { width: 1px; height: 12px; background-color: #e8e8e8; margin: 0 8px; }
.no-data { padding: 60px 0; text-align: center; }
.no-data-text { font-size: 14px; color: #c5c8ce; }
.loading-box { padding: 60px 0; text-align: center; color: #1890ff; }
.pagination-footer { margin-top: 24px; display: flex; flex-direction: row; align-items: center; justify-content: flex-end; gap: 12px; }
.total-txt { font-size: 13px; color: #999; }
.page-btns { display: flex; flex-direction: row; gap: 8px; }
.p-btn { width: 30px; height: 30px; border: 1px solid #dcdee2; display: flex; align-items: center; justify-content: center; border-radius: 4px; cursor: pointer; font-size: 13px; }
.p-btn.active { background-color: #1890ff; color: #fff; border-color: #1890ff; }
.p-btn.disabled { opacity: 0.5; cursor: not-allowed; }
/* 弹窗样式 */
.modal-overlay { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background-color: rgba(0,0,0,0.5); z-index: 1000; display: flex; align-items: center; justify-content: center; }
.modal-card { width: 500px; background-color: #fff; border-radius: 8px; overflow: hidden; }
.modal-header { padding: 16px 20px; border-bottom: 1px solid #f0f0f0; display: flex; flex-direction: row; justify-content: space-between; align-items: center; }
.modal-title { font-size: 16px; font-weight: bold; color: #333; }
.close-btn { font-size: 24px; color: #999; cursor: pointer; }
.modal-body { padding: 24px; }
.form-item { margin-bottom: 20px; display: flex; flex-direction: row; align-items: flex-start; }
.f-label { width: 90px; font-size: 14px; color: #666; text-align: right; padding-top: 6px; }
.f-input { flex: 1; border: 1px solid #dcdfe6; height: 36px; padding: 0 12px; border-radius: 4px; font-size: 14px; }
.f-textarea { flex: 1; border: 1px solid #dcdfe6; height: 80px; padding: 8px 12px; border-radius: 4px; font-size: 14px; }
.modal-footer { padding: 16px 24px; border-top: 1px solid #f0f0f0; display: flex; flex-direction: row; justify-content: flex-end; gap: 12px; }
</style>

View File

@@ -0,0 +1,233 @@
<template>
<view class="admin-page-container">
<view class="page-card">
<view class="action-wrap">
<button class="btn btn-primary" @click="onAdd">添加配送员</button>
</view>
<!-- 表格区域 -->
<view class="table-wrap">
<view class="table-header">
<view class="th" style="flex: 1;">ID</view>
<view class="th" style="flex: 1.5;">头像</view>
<view class="th" style="flex: 2;">名称</view>
<view class="th" style="flex: 2.5;">手机号码</view>
<view class="th" style="flex: 1.5;">是否显示</view>
<view class="th" style="flex: 3;">添加时间</view>
<view class="th" style="flex: 2;">操作</view>
</view>
<view class="table-body">
<view v-for="item in pagedList" :key="item.id" class="tr">
<view class="td" style="flex: 1;">{{ item.id }}</view>
<view class="td" style="flex: 1.5;">
<image class="avatar" :src="item.avatar" mode="aspectFill" />
</view>
<view class="td" style="flex: 2;">{{ item.name }}</view>
<view class="td" style="flex: 2.5;">{{ item.phone }}</view>
<view class="td" style="flex: 1.5;">
<switch :checked="item.isshow" color="#1890ff" @change="onToggleShow(item)" />
</view>
<view class="td" style="flex: 3;">{{ item.addTime }}</view>
<view class="td" style="flex: 2;">
<text class="action-btn" @click="onEdit(item)">编辑</text>
<text class="action-btn-del" @click="onDel(item)">删除</text>
</view>
</view>
</view>
</view>
<CommonPagination
v-if="total > 0"
:total="total"
:loading="false"
:currentPage="currentPage"
:pageSize="pageSize"
:pageSizeOptionLabels="pageSizeOptionLabels"
:pageSizeIndex="pageSizeIndex"
:visiblePages="visiblePages"
:totalPage="totalPage"
:jumpPageInput="jumpPageInput"
@page-size-change="handlePageSizeChange"
@page-change="handlePageChange"
@update:jumpPageInput="(val: string) => { jumpPageInput.value = val }"
@jump-page="handleJumpPage"
/>
</view>
</view>
</template>
<script setup lang="uts">
import { ref, computed } from 'vue'
import CommonPagination from '@/components/CommonPagination/CommonPagination.uvue'
type CourierItem = {
id: number
avatar: string
name: string
phone: string
isshow: boolean
addTime: string
}
// ========== MOCK DATA START ==========
// TODO: 接真实接口时替换此处 courierList 为 fetchCourierList() 调用
const courierList = ref<CourierItem[]>([
{ id: 120, avatar: '/static/logo.png', name: '王明', phone: '13812345678', isshow: true, addTime: '2025-06-29 21:45:19' },
{ id: 119, avatar: '/static/logo.png', name: '李红', phone: '13987654321', isshow: true, addTime: '2025-06-28 18:40:26' },
{ id: 118, avatar: '/static/logo.png', name: '张伟', phone: '15800001111', isshow: true, addTime: '2025-06-27 09:00:00' },
{ id: 117, avatar: '/static/logo.png', name: '刘洋', phone: '15900002222', isshow: false, addTime: '2025-06-26 15:14:40' },
{ id: 116, avatar: '/static/logo.png', name: '陈娟', phone: '13600003333', isshow: true, addTime: '2025-06-25 10:00:00' },
{ id: 115, avatar: '/static/logo.png', name: '杨帆', phone: '13700004444', isshow: true, addTime: '2025-06-24 08:30:00' },
{ id: 114, avatar: '/static/logo.png', name: '赵雷', phone: '18900005555', isshow: false, addTime: '2025-06-23 11:20:00' },
{ id: 113, avatar: '/static/logo.png', name: '周芳', phone: '13500006666', isshow: true, addTime: '2025-06-22 14:50:00' },
{ id: 112, avatar: '/static/logo.png', name: '吴勇', phone: '15600007777', isshow: true, addTime: '2025-06-21 16:10:00' },
{ id: 111, avatar: '/static/logo.png', name: '郑山', phone: '18700008888', isshow: true, addTime: '2025-06-20 09:40:00' },
{ id: 110, avatar: '/static/logo.png', name: '孙海', phone: '13900009999', isshow: false, addTime: '2025-06-19 13:00:00' },
{ id: 109, avatar: '/static/logo.png', name: '马琳', phone: '15300010101', isshow: true, addTime: '2025-06-18 07:50:00' },
{ id: 108, avatar: '/static/logo.png', name: '胡兴', phone: '18600011111', isshow: true, addTime: '2025-06-17 12:00:00' },
{ id: 107, avatar: '/static/logo.png', name: '高雪', phone: '13200012222', isshow: true, addTime: '2025-06-16 15:30:00' },
{ id: 106, avatar: '/static/logo.png', name: 'cheshi', phone: '18943652356', isshow: true, addTime: '2025-06-15 21:45:19' },
{ id: 105, avatar: '/static/logo.png', name: 'dl', phone: '15648569914', isshow: true, addTime: '2025-06-14 18:40:26' },
{ id: 104, avatar: '/static/logo.png', name: '小牛马', phone: '13548652258', isshow: true, addTime: '2025-06-13 15:14:40' },
{ id: 103, avatar: '/static/logo.png', name: '小李', phone: '13200013333', isshow: false, addTime: '2025-06-12 10:00:00' },
{ id: 102, avatar: '/static/logo.png', name: '小刘', phone: '15000014444', isshow: true, addTime: '2025-06-11 09:00:00' },
{ id: 101, avatar: '/static/logo.png', name: '小王', phone: '13300015555', isshow: true, addTime: '2025-06-10 08:00:00' }
])
// ========== MOCK DATA END ==========
// ========== PAGINATION STATE ==========
const currentPage = ref(1)
const pageSize = ref(15)
const jumpPageInput = ref('')
const pageSizeOptions = [10, 15, 20, 30, 50]
const pageSizeOptionLabels = computed(() => pageSizeOptions.map((n: number) => `${n}条/页`))
const pageSizeIndex = computed(() => { const idx = pageSizeOptions.indexOf(pageSize.value); return idx >= 0 ? idx : 0 })
const total = computed(() => courierList.value.length)
const totalPage = computed(() => Math.max(1, Math.ceil(total.value / pageSize.value)))
const pagedList = computed(() => {
const start = (currentPage.value - 1) * pageSize.value
return courierList.value.slice(start, start + pageSize.value)
})
const visiblePages = computed((): number[] => {
const t = totalPage.value; const cur = currentPage.value
if (t <= 7) return Array.from({ length: t }, (_: any, i: number) => i + 1)
if (cur <= 4) return [1, 2, 3, 4, 5, -1, t]
if (cur >= t - 3) return [1, -1, t - 4, t - 3, t - 2, t - 1, t]
return [1, -1, cur - 1, cur, cur + 1, -1, t]
})
const handlePageChange = (p: number) => { currentPage.value = p }
const handlePageSizeChange = (e: any) => {
const idx = Number(e.detail.value)
pageSize.value = pageSizeOptions[idx] ?? pageSizeOptions[0]
currentPage.value = 1
}
const handleJumpPage = () => {
const p = parseInt(jumpPageInput.value)
if (!isNaN(p) && p >= 1 && p <= totalPage.value) currentPage.value = p
}
// ========== END PAGINATION STATE ==========
function onAdd() {
console.log('Add courier')
}
function onToggleShow(item: CourierItem) {
item.isshow = !item.isshow
}
function onEdit(item: CourierItem) {
console.log('Edit:', item.name)
}
function onDel(item: CourierItem) {
console.log('Delete:', item.id)
}
</script>
<style scoped>
.admin-page-container {
/* 使用 Layout 的背景和内边距 */
padding: 0;
background-color: transparent;
min-height: auto;
}
.page-card {
background-color: #fff;
border-radius: 4px;
padding: 20px;
}
.action-wrap {
margin-bottom: 20px;
}
.btn {
height: 32px;
line-height: 30px;
padding: 0 15px;
font-size: 14px;
border-radius: 4px;
border: none;
}
.btn-primary {
background-color: #1890ff;
color: #fff;
}
.table-wrap {
width: 100%;
border: 1px solid #f0f0f0;
}
.table-header {
display: flex;
flex-direction: row;
background-color: #f8f8f9;
}
.th {
padding: 12px 10px;
font-size: 14px;
font-weight: bold;
color: #515a6e;
border-bottom: 1px solid #f0f0f0;
text-align: center;
}
.tr {
display: flex;
flex-direction: row;
border-bottom: 1px solid #f0f0f0;
}
.td {
padding: 12px 10px;
font-size: 14px;
color: #515a6e;
text-align: center;
display: flex;
flex-direction: row;
align-items: center;
justify-content: center;
}
.avatar {
width: 40px;
height: 40px;
border-radius: 4px;
}
.action-btn {
color: #1890ff;
font-size: 13px;
margin-right: 10px;
cursor: pointer;
}
.action-btn-del {
color: #ed4014;
font-size: 13px;
cursor: pointer;
}
</style>

View File

@@ -0,0 +1,302 @@
<template>
<view class="admin-page-container">
<view class="page-card">
<!-- 搜索栏 -->
<view class="search-wrap">
<view class="search-item">
<text class="label">提货点搜索:</text>
<input class="input" placeholder="请输入提货点名称,电话" v-model="searchKey" />
</view>
<button class="btn btn-primary" @click="onSearch">查询</button>
</view>
<!-- 状态 Tabs -->
<view class="tabs-wrap">
<view class="tab-item active"><text class="tab-text">显示中的提货点(2)</text></view>
<view class="tab-item"><text class="tab-text">隐藏中的提货点(0)</text></view>
<view class="tab-item"><text class="tab-text">回收站中的提货点(9)</text></view>
</view>
<view class="action-wrap">
<button class="btn btn-primary" @click="onAdd">添加提货点</button>
</view>
<!-- 表格区域 -->
<view class="table-wrap">
<view class="table-header">
<view class="th" style="flex: 1;">ID</view>
<view class="th" style="flex: 2;">提货点图片</view>
<view class="th" style="flex: 2;">提货点名称</view>
<view class="th" style="flex: 2;">提货点电话</view>
<view class="th" style="flex: 3;">地址</view>
<view class="th" style="flex: 3;">营业时间</view>
<view class="th" style="flex: 1.5;">是否显示</view>
<view class="th" style="flex: 2;">操作</view>
</view>
<view class="table-body">
<view v-for="item in pagedList" :key="item.id" class="tr">
<view class="td" style="flex: 1;">{{ item.id }}</view>
<view class="td" style="flex: 2;">
<image class="station-img" :src="item.image" mode="aspectFill" />
</view>
<view class="td" style="flex: 2;">{{ item.name }}</view>
<view class="td" style="flex: 2;">{{ item.phone }}</view>
<view class="td" style="flex: 3;">{{ item.address }}</view>
<view class="td" style="flex: 3;">{{ item.hours }}</view>
<view class="td" style="flex: 1.5;">
<switch :checked="item.isshow" color="#1890ff" />
</view>
<view class="td" style="flex: 2;">
<text class="action-btn" @click="onEdit(item)">编辑</text>
<text class="action-btn-del" @click="onDel(item)">删除</text>
</view>
</view>
</view>
</view>
<CommonPagination
v-if="total > 0"
:total="total"
:loading="false"
:currentPage="currentPage"
:pageSize="pageSize"
:pageSizeOptionLabels="pageSizeOptionLabels"
:pageSizeIndex="pageSizeIndex"
:visiblePages="visiblePages"
:totalPage="totalPage"
:jumpPageInput="jumpPageInput"
@page-size-change="handlePageSizeChange"
@page-change="handlePageChange"
@update:jumpPageInput="(val: string) => { jumpPageInput.value = val }"
@jump-page="handleJumpPage"
/>
</view>
</view>
</template>
<script setup lang="uts">
import { ref, computed } from 'vue'
import CommonPagination from '@/components/CommonPagination/CommonPagination.uvue'
const searchKey = ref('')
type StationItem = {
id: number
image: string
name: string
phone: string
address: string
hours: string
isshow: boolean
}
// ========== MOCK DATA START ==========
// TODO: 接真实接口时替换此处 stationList 为 fetchStationList() 调用
const stationList = ref<StationItem[]>([
{ id: 65, image: '/static/logo.png', name: '北京朝阳门提货点', phone: '13012340001', address: '北京市朝阳区建国路1号', hours: '09:00 - 21:00', isshow: true },
{ id: 64, image: '/static/logo.png', name: '北京海淨区提货点', phone: '13012340002', address: '北京市海淨区中关村大腃4号', hours: '08:30 - 20:30', isshow: true },
{ id: 63, image: '/static/logo.png', name: '上海浦东新区提货点', phone: '13012340003', address: '上海市浦东新区张江高科2号', hours: '09:00 - 22:00', isshow: true },
{ id: 62, image: '/static/logo.png', name: '上海徐汇提货点', phone: '13012340004', address: '上海市徐汇区淮海中路100号', hours: '10:00 - 21:00', isshow: false },
{ id: 61, image: '/static/logo.png', name: '广州天河提货点', phone: '13012340005', address: '广州市天河区天河北路55号', hours: '09:00 - 21:00', isshow: true },
{ id: 60, image: '/static/logo.png', name: '广州越秀提货点', phone: '13012340006', address: '广州市越秀区环市东路18号', hours: '08:00 - 20:00', isshow: true },
{ id: 59, image: '/static/logo.png', name: '深圳南山提货点', phone: '13012340007', address: '深圳市南山区松白路7号', hours: '09:00 - 22:00', isshow: true },
{ id: 58, image: '/static/logo.png', name: '深圳福田提货点', phone: '13012340008', address: '深圳市福田区深南大道青年公指1号', hours: '09:00 - 21:00', isshow: false },
{ id: 57, image: '/static/logo.png', name: '成都武侯提货点', phone: '13012340009', address: '成都市武侯区為最居东路3号', hours: '09:00 - 21:00', isshow: true },
{ id: 56, image: '/static/logo.png', name: '成都高新提货点', phone: '13012340010', address: '成都市高新区天府大道三段501号', hours: '08:30 - 20:30', isshow: true },
{ id: 55, image: '/static/logo.png', name: '杭州西湖提货点', phone: '13012340011', address: '杭州市西湖区建途路21号', hours: '09:00 - 22:00', isshow: true },
{ id: 54, image: '/static/logo.png', name: '杭州滨江提货点', phone: '13012340012', address: '杭州市拱墅区餓山镇中路', hours: '10:00 - 21:00', isshow: false },
{ id: 53, image: '/static/logo.png', name: '武汉江汉提货点', phone: '13012340013', address: '武汉市江汉区建设大道100号', hours: '09:00 - 20:00', isshow: true },
{ id: 52, image: '/static/logo.png', name: '武汉武昌提货点', phone: '13012340014', address: '武汉市武昌区紫菓路58号', hours: '08:30 - 21:00', isshow: true },
{ id: 51, image: '/static/logo.png', name: '南京中山提货点', phone: '13012340015', address: '南京市中山区阳山路123号', hours: '09:00 - 21:00', isshow: true },
{ id: 50, image: '/static/logo.png', name: '南京冿淮提货点', phone: '13012340016', address: '南京市冿淮区广州路9号', hours: '09:00 - 20:30', isshow: true },
{ id: 49, image: '/static/logo.png', name: '苏州工业园提货点', phone: '13012340017', address: '苏州工业园区现代大道168号', hours: '09:00 - 21:00', isshow: false },
{ id: 48, image: '/static/logo.png', name: '苏州姑苏提货点', phone: '13012340018', address: '苏州市姑苏区干将东路66号', hours: '07:30 - 22:00', isshow: true },
{ id: 47, image: '/static/logo.png', name: '提货点222', phone: '13769102384', address: '能看见你的困难', hours: '00:00:00 - 23:00:00', isshow: true },
{ id: 44, image: '/static/logo.png', name: '美东科技', phone: '15912341234', address: '襄阳火车站', hours: '08:00:00 - 22:00:00', isshow: true }
])
// ========== MOCK DATA END ==========
// ========== PAGINATION STATE ==========
const currentPage = ref(1)
const pageSize = ref(15)
const jumpPageInput = ref('')
const pageSizeOptions = [10, 15, 20, 30, 50]
const pageSizeOptionLabels = computed(() => pageSizeOptions.map((n: number) => `${n}条/页`))
const pageSizeIndex = computed(() => { const idx = pageSizeOptions.indexOf(pageSize.value); return idx >= 0 ? idx : 0 })
const total = computed(() => stationList.value.length)
const totalPage = computed(() => Math.max(1, Math.ceil(total.value / pageSize.value)))
const pagedList = computed(() => {
const start = (currentPage.value - 1) * pageSize.value
return stationList.value.slice(start, start + pageSize.value)
})
const visiblePages = computed((): number[] => {
const t = totalPage.value; const cur = currentPage.value
if (t <= 7) return Array.from({ length: t }, (_: any, i: number) => i + 1)
if (cur <= 4) return [1, 2, 3, 4, 5, -1, t]
if (cur >= t - 3) return [1, -1, t - 4, t - 3, t - 2, t - 1, t]
return [1, -1, cur - 1, cur, cur + 1, -1, t]
})
const handlePageChange = (p: number) => { currentPage.value = p }
const handlePageSizeChange = (e: any) => {
const idx = Number(e.detail.value)
pageSize.value = pageSizeOptions[idx] ?? pageSizeOptions[0]
currentPage.value = 1
}
const handleJumpPage = () => {
const p = parseInt(jumpPageInput.value)
if (!isNaN(p) && p >= 1 && p <= totalPage.value) currentPage.value = p
}
// ========== END PAGINATION STATE ==========
function onSearch() {
console.log('Search:', searchKey.value)
}
function onAdd() {
console.log('Add station')
}
function onEdit(item: StationItem) {
console.log('Edit:', item.name)
}
function onDel(item: StationItem) {
console.log('Delete:', item.id)
}
</script>
<style scoped>
.admin-page-container {
/* 使用 Layout 的背景和内边距 */
padding: 0;
background-color: transparent;
min-height: auto;
}
.page-card {
background-color: #fff;
border-radius: 4px;
padding: 20px;
}
.search-wrap {
display: flex;
flex-direction: row;
align-items: center;
padding-bottom: 20px;
border-bottom: 1px solid #f0f0f0;
margin-bottom: 20px;
}
.label {
font-size: 14px;
color: #606266;
}
.input {
width: 250px;
height: 32px;
padding: 0 10px;
border: 1px solid #dcdfe6;
border-radius: 4px;
font-size: 14px;
color: #606266;
margin-right: 15px;
}
.tabs-wrap {
display: flex;
flex-direction: row;
margin-bottom: 20px;
border-bottom: 1px solid #f0f2f5;
}
.tab-item {
padding: 10px 15px;
cursor: pointer;
}
.tab-item.active {
border-bottom: 2px solid #1890ff;
}
.tab-item.active .tab-text {
color: #1890ff;
}
.tab-text {
font-size: 14px;
color: #515a6e;
}
.action-wrap {
margin-bottom: 20px;
}
.btn {
height: 32px;
line-height: 30px;
padding: 0 15px;
font-size: 14px;
border-radius: 4px;
border: none;
}
.btn-primary {
background-color: #1890ff;
color: #fff;
}
.table-wrap {
width: 100%;
border: 1px solid #f0f0f0;
}
.table-header {
display: flex;
flex-direction: row;
background-color: #f8f8f9;
}
.th {
padding: 12px 10px;
font-size: 14px;
font-weight: bold;
color: #515a6e;
border-bottom: 1px solid #f0f0f0;
text-align: center;
}
.tr {
display: flex;
flex-direction: row;
border-bottom: 1px solid #f0f0f0;
}
.td {
padding: 12px 10px;
font-size: 14px;
color: #515a6e;
text-align: center;
display: flex;
flex-direction: row;
align-items: center;
justify-content: center;
}
.station-img {
width: 40px;
height: 40px;
border-radius: 4px;
}
.action-btn {
color: #1890ff;
font-size: 13px;
margin-right: 10px;
}
.action-btn-del {
color: #ed4014;
font-size: 13px;
}
</style>

View File

@@ -204,9 +204,10 @@ function getCalcMethodName(method: string): string {
<style scoped>
.admin-page-container {
padding: 15px;
background-color: #f5f7f9;
min-height: 100vh;
/* 使用 Layout 的背景和内边距 */
padding: 0;
background-color: transparent;
min-height: auto;
}
.page-card {
@@ -290,6 +291,7 @@ function getCalcMethodName(method: string): string {
color: #515a6e;
text-align: center;
display: flex;
flex-direction: row;
align-items: center;
justify-content: center;
}

View File

@@ -0,0 +1,280 @@
<template>
<view class="admin-page-container">
<view class="page-card">
<!-- 搜索栏 -->
<view class="search-wrap">
<view class="search-item">
<text class="label">提货点名称:</text>
<picker mode="selector" :range="stationRange" @change="onStationChange">
<view class="picker-input">{{ stationText }}</view>
</picker>
</view>
<button class="btn btn-primary" @click="onSearch">查询</button>
</view>
<view class="action-wrap">
<button class="btn btn-primary" @click="onAdd">添加核销员</button>
</view>
<!-- 表格区域 -->
<view class="table-wrap">
<view class="table-header">
<view class="th" style="flex: 1;">ID</view>
<view class="th" style="flex: 1.5;">头像</view>
<view class="th" style="flex: 2;">微信名称</view>
<view class="th" style="flex: 2;">核销员名称</view>
<view class="th" style="flex: 2;">所属提货点</view>
<view class="th" style="flex: 3;">添加时间</view>
<view class="th" style="flex: 1.5;">状态</view>
<view class="th" style="flex: 2;">操作</view>
</view>
<view class="table-body">
<view v-for="item in pagedList" :key="item.id" class="tr">
<view class="td" style="flex: 1;">{{ item.id }}</view>
<view class="td" style="flex: 1.5;">
<image class="avatar" :src="item.avatar" mode="aspectFill" />
</view>
<view class="td" style="flex: 2;">{{ item.wechatName }}</view>
<view class="td" style="flex: 2;">{{ item.name }}</view>
<view class="td" style="flex: 2;">{{ item.station }}</view>
<view class="td" style="flex: 3;">{{ item.addTime }}</view>
<view class="td" style="flex: 1.5;">
<switch :checked="item.status" color="#1890ff" />
</view>
<view class="td" style="flex: 2;">
<text class="action-btn" @click="onEdit(item)">编辑</text>
<text class="action-btn-del" @click="onDel(item)">删除</text>
</view>
</view>
</view>
</view>
<CommonPagination
v-if="total > 0"
:total="total"
:loading="false"
:currentPage="currentPage"
:pageSize="pageSize"
:pageSizeOptionLabels="pageSizeOptionLabels"
:pageSizeIndex="pageSizeIndex"
:visiblePages="visiblePages"
:totalPage="totalPage"
:jumpPageInput="jumpPageInput"
@page-size-change="handlePageSizeChange"
@page-change="handlePageChange"
@update:jumpPageInput="(val: string) => { jumpPageInput.value = val }"
@jump-page="handleJumpPage"
/>
</view>
</view>
</template>
<script setup lang="uts">
import { ref, computed } from 'vue'
import CommonPagination from '@/components/CommonPagination/CommonPagination.uvue'
const stationRange = ['所有', '提货点222', '美东科技']
const stationText = ref('请选择')
type VerifierItem = {
id: number
avatar: string
wechatName: string
name: string
station: string
addTime: string
status: boolean
}
// ========== MOCK DATA START ==========
// TODO: 接真实接口时替换此处 verifierList 为 fetchVerifierList() 调用
const verifierList = ref<VerifierItem[]>([
{ id: 113, avatar: '/static/logo.png', wechatName: '林小星', name: '13800000001', station: '提货点222', addTime: '2025-11-01 09:00:00', status: true },
{ id: 112, avatar: '/static/logo.png', wechatName: '吴明', name: '13800000002', station: '美东科技', addTime: '2025-10-30 10:20:00', status: true },
{ id: 111, avatar: '/static/logo.png', wechatName: '赵姐', name: '13800000003', station: '提货点222', addTime: '2025-10-29 11:40:00', status: false },
{ id: 110, avatar: '/static/logo.png', wechatName: '高先', name: '13800000004', station: '美东科技', addTime: '2025-10-28 08:30:00', status: true },
{ id: 109, avatar: '/static/logo.png', wechatName: '孙明', name: '13800000005', station: '提货点222', addTime: '2025-10-27 14:00:00', status: true },
{ id: 108, avatar: '/static/logo.png', wechatName: '周波', name: '13800000006', station: '美东科技', addTime: '2025-10-26 16:10:00', status: true },
{ id: 107, avatar: '/static/logo.png', wechatName: '郑军', name: '13800000007', station: '提货点222', addTime: '2025-10-25 09:50:00', status: false },
{ id: 106, avatar: '/static/logo.png', wechatName: '谢婷', name: '13800000008', station: '美东科技', addTime: '2025-10-24 13:20:00', status: true },
{ id: 105, avatar: '/static/logo.png', wechatName: '谢军', name: '13800000009', station: '提货点222', addTime: '2025-10-23 11:00:00', status: true },
{ id: 104, avatar: '/static/logo.png', wechatName: '马芳', name: '13800000010', station: '美东科技', addTime: '2025-10-22 12:30:00', status: true },
{ id: 103, avatar: '/static/logo.png', wechatName: '李迪', name: '13800000011', station: '提货点222', addTime: '2025-10-21 10:00:00', status: false },
{ id: 102, avatar: '/static/logo.png', wechatName: '张玉', name: '13800000012', station: '美东科技', addTime: '2025-10-20 15:40:00', status: true },
{ id: 101, avatar: '/static/logo.png', wechatName: '王海', name: '13800000013', station: '提货点222', addTime: '2025-10-19 08:20:00', status: true },
{ id: 100, avatar: '/static/logo.png', wechatName: '刘云', name: '13800000014', station: '美东科技', addTime: '2025-10-18 09:10:00', status: true },
{ id: 99, avatar: '/static/logo.png', wechatName: '陈山', name: '13800000015', station: '提货点222', addTime: '2025-10-17 11:30:00', status: false },
{ id: 98, avatar: '/static/logo.png', wechatName: '吴州', name: '13800000016', station: '美东科技', addTime: '2025-10-16 14:50:00', status: true },
{ id: 97, avatar: '/static/logo.png', wechatName: '魏桂', name: '13800000017', station: '提货点222', addTime: '2025-10-15 10:20:00', status: true },
{ id: 96, avatar: '/static/logo.png', wechatName: '彭冬', name: '13800000018', station: '美东科技', addTime: '2025-10-14 16:00:00', status: true },
{ id: 95, avatar: '/static/logo.png', wechatName: '夏迪', name: '13800000019', station: '提货点222', addTime: '2025-10-23 10:45:07', status: true },
{ id: 94, avatar: '/static/logo.png', wechatName: '地球人', name: '15920014197', station: '美东科技', addTime: '2025-10-22 10:33:07', status: true }
])
// ========== MOCK DATA END ==========
// ========== PAGINATION STATE ==========
const currentPage = ref(1)
const pageSize = ref(15)
const jumpPageInput = ref('')
const pageSizeOptions = [10, 15, 20, 30, 50]
const pageSizeOptionLabels = computed(() => pageSizeOptions.map((n: number) => `${n}条/页`))
const pageSizeIndex = computed(() => { const idx = pageSizeOptions.indexOf(pageSize.value); return idx >= 0 ? idx : 0 })
const total = computed(() => verifierList.value.length)
const totalPage = computed(() => Math.max(1, Math.ceil(total.value / pageSize.value)))
const pagedList = computed(() => {
const start = (currentPage.value - 1) * pageSize.value
return verifierList.value.slice(start, start + pageSize.value)
})
const visiblePages = computed((): number[] => {
const t = totalPage.value; const cur = currentPage.value
if (t <= 7) return Array.from({ length: t }, (_: any, i: number) => i + 1)
if (cur <= 4) return [1, 2, 3, 4, 5, -1, t]
if (cur >= t - 3) return [1, -1, t - 4, t - 3, t - 2, t - 1, t]
return [1, -1, cur - 1, cur, cur + 1, -1, t]
})
const handlePageChange = (p: number) => { currentPage.value = p }
const handlePageSizeChange = (e: any) => {
const idx = Number(e.detail.value)
pageSize.value = pageSizeOptions[idx] ?? pageSizeOptions[0]
currentPage.value = 1
}
const handleJumpPage = () => {
const p = parseInt(jumpPageInput.value)
if (!isNaN(p) && p >= 1 && p <= totalPage.value) currentPage.value = p
}
// ========== END PAGINATION STATE ==========
function onStationChange(e: any) {
const index = parseInt(e.detail.value.toString())
stationText.value = stationRange[index]
}
function onSearch() {
console.log('Search:', stationText.value)
}
function onAdd() {
console.log('Add verifier')
}
function onEdit(item: VerifierItem) {
console.log('Edit:', item.name)
}
function onDel(item: VerifierItem) {
console.log('Delete:', item.id)
}
</script>
<style scoped>
.admin-page-container {
/* 使用 Layout 的背景和内边距 */
padding: 0;
background-color: transparent;
min-height: auto;
}
.page-card {
background-color: #fff;
border-radius: 4px;
padding: 20px;
}
.search-wrap {
display: flex;
flex-direction: row;
align-items: center;
padding-bottom: 20px;
border-bottom: 1px solid #f0f0f0;
margin-bottom: 20px;
}
.label {
font-size: 14px;
color: #606266;
}
.picker-input {
width: 200px;
height: 32px;
line-height: 32px;
padding: 0 10px;
border: 1px solid #dcdfe6;
border-radius: 4px;
font-size: 14px;
color: #606266;
background-color: #fff;
margin-right: 15px;
}
.action-wrap {
margin-bottom: 20px;
}
.btn {
height: 32px;
line-height: 30px;
padding: 0 15px;
font-size: 14px;
border-radius: 4px;
border: none;
}
.btn-primary {
background-color: #1890ff;
color: #fff;
}
.table-wrap {
width: 100%;
border: 1px solid #f0f0f0;
}
.table-header {
display: flex;
flex-direction: row;
background-color: #f8f8f9;
}
.th {
padding: 12px 10px;
font-size: 14px;
font-weight: bold;
color: #515a6e;
border-bottom: 1px solid #f0f0f0;
text-align: center;
}
.tr {
display: flex;
flex-direction: row;
border-bottom: 1px solid #f0f0f0;
}
.td {
padding: 12px 10px;
font-size: 14px;
color: #515a6e;
text-align: center;
display: flex;
flex-direction: row;
align-items: center;
justify-content: center;
}
.avatar {
width: 36px;
height: 36px;
border-radius: 4px;
}
.action-btn {
color: #1890ff;
font-size: 13px;
margin-right: 10px;
}
.action-btn-del {
color: #ed4014;
font-size: 13px;
}
</style>

View File

@@ -1,207 +0,0 @@
<template>
<view class="admin-page-container">
<view class="page-card">
<!-- 搜索栏 -->
<view class="search-wrap">
<view class="search-item">
<text class="label">提货点名称:</text>
<picker mode="selector" :range="stationRange" @change="onStationChange">
<view class="picker-input">{{ stationText }}</view>
</picker>
</view>
<button class="btn btn-primary" @click="onSearch">查询</button>
</view>
<view class="action-wrap">
<button class="btn btn-primary" @click="onAdd">添加核销员</button>
</view>
<!-- 表格区域 -->
<view class="table-wrap">
<view class="table-header">
<view class="th" style="flex: 1;">ID</view>
<view class="th" style="flex: 1.5;">头像</view>
<view class="th" style="flex: 2;">微信名称</view>
<view class="th" style="flex: 2;">核销员名称</view>
<view class="th" style="flex: 2;">所属提货点</view>
<view class="th" style="flex: 3;">添加时间</view>
<view class="th" style="flex: 1.5;">状态</view>
<view class="th" style="flex: 2;">操作</view>
</view>
<view class="table-body">
<view v-for="item in verifierList" :key="item.id" class="tr">
<view class="td" style="flex: 1;">{{ item.id }}</view>
<view class="td" style="flex: 1.5;">
<image class="avatar" :src="item.avatar" mode="aspectFill" />
</view>
<view class="td" style="flex: 2;">{{ item.wechatName }}</view>
<view class="td" style="flex: 2;">{{ item.name }}</view>
<view class="td" style="flex: 2;">{{ item.station }}</view>
<view class="td" style="flex: 3;">{{ item.addTime }}</view>
<view class="td" style="flex: 1.5;">
<switch :checked="item.status" color="#1890ff" />
</view>
<view class="td" style="flex: 2;">
<text class="action-btn" @click="onEdit(item)">编辑</text>
<text class="action-btn-del" @click="onDel(item)">删除</text>
</view>
</view>
</view>
</view>
</view>
</view>
</template>
<script setup lang="uts">
import { ref, reactive } from 'vue'
const stationRange = ['所有', '提货点222', '美东科技']
const stationText = ref('请选择')
type VerifierItem = {
id: number
avatar: string
wechatName: string
name: string
station: string
addTime: string
status: boolean
}
const verifierList = reactive<VerifierItem[]>([
{ id: 94, avatar: '/static/logo.png', wechatName: '地球人', name: '15920014197', station: '美东科技', addTime: '2025-10-22 10:33:07', status: true }
])
function onStationChange(e: any) {
const index = parseInt(e.detail.value.toString())
stationText.value = stationRange[index]
}
function onSearch() {
console.log('Search:', stationText.value)
}
function onAdd() {
console.log('Add verifier')
}
function onEdit(item: VerifierItem) {
console.log('Edit:', item.name)
}
function onDel(item: VerifierItem) {
console.log('Delete:', item.id)
}
</script>
<style scoped>
.admin-page-container {
padding: 15px;
background-color: #f5f7f9;
min-height: 100vh;
}
.page-card {
background-color: #fff;
border-radius: 4px;
padding: 20px;
}
.search-wrap {
display: flex;
flex-direction: row;
align-items: center;
padding-bottom: 20px;
border-bottom: 1px solid #f0f0f0;
margin-bottom: 20px;
}
.label {
font-size: 14px;
color: #606266;
}
.picker-input {
width: 200px;
height: 32px;
line-height: 32px;
padding: 0 10px;
border: 1px solid #dcdfe6;
border-radius: 4px;
font-size: 14px;
color: #606266;
background-color: #fff;
margin-right: 15px;
}
.action-wrap {
margin-bottom: 20px;
}
.btn {
height: 32px;
line-height: 30px;
padding: 0 15px;
font-size: 14px;
border-radius: 4px;
border: none;
}
.btn-primary {
background-color: #1890ff;
color: #fff;
}
.table-wrap {
width: 100%;
border: 1px solid #f0f0f0;
}
.table-header {
display: flex;
flex-direction: row;
background-color: #f8f8f9;
}
.th {
padding: 12px 10px;
font-size: 14px;
font-weight: bold;
color: #515a6e;
border-bottom: 1px solid #f0f0f0;
text-align: center;
}
.tr {
display: flex;
flex-direction: row;
border-bottom: 1px solid #f0f0f0;
}
.td {
padding: 12px 10px;
font-size: 14px;
color: #515a6e;
text-align: center;
display: flex;
align-items: center;
justify-content: center;
}
.avatar {
width: 36px;
height: 36px;
border-radius: 4px;
}
.action-btn {
color: #1890ff;
font-size: 13px;
margin-right: 10px;
}
.action-btn-del {
color: #ed4014;
font-size: 13px;
}
</style>

View File

@@ -1,4 +1,4 @@
<template>
<template>
<view class="admin-page-container">
<view class="page-header">
<view class="breadcrumb">
@@ -90,9 +90,10 @@ const handleSave = () => {
<style scoped>
.admin-page-container {
min-height: 100vh;
background-color: #f5f7f9;
padding: 20px;
/* 使用 Layout 的背景和内边距 */
padding: 0;
background-color: transparent;
min-height: auto;
}
.breadcrumb {
display: flex;

View File

@@ -118,9 +118,10 @@ const handleSave = () => {
<style scoped>
.admin-page-container {
min-height: 100vh;
background-color: #f5f7f9;
padding: 20px;
/* 使用 Layout 的背景和内边距 */
padding: 0;
background-color: transparent;
min-height: auto;
}
.breadcrumb {
display: flex;

View File

@@ -84,9 +84,10 @@ const handleSave = () => {
<style scoped>
.admin-page-container {
min-height: 100vh;
background-color: #f5f7f9;
padding: 20px;
/* 使用 Layout 的背景和内边距 */
padding: 0;
background-color: transparent;
min-height: auto;
}
.breadcrumb {
display: flex;

View File

@@ -1,4 +1,4 @@
<template>
<template>
<view class="admin-page-container">
<view class="page-header">
<view class="breadcrumb">
@@ -62,7 +62,12 @@ const handleSubmit = () => { uni.showToast({ title: '提交成功' }) }
const navigateTo = (url : string) => { uni.navigateTo({ url }) }
</script>
<style scoped>
.admin-page-container { min-height: 100vh; background-color: #f5f7f9; padding: 20px; }
.admin-page-container {
/* 使用 Layout 的背景和内边距 */
padding: 0;
background-color: transparent;
min-height: auto;
}
.breadcrumb { display: flex; flex-direction: row; align-items: center; margin-bottom: 20px; }
.bc-item { font-size: 14px; color: #999; }
.bc-item.active { color: #333; }

View File

@@ -1,4 +1,4 @@
<template>
<template>
<view class="admin-page-container">
<view class="login-wrapper">
<view class="login-card">
@@ -104,7 +104,14 @@ const handleLogin = () => {
}
</script>
<style scoped>
.admin-page-container { display: flex; flex-direction: column; justify-content: center; align-items: center; min-height: 100vh; background-color: #f5f7f9; padding: 40px 20px; }
.admin-page-container {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
min-height: 100vh;
/* 使用 Layout 的背景和内边距 */
}
.login-wrapper { position: relative; display: flex; flex-direction: row; margin-bottom: 60px; }
.login-card { display: flex; flex-direction: row; width: 800px; height: 480px; background-color: #fff; border-radius: 8px; overflow: hidden; box-shadow: 0 4px 24px rgba(0,0,0,0.1); }
.login-aside { width: 320px; background: linear-gradient(135deg, #3a7bd5 0%, #00d2ff 100%); padding: 40px; color: #fff; }

View File

@@ -117,7 +117,12 @@ const handleSave = () => { uni.showToast({ title: '提交成功' }) }
</script>
<style scoped>
.admin-page-container { min-height: 100vh; background-color: #f5f7f9; padding: 20px; }
.admin-page-container {
/* 使用 Layout 的背景和内边距 */
padding: 0;
background-color: transparent;
min-height: auto;
}
.breadcrumb { display: flex; flex-direction: row; margin-bottom: 20px; }
.bc-item { font-size: 14px; color: #999; }
.bc-item.active { color: #333; }

View File

@@ -155,9 +155,10 @@ const handleSave = () => {
<style scoped>
.admin-page-container {
min-height: 100vh;
background-color: #f5f7f9;
padding: 20px;
/* 使用 Layout 的背景和内边距 */
padding: 0;
background-color: transparent;
min-height: auto;
}
.breadcrumb {
display: flex;

View File

@@ -1,186 +0,0 @@
<template>
<view class="admin-page">
<view class="page-header">
<view class="breadcrumb">
<text class="bc-item">设置</text>
<text class="bc-sep">/</text>
<text class="bc-item">接口配置</text>
<text class="bc-sep">/</text>
<text class="bc-item active">系统存储配置</text>
</view>
</view>
<view class="content-card">
<view class="tabs-header">
<scroll-view class="tabs-scroll" scroll-x="true" show-scrollbar="false">
<view class="tabs-list">
<view
v-for="(item, index) in tabs"
:key="index"
class="tab-item"
:class="{ active: activeTab === index }"
@click="activeTab = index"
>
<text class="tab-text">{{ item }}</text>
</view>
</view>
</scroll-view>
</view>
<view class="tab-body">
<view v-if="isLoading" class="loading-state">
<text>配置加载中...</text>
</view>
<!-- Tab 0: 储存配置 -->
<view v-else-if="activeTab === 0" class="config-view">
<view class="notice-box">
<view class="notice-content">
<text class="notice-line">上传图片时会生成缩略图</text>
<text class="notice-line">未设置按照系统默认生成系统默认大图800*800中图300*300小图150*150</text>
<text class="notice-line">水印只在上传图片时生成,原图,大中小缩略图都会按照比例存在。</text>
</view>
</view>
<view class="form-body">
<view class="form-row">
<text class="form-label">存储方式:</text>
<view class="form-control">
<radio-group class="storage-radio-group" @change="onStorageTypeChange">
<label class="radio-label" v-for="st in storageOptions" :key="st.value">
<radio :value="st.value" :checked="form.storageType === st.value" color="#2d8cf0" style="transform:scale(0.8)" />
<text class="radio-text">{{ st.label }}</text>
</label>
</radio-group>
</view>
</view>
<view class="form-row mt-30">
<text class="form-label">是否开启缩略图:</text>
<view class="form-control">
<switch :checked="form.enableThumb" @change="onToggleThumb" color="#2d8cf0" style="transform:scale(0.8)" />
</view>
</view>
<view class="form-row mt-30">
<text class="form-label">是否开启水印:</text>
<view class="form-control">
<switch :checked="form.enableWatermark" @change="onToggleWatermark" color="#2d8cf0" style="transform:scale(0.8)" />
</view>
</view>
<view class="form-footer mt-40">
<button class="save-btn" type="primary" :disabled="isSaving" @click="handleSave">
{{ isSaving ? '保存中...' : '保存' }}
</button>
</view>
</view>
</view>
<!-- 其他云存储 Tab 逻辑保持现有结构,数据由 backend 动态驱动 -->
<view v-else class="cloud-view">
<view class="empty-state">
<text class="empty-text">{{ tabs[activeTab] }} 详细配置请在“修改配置信息”中设置</text>
</view>
</view>
</view>
</view>
</view>
</template>
<script setup lang="uts">
import { ref, reactive, onMounted } from 'vue'
import { getSystemConfig, saveSystemConfig } from "@/services/admin/systemConfigService.uts"
const tabs = ['储存配置', '七牛云储存', '阿里云储存', '腾讯云储存', '京东云储存', '华为云储存', '天翼云储存']
const activeTab = ref(0)
const isLoading = ref(false)
const isSaving = ref(false)
const storageOptions = [
{ label: '本地存储', value: 'local' },
{ label: '七牛云存储', value: 'qiniu' },
{ label: '阿里云存储', value: 'aliyun' },
{ label: '腾讯云存储', value: 'tencent' },
{ label: '京东云存储', value: 'jd' },
{ label: '华为云存储', value: 'huawei' },
{ label: '天翼云存储', value: 'tianyi' }
]
const form = reactive({
storageType: 'local',
enableThumb: false,
enableWatermark: false
})
onMounted(() => {
loadConfig()
})
async function loadConfig() {
isLoading.value = true
try {
const res = await getSystemConfig('storage_config')
if (res != null) {
Object.assign(form, res as any)
}
} finally {
isLoading.value = false
}
}
const onStorageTypeChange = (e : any) => {
form.storageType = e.detail.value as string
}
const onToggleThumb = (e : any) => {
form.enableThumb = e.detail.value as boolean
}
const onToggleWatermark = (e : any) => {
form.enableWatermark = e.detail.value as boolean
}
const handleSave = async () => {
isSaving.value = true
try {
const ok = await saveSystemConfig('storage_config', form as UTSJSONObject, '系统存储配置')
if (ok) {
uni.showToast({ title: '保存成功', icon: 'success' })
}
} finally {
isSaving.value = false
}
}
</script>
<style scoped>
.admin-page { min-height: 100vh; background-color: #f5f7f9; padding: 20px; }
.breadcrumb { display: flex; flex-direction: row; margin-bottom: 20px; }
.bc-item { font-size: 14px; color: #999; }
.bc-item.active { color: #333; }
.bc-sep { margin: 0 8px; color: #ccc; }
.content-card { background-color: #ffffff; border-radius: 4px; box-shadow: 0 1px 4px rgba(0,21,41,.08); }
.tabs-header { border-bottom: 1px solid #f0f0f0; }
.tabs-scroll { white-space: nowrap; width: 100%; }
.tabs-list { display: flex; flex-direction: row; padding: 0 15px; }
.tab-item { padding: 15px 15px; cursor: pointer; position: relative; }
.tab-text { font-size: 14px; color: #666; }
.tab-item.active .tab-text { color: #2d8cf0; font-weight: bold; }
.tab-item.active::after { content: ""; position: absolute; bottom: 0; left: 15px; right: 15px; height: 2px; background-color: #2d8cf0; }
.tab-body { padding: 20px; }
.loading-state { padding: 60px; text-align: center; color: #999; }
.notice-box { background-color: #fffaf3; border: 1px solid #ffebcc; padding: 15px 20px; border-radius: 4px; margin-bottom: 30px; }
.notice-line { font-size: 13px; color: #666; line-height: 1.8; display: block; }
.form-body { max-width: 800px; }
.form-row { display: flex; flex-direction: row; align-items: center; }
.form-label { width: 140px; font-size: 13px; color: #333; }
.storage-radio-group { display: flex; flex-direction: row; flex-wrap: wrap; }
.radio-label { display: flex; flex-direction: row; align-items: center; margin-right: 20px; margin-bottom: 10px; }
.radio-text { font-size: 13px; margin-left: 4px; color: #666; }
.save-btn { width: 80px; height: 32px; line-height: 32px; background-color: #2d8cf0; color: white; font-size: 13px; border-radius: 4px; }
.mt-30 { margin-top: 30px; }
.mt-40 { margin-top: 40px; }
.cloud-view { padding: 40px; text-align: center; }
.empty-text { color: #ccc; font-size: 14px; }
</style>

View File

@@ -0,0 +1,482 @@
<template>
<view class="admin-page">
<view class="page-header">
<view class="breadcrumb">
<text class="bc-item">设置</text>
<text class="bc-sep">/</text>
<text class="bc-item">接口配置</text>
<text class="bc-sep">/</text>
<text class="bc-item active">系统存储配置</text>
</view>
</view>
<view class="content-card">
<view class="tabs-header">
<scroll-view class="tabs-scroll" scroll-x="true" show-scrollbar="false">
<view class="tabs-list">
<view
v-for="(item, index) in tabs"
:key="index"
class="tab-item"
:class="{ active: activeTab === index }"
@click="activeTab = index"
>
<text class="tab-text">{{ item }}</text>
</view>
</view>
</scroll-view>
</view>
<view class="tab-body">
<!-- Tab 0: 储存配置 -->
<view v-if="activeTab === 0" class="config-view">
<view class="notice-box">
<view class="notice-content">
<text class="notice-line">上传图片时会生成缩略图</text>
<text class="notice-line">未设置按照系统默认生成系统默认大图800*800中图300*300小图150*150</text>
<text class="notice-line">水印只在上传图片时生成,原图,大中小缩略图都会按照比例存在。</text>
<text class="notice-line">若上传图片时未开启水印,则该图在开启水印之后依旧无水印效果。</text>
</view>
<text class="notice-close">×</text>
</view>
<view class="form-body">
<view class="form-row">
<text class="form-label">存储方式:</text>
<view class="form-control">
<radio-group class="storage-radio-group" @change="onStorageTypeChange">
<label class="radio-label" v-for="st in storageOptions" :key="st.value">
<radio :value="st.value" :checked="form.storageType === st.value" color="#2d8cf0" style="transform:scale(0.8)" />
<text class="radio-text">{{ st.label }}</text>
</label>
</radio-group>
</view>
</view>
<view class="form-row mt-30">
<text class="form-label">是否开启缩略图:</text>
<view class="form-control">
<switch :checked="form.enableThumb" @change="onToggleThumb" color="#2d8cf0" style="transform:scale(0.8)" />
</view>
</view>
<view class="form-row mt-30">
<text class="form-label">是否开启水印:</text>
<view class="form-control">
<switch :checked="form.enableWatermark" @change="onToggleWatermark" color="#2d8cf0" style="transform:scale(0.8)" />
</view>
</view>
<view class="form-footer mt-40">
<button class="save-btn" type="primary" @click="handleSave">保存</button>
</view>
</view>
</view>
<!-- Tab 1-6: Cloud Storage -->
<view v-else class="cloud-view">
<view class="cloud-notice">
<view class="notice-title">
<text class="blue-title">{{ tabs[activeTab] }}开通方法:</text>
<text class="link-text">点击查看</text>
</view>
<text class="notice-step">第一步:添加【存储空间】(空间名称不能重复)</text>
<text class="notice-step">第二步:开启【使用状态】</text>
<text class="notice-step">第三步(可选):选择云存储空间列表上的修改【空间域名操作】</text>
<text class="notice-step">第四步可选选择云存储空间列表上的修改【CNAME配置】打开后复制记录值到对应的平台解析</text>
<text class="notice-close">×</text>
</view>
<view class="action-bar mt-20">
<view class="left-actions">
<button class="action-btn primary-btn">添加存储空间</button>
<button class="action-btn success-btn ml-10">同步存储空间</button>
</view>
<button class="action-btn outline-btn">修改配置信息</button>
</view>
<view class="table-container mt-20">
<view class="table-header">
<text class="th flex-2">储存空间名称</text>
<text class="th flex-1">区域</text>
<text class="th flex-3">空间域名</text>
<text class="th flex-1">使用状态</text>
<text class="th flex-2">创建时间</text>
<text class="th flex-2">更新时间</text>
<text class="th flex-2 center">操作</text>
</view>
<view class="table-body">
<view v-if="getCloudData().length > 0">
<view
class="table-row"
v-for="(row, rIndex) in getCloudData()"
:key="rIndex"
>
<text class="td flex-2">{{ row.name }}</text>
<text class="td flex-1">{{ row.region }}</text>
<text class="td flex-3 link">{{ row.domain }}</text>
<view class="td flex-1">
<switch :checked="row.status" scale="0.6" color="#2d8cf0" />
</view>
<text class="td flex-2 small-text muted">{{ row.createTime }}</text>
<text class="td flex-2 small-text muted">{{ row.updateTime }}</text>
<view class="td flex-2 center-row">
<text class="op-link">CNAME配置</text>
<text class="op-link ml-10">修改空间域名</text>
<text class="op-link danger ml-10">删除</text>
</view>
</view>
</view>
<view v-else class="empty-state">
<text class="empty-text">暂无数据</text>
</view>
</view>
</view>
</view>
</view>
</view>
</view>
</template>
<script setup lang="uts">
import { ref, reactive } from 'vue'
const tabs = ['储存配置', '七牛云储存', '阿里云储存', '腾讯云储存', '京东云储存', '华为云储存', '天翼云储存']
const activeTab = ref(0)
const storageOptions = [
{ label: '本地存储', value: 'local' },
{ label: '七牛云存储', value: 'qiniu' },
{ label: '阿里云存储', value: 'aliyun' },
{ label: '腾讯云存储', value: 'tencent' },
{ label: '京东云存储', value: 'jd' },
{ label: '华为云存储', value: 'huawei' },
{ label: '天翼云存储', value: 'tianyi' }
]
const form = reactive({
storageType: 'local',
enableThumb: false,
enableWatermark: false
})
const onStorageTypeChange = (e : any) => {
form.storageType = e.detail.value as string
}
const onToggleThumb = (e : any) => {
form.enableThumb = e.detail.value as boolean
}
const onToggleWatermark = (e : any) => {
form.enableWatermark = e.detail.value as boolean
}
const handleSave = () => {
uni.showToast({
title: '保存成功',
icon: 'success'
})
}
// Simulated data for Aliyun Storage (based on screenshot)
const aliyunData = [
{ name: 'crmebdoc', region: '华北2 (北京)', domain: 'https://crmebdoc.oss-cn-beijing.aliyuncs.com', status: false, createTime: '2024-07-30 12:10:42', updateTime: '2025-01-22 10:58:20' },
{ name: 'crmebjavasingle', region: '华北2 (北京)', domain: 'https://crmebjavasingl...oss-cn-beijing.aliyunc...s.com', status: false, createTime: '2024-07-29 17:22:24', updateTime: '2025-01-22 10:58:20' },
{ name: 'crmebjavamer', region: '华北2 (北京)', domain: 'https://crmebjavamer.o...ss-cn-beijing.aliyuncs.c...om', status: false, createTime: '2024-07-22 14:43:42', updateTime: '2025-01-22 10:58:20' },
{ name: 'crmebmer', region: '华北2 (北京)', domain: 'https://crmebmer.oss-c...n-beijing.aliyuncs.com', status: false, createTime: '2024-07-22 14:42:53', updateTime: '2025-01-22 10:58:20' },
{ name: 'crmebmulti', region: '华北2 (北京)', domain: 'https://crmebmulti.oss-...cn-beijing.aliyuncs.com', status: false, createTime: '2024-07-22 14:42:08', updateTime: '2025-01-22 10:58:20' },
{ name: 'crmebpros', region: '华北2 (北京)', domain: 'https://crmebpros.oss-c...n-beijing.aliyuncs.com', status: false, createTime: '2024-07-22 14:41:17', updateTime: '2025-01-22 10:58:20' },
{ name: 'crmebbz', region: '华东1 (杭州)', domain: 'https://crmebbz.oss-cn-...hangzhou.aliyuncs.com', status: true, createTime: '2022-08-18 17:30:33', updateTime: '2025-01-22 10:58:20' }
]
const getCloudData = () : any[] => {
if (activeTab.value === 2) { // 阿里云
return aliyunData
}
return [] as any[]
}
</script>
<style scoped>
.admin-page {
/* 使用 Layout 的背景和内边距 */
padding: 0;
background-color: transparent;
min-height: auto;
}
.breadcrumb {
display: flex;
flex-direction: row;
margin-bottom: 20px;
}
.bc-item {
font-size: 14px;
color: #999;
}
.bc-item.active {
color: #333;
}
.bc-sep {
margin: 0 8px;
color: #ccc;
}
.content-card {
background-color: #ffffff;
border-radius: 4px;
box-shadow: 0 1px 4px rgba(0,21,41,.08);
}
.tabs-header {
border-bottom: 1px solid #f0f0f0;
}
.tabs-scroll {
white-space: nowrap;
width: 100%;
}
.tabs-list {
display: flex;
flex-direction: row;
padding: 0 15px;
}
.tab-item {
padding: 15px 15px;
cursor: pointer;
position: relative;
}
.tab-text {
font-size: 14px;
color: #666;
}
.tab-item.active .tab-text {
color: #2d8cf0;
font-weight: bold;
}
.tab-item.active::after {
content: "";
position: absolute;
bottom: 0;
left: 15px;
right: 15px;
height: 2px;
background-color: #2d8cf0;
}
.tab-body {
padding: 20px;
}
/* Notice Box Styles */
.notice-box {
background-color: #fffaf3;
border: 1px solid #ffebcc;
padding: 15px 20px;
border-radius: 4px;
display: flex;
flex-direction: row;
justify-content: space-between;
margin-bottom: 30px;
}
.notice-line {
font-size: 13px;
color: #666;
line-height: 1.8;
display: block;
}
.notice-close {
color: #ccc;
font-size: 18px;
cursor: pointer;
}
/* Form Styles */
.form-body {
max-width: 800px;
}
.form-row {
display: flex;
flex-direction: row;
align-items: center;
}
.form-label {
width: 140px;
font-size: 13px;
color: #333;
}
.storage-radio-group {
display: flex;
flex-direction: row;
flex-wrap: wrap;
}
.radio-label {
display: flex;
flex-direction: row;
align-items: center;
margin-right: 20px;
margin-bottom: 10px;
}
.radio-text {
font-size: 13px;
margin-left: 4px;
color: #666;
}
.save-btn {
width: 80px;
height: 32px;
line-height: 32px;
background-color: #2d8cf0;
color: white;
font-size: 13px;
padding: 0;
border-radius: 4px;
}
.mt-20 { margin-top: 20px; }
.mt-30 { margin-top: 30px; }
.mt-40 { margin-top: 40px; }
.ml-10 { margin-left: 10px; }
/* Cloud View Styles */
.cloud-notice {
background-color: #f0faff;
border: 1px solid #d5e8fc;
border-radius: 4px;
padding: 15px 20px;
position: relative;
}
.blue-title {
color: #2db7f5;
font-size: 14px;
font-weight: bold;
}
.link-text {
color: #2d8cf0;
font-size: 14px;
margin-left: 10px;
cursor: pointer;
text-decoration: underline;
}
.notice-step {
display: block;
font-size: 13px;
color: #666;
line-height: 1.8;
}
.action-bar {
display: flex;
flex-direction: row;
justify-content: space-between;
}
.left-actions {
display: flex;
flex-direction: row;
}
.action-btn {
font-size: 12px;
height: 30px;
line-height: 30px;
padding: 0 12px;
border-radius: 3px;
}
.primary-btn { background-color: #2d8cf0; color: white; border: none; }
.success-btn { background-color: #19be6b; color: white; border: none; }
.outline-btn { background-color: white; color: #666; border: 1px solid #dcdee2; }
/* Table Styles */
.table-container {
border: 1px solid #f0f0f0;
}
.table-header {
display: flex;
flex-direction: row;
background-color: #f8f8f9;
border-bottom: 1px solid #f0f0f0;
}
.th {
padding: 12px 10px;
font-size: 13px;
font-weight: bold;
color: #333;
}
.table-row {
display: flex;
flex-direction: row;
border-bottom: 1px solid #f0f0f0;
align-items: center;
}
.td {
padding: 12px 10px;
font-size: 13px;
color: #666;
display: flex;
flex-direction: row;
align-items: center;
}
.flex-1 { flex: 1; }
.flex-2 { flex: 2; }
.flex-3 { flex: 3; }
.center { justify-content: center; }
.center-row { justify-content: center; }
.link {
color: #2d8cf0;
text-decoration: underline;
}
.small-text { font-size: 11px; }
.muted { color: #999; }
.op-link {
color: #2d8cf0;
font-size: 12px;
cursor: pointer;
}
.op-link.danger {
color: #ed4014;
}
.empty-state {
padding: 40px;
display: flex;
justify-content: center;
}
.empty-text {
color: #ccc;
font-size: 14px;
}
</style>

View File

@@ -115,13 +115,12 @@ function handleSet(item: any) {
<style scoped>
.message-management {
padding: 20px;
background-color: #f5f7f9;
/* 使用 AdminLayout 的统一内边距和背景色 */
}
.admin-card {
background-color: #fff;
padding: 24px;
padding: var(--admin-card-padding);
border-radius: 8px;
}

View File

@@ -33,7 +33,7 @@
<view class="table-cell action-cell" style="flex: 2;">操作</view>
</view>
<view class="table-body">
<view class="table-row" v-for="(item, index) in printerList" :key="index">
<view class="table-row" v-for="(item, index) in pagedList" :key="index">
<view class="table-cell" style="flex: 0 0 60px;">{{ item.id }}</view>
<view class="table-cell" style="flex: 2;">{{ item.name }}</view>
<view class="table-cell" style="flex: 1.5;">{{ item.platform }}</view>
@@ -52,26 +52,90 @@
</view>
</view>
<!-- 分页 (模拟) -->
<view class="pagination">
<text class="total">共 1 条</text>
<picker :range="['15条/页', '30条/页']">
<view class="page-size">15条/页</view>
</picker>
</view>
<CommonPagination
v-if="total > 0"
:total="total"
:loading="false"
:currentPage="currentPage"
:pageSize="pageSize"
:pageSizeOptionLabels="pageSizeOptionLabels"
:pageSizeIndex="pageSizeIndex"
:visiblePages="visiblePages"
:totalPage="totalPage"
:jumpPageInput="jumpPageInput"
@page-size-change="handlePageSizeChange"
@page-change="handlePageChange"
@update:jumpPageInput="(val: string) => { jumpPageInput.value = val }"
@jump-page="handleJumpPage"
/>
</view>
</view>
</view></template>
<script setup lang="uts">
import { ref } from 'vue'
import { ref, computed } from 'vue'
import CommonPagination from '@/components/CommonPagination/CommonPagination.uvue'
const searchQuery = ref({ name: '' })
const platforms = ['全部', '易联云', '飞鹅打印机']
const selectedPlatform = ref(0)
// ========== MOCK DATA START ==========
// TODO: 接真实接口时替换此处 printerList 为 fetchPrinterList() 调用
const printerList = ref([
{ id: 20, name: '总部底层打印机', platform: '易联云', account: 'hq_admin', copies: 2, add_time: '2025-02-01 10:00:00', status: true },
{ id: 19, name: '广州仓库打印机', platform: '飞鹅打印机', account: 'gz_wh01', copies: 1, add_time: '2025-02-03 11:00:00', status: true },
{ id: 18, name: '上海分拨打印机', platform: '易联云', account: 'sh_fp01', copies: 1, add_time: '2025-02-05 09:30:00', status: false },
{ id: 17, name: '北京主打印机', platform: '易联云', account: 'bj_main', copies: 2, add_time: '2025-02-08 14:00:00', status: true },
{ id: 16, name: '北京备打印机', platform: '飞鹅打印机', account: 'bj_bak01', copies: 1, add_time: '2025-02-10 08:30:00', status: true },
{ id: 15, name: '化妙打印机', platform: '易联云', account: 'hm_pr01', copies: 3, add_time: '2025-02-12 10:20:00', status: true },
{ id: 14, name: '客服部打印机', platform: '飞鹅打印机', account: 'cs_pr01', copies: 1, add_time: '2025-02-15 15:00:00', status: true },
{ id: 13, name: '采购部打印机', platform: '易联云', account: 'cg_pr01', copies: 1, add_time: '2025-02-18 12:00:00', status: false },
{ id: 12, name: '财务部打印机', platform: '飞鹅打印机', account: 'cw_pr01', copies: 2, add_time: '2025-02-20 09:00:00', status: true },
{ id: 11, name: '运营部打印机', platform: '易联云', account: 'yy_pr01', copies: 1, add_time: '2025-02-22 11:30:00', status: true },
{ id: 10, name: '成都网点打印机', platform: '飞鹅打印机', account: 'cd_np01', copies: 1, add_time: '2025-02-25 10:00:00', status: true },
{ id: 9, name: '武汉网点打印机', platform: '易联云', account: 'wh_np01', copies: 2, add_time: '2025-03-01 14:00:00', status: false },
{ id: 8, name: '深圳网点打印机', platform: '飞鹅打印机', account: 'sz_np01', copies: 1, add_time: '2025-03-05 09:00:00', status: true },
{ id: 7, name: '杭州网点打印机', platform: '易联云', account: 'hz_np01', copies: 1, add_time: '2025-03-08 11:00:00', status: true },
{ id: 6, name: '南京网点打印机', platform: '飞鹅打印机', account: 'nj_np01', copies: 2, add_time: '2025-03-10 12:00:00', status: true },
{ id: 5, name: '苏州网点打印机', platform: '易联云', account: 'sz2_np01', copies: 1, add_time: '2025-03-12 15:00:00', status: false },
{ id: 4, name: '小类目打印机', platform: '飞鹅打印机', account: 'xl_pr01', copies: 1, add_time: '2025-03-15 10:30:00', status: true },
{ id: 3, name: '大档打印机', platform: '易联云', account: 'dd_pr01', copies: 3, add_time: '2025-03-18 09:00:00', status: true },
{ id: 2, name: '二号打印', platform: '飞鹅打印机', account: '333', copies: 1, add_time: '2025-01-01 12:00:00', status: false },
{ id: 1, name: '一号打印', platform: '易联云', account: '222', copies: 1, add_time: '2024-12-11 15:12:58', status: true }
])
// ========== MOCK DATA END ==========
// ========== PAGINATION STATE ==========
const currentPage = ref(1)
const pageSize = ref(15)
const jumpPageInput = ref('')
const pageSizeOptions = [10, 15, 20, 30, 50]
const pageSizeOptionLabels = computed(() => pageSizeOptions.map((n: number) => `${n}条/页`))
const pageSizeIndex = computed(() => { const idx = pageSizeOptions.indexOf(pageSize.value); return idx >= 0 ? idx : 0 })
const total = computed(() => printerList.value.length)
const totalPage = computed(() => Math.max(1, Math.ceil(total.value / pageSize.value)))
const pagedList = computed(() => {
const start = (currentPage.value - 1) * pageSize.value
return printerList.value.slice(start, start + pageSize.value)
})
const visiblePages = computed((): number[] => {
const t = totalPage.value; const cur = currentPage.value
if (t <= 7) return Array.from({ length: t }, (_: any, i: number) => i + 1)
if (cur <= 4) return [1, 2, 3, 4, 5, -1, t]
if (cur >= t - 3) return [1, -1, t - 4, t - 3, t - 2, t - 1, t]
return [1, -1, cur - 1, cur, cur + 1, -1, t]
})
const handlePageChange = (p: number) => { currentPage.value = p }
const handlePageSizeChange = (e: any) => {
const idx = Number(e.detail.value)
pageSize.value = pageSizeOptions[idx] ?? pageSizeOptions[0]
currentPage.value = 1
}
const handleJumpPage = () => {
const p = parseInt(jumpPageInput.value)
if (!isNaN(p) && p >= 1 && p <= totalPage.value) currentPage.value = p
}
// ========== END PAGINATION STATE ==========
function onPlatformChange(e: any) {
selectedPlatform.value = e.detail.value
@@ -108,8 +172,8 @@ function handleDelete(item: any) {
<style scoped>
.ticket-config {
padding: 20px;
background-color: #f5f7f9;
padding: 0;
background-color: transparent;
}
.admin-card {
@@ -207,6 +271,8 @@ function handleDelete(item: any) {
}
.table-cell {
display:flex;
flex-direction: row;
font-size: 13px;
color: #666;
padding: 0 10px;

View File

@@ -1,81 +0,0 @@
<template>
<view class="page-container">
<view class="page-header">
<text class="page-title">管理员管理</text>
<text class="page-subtitle">Component: SettingSystemAdmin</text>
</view>
<view class="page-content">
<view class="placeholder-card">
<text class="placeholder-title">页面占位</text>
<text class="placeholder-desc">该功能模块正在开发中</text>
<text class="placeholder-info">当前采用 CRMEB 路由体系 1:1 映射</text>
</view>
</view>
</view>
</template>
<script setup lang="uts">
import { ref } from 'vue'
// TODO: 实现 管理员管理 的具体功能
const loading = ref<boolean>(false)
</script>
<style scoped lang="scss">
.page-container {
padding: 20px;
min-height: 100vh;
background: #f5f5f5;
}
.page-header {
margin-bottom: 20px;
}
.page-title {
display: block;
font-size: 24px;
font-weight: 600;
color: #333;
margin-bottom: 8px;
}
.page-subtitle {
display: block;
font-size: 14px;
color: #999;
}
.page-content {
background: #fff;
border-radius: 4px;
padding: 24px;
}
.placeholder-card {
text-align: center;
padding: 60px 20px;
}
.placeholder-title {
display: block;
font-size: 18px;
font-weight: 600;
color: #666;
margin-bottom: 12px;
}
.placeholder-desc {
display: block;
font-size: 14px;
color: #999;
margin-bottom: 8px;
}
.placeholder-info {
display: block;
font-size: 12px;
color: #1890ff;
}
</style>

View File

@@ -1,23 +0,0 @@
<template>
<view class="admin-page-container">
<view class="page-card">
<view class="page-header">
<text class="page-title">协议设置</text>
</view>
<view class="page-content">
<text class="placeholder-text">协议设置 页面开发中...</text>
</view>
</view>
</view>
</template>
<script setup lang="uts">
</script>
<style scoped>
.admin-page-container { padding: 20px; background-color: #f5f7f9; min-height: 100vh; }
.page-card { background-color: #fff; border-radius: 4px; padding: 20px; box-shadow: 0 1px 4px rgba(0,21,41,0.08); }
.page-header { margin-bottom: 20px; border-bottom: 1px solid #f0f0f0; padding-bottom: 15px; }
.page-title { font-size: 16px; font-weight: bold; color: #303133; }
.placeholder-text { font-size: 14px; color: #909399; }
</style>

View File

@@ -0,0 +1,234 @@
<template>
<view class="admin-page">
<view class="admin-sections">
<view class="admin-card settings-card">
<!-- 顶部导航标签 (1:1 复刻 CRMEB 截图 Pic 0) -->
<view class="tabs-container">
<scroll-view class="tabs-scroll" scroll-x="true" show-scrollbar="false" :enable-flex="true">
<view class="tabs-bar">
<view
v-for="(tab, index) in tabs"
:key="index"
class="tab-item"
:class="{ active: currentTab === index }"
@click="currentTab = index"
>
<text class="tab-text">{{ tab.name }}</text>
<view class="tab-line" v-if="currentTab === index"></view>
</view>
</view>
</scroll-view>
</view>
<!-- 表单区域 (复刻 Pic 0 WAF 配置) -->
<view class="form-container">
<!-- 此处根据 currentTab 渲染内容,主要展示截图中选中的 WAF 状态 -->
<view v-if="currentTab === 8" class="form-content">
<!-- WAF类型 -->
<view class="form-item">
<view class="form-label">WAF类型:</view>
<view class="form-right">
<radio-group class="radio-group" @change="formData.waf_type = parseInt(($event.detail.value as string))">
<label class="radio-item"><radio value="0" :checked="formData.waf_type == 0" color="#1890ff" /><text class="radio-text">关闭</text></label>
<label class="radio-item"><radio value="1" :checked="formData.waf_type == 1" color="#1890ff" /><text class="radio-text">拦截</text></label>
<label class="radio-item"><radio value="2" :checked="formData.waf_type == 2" color="#1890ff" /><text class="radio-text">过滤</text></label>
</radio-group>
<view class="form-tip">WAF类型关闭所有参数都能正常请求拦截匹配到WAF配置的参数阻断接口请求过滤匹配到WAF配置的参数过滤参数正常请求接口</view>
</view>
</view>
<!-- WAF配置 -->
<view class="form-item">
<view class="form-label middle-label">WAF配置:</view>
<view class="form-right">
<textarea
class="form-textarea code-textarea"
v-model="formData.waf_config"
placeholder="请输入 WAF 配置"
maxlength="-1"
></textarea>
<view class="form-tip">WAF配置验证参数过滤掉不需要的参数或拦截请求多个参数用回车换行分隔</view>
</view>
</view>
<!-- 提交按钮 -->
<view class="submit-row">
<view class="form-label"></view>
<view class="form-right">
<button class="btn-submit" @click="handleSubmit">提交</button>
</view>
</view>
</view>
<!-- 暂未切换的其他 Tab -->
<view v-else class="placeholder-content">
<text class="placeholder-text">此处为【{{ tabs[currentTab].name }}】的复刻内容</text>
<view class="form-tip">(已按 CRMEB 截图逻辑预置字段,点击“提交”可测试反馈)</view>
</view>
</view>
</view>
</view>
</view>
</template>
<script setup lang="uts">
import { ref } from "vue"
const currentTab = ref(8) // 默认打开截图中的“WAF配置”
const tabs = [
{ name: "基础配置" }, { name: "分享配置" }, { name: "LOGO配置" },
{ name: "自定义JS" }, { name: "地图配置" }, { name: "备案配置" },
{ name: "模块配置" }, { name: "远程登录配置" }, { name: "WAF配置" }
]
const formData = ref({
waf_type: 2, // 截图中的“过滤”
waf_config: `/\\.\\.\\./
/\\<\\?/
/\\bor\\b.*=.*|/i
/(select[\\s\\S]*?)(from|limit)/i
/(union[\\s\\S]*?select)/i
/(having[\\s\\S]*?updatexml|extractvalue)/i`
})
const handleSubmit = () => {
uni.showToast({ title: "保存成功", icon: "success" })
}
</script>
<style scoped>
.admin-page {
background-color: transparent; /* 已由 AdminLayout 处理 */
min-height: auto;
padding: 0; /* 已由 AdminLayout 处理 */
}
.settings-card {
background-color: #fff;
border-radius: 8px; /* 统一为 8px */
min-height: calc(100vh - 150px);
padding: 0; /* 使用 admin-card 统一 padding */
}
/* 标签栏 - 保持不变 */
.tabs-container {
border-bottom: 1px solid #f0f2f5;
padding: 0 10px;
}
.tabs-scroll {
width: 100%;
}
.tabs-bar {
display: flex;
flex-direction: row;
}
.tab-item {
padding: 16px 20px;
font-size: 14px;
color: #515a6e;
position: relative;
cursor: pointer;
}
.tab-item.active {
color: #1890ff;
}
.tab-line {
position: absolute;
bottom: 0px;
left: 20px;
right: 20px;
height: 2px;
background-color: #1890ff;
}
/* 表单布局复刻 */
.form-container {
padding: 30px 20px;
}
.form-item {
display: flex;
flex-direction: row;
margin-bottom: 24px;
}
.form-label {
width: 120px;
text-align: right;
padding-right: 20px;
font-size: 14px;
color: #303133;
line-height: 32px;
}
.middle-label {
padding-top: 10px;
}
.form-right {
flex: 1;
}
/* Radio 样式 */
.radio-group {
display: flex;
flex-direction: row;
height: 32px;
align-items: center;
}
.radio-item {
display: flex;
flex-direction: row;
align-items: center;
margin-right: 24px;
}
.radio-text {
font-size: 14px;
color: #606266;
margin-left: 6px;
}
/* Textarea 样式 像素级对齐 */
.code-textarea {
width: 600px;
height: 200px;
border: 1px solid #dcdfe6;
border-radius: 4px;
padding: 12px;
font-size: 14px;
color: #303133;
font-family: 'Courier New', Courier, monospace;
}
/* 提示文本 1:1 复刻颜色 */
.form-tip {
font-size: 12px;
color: #999;
margin-top: 10px;
line-height: 1.6;
width: 600px;
}
/* 按钮样式 */
.submit-row {
margin-top: 20px;
}
.btn-submit {
background-color: #1890ff;
color: #fff;
width: 64px;
height: 32px;
line-height: 32px;
font-size: 12px;
border-radius: 4px;
text-align: center;
border: none;
padding: 0;
margin: 0;
}
.placeholder-content {
padding: 50px;
text-align: center;
}
.placeholder-text {
font-size: 16px;
color: #909399;
}
</style>

View File

@@ -1,23 +0,0 @@
<template>
<view class="admin-page-container">
<view class="page-card">
<view class="page-header">
<text class="page-title">消息管理</text>
</view>
<view class="page-content">
<text class="placeholder-text">消息管理 页面开发中...</text>
</view>
</view>
</view>
</template>
<script setup lang="uts">
</script>
<style scoped>
.admin-page-container { padding: 20px; background-color: #f5f7f9; min-height: 100vh; }
.page-card { background-color: #fff; border-radius: 4px; padding: 20px; box-shadow: 0 1px 4px rgba(0,21,41,0.08); }
.page-header { margin-bottom: 20px; border-bottom: 1px solid #f0f0f0; padding-bottom: 15px; }
.page-title { font-size: 16px; font-weight: bold; color: #303133; }
.placeholder-text { font-size: 14px; color: #909399; }
</style>

View File

@@ -1,81 +0,0 @@
<template>
<view class="page-container">
<view class="page-header">
<text class="page-title">角色管理</text>
<text class="page-subtitle">Component: SettingSystemRole</text>
</view>
<view class="page-content">
<view class="placeholder-card">
<text class="placeholder-title">页面占位</text>
<text class="placeholder-desc">该功能模块正在开发中</text>
<text class="placeholder-info">当前采用 CRMEB 路由体系 1:1 映射</text>
</view>
</view>
</view>
</template>
<script setup lang="uts">
import { ref } from 'vue'
// TODO: 实现 角色管理 的具体功能
const loading = ref<boolean>(false)
</script>
<style scoped lang="scss">
.page-container {
padding: 20px;
min-height: 100vh;
background: #f5f5f5;
}
.page-header {
margin-bottom: 20px;
}
.page-title {
display: block;
font-size: 24px;
font-weight: 600;
color: #333;
margin-bottom: 8px;
}
.page-subtitle {
display: block;
font-size: 14px;
color: #999;
}
.page-content {
background: #fff;
border-radius: 4px;
padding: 24px;
}
.placeholder-card {
text-align: center;
padding: 60px 20px;
}
.placeholder-title {
display: block;
font-size: 18px;
font-weight: 600;
color: #666;
margin-bottom: 12px;
}
.placeholder-desc {
display: block;
font-size: 14px;
color: #999;
margin-bottom: 8px;
}
.placeholder-info {
display: block;
font-size: 12px;
color: #1890ff;
}
</style>

View File

@@ -1,23 +0,0 @@
<template>
<view class="admin-page-container">
<view class="page-card">
<view class="page-header">
<text class="page-title">小票配置</text>
</view>
<view class="page-content">
<text class="placeholder-text">小票配置 页面开发中...</text>
</view>
</view>
</view>
</template>
<script setup lang="uts">
</script>
<style scoped>
.admin-page-container { padding: 20px; background-color: #f5f7f9; min-height: 100vh; }
.page-card { background-color: #fff; border-radius: 4px; padding: 20px; box-shadow: 0 1px 4px rgba(0,21,41,0.08); }
.page-header { margin-bottom: 20px; border-bottom: 1px solid #f0f0f0; padding-bottom: 15px; }
.page-title { font-size: 16px; font-weight: bold; color: #303133; }
.placeholder-text { font-size: 14px; color: #909399; }
</style>