6 Commits
3.1.1 ... 4.0.1

Author SHA1 Message Date
zzc
4bb09a0fb1 fix: system
All checks were successful
continuous-integration/drone/tag Build is passing
2026-04-22 21:51:49 +08:00
zzc
90bbed91f0 fix: message obj 2026-04-22 19:20:32 +08:00
zzc
6b8e8ab5d8 fix: message obj 2026-04-22 19:13:28 +08:00
zzc
f86e4b5b9a fix: add black 2026-04-21 23:09:36 +08:00
zzc
b52d832986 fix: add black 2026-04-21 22:46:53 +08:00
zzc
1121a6fa64 feat: card musin
All checks were successful
continuous-integration/drone/tag Build is passing
2026-03-19 16:44:33 +08:00
24 changed files with 1019 additions and 22 deletions

View File

@@ -0,0 +1,55 @@
import request from '@/utils/request'
export function getList(data) {
return request({
url: '/management/api/spring/card-music/list',
method: 'get',
params: data,
})
}
export function doAdd(data) {
return request({
url: '/management/api/spring/card-music',
method: 'post',
data,
})
}
export function doEdit(id, data) {
return request({
url: `/management/api/spring/card-music/${id}`,
method: 'put',
data,
})
}
export function doDelete(data) {
return request({
url: '/management/api/spring/card-music/delete',
method: 'put',
data,
})
}
export function doMoveUp(id) {
return request({
url: `/management/api/spring/card-music/moveUp/${id}`,
method: 'patch',
})
}
export function doMoveDown(id) {
return request({
url: `/management/api/spring/card-music/moveDown/${id}`,
method: 'patch',
})
}
export function toggleEnable(id, isEnabled) {
return request({
url: `/management/api/spring/card-music/enable/${id}`,
method: 'patch',
data: { isEnabled },
})
}

25
src/api/system/ipBlack.js Normal file
View File

@@ -0,0 +1,25 @@
import request from '@/utils/request'
export function getList(data) {
return request({
url: 'management/api/system/blacklist/ip/list',
method: 'get',
params: data,
})
}
export function doAdd(data) {
return request({
url: 'management/api/system/blacklist/ip',
method: 'post',
data,
})
}
export function doRemove(data) {
return request({
url: 'management/api/system/blacklist/ip/remove',
method: 'post',
data,
})
}

View File

@@ -0,0 +1,25 @@
import request from '@/utils/request'
export function getList(data) {
return request({
url: 'management/api/system/blacklist/user/list',
method: 'get',
params: data,
})
}
export function doAdd(data) {
return request({
url: 'management/api/system/blacklist/user',
method: 'post',
data,
})
}
export function doRemove(data) {
return request({
url: 'management/api/system/blacklist/user/remove',
method: 'post',
data,
})
}

View File

