1. 设备管理界面完成
2. 用户管理界面完成
3. 会话列表完成
This commit is contained in:
Zy
2026-09-30 17:43:01 +08:00
parent a19777a2b8
commit 23703a66c2
47 changed files with 7451 additions and 190 deletions

View File

@@ -0,0 +1,242 @@
<script lang="ts" setup>
import FormItemTip from "@/components/FormItemTip/index.vue";
const router = useRouter();
const form = ref({
phone: "",
username: "",
sex: 1,
creatDay: '',
status: 1,
img: ''
})
function handleBack() {
router.replace({
path: "/customer/customerList"
})
}
function handleChangeFile(file: File) {
console.log(file)
}
</script>
<template>
<div class="edit">
<div class="flex justify-between">
<pagecrumb></pagecrumb>
<el-button plain type="info" @click="handleBack"> 返回用户列表</el-button>
</div>
<!-- 用户信息-->
<section class="customerInfoBox commonCard flex justify-between flex-items-center">
<div class="flex infoBox">
<el-image
class="customer-Img"
src="https://ts3.tc.mm.bing.net/th?id=ORMS.48a27ca8353fa47bf0dc8df38854d0e1&pid=Wdp&w=312&h=172&qlt=90&c=1&rs=1&dpr=1&p=0"></el-image>
<div class="flex flex-col justify-between">
<div>
<span class="userName">林小满</span>
<el-tag effect="light" round style="margin: 0 12px " type="success">
<div class="flex flex-items-center"><i class="circle"></i>
<span>正常</span></div>
</el-tag>
<el-tag effect="light" round type="info">150****0831</el-tag>
</div>
<div class="subInfoBox">
<span>用户ID: U20260918001 </span>
<span class="dat">·</span>
<span>注册时间: 2026-01-10 14:20</span>
<span class="dat">·</span>
<span>最后登录: 2026-09-17 09:35</span>
</div>
</div>
</div>
</section>
<!-- form -->
<section class="commonCard">
<card-nav subTitle="手机号为账号唯一标识不可修改;个人资料与账号状态可维护" title="用户资料"></card-nav>
<div class="formbox">
<el-form label-position="top">
<el-row :gutter="24">
<el-col :span="12">
<FormItemTip
v-model="form.phone"
:inputAttrs="{ placeholder: '请输入手机号', disabled: true , showWordLimit:false ,maxlength:11}"
label="手机号"
prop="phone"
tip="账号唯一标识,如需更换手机号请联系用户重新注册"
>
<template #suffix>不可修改</template>
</FormItemTip>
</el-col>
<el-col :span="12">
<FormItemTip
v-model="form.username"
:inputAttrs="{ placeholder: '请输入用户昵称', disabled: false , showWordLimit:true ,maxlength:20}"
:required="true"
prop="username"
tip="必填,最多 20 个字符,将同步展示在 APP 端"
>
<template #label>
<span>用户昵称</span>
</template>
</FormItemTip>
</el-col>
</el-row>
<el-row :gutter="24">
<el-col :span="12">
<FormItemTip
v-model="form.sex"
:radioOptions="[
{label:'男',value:1},
{label:'女',value:0},
{label:'未填写',value:2},
]"
prop="sex"
tip="选填,选择「未填写」时 APP 端不展示性别"
type="radio"
>
<template #label>
<span>性别</span>
<span class="subTitle">(选填)</span>
</template>
</FormItemTip>
</el-col>
<el-col :span="12">
<FormItemTip
v-model="form.creatDay"
:inputAttrs="{ placeholder: '请选择生日'}"
label="生日"
prop="creatDay"
tip="选填,修改后将同步至用户个人资料"
type="date"
>
<template #label>
<span>生日</span>
<span class="subTitle">(选填)</span>
</template>
</FormItemTip>
</el-col>
</el-row>
<el-row :gutter="24">
<el-col :span="12">
<FormItemTip
v-model="form.status"
:inputAttrs="{ placeholder: '', disabled: false }"
:radioOptions="[
{label:'正常',value:1},
{label:'禁用',value:0},
]"
label="账号状态"
prop="status"
tip="切换为「禁用」后该账号将无法登录 APP,且已登录设备将下线"
type="radio"
>
</FormItemTip>
</el-col>
<el-col :span="12">
<FormItemTip
v-model="form.username"
:inputAttrs="{ placeholder: '请输入用户昵称', disabled: true }"
:required="true"
label="头像"
prop="username"
tip="必填,最多 20 个字符,将同步展示在 APP 端"
type="uploadUserAvatar"
@file-change="handleChangeFile"
>
</FormItemTip>
</el-col>
</el-row>
<el-row :gutter="24">
<el-col :span="24">
<FormItemTip
v-model="form.phone"
:inputAttrs="{ placeholder: '请输入后台内部备注,如工单号、对接人、异常说明等信息', disabled: false , showWordLimit:true ,maxlength:20}"
:required="false"
label="备注"
prop="phone"
type="textarea"
>
<template #label>
<span>备注 </span>
<span>(选填 · 仅后台管理员可见)</span>
</template>
</FormItemTip>
</el-col>
</el-row>
</el-form>
</div>
</section>
<div class="footer">
<el-button>取消</el-button>
<el-button type="primary">保存</el-button>
</div>
</div>
</template>
<style lang="scss" scoped>
.edit {
.customerInfoBox {
.infoBox {
.customer-Img {
width: 73px;
height: 72px;
border-radius: 50%;
margin-right: 24px;
}
.userName {
height: 26px;
line-height: 26px;
font-weight: bold;
color: rgba(17, 24, 39, 1);
font-size: 22px;
}
.circle {
display: block;
width: 7px;
height: 6px;
border-radius: 3px;
margin-right: 6px;
background-color: rgba(22, 163, 74, 1);
}
}
.subInfoBox {
line-height: 20px;
color: rgba(107, 114, 128, 1);
font-size: 13px;
text-align: left;
.dat {
margin: 0 1px;
}
}
}
.subTitle {
line-height: 14px;
color: rgba(156, 163, 175, 1);
font-size: 12px;
text-align: left;
}
.formbox {
margin-top: 46px;
}
.footer {
margin-top: 27px;
text-align: right;
}
}
</style>