@@ -149,6 +149,12 @@ export const asyncRoutes = [
component: () => import('@/views/spring/blessing/titleTemplate/index'), component: () => import('@/views/spring/blessing/titleTemplate/index'),
meta: { title: '图片标题模版' }, meta: { title: '图片标题模版' },
}, },
{
path: 'music',
name: 'Music',
component: () => import('@/views/spring/blessing/music/index'),
meta: { title: '背景音乐' },
},
{ {
path: 'contentTemplate', path: 'contentTemplate',
name: 'contentTemplate', name: 'contentTemplate',
@@ -201,18 +207,18 @@ export const asyncRoutes = [
permissions: ['admin'], permissions: ['admin'],
}, },
children: [ children: [
{
path: 'systemAvatar',
name: 'SystemAvatar',
component: () => import('@/views/spring/avatar/systemAvatar/index'),
meta: { title: '系统头像' },
},
{ {
path: 'avatarCategory', path: 'avatarCategory',
name: 'AvatarCategory', name: 'AvatarCategory',
component: () => import('@/views/spring/avatar/category/index'), component: () => import('@/views/spring/avatar/category/index'),
meta: { title: '头像类型' }, meta: { title: '头像类型' },
}, },
{
path: 'systemAvatar',
name: 'SystemAvatar',
component: () => import('@/views/spring/avatar/systemAvatar/index'),
meta: { title: '系统头像' },
},
{ {
path: 'avatarFrame', path: 'avatarFrame',
name: 'AvatarFrame', name: 'AvatarFrame',
@@ -302,8 +308,8 @@ export const asyncRoutes = [
meta: { title: '用户签到记录' }, meta: { title: '用户签到记录' },
}, },
{ {
path: 'userChat', path: 'userDevice',
name: 'UserChat', name: 'UserDevice',
component: () => import('@/views/spring/user/device/index'), component: () => import('@/views/spring/user/device/index'),
meta: { title: '设备' }, meta: { title: '设备' },
}, },
@@ -372,6 +378,18 @@ export const asyncRoutes = [
component: () => import('@/views/personnelManagement/suspiciousRequest/index'), component: () => import('@/views/personnelManagement/suspiciousRequest/index'),
meta: { title: '异常请求' }, meta: { title: '异常请求' },
}, },
{
path: 'ipBlacklist',
name: 'IPBlacklist',
component: () => import('@/views/systemManagement/ipBlack/index'),
meta: { title: 'IP 黑名单' },
},
{
path: 'userBlacklist',
name: 'UserBlacklist',
component: () => import('@/views/systemManagement/userBlack/index'),
meta: { title: '用户 黑名单' },
},
{ {
path: 'uploadedFileManagement', path: 'uploadedFileManagement',
name: 'UploadedFileManagement', name: 'UploadedFileManagement',
@@ -446,8 +464,8 @@ export const asyncRoutes = [
// meta: { title: '用户' }, // meta: { title: '用户' },
// }, // },
// { // {
// path: 'userChat', // path: 'userDevice',
// name: 'UserChat', // name: 'userDevice',
// component: () => import('@/views/maomao/user/chat/index'), // component: () => import('@/views/maomao/user/chat/index'),
// meta: { title: '聊天' }, // meta: { title: '聊天' },
// }, // },

View File

@@ -54,6 +54,8 @@ instance.interceptors.request.use(
} }
if (store.getters['user/appId']) { if (store.getters['user/appId']) {
config.headers['x-app-id'] = store.getters['user/appId'] config.headers['x-app-id'] = store.getters['user/appId']
} else {
config.headers['x-app-id'] = '69665538a49b8ae3be50fe5d'
} }
if (config.method === 'get' && config.params) { if (config.method === 'get' && config.params) {
config.params = Vue.prototype.$baseLodash.pickBy(config.params, Vue.prototype.$baseLodash.identity) config.params = Vue.prototype.$baseLodash.pickBy(config.params, Vue.prototype.$baseLodash.identity)

View File

@@ -63,6 +63,9 @@
<el-form-item> <el-form-item>
<el-button icon="el-icon-search" type="primary" @click="handleQuery">查询</el-button> <el-button icon="el-icon-search" type="primary" @click="handleQuery">查询</el-button>
<el-button icon="el-icon-refresh" @click="resetQuery">重置</el-button> <el-button icon="el-icon-refresh" @click="resetQuery">重置</el-button>
<el-button :type="excludeAcquaintance ? 'primary' : 'default'" @click="toggleExcludeAcquaintance">去掉熟人</el-button>
<el-button :type="onlyUserId === true ? 'primary' : 'default'" @click="toggleOnlyUserId(true)">只显示有用户请求</el-button>
<el-button :type="onlyNoUserId === true ? 'primary' : 'default'" @click="toggleOnlyNoUserId()">只显示无用户请求</el-button>
</el-form-item> </el-form-item>
</el-form> </el-form>
</el-card> </el-card>
@@ -136,6 +139,14 @@
<el-link type="primary" :underline="false" @click="goToUser(row.userId)">{{ row.userId }}</el-link> <el-link type="primary" :underline="false" @click="goToUser(row.userId)">{{ row.userId }}</el-link>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="Device ID" prop="deviceId" show-overflow-tooltip>
<template slot-scope="{ row }">
<el-link v-if="row.deviceId" type="primary" :underline="false" @click="goToDevice(row.deviceId)">
{{ row.deviceId }}
</el-link>
<span v-else>-</span>
</template>
</el-table-column>
</el-table> </el-table>
<el-pagination <el-pagination
background background
@@ -175,6 +186,9 @@
}, },
data() { data() {
return { return {
excludeAcquaintance: false,
onlyUserId: null, // null: all, true: only with user
onlyNoUserId: null, // null: all, true: only without user
eventNameMap, eventNameMap,
eventTypeMap, eventTypeMap,
appMap, appMap,
@@ -273,6 +287,16 @@
pageSize: 10000, // 获取足够多的数据进行前端统计,或者应该依赖后端聚合接口 pageSize: 10000, // 获取足够多的数据进行前端统计,或者应该依赖后端聚合接口
} }
if (this.excludeAcquaintance) {
params.excludeAcquaintance = true
}
if (this.onlyUserId !== null) {
params.onlyUserId = this.onlyUserId
}
if (this.onlyNoUserId !== null) {
params.onlyNoUserId = this.onlyNoUserId
}
const { data } = await getTrackingLogsList(params) const { data } = await getTrackingLogsList(params)
this.list = data.list || [] this.list = data.list || []
@@ -314,6 +338,28 @@
this.pageSize = val this.pageSize = val
this.currentPage = 1 this.currentPage = 1
}, },
toggleExcludeAcquaintance() {
this.excludeAcquaintance = !this.excludeAcquaintance
this.fetchData()
},
toggleOnlyUserId(value) {
if (this.onlyUserId === value) {
this.onlyUserId = null // Toggle off if already selected
} else {
this.onlyUserId = value
this.onlyNoUserId = null // 互斥
}
this.fetchData()
},
toggleOnlyNoUserId() {
if (this.onlyNoUserId === true) {
this.onlyNoUserId = null // Toggle off if already selected
} else {
this.onlyNoUserId = true
this.onlyUserId = null // 互斥
}
this.fetchData()
},
handleCurrentChange(val) { handleCurrentChange(val) {
this.currentPage = val this.currentPage = val
}, },
@@ -330,6 +376,10 @@
query: { userId }, query: { userId },
}) })
}, },
goToDevice(deviceId) {
if (!deviceId) return
this.$router.push({ path: '/spring/user/userDevice', query: { deviceId } })
},
handleEventNameClick(params) { handleEventNameClick(params) {
const name = params.name const name = params.name
// name 可能是中文映射名,需要反向查找 key或者在 processData 时把 key 存入 // name 可能是中文映射名,需要反向查找 key或者在 processData 时把 key 存入

View File

@@ -1,5 +1,9 @@
<template> <template>
<div class="accessLogManagement-container"> <div class="accessLogManagement-container">
<el-tabs v-model="queryForm.appId" type="card" @tab-click="handleTabClick">
<el-tab-pane v-for="item in applicationList" :key="item.id" :label="item.name" :name="item.id" />
</el-tabs>
<vab-query-form> <vab-query-form>
<vab-query-form-right-panel :span="12"> <vab-query-form-right-panel :span="12">
<el-form :inline="true" :model="queryForm" @submit.native.prevent> <el-form :inline="true" :model="queryForm" @submit.native.prevent>
@@ -24,7 +28,7 @@
</el-table-column> </el-table-column>
<el-table-column align="center" label="类型" show-overflow-tooltip> <el-table-column align="center" label="类型" show-overflow-tooltip>
<template #default="{ row }"> <template #default="{ row }">
<el-tag v-if="row.url.includes('api/v')" type="success">应用</el-tag> <el-tag v-if="row.platform.includes('weixin')" type="success">微信小程序</el-tag>
<el-tag v-else type="info">后台</el-tag> <el-tag v-else type="info">后台</el-tag>
</template> </template>
</el-table-column> </el-table-column>
@@ -39,8 +43,13 @@
{{ row.userName || row.userId }} {{ row.userName || row.userId }}
</template> </template>
</el-table-column> </el-table-column>
<el-table-column align="center" label="method" prop="method" show-overflow-tooltip width="80" />
<el-table-column align="center" label="statusCode" prop="statusCode" show-overflow-tooltip width="100" />
<el-table-column align="center" label="耗时(ms)" prop="duration" show-overflow-tooltip width="100" />
<el-table-column align="center" label="平台" prop="platform" show-overflow-tooltip width="100" />
<el-table-column align="center" label="userAgent" prop="userAgent" show-overflow-tooltip /> <el-table-column align="center" label="userAgent" prop="userAgent" show-overflow-tooltip />
<el-table-column align="center" label="referrer" prop="referrer" show-overflow-tooltip /> <el-table-column align="center" label="referrer" prop="referrer" show-overflow-tooltip />
<el-table-column align="center" label="body" prop="body" show-overflow-tooltip />
</el-table> </el-table>
<el-pagination <el-pagination
background background
@@ -56,6 +65,7 @@
<script> <script>
import { getList } from '@/api/accessLogManagement' import { getList } from '@/api/accessLogManagement'
import { getList as getApplicationList } from '@/api/appManagement'
import { formatTime } from '@/utils' import { formatTime } from '@/utils'
export default { export default {
@@ -69,14 +79,17 @@
selectRows: '', selectRows: '',
elementLoadingText: '正在加载...', elementLoadingText: '正在加载...',
queryForm: { queryForm: {
appId: '',
pageNo: 1, pageNo: 1,
pageSize: 10, pageSize: 10,
permission: '', permission: '',
}, },
applicationList: [],
timeOutID: null, timeOutID: null,
} }
}, },
created() { created() {
this.fetchApplicationList()
this.fetchData() this.fetchData()
}, },
@@ -84,6 +97,13 @@
clearTimeout(this.timeOutID) clearTimeout(this.timeOutID)
}, },
methods: { methods: {
async fetchApplicationList() {
const { data } = await getApplicationList({ pageNo: 1, pageSize: 100 })
this.applicationList = data.list
},
handleTabClick() {
this.queryData()
},
formatTime, formatTime,
setSelectRows(val) { setSelectRows(val) {
this.selectRows = val this.selectRows = val

View File

@@ -32,9 +32,12 @@
</vab-query-form> </vab-query-form>
<el-table v-loading="listLoading" :data="list" :element-loading-text="elementLoadingText"> <el-table v-loading="listLoading" :data="list" :element-loading-text="elementLoadingText">
<el-table-column align="center" label="IP" prop="ip" show-overflow-tooltip />
<el-table-column align="center" label="地址" prop="address" show-overflow-tooltip />
<el-table-column align="center" label="用户" show-overflow-tooltip> <el-table-column align="center" label="用户" show-overflow-tooltip>
<template slot-scope="{ row }"> <template slot-scope="{ row }">
{{ row.userName || row.userId }} {{ row.userId }}
</template> </template>
</el-table-column> </el-table-column>
<el-table-column align="center" label="应用" show-overflow-tooltip> <el-table-column align="center" label="应用" show-overflow-tooltip>
@@ -42,7 +45,6 @@
{{ row.appName || row.appId }} {{ row.appName || row.appId }}
</template> </template>
</el-table-column> </el-table-column>
<el-table-column align="center" label="IP" prop="ip" show-overflow-tooltip />
<el-table-column align="center" label="路径" prop="path" show-overflow-tooltip /> <el-table-column align="center" label="路径" prop="path" show-overflow-tooltip />
<el-table-column align="center" label="原因" prop="reason" show-overflow-tooltip /> <el-table-column align="center" label="原因" prop="reason" show-overflow-tooltip />
<el-table-column align="center" label="UserAgent" prop="userAgent" show-overflow-tooltip /> <el-table-column align="center" label="UserAgent" prop="userAgent" show-overflow-tooltip />

View File

@@ -122,7 +122,7 @@
this.fetchData() this.fetchData()
}, },
goToDevice(deviceId) { goToDevice(deviceId) {
this.$router.push({ path: '/spring/user/userChat', query: { deviceId } }) this.$router.push({ path: '/spring/user/userDevice', query: { deviceId } })
}, },
async fetchData() { async fetchData() {
this.listLoading = true this.listLoading = true

View File

@@ -186,7 +186,7 @@
this.fetchData() this.fetchData()
}, },
goToDevice(deviceId) { goToDevice(deviceId) {
this.$router.push({ path: '/spring/user/userChat', query: { deviceId } }) this.$router.push({ path: '/spring/user/userDevice', query: { deviceId } })
}, },
goToTemplate(templateId) { goToTemplate(templateId) {
this.$router.push({ path: '/spring/blessing/template', query: { templateId } }) this.$router.push({ path: '/spring/blessing/template', query: { templateId } })

View File

@@ -0,0 +1,183 @@
<template>
<el-dialog :title="title" :visible.sync="dialogFormVisible" width="500px" @close="close">
<el-form ref="form" label-width="80px" :model="form" :rules="rules">
<el-form-item label="音乐名称" prop="name">
<el-input v-model="form.name" autocomplete="off" placeholder="请输入音乐名称" />
</el-form-item>
<el-form-item label="场景" prop="scene">
<el-select v-model="form.scene" clearable placeholder="请选择场景(可为空)" style="width: 100%">
<el-option v-for="item in sceneList" :key="item.scene" :label="item.sceneName" :value="item.scene" />
</el-select>
</el-form-item>
<el-form-item label="标签" prop="tag">
<el-input v-model="form.tag" autocomplete="off" placeholder="请输入标签(可选)" />
</el-form-item>
<el-form-item label="音乐文件" prop="musicUrl">
<el-upload
accept="audio/*"
:action="uploadUrl"
:before-upload="beforeUpload"
:headers="uploadHeaders"
:on-error="handleUploadError"
:on-success="handleUploadSuccess"
:show-file-list="false"
>
<el-button size="small" type="primary">点击上传</el-button>
<div slot="tip" class="el-upload__tip">只能上传音频文件且不超过 10MB</div>
</el-upload>
<div v-if="form.musicUrl" style="margin-top: 10px">
<audio controls :src="form.musicUrl" style="width: 100%"></audio>
</div>
</el-form-item>
<el-form-item v-if="!form.id" label="是否启用" prop="isEnabled">
<el-switch v-model="form.isEnabled" active-text="启用" :active-value="true" inactive-text="禁用" :inactive-value="false" />
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="close"> </el-button>
<el-button :loading="loading" type="primary" @click="save"> </el-button>
</div>
</el-dialog>
</template>
<script>
import { doEdit, doAdd } from '@/api/spring/blessing/music/index'
import { getAll as getAllScenes } from '@/api/spring/blessing/scene'
import { getAccessToken } from '@/utils/accessToken'
export default {
name: 'MusicManagementEdit',
data() {
return {
id: '',
form: {
name: '',
scene: '',
musicUrl: '',
tag: '',
isEnabled: true,
},
rules: {
name: [{ required: true, trigger: 'blur', message: '请输入音乐名称' }],
musicUrl: [{ required: true, trigger: 'change', message: '请上传音乐文件' }],
},
title: '',
dialogFormVisible: false,
sceneList: [],
token: getAccessToken() || '',
loading: false,
}
},
computed: {
uploadUrl() {
return `${process.env.VUE_APP_API_BASE_URL}/management/api/common/upload`
},
uploadHeaders() {
let userId = ''
let appId = ''
if (this.$store.state?.user?.userId) {
userId = this.$store.state?.user?.userId
}
if (this.$store.state?.user?.appId) {
appId = this.$store.state?.user?.appId
}
return {
Authorization: `${this.token}`,
'x-user-id': userId,
'x-app-id': appId,
}
},
},
created() {
this.fetchSceneList()
},
methods: {
async fetchSceneList() {
try {
const { data } = await getAllScenes()
this.sceneList = data || []
} catch (error) {
console.error(error)
}
},
beforeUpload(file) {
const isValidSize = file.size / 1024 / 1024 < 10
if (!isValidSize) {
this.$message.error('文件大小不能超过 10MB')
return false
}
this.loading = true
return true
},
handleUploadSuccess(response) {
this.loading = false
if (response.code === 200) {
this.form.musicUrl = `https://file.lihailezzc.com/${response.data.key}`
this.$message.success('上传成功!')
} else {
this.$message.error('上传失败,请重试!')
}
},
handleUploadError() {
this.loading = false
this.$message.error('上传失败,请重试!')
},
showEdit(row) {
if (!row) {
this.title = '添加'
this.id = ''
this.form = {
name: '',
scene: '',
musicUrl: '',
tag: '',
isEnabled: true,
}
} else {
this.title = '编辑'
this.id = row.id
this.form = {
id: row.id,
name: row.name,
scene: row.scene,
musicUrl: row.musicUrl,
tag: row.tag,
isEnabled: row.isEnabled,
}
}
this.dialogFormVisible = true
},
close() {
this.$refs['form'].resetFields()
this.form = this.$options.data().form
this.id = ''
this.dialogFormVisible = false
},
save() {
this.$refs['form'].validate(async (valid) => {
if (valid) {
this.loading = true
try {
if (this.id) {
const { msg } = await doEdit(this.id, this.form)
this.$baseMessage(msg, 'success')
} else {
const { msg } = await doAdd(this.form)
this.$baseMessage(msg, 'success')
}
this.$emit('fetch-data')
this.close()
} catch (error) {
console.error(error)
} finally {
this.loading = false
}
} else {
return false
}
})
},
},
}
</script>

View File

@@ -0,0 +1,228 @@
<template>
<div class="music-management-container">
<vab-query-form>
<vab-query-form-left-panel :span="12">
<el-button icon="el-icon-plus" type="primary" @click="handleEdit">添加</el-button>
<el-button icon="el-icon-delete" type="danger" @click="handleDelete">批量删除</el-button>
</vab-query-form-left-panel>
<vab-query-form-right-panel :span="12">
<el-form :inline="true" :model="queryForm" @submit.native.prevent>
<el-form-item>
<el-select v-model="queryForm.scene" clearable placeholder="请选择场景" @change="queryData">
<el-option v-for="item in sceneList" :key="item.scene" :label="item.sceneName" :value="item.scene" />
</el-select>
</el-form-item>
<el-form-item>
<el-input v-model.trim="queryForm.keyword" clearable placeholder="请输入查询条件" />
</el-form-item>
<el-form-item>
<el-button icon="el-icon-search" type="primary" @click="queryData">查询</el-button>
</el-form-item>
</el-form>
</vab-query-form-right-panel>
</vab-query-form>
<el-table v-loading="listLoading" :data="list" :element-loading-text="elementLoadingText" @selection-change="setSelectRows">
<el-table-column align="center" show-overflow-tooltip type="selection" width="55" />
<el-table-column align="center" label="排序" prop="sort" sortable width="100" />
<el-table-column align="center" label="音乐名称" prop="name" show-overflow-tooltip />
<el-table-column align="center" label="场景" show-overflow-tooltip>
<template #default="{ row }">
{{ getSceneName(row.scene) }}
</template>
</el-table-column>
<el-table-column align="center" label="试听" width="300">
<template slot-scope="scope">
<audio controls :src="scope.row.musicUrl" style="width: 250px; height: 40px"></audio>
</template>
</el-table-column>
<el-table-column align="center" label="标签" prop="tag" show-overflow-tooltip />
<el-table-column align="center" label="状态" prop="isEnabled" width="100">
<template #default="{ row }">
<el-switch active-color="#13ce66" inactive-color="#ff4949" :value="row.isEnabled" @change="handleToggleEnable(row, $event)" />
</template>
</el-table-column>
<el-table-column align="center" fixed="right" label="操作" width="200">
<template slot-scope="scope">
<el-button type="text" @click="handleEdit(scope.row)">编辑</el-button>
<el-button :disabled="!scope.row.isEnabled || isFirstEnabled(scope.row)" type="text" @click="handleMoveUp(scope.row)">
上移
</el-button>
<el-button :disabled="!scope.row.isEnabled || isLastEnabled(scope.row)" type="text" @click="handleMoveDown(scope.row)">
下移
</el-button>
<el-button type="text" @click="handleDelete(scope.row)">删除</el-button>
</template>
</el-table-column>
</el-table>
<el-pagination
background
:current-page="queryForm.pageNo"
:layout="layout"
:page-size="queryForm.pageSize"
:total="total"
@current-change="handleCurrentChange"
@size-change="handleSizeChange"
/>
<edit ref="edit" @fetch-data="fetchData" />
</div>
</template>
<script>
import { doDelete, getList, toggleEnable, doMoveUp, doMoveDown } from '@/api/spring/blessing/music/index'
import { getAll as getAllScenes } from '@/api/spring/blessing/scene'
import Edit from './components/AppManagementEdit'
export default {
name: 'MusicManagement',
components: { Edit },
data() {
return {
list: [],
listLoading: true,
layout: 'total, sizes, prev, pager, next, jumper',
total: 0,
selectRows: [],
elementLoadingText: '正在加载...',
queryForm: {
pageNo: 1,
pageSize: 10,
keyword: '',
scene: '',
},
sceneList: [],
}
},
created() {
this.fetchSceneList()
this.fetchData()
},
methods: {
setSelectRows(val) {
this.selectRows = val
},
handleEdit(row) {
if (row && row.id) {
this.$refs['edit'].showEdit(row)
} else {
this.$refs['edit'].showEdit()
}
},
handleDelete(row) {
if (row && row.id) {
this.$baseConfirm('你确定要删除当前项吗', null, async () => {
try {
const { msg } = await doDelete({ ids: [row.id] })
this.$baseMessage(msg, 'success')
this.fetchData()
} catch (error) {
console.error(error)
}
})
} else {
if (this.selectRows.length > 0) {
const ids = this.selectRows.map((item) => item.id)
this.$baseConfirm('你确定要删除选中项吗', null, async () => {
try {
const { msg } = await doDelete({ ids })
this.$baseMessage(msg, 'success')
this.fetchData()
} catch (error) {
console.error(error)
}
})
} else {
this.$baseMessage('未选中任何行', 'error')
return false
}
}
},
handleSizeChange(val) {
this.queryForm.pageSize = val
this.fetchData()
},
handleCurrentChange(val) {
this.queryForm.pageNo = val
this.fetchData()
},
queryData() {
this.queryForm.pageNo = 1
this.fetchData()
},
async fetchData() {
this.listLoading = true
try {
const { data } = await getList(this.queryForm)
this.list = data.list
this.total = data.totalCount
} catch (error) {
console.error(error)
} finally {
this.listLoading = false
}
},
async handleToggleEnable(row, value) {
this.$baseConfirm(`你确定要${value ? '启用' : '禁用'}当前项吗`, null, async () => {
try {
const { msg } = await toggleEnable(row.id, value)
this.$baseMessage(msg, 'success')
this.fetchData()
} catch (error) {
console.error(error)
}
})
},
async handleMoveUp(row) {
try {
const { msg } = await doMoveUp(row.id)
this.$baseMessage(msg, 'success')
this.fetchData()
} catch (error) {
console.error(error)
}
},
async handleMoveDown(row) {
try {
const { msg } = await doMoveDown(row.id)
this.$baseMessage(msg, 'success')
this.fetchData()
} catch (error) {
console.error(error)
}
},
isFirstEnabled(row) {
const enabledList = this.list.filter((item) => item.isEnabled)
return enabledList.length > 0 && enabledList[0].id === row.id
},
isLastEnabled(row) {
const enabledList = this.list.filter((item) => item.isEnabled)
return enabledList.length > 0 && enabledList[enabledList.length - 1].id === row.id
},
async fetchSceneList() {
try {
const { data } = await getAllScenes()
this.sceneList = data || []
} catch (error) {
console.error(error)
}
},
getSceneName(scene) {
if (!scene) return '通用'
const found = this.sceneList.find((item) => item.scene === scene)
return found ? found.sceneName : scene
},
},
}
</script>
<style scoped>
.music-management-container {
padding: 20px;
}
</style>

View File

@@ -136,7 +136,7 @@
this.fetchData() this.fetchData()
}, },
goToDevice(deviceId) { goToDevice(deviceId) {
this.$router.push({ path: '/spring/user/userChat', query: { deviceId } }) this.$router.push({ path: '/spring/user/userDevice', query: { deviceId } })
}, },
goToCard(cardId) { goToCard(cardId) {
// Assuming there is a card detail or list page, but for now just placeholder or link to card list // Assuming there is a card detail or list page, but for now just placeholder or link to card list

View File

@@ -139,7 +139,7 @@
this.fetchData() this.fetchData()
}, },
goToDevice(deviceId) { goToDevice(deviceId) {
this.$router.push({ path: '/spring/user/userChat', query: { deviceId } }) this.$router.push({ path: '/spring/user/userDevice', query: { deviceId } })
}, },
async fetchData() { async fetchData() {
this.listLoading = true this.listLoading = true

View File

@@ -199,7 +199,7 @@
this.fetchData() this.fetchData()
}, },
goToDevice(deviceId) { goToDevice(deviceId) {
this.$router.push({ path: '/spring/user/userChat', query: { deviceId } }) this.$router.push({ path: '/spring/user/userDevice', query: { deviceId } })
}, },
goToContent(row) { goToContent(row) {
if (row.scene === 'card_generate') { if (row.scene === 'card_generate') {

View File

@@ -202,7 +202,7 @@
this.fetchData() this.fetchData()
}, },
goToDevice(deviceId) { goToDevice(deviceId) {
this.$router.push({ path: '/spring/user/userChat', query: { deviceId } }) this.$router.push({ path: '/spring/user/userDevice', query: { deviceId } })
}, },
goToContent(row) { goToContent(row) {
if (row.type === 1) { if (row.type === 1) {

View File

@@ -165,7 +165,7 @@
this.fetchData() this.fetchData()
}, },
goToDevice(deviceId) { goToDevice(deviceId) {
this.$router.push({ path: '/spring/user/userChat', query: { deviceId } }) this.$router.push({ path: '/spring/user/userDevice', query: { deviceId } })
}, },
goToShareRecord(userId) { goToShareRecord(userId) {
this.$router.push({ path: '/spring/user/shareRecord', query: { userId } }) this.$router.push({ path: '/spring/user/shareRecord', query: { userId } })

View File

@@ -200,7 +200,7 @@
this.$router.push({ path: '/spring/user/shareRecord', query: { keyword: shareToken } }) this.$router.push({ path: '/spring/user/shareRecord', query: { keyword: shareToken } })
}, },
goToDevice(deviceId) { goToDevice(deviceId) {
this.$router.push({ path: '/spring/user/userChat', query: { deviceId } }) this.$router.push({ path: '/spring/user/userDevice', query: { deviceId } })
}, },
goToTemplate(templateId) { goToTemplate(templateId) {
this.$router.push({ path: '/spring/blessing/template', query: { templateId } }) this.$router.push({ path: '/spring/blessing/template', query: { templateId } })

View File

@@ -214,7 +214,7 @@
this.fetchData() this.fetchData()
}, },
goToDevice(deviceId) { goToDevice(deviceId) {
this.$router.push({ path: '/spring/user/userChat', query: { deviceId } }) this.$router.push({ path: '/spring/user/userDevice', query: { deviceId } })
}, },
goToShareRecord(userId) { goToShareRecord(userId) {
this.$router.push({ path: '/spring/user/shareRecord', query: { userId } }) this.$router.push({ path: '/spring/user/shareRecord', query: { userId } })

View File

@@ -69,6 +69,10 @@
} }
}, },
created() { created() {
const { permission } = this.$route.query
if (permission) {
this.queryForm.permission = permission
}
this.fetchData() this.fetchData()
}, },

View File

@@ -0,0 +1,63 @@
<template>
<el-dialog :title="title" :visible.sync="dialogFormVisible" width="500px" @close="close">
<el-form ref="form" label-width="80px" :model="form" :rules="rules">
<el-form-item label="IP地址" prop="ip">
<el-input v-model.trim="form.ip" autocomplete="off" placeholder="请输入需要拉黑的IP地址" />
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="close"> </el-button>
<el-button type="primary" @click="save"> </el-button>
</div>
</el-dialog>
</template>
<script>
import { doAdd } from '@/api/system/ipBlack'
export default {
name: 'IPBlacklistEdit',
data() {
return {
form: {
ip: '',
},
rules: {
ip: [{ required: true, trigger: 'blur', message: '请输入IP地址' }],
},
title: '新增',
dialogFormVisible: false,
}
},
methods: {
showEdit() {
this.title = '新增'
this.form = this.$options.data().form
this.dialogFormVisible = true
},
close() {
this.$refs['form'].resetFields()
this.form = this.$options.data().form
this.dialogFormVisible = false
},
save() {
this.$refs['form'].validate(async (valid) => {
if (valid) {
try {
const { msg } = await doAdd(this.form)
this.$baseMessage(msg, 'success')
this.$refs['form'].resetFields()
this.dialogFormVisible = false
this.$emit('fetch-data')
this.form = this.$options.data().form
} catch (error) {
console.error(error)
}
} else {
return false
}
})
},
},
}
</script>

View File

@@ -0,0 +1,130 @@
<template>
<div class="ip-blacklist-container">
<vab-query-form>
<vab-query-form-left-panel :span="12">
<el-button icon="el-icon-plus" type="primary" @click="handleAdd">新增</el-button>
<el-button icon="el-icon-delete" type="danger" @click="handleDelete">移除选中</el-button>
</vab-query-form-left-panel>
<vab-query-form-right-panel :span="12">
<el-form :inline="true" :model="queryForm" @submit.native.prevent>
<el-form-item>
<el-input v-model.trim="queryForm.ip" clearable placeholder="请输入查询的IP" />
</el-form-item>
<el-form-item>
<el-button icon="el-icon-search" type="primary" @click="queryData">查询</el-button>
</el-form-item>
</el-form>
</vab-query-form-right-panel>
</vab-query-form>
<el-table v-loading="listLoading" :data="list" :element-loading-text="elementLoadingText" @selection-change="setSelectRows">
<el-table-column align="center" show-overflow-tooltip type="selection" width="55" />
<el-table-column align="center" label="IP" prop="ip" show-overflow-tooltip />
<el-table-column align="center" label="地址" prop="address" show-overflow-tooltip />
<el-table-column align="center" fixed="right" label="操作" show-overflow-tooltip width="200">
<template #default="{ row }">
<el-button type="text" @click="handleDelete(row)">移除</el-button>
</template>
</el-table-column>
</el-table>
<el-pagination
background
:current-page="queryForm.pageNo"
:layout="layout"
:page-size="queryForm.pageSize"
:total="total"
@current-change="handleCurrentChange"
@size-change="handleSizeChange"
/>
<edit ref="edit" @fetch-data="fetchData" />
</div>
</template>
<script>
import { getList, doRemove } from '@/api/system/ipBlack'
import Edit from './components/IPBlacklistEdit'
export default {
name: 'IPBlacklist',
components: { Edit },
data() {
return {
list: [],
listLoading: true,
layout: 'total, sizes, prev, pager, next, jumper',
total: 0,
selectRows: [],
elementLoadingText: '正在加载...',
queryForm: {
pageNo: 1,
pageSize: 10,
ip: '',
},
}
},
created() {
this.fetchData()
},
methods: {
setSelectRows(val) {
this.selectRows = val
},
handleAdd() {
this.$refs['edit'].showEdit()
},
handleDelete(row) {
if (row.ip) {
this.$baseConfirm('你确定要将当前IP从黑名单中移除吗', null, async () => {
const { msg } = await doRemove({ ips: [row.ip] })
this.$baseMessage(msg, 'success')
this.fetchData()
})
} else {
if (this.selectRows.length > 0) {
const ips = this.selectRows.map((item) => item.ip)
this.$baseConfirm('你确定要将选中的IP从黑名单中移除吗', null, async () => {
const { msg } = await doRemove({ ips })
this.$baseMessage(msg, 'success')
this.fetchData()
})
} else {
this.$baseMessage('未选中任何行', 'error')
return false
}
}
},
handleSizeChange(val) {
this.queryForm.pageSize = val
this.fetchData()
},
handleCurrentChange(val) {
this.queryForm.pageNo = val
this.fetchData()
},
queryData() {
this.queryForm.pageNo = 1
this.fetchData()
},
async fetchData() {
this.listLoading = true
try {
const { data } = await getList(this.queryForm)
this.list = data.list
this.total = data.totalCount
} catch (error) {
console.error(error)
} finally {
this.listLoading = false
}
},
},
}
</script>
<style scoped>
.ip-blacklist-container {
padding: 20px;
}
</style>

View File

@@ -0,0 +1,63 @@
<template>
<el-dialog :title="title" :visible.sync="dialogFormVisible" width="500px" @close="close">
<el-form ref="form" label-width="80px" :model="form" :rules="rules">
<el-form-item label="用户ID" prop="userId">
<el-input v-model.trim="form.userId" autocomplete="off" placeholder="请输入需要拉黑的用户ID" />
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="close"> </el-button>
<el-button type="primary" @click="save"> </el-button>
</div>
</el-dialog>
</template>
<script>
import { doAdd } from '@/api/system/userBlack'
export default {
name: 'UserBlacklistEdit',
data() {
return {
form: {
userId: '',
},
rules: {
userId: [{ required: true, trigger: 'blur', message: '请输入用户ID' }],
},
title: '新增',
dialogFormVisible: false,
}
},
methods: {
showEdit() {
this.title = '新增'
this.form = this.$options.data().form
this.dialogFormVisible = true
},
close() {
this.$refs['form'].resetFields()
this.form = this.$options.data().form
this.dialogFormVisible = false
},
save() {
this.$refs['form'].validate(async (valid) => {
if (valid) {
try {
const { msg } = await doAdd(this.form)
this.$baseMessage(msg, 'success')
this.$refs['form'].resetFields()
this.dialogFormVisible = false
this.$emit('fetch-data')
this.form = this.$options.data().form
} catch (error) {
console.error(error)
}
} else {
return false
}
})
},
},
}
</script>

View File

@@ -0,0 +1,129 @@
<template>
<div class="user-blacklist-container">
<vab-query-form>
<vab-query-form-left-panel :span="12">
<el-button icon="el-icon-plus" type="primary" @click="handleAdd">新增</el-button>
<el-button icon="el-icon-delete" type="danger" @click="handleDelete">移除选中</el-button>
</vab-query-form-left-panel>
<vab-query-form-right-panel :span="12">
<el-form :inline="true" :model="queryForm" @submit.native.prevent>
<el-form-item>
<el-input v-model.trim="queryForm.userId" clearable placeholder="请输入查询的用户ID" />
</el-form-item>
<el-form-item>
<el-button icon="el-icon-search" type="primary" @click="queryData">查询</el-button>
</el-form-item>
</el-form>
</vab-query-form-right-panel>
</vab-query-form>
<el-table v-loading="listLoading" :data="list" :element-loading-text="elementLoadingText" @selection-change="setSelectRows">
<el-table-column align="center" show-overflow-tooltip type="selection" width="55" />
<el-table-column align="center" label="用户ID" prop="userId" show-overflow-tooltip />
<el-table-column align="center" fixed="right" label="操作" show-overflow-tooltip width="200">
<template #default="{ row }">
<el-button type="text" @click="handleDelete(row)">移除</el-button>
</template>
</el-table-column>
</el-table>
<el-pagination
background
:current-page="queryForm.pageNo"
:layout="layout"
:page-size="queryForm.pageSize"
:total="total"
@current-change="handleCurrentChange"
@size-change="handleSizeChange"
/>
<edit ref="edit" @fetch-data="fetchData" />
</div>
</template>
<script>
import { getList, doRemove } from '@/api/system/userBlack'
import Edit from './components/UserBlacklistEdit'
export default {
name: 'UserBlacklist',
components: { Edit },
data() {
return {
list: [],
listLoading: true,
layout: 'total, sizes, prev, pager, next, jumper',
total: 0,
selectRows: [],
elementLoadingText: '正在加载...',
queryForm: {
pageNo: 1,
pageSize: 10,
userId: '',
},
}
},
created() {
this.fetchData()
},
methods: {
setSelectRows(val) {
this.selectRows = val
},
handleAdd() {
this.$refs['edit'].showEdit()
},
handleDelete(row) {
if (row.userId) {
this.$baseConfirm('你确定要将当前用户从黑名单中移除吗?', null, async () => {
const { msg } = await doRemove({ userIds: [row.userId] })
this.$baseMessage(msg, 'success')
this.fetchData()
})
} else {
if (this.selectRows.length > 0) {
const userIds = this.selectRows.map((item) => item.userId)
this.$baseConfirm('你确定要将选中的用户从黑名单中移除吗?', null, async () => {
const { msg } = await doRemove({ userIds })
this.$baseMessage(msg, 'success')
this.fetchData()
})
} else {
this.$baseMessage('未选中任何行', 'error')
return false
}
}
},
handleSizeChange(val) {
this.queryForm.pageSize = val
this.fetchData()
},
handleCurrentChange(val) {
this.queryForm.pageNo = val
this.fetchData()
},
queryData() {
this.queryForm.pageNo = 1
this.fetchData()
},
async fetchData() {
this.listLoading = true
try {
const { data } = await getList(this.queryForm)
this.list = data.list
this.total = data.totalCount
} catch (error) {
console.error(error)
} finally {
this.listLoading = false
}
},
},
}
</script>
<style scoped>
.user-blacklist-container {
padding: 20px;
}
</style>