View File

@@ -0,0 +1,209 @@
<template>
<div class="p-2 app-container monitor-online-page">
<Pagecrumb></Pagecrumb>
<div class="search-wrap">
<el-card class="search-panel" shadow="hover">
<el-form ref="queryFormRef" :inline="true" :model="queryParams" class="query-form" label-position="top">
<el-form-item label="手机号" prop="phoneNumber">
<el-input v-model="queryParams.phoneNumber" clearable placeholder="请输入手机号" size="large"
style="width: 190px;" @keyup.enter="handleQuery"/>
</el-form-item>
<el-form-item label="用户昵称" prop="nickName">
<el-input v-model="queryParams.nickName" clearable placeholder="请输入用户昵称" size="large"
style="width: 190px;" @keyup.enter="handleQuery"/>
</el-form-item>
<el-form-item label="性别" prop="gender">
<el-select
v-model="queryParams.gender"
:value-on-clear="null"
clearable
size="large"
style="width:100px;"
>
<el-option label="女" value="2"></el-option>
<el-option label="男" value="1"></el-option>
<el-option label="未知" value="0"></el-option>
</el-select>
</el-form-item>
<el-form-item label="所在地区" prop="userName">
<el-select
v-model="queryParams.ipaddr"
:empty-values="[null, undefined]"
:value-on-clear="null"
clearable
size="large"
style="width: 190px;"
>
<el-option label="在线" value="0"></el-option>
<el-option label="离线" value="1"></el-option>
</el-select>
</el-form-item>
<el-form-item label="注册时间" prop="createTime">
<el-date-picker
v-model="queryParams.createTime"
size="large"
style="width:150px;"
type="date"
/>
</el-form-item>
<el-form-item label="账号状态" prop="status">
<el-select
v-model="queryParams.status"
:value-on-clear="null"
clearable
size="large"
style="width:100px;"
>
<el-option label="正常" value="1"></el-option>
<el-option label="停用" value="0"></el-option>
</el-select>
</el-form-item>
<el-form-item>
<el-button size="large" type="primary" @click="handleQuery">查询</el-button>
<el-button size="large" @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
</el-card>
</div>
<el-card class="table-panel" shadow="hover">
<template #header>
<div class="flex justify-end">
<el-button plain type="info">批量导出用户信息</el-button>
<el-button plain type="danger">批量禁用账号</el-button>
</div>
</template>
<el-table
v-loading="loading"
:data="onlineList"
class="data-table"
style="width: 100%"
>
<el-table-column align="center" type="selection"></el-table-column>
<el-table-column :show-overflow-tooltip="true" align="center" label="用户昵称" prop="nickName"/>
<el-table-column :show-overflow-tooltip="true" align="center" label="手机号" prop="phoneNumber"/>
<el-table-column :show-overflow-tooltip="true" align="center" label="性别" prop="gender">
<template #default="scope">
<span v-if="scope.row.gender === '1'">男</span>
<span v-else-if="scope.row.gender==='2'">女</span>
<span v-else>未填写</span>
</template>
</el-table-column>
<el-table-column align="center" label="生日" prop="birthday"></el-table-column>
<el-table-column :show-overflow-tooltip="true" align="center" label="所在地区" prop="deptName"/>
<el-table-column :show-overflow-tooltip="true" align="center" label="绑定设备量" prop="ipaddr"/>
<el-table-column :show-overflow-tooltip="true" align="center" label="注册时间" prop="creatTime"/>
<el-table-column :show-overflow-tooltip="true" align="center" label="最后登录时间" prop="loginDate"/>
<el-table-column :show-overflow-tooltip="true" align="center" label="账号状态" prop="status">
<template #default="scope">
<el-tag v-if="scope.row.status === '0'" type="success">正常</el-tag>
<el-tag v-else type="success">异常</el-tag>
</template>
</el-table-column>
<el-table-column align="center" class-name="small-padding fixed-width" label="操作" min-width="250">
<template #default="scope">
<el-button
v-hasPermi="['monitor:online:forceLogout']"
plain
type="primary"
@click="handleMain(scope.row)"
>查看详情
</el-button>
<el-button
v-hasPermi="['monitor:online:forceLogout']"
plain
type="info"
>编辑
</el-button>
<el-button
v-hasPermi="['monitor:online:forceLogout']"
plain
type="info"
>重置密码
</el-button>
<el-button
v-if="scope.row.status === '0'"
v-hasPermi="['monitor:online:forceLogout']"
plain
type="warning"
>禁用
</el-button>
<el-button
v-if="scope.row.status === '1'"
v-hasPermi="['monitor:online:forceLogout']"
plain
type="success"
>启用
</el-button>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total > 0"
v-model:limit="queryParams.pageSize"
v-model:page="queryParams.pageNum"
:total="total"
/>
</el-card>
</div>
</template>
<script lang="ts" setup>
import {listUser as initData} from '@/api/system/customer/index';
import {useDict} from '@/utils/dict';
import {UserQuery, UserVO} from "@/api/system/customer/types";
const {sys_device_type} = toRefs<any>(useDict('sys_device_type'));
const router = useRouter();
const onlineList = ref<UserVO[]>([]);
const loading = ref(true);
const total = ref(0);
const queryFormRef = ref<ElFormInstance>();
const queryParams = ref<UserQuery>({
pageNum: 1,
pageSize: 10,
ipaddr: '',
userName: ''
});
/** 查询登录日志列表 */
const getList = async () => {
loading.value = true;
const res = await initData(queryParams.value);
onlineList.value = res.data?.rows;
total.value = res.data?.total;
loading.value = false;
};
/** 搜索按钮操作 */
const handleQuery = () => {
queryParams.value.pageNum = 1;
getList();
};
/** 重置按钮操作 */
const resetQuery = () => {
queryFormRef.value?.resetFields();
handleQuery();
};
function handleMain(row) {
console.log(row);
router.push({
path: '/customer/customerMain'
})
}
onMounted(() => {
getList();
});
</script>
<style lang="scss" scoped>
//@use '@/assets/styles/components/page-shell' as pageShell;
//
//@include pageShell.table-crud-page;
</style>

View File

@@ -0,0 +1,311 @@
<script lang="ts" setup>
import Pagecrumb from '@/components/Pagecrumb/index.vue';
const router = useRouter();
function handleEdit() {
router.push({
path: '/customer/customerEdit'
})
}
function handleBack() {
router.push({
path: '/customer/customerList'
})
}
</script>
<template>
<div class="Main">
<div class="flex justify-between">
<Pagecrumb></Pagecrumb>
<el-button plain type="info" @click="handleBack">返回用户列表</el-button>
</div>
<!-- 用户信息-->
<section class="customerInfoBox commonCard flex justify-between flex-items-center">
<div class="flex infoBox">
<el-image
class="customer-Img"
src="https://ts3.tc.mm.bing.net/th?id=ORMS.48a27ca8353fa47bf0dc8df38854d0e1&pid=Wdp&w=312&h=172&qlt=90&c=1&rs=1&dpr=1&p=0"></el-image>
<div class="flex flex-col justify-between">
<div>
<span class="userName">林小满</span>
<el-tag effect="light" round style="margin: 0 12px " type="success">
<div class="flex flex-items-center"><i class="circle"></i>
<span>正常</span></div>
</el-tag>
<el-tag effect="light" round type="info">150****0831</el-tag>
</div>
<div class="subInfoBox">
<span>用户ID: U20260918001 </span>
<span class="dat">·</span>
<span>注册时间: 2026-01-10 14:20</span>
<span class="dat">·</span>
<span>最后登录: 2026-09-17 09:35</span>
</div>
</div>
</div>
<div>
<el-button size="large" type="primary" @click="handleEdit">编辑用户</el-button>
<el-button plain size="large" type="primary">重置密码</el-button>
<el-button plain size="large" type="danger">禁用账号</el-button>
</div>
</section>
<el-row :gutter="20">
<el-col :span="12">
<!-- 账号信息-->
<div class="userNameBox commonCard">
<cardNav line-color="#2563eb" title="账号基础信息"></cardNav>
<ul class=" userNameInfoBox">
<li>
<span class="label">用户ID</span>
<span class="value">U20260918001</span>
</li>
<li>
<span class="label">手机号</span>
<span class="value">138****6688</span>
</li>
<li>
<span class="label">账号状态</span>
<el-tag type="success">正常</el-tag>
</li>
<li>
<span class="label">注册时间</span>
<span class="value">2026-01-10 14:20</span>
</li>
<li>
<span class="label">最后登录时间</span>
<span class="value">2026-09-17 09:35</span>
</li>
<li>
<span class="label">登录次数</span>
<span class="value">126次</span>
</li>
</ul>
</div>
</el-col>
<el-col :span="12">
<!-- 个人信息-->
<div class="userInfoBox commonCard">
<cardNav line-color="#14b8a6" title="个人资料"></cardNav>
<div class="userInfoInfoBox">
<div class="userInfoImageBox">
<el-image
class="userImage"
src="https://ts1.tc.mm.bing.net/th?id=OADD2.1174278572182418_11B688OHMGU9KL6&pid=21.2&c=3&roil=0.0242&roit=0.0014&roir=0.9742&roib=1&w=334&h=184&dynsize=1&qlt=90&dpr=1.50"></el-image>
<div class="description">APP端头像</div>
</div>
<ul>
<li>
<span class="label">昵称</span>
<span class="value">黎晓曼</span>
</li>
<li>
<span class="label">性别</span>
<span class="value">男</span>
</li>
<li>
<span class="label">生日</span>
<span class="value">1926-09-18</span>
</li>
<li>
<span class="label"> 所在地区</span>
<span class="value">上海市・浦东新区</span>
</li>
</ul>
</div>
<div class="footer">
个人资料由用户在 APP 端自行维护,后台仅可查看;如需调整请在「编辑用户」中操作。
</div>
</div>
</el-col>
</el-row>
<!-- 绑定设备清单-->
<div class="bindDevicesListBox commonCard">
<div class="flex justify-between">
<card-nav line-color="#f59e0b" subTitle="该用户名下全部绑定设备,点击操作可跳转设备详情"
title="绑定设备清单"></card-nav>
<el-tag type="primary">共3台</el-tag>
</div>
<el-table
class="data-table"
style="width: 100%"
>
<el-table-column :show-overflow-tooltip="true" align="center" label="设备名称" prop="tokenId"/>
<el-table-column :show-overflow-tooltip="true" align="center" label="MAC地址" prop="userName"/>
<el-table-column :show-overflow-tooltip="true" align="center" label="型号" prop="clientKey"/>
<el-table-column align="center" label="在线状态">
<template #default="scope">
<el-tag type="primary">在线</el-tag>
<el-tag type="danger">离线</el-tag>
</template>
</el-table-column>
<el-table-column :show-overflow-tooltip="true" align="center" label="绑定时间" prop="userName"/>
<el-table-column align="center" label="操作">
<template #default="scope">
<el-button plain type="primary">查看设备详情</el-button>
</template>
</el-table-column>
</el-table>
</div>
</div>
</template>
<style lang="scss" scoped>
.Main {
.customerInfoBox {
.infoBox {
.customer-Img {
width: 73px;
height: 72px;
border-radius: 50%;
margin-right: 24px;
}
.userName {
height: 26px;
line-height: 26px;
font-weight: bold;
color: rgba(17, 24, 39, 1);
font-size: 22px;
}
.circle {
display: block;
width: 7px;
height: 6px;
border-radius: 3px;
margin-right: 6px;
background-color: rgba(22, 163, 74, 1);
}
}
.subInfoBox {
line-height: 20px;
color: rgba(107, 114, 128, 1);
font-size: 13px;
text-align: left;
.dat {
margin: 0 1px;
}
}
}
.userNameBox {
min-height: 389px;
display: flex;
flex-direction: column;
.userNameInfoBox {
flex: 1;
margin-top: 25px;
display: flex;
align-items: center;
flex-direction: column;
justify-content: space-around;
li {
width: 100%;
display: flex;
justify-content: space-between;
.label {
line-height: 16px;
color: rgba(107, 114, 128, 1);
font-size: 13px;
}
.value {
line-height: 17px;
color: rgba(17, 24, 39, 1);
font-size: 14px;
}
}
}
}
.userInfoBox {
.userInfoInfoBox {
margin-top: 24px;
margin-bottom: 32px;
display: flex;
.userInfoImageBox {
width: 100px;
margin-right: 24px;
.userImage {
width: 97px;
height: 96px;
border-radius: 50%;
}
.description {
line-height: 16px;
color: rgba(156, 163, 175, 1);
font-size: 12px;
text-align: center;
}
}
ul {
flex: 1;
display: flex;
flex-direction: column;
justify-content: space-around;
li {
display: flex;
align-items: center;
justify-content: space-between;
.label {
line-height: 16px;
color: rgba(107, 114, 128, 1);
font-size: 13px;
text-align: left;
}
.value {
height: 17px;
line-height: 17px;
color: rgba(17, 24, 39, 1);
font-size: 14px;
text-align: left;
}
}
}
}
.footer {
height: 44px;
border-radius: 12px 12px 12px 12px;
background-color: rgba(247, 249, 252, 1);
border: 1px solid rgba(238, 240, 243, 1);
line-height: 18px;
padding: 13px;
color: rgba(156, 163, 175, 1);
font-size: 12px;
text-align: left;
}
}
.bindDevicesListBox {
margin-top: 16px;
.data-table {
margin-top: 16px;
}
}
}
</style>