Compare commits
12 Commits
3.0.1
...
33d4a02a5d
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
33d4a02a5d | ||
|
|
718fdd7826 | ||
|
|
0ec5aa2228 | ||
|
|
d36a2ca5f1 | ||
|
|
780facd765 | ||
|
|
e2366f9036 | ||
|
|
db2dcaf64e | ||
|
|
f6ae86557e | ||
|
|
0551f2047c | ||
|
|
cba8e32719 | ||
|
|
bb45d41b7f | ||
|
|
20a71673f6 |
@@ -1,2 +1,3 @@
|
||||
VUE_APP_API_BASE_URL=http://127.0.0.1:3999
|
||||
VUE_APP_FILE_BASE_URL=https://file.lihailezzc.com
|
||||
# VUE_APP_API_BASE_URL=https://apis.lihailezzc.com
|
||||
@@ -1 +1,2 @@
|
||||
VUE_APP_API_BASE_URL=https://api.ai-meng.com
|
||||
VUE_APP_FILE_BASE_URL=https://file.lihailezzc.com
|
||||
55
src/api/spring/avatar/decor.js
Normal file
55
src/api/spring/avatar/decor.js
Normal file
@@ -0,0 +1,55 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
export function getList(data) {
|
||||
return request({
|
||||
url: '/management/api/spring/avatar/decor/list',
|
||||
method: 'get',
|
||||
params: data,
|
||||
})
|
||||
}
|
||||
|
||||
export function doAdd(data) {
|
||||
return request({
|
||||
url: '/management/api/spring/avatar/decor',
|
||||
method: 'post',
|
||||
data,
|
||||
})
|
||||
}
|
||||
|
||||
export function doEdit(id, data) {
|
||||
return request({
|
||||
url: `/management/api/spring/avatar/decor/${id}`,
|
||||
method: 'put',
|
||||
data,
|
||||
})
|
||||
}
|
||||
|
||||
export function doDelete(data) {
|
||||
return request({
|
||||
url: '/management/api/spring/avatar/decor/delete',
|
||||
method: 'put',
|
||||
data,
|
||||
})
|
||||
}
|
||||
|
||||
export function doMoveUp(id) {
|
||||
return request({
|
||||
url: `/management/api/spring/avatar/decor/moveUp/${id}`,
|
||||
method: 'patch',
|
||||
})
|
||||
}
|
||||
|
||||
export function doMoveDown(id) {
|
||||
return request({
|
||||
url: `/management/api/spring/avatar/decor/moveDown/${id}`,
|
||||
method: 'patch',
|
||||
})
|
||||
}
|
||||
|
||||
export function toggleEnable(id, isEnabled) {
|
||||
return request({
|
||||
url: `/management/api/spring/avatar/decor/enable/${id}`,
|
||||
method: 'patch',
|
||||
data: { isEnabled },
|
||||
})
|
||||
}
|
||||
55
src/api/spring/avatar/frame.js
Normal file
55
src/api/spring/avatar/frame.js
Normal file
@@ -0,0 +1,55 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
export function getList(data) {
|
||||
return request({
|
||||
url: '/management/api/spring/avatar/frame/list',
|
||||
method: 'get',
|
||||
params: data,
|
||||
})
|
||||
}
|
||||
|
||||
export function doAdd(data) {
|
||||
return request({
|
||||
url: '/management/api/spring/avatar/frame',
|
||||
method: 'post',
|
||||
data,
|
||||
})
|
||||
}
|
||||
|
||||
export function doEdit(id, data) {
|
||||
return request({
|
||||
url: `/management/api/spring/avatar/frame/${id}`,
|
||||
method: 'put',
|
||||
data,
|
||||
})
|
||||
}
|
||||
|
||||
export function doDelete(data) {
|
||||
return request({
|
||||
url: '/management/api/spring/avatar/frame/delete',
|
||||
method: 'put',
|
||||
data,
|
||||
})
|
||||
}
|
||||
|
||||
export function doMoveUp(id) {
|
||||
return request({
|
||||
url: `/management/api/spring/avatar/frame/moveUp/${id}`,
|
||||
method: 'patch',
|
||||
})
|
||||
}
|
||||
|
||||
export function doMoveDown(id) {
|
||||
return request({
|
||||
url: `/management/api/spring/avatar/frame/moveDown/${id}`,
|
||||
method: 'patch',
|
||||
})
|
||||
}
|
||||
|
||||
export function toggleEnable(id, isEnabled) {
|
||||
return request({
|
||||
url: `/management/api/spring/avatar/frame/enable/${id}`,
|
||||
method: 'patch',
|
||||
data: { isEnabled },
|
||||
})
|
||||
}
|
||||
55
src/api/spring/avatar/index.js
Normal file
55
src/api/spring/avatar/index.js
Normal file
@@ -0,0 +1,55 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
export function getList(data) {
|
||||
return request({
|
||||
url: '/management/api/spring/avatar/system/list',
|
||||
method: 'get',
|
||||
params: data,
|
||||
})
|
||||
}
|
||||
|
||||
export function doAdd(data) {
|
||||
return request({
|
||||
url: '/management/api/spring/avatar/system',
|
||||
method: 'post',
|
||||
data,
|
||||
})
|
||||
}
|
||||
|
||||
export function doEdit(id, data) {
|
||||
return request({
|
||||
url: `/management/api/spring/avatar/system/${id}`,
|
||||
method: 'put',
|
||||
data,
|
||||
})
|
||||
}
|
||||
|
||||
export function doDelete(data) {
|
||||
return request({
|
||||
url: '/management/api/spring/avatar/system/delete',
|
||||
method: 'put',
|
||||
data,
|
||||
})
|
||||
}
|
||||
|
||||
export function doMoveUp(id) {
|
||||
return request({
|
||||
url: `/management/api/spring/avatar/system/moveUp/${id}`,
|
||||
method: 'patch',
|
||||
})
|
||||
}
|
||||
|
||||
export function doMoveDown(id) {
|
||||
return request({
|
||||
url: `/management/api/spring/avatar/system/moveDown/${id}`,
|
||||
method: 'patch',
|
||||
})
|
||||
}
|
||||
|
||||
export function toggleEnable(id, isEnabled) {
|
||||
return request({
|
||||
url: `/management/api/spring/avatar/system/enable/${id}`,
|
||||
method: 'patch',
|
||||
data: { isEnabled },
|
||||
})
|
||||
}
|
||||
@@ -7,19 +7,3 @@ export function getList(data) {
|
||||
params: data,
|
||||
})
|
||||
}
|
||||
|
||||
export function getShareList(data) {
|
||||
return request({
|
||||
url: '/management/api/spring/blessing/share-record/list',
|
||||
method: 'get',
|
||||
params: data,
|
||||
})
|
||||
}
|
||||
|
||||
export function getViewList(data) {
|
||||
return request({
|
||||
url: '/management/api/spring/blessing/view-record/list',
|
||||
method: 'get',
|
||||
params: data,
|
||||
})
|
||||
}
|
||||
|
||||
@@ -7,3 +7,27 @@ export function getUserList(data) {
|
||||
params: data,
|
||||
})
|
||||
}
|
||||
|
||||
export function getShareList(data) {
|
||||
return request({
|
||||
url: '/management/api/spring/system/share-record/list',
|
||||
method: 'get',
|
||||
params: data,
|
||||
})
|
||||
}
|
||||
|
||||
export function getViewList(data) {
|
||||
return request({
|
||||
url: '/management/api/spring/system/view-record/list',
|
||||
method: 'get',
|
||||
params: data,
|
||||
})
|
||||
}
|
||||
|
||||
export function getSaveList(data) {
|
||||
return request({
|
||||
url: '/management/api/spring/system/save-record/list',
|
||||
method: 'get',
|
||||
params: data,
|
||||
})
|
||||
}
|
||||
|
||||
55
src/api/spring/wallpaper/system.js
Normal file
55
src/api/spring/wallpaper/system.js
Normal file
@@ -0,0 +1,55 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
export function getList(data) {
|
||||
return request({
|
||||
url: '/management/api/spring/wallpaper/system/list',
|
||||
method: 'get',
|
||||
params: data,
|
||||
})
|
||||
}
|
||||
|
||||
export function doAdd(data) {
|
||||
return request({
|
||||
url: '/management/api/spring/wallpaper/system',
|
||||
method: 'post',
|
||||
data,
|
||||
})
|
||||
}
|
||||
|
||||
export function doEdit(id, data) {
|
||||
return request({
|
||||
url: `/management/api/spring/wallpaper/system/${id}`,
|
||||
method: 'put',
|
||||
data,
|
||||
})
|
||||
}
|
||||
|
||||
export function doDelete(data) {
|
||||
return request({
|
||||
url: '/management/api/spring/wallpaper/system/delete',
|
||||
method: 'put',
|
||||
data,
|
||||
})
|
||||
}
|
||||
|
||||
export function doMoveUp(id) {
|
||||
return request({
|
||||
url: `/management/api/spring/wallpaper/system/moveUp/${id}`,
|
||||
method: 'patch',
|
||||
})
|
||||
}
|
||||
|
||||
export function doMoveDown(id) {
|
||||
return request({
|
||||
url: `/management/api/spring/wallpaper/system/moveDown/${id}`,
|
||||
method: 'patch',
|
||||
})
|
||||
}
|
||||
|
||||
export function toggleEnable(id, isEnabled) {
|
||||
return request({
|
||||
url: `/management/api/spring/wallpaper/system/enable/${id}`,
|
||||
method: 'patch',
|
||||
data: { isEnabled },
|
||||
})
|
||||
}
|
||||
62
src/api/spring/wallpaper/type.js
Normal file
62
src/api/spring/wallpaper/type.js
Normal file
@@ -0,0 +1,62 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
export function getList(data) {
|
||||
return request({
|
||||
url: '/management/api/spring/wallpaper/category/list',
|
||||
method: 'get',
|
||||
params: data,
|
||||
})
|
||||
}
|
||||
|
||||
export function getAllList() {
|
||||
return request({
|
||||
url: '/management/api/spring/wallpaper/category/list/all',
|
||||
method: 'get',
|
||||
})
|
||||
}
|
||||
|
||||
export function doAdd(data) {
|
||||
return request({
|
||||
url: '/management/api/spring/wallpaper/category',
|
||||
method: 'post',
|
||||
data,
|
||||
})
|
||||
}
|
||||
|
||||
export function doEdit(id, data) {
|
||||
return request({
|
||||
url: `/management/api/spring/wallpaper/category/${id}`,
|
||||
method: 'put',
|
||||
data,
|
||||
})
|
||||
}
|
||||
|
||||
export function doDelete(data) {
|
||||
return request({
|
||||
url: '/management/api/spring/wallpaper/category/delete',
|
||||
method: 'put',
|
||||
data,
|
||||
})
|
||||
}
|
||||
|
||||
export function doMoveUp(id) {
|
||||
return request({
|
||||
url: `/management/api/spring/wallpaper/category/moveUp/${id}`,
|
||||
method: 'patch',
|
||||
})
|
||||
}
|
||||
|
||||
export function doMoveDown(id) {
|
||||
return request({
|
||||
url: `/management/api/spring/wallpaper/category/moveDown/${id}`,
|
||||
method: 'patch',
|
||||
})
|
||||
}
|
||||
|
||||
export function toggleEnable(id, isEnabled) {
|
||||
return request({
|
||||
url: `/management/api/spring/wallpaper/category/enable/${id}`,
|
||||
method: 'patch',
|
||||
data: { isEnabled },
|
||||
})
|
||||
}
|
||||
151
src/components/BatchImageAdd/index.vue
Normal file
151
src/components/BatchImageAdd/index.vue
Normal file
@@ -0,0 +1,151 @@
|
||||
<template>
|
||||
<el-dialog title="批量添加" :visible.sync="dialogVisible" width="600px" @close="close">
|
||||
<el-form ref="form" label-width="80px">
|
||||
<el-form-item label="图片上传">
|
||||
<el-upload
|
||||
ref="upload"
|
||||
accept="image/*"
|
||||
:action="uploadUrl"
|
||||
drag
|
||||
:file-list="fileList"
|
||||
:headers="uploadHeaders"
|
||||
:multiple="true"
|
||||
:on-preview="handlePreview"
|
||||
:on-remove="handleRemove"
|
||||
:on-success="handleSuccess"
|
||||
>
|
||||
<i class="el-icon-upload"></i>
|
||||
<div class="el-upload__text">
|
||||
将文件拖到此处,或
|
||||
<em>点击上传</em>
|
||||
</div>
|
||||
</el-upload>
|
||||
<el-dialog append-to-body :visible.sync="previewVisible">
|
||||
<img alt="" :src="previewImageUrl" width="100%" />
|
||||
</el-dialog>
|
||||
</el-form-item>
|
||||
<el-form-item v-if="hasType" label="类型">
|
||||
<el-select
|
||||
v-if="typeList && typeList.length > 0"
|
||||
v-model="type"
|
||||
allow-create
|
||||
default-first-option
|
||||
filterable
|
||||
placeholder="请选择类型"
|
||||
style="width: 100%"
|
||||
>
|
||||
<el-option v-for="item in typeList" :key="item.id" :label="item.name" :value="item.id" />
|
||||
</el-select>
|
||||
<el-input v-else v-model.trim="type" placeholder="请输入类型" />
|
||||
</el-form-item>
|
||||
<el-form-item label="是否启用">
|
||||
<el-switch v-model="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 { getAccessToken } from '@/utils/accessToken'
|
||||
|
||||
export default {
|
||||
name: 'BatchImageAdd',
|
||||
props: {
|
||||
doAdd: {
|
||||
type: Function,
|
||||
required: true,
|
||||
},
|
||||
hasType: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
typeList: {
|
||||
type: Array,
|
||||
default: () => [],
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
dialogVisible: false,
|
||||
isEnabled: true,
|
||||
type: '',
|
||||
loading: false,
|
||||
fileList: [],
|
||||
previewVisible: false,
|
||||
previewImageUrl: '',
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
uploadUrl() {
|
||||
return `${process.env.VUE_APP_API_BASE_URL}/management/api/common/upload`
|
||||
},
|
||||
uploadHeaders() {
|
||||
return {
|
||||
Authorization: getAccessToken() || '',
|
||||
'x-user-id': this.$store.state.user.userId || '',
|
||||
'x-app-id': this.$store.state.user.appId || '',
|
||||
}
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
show() {
|
||||
this.dialogVisible = true
|
||||
this.fileList = []
|
||||
},
|
||||
close() {
|
||||
this.isEnabled = true
|
||||
this.type = ''
|
||||
this.loading = false
|
||||
this.fileList = []
|
||||
this.dialogVisible = false
|
||||
},
|
||||
handleSuccess(response, file, fileList) {
|
||||
if (response.code !== 200) {
|
||||
this.$baseMessage(response.msg || '上传失败', 'error')
|
||||
}
|
||||
this.fileList = fileList
|
||||
},
|
||||
handleRemove(file, fileList) {
|
||||
this.fileList = fileList
|
||||
},
|
||||
handlePreview(file) {
|
||||
this.previewImageUrl = file.url || file.thumbUrl
|
||||
this.previewVisible = true
|
||||
},
|
||||
async save() {
|
||||
const urls = this.fileList
|
||||
.filter((f) => f.status === 'success' && f.response && f.response.code === 200)
|
||||
.map((f) => `https://file.lihailezzc.com/${f.response.data.key}`)
|
||||
|
||||
if (urls.length === 0) {
|
||||
this.$baseMessage('请至少上传一张图片', 'warning')
|
||||
return
|
||||
}
|
||||
|
||||
this.loading = true
|
||||
try {
|
||||
let successCount = 0
|
||||
for (const url of urls) {
|
||||
const data = { imageUrl: url, isEnabled: this.isEnabled }
|
||||
if (this.hasType) {
|
||||
data.type = this.type
|
||||
}
|
||||
await this.doAdd(data)
|
||||
successCount++
|
||||
}
|
||||
this.$emit('fetch-data')
|
||||
this.close()
|
||||
} catch (error) {
|
||||
console.error('批量添加失败:', error)
|
||||
this.$baseMessage('部分或全部添加失败', 'error')
|
||||
} finally {
|
||||
this.loading = false
|
||||
}
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
@@ -87,6 +87,64 @@ export const asyncRoutes = [
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
path: 'wallpaper',
|
||||
component: EmptyLayout,
|
||||
alwaysShow: true,
|
||||
redirect: 'noRedirect',
|
||||
name: 'Wallpaper',
|
||||
meta: {
|
||||
title: '壁纸',
|
||||
icon: 'clover',
|
||||
permissions: ['admin'],
|
||||
},
|
||||
children: [
|
||||
{
|
||||
path: 'systemWallpaper',
|
||||
name: 'SystemWallpaper',
|
||||
component: () => import('@/views/spring/wallpaper/system/index'),
|
||||
meta: { title: '系统壁纸' },
|
||||
},
|
||||
{
|
||||
path: 'wallpaperType',
|
||||
name: 'WallpaperType',
|
||||
component: () => import('@/views/spring/wallpaper/type/index'),
|
||||
meta: { title: '壁纸类型' },
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
path: 'avatar',
|
||||
component: EmptyLayout,
|
||||
alwaysShow: true,
|
||||
redirect: 'noRedirect',
|
||||
name: 'Avatar',
|
||||
meta: {
|
||||
title: '头像',
|
||||
icon: 'user',
|
||||
permissions: ['admin'],
|
||||
},
|
||||
children: [
|
||||
{
|
||||
path: 'systemAvatar',
|
||||
name: 'SystemAvatar',
|
||||
component: () => import('@/views/spring/avatar/systemAvatar/index'),
|
||||
meta: { title: '系统头像' },
|
||||
},
|
||||
{
|
||||
path: 'avatarFrame',
|
||||
name: 'AvatarFrame',
|
||||
component: () => import('@/views/spring/avatar/avatarFrame/index'),
|
||||
meta: { title: '头像框' },
|
||||
},
|
||||
{
|
||||
path: 'avatarDecor',
|
||||
name: 'AvatarDecor',
|
||||
component: () => import('@/views/spring/avatar/avatarDecor/index'),
|
||||
meta: { title: '头像挂饰' },
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
path: 'fortune',
|
||||
component: EmptyLayout,
|
||||
@@ -134,13 +192,19 @@ export const asyncRoutes = [
|
||||
{
|
||||
path: 'shareRecord',
|
||||
name: 'ShareRecord',
|
||||
component: () => import('@/views/spring/blessing/shareRecord/index'),
|
||||
component: () => import('@/views/spring/user/shareRecord/index'),
|
||||
meta: { title: '分享记录' },
|
||||
},
|
||||
{
|
||||
path: 'saveRecord',
|
||||
name: 'SaveRecord',
|
||||
component: () => import('@/views/spring/user/saveRecord/index'),
|
||||
meta: { title: '保存记录' },
|
||||
},
|
||||
{
|
||||
path: 'viewRecord',
|
||||
name: 'ViewRecord',
|
||||
component: () => import('@/views/spring/blessing/viewRecord/index'),
|
||||
component: () => import('@/views/spring/user/viewRecord/index'),
|
||||
meta: { title: '查看记录' },
|
||||
},
|
||||
],
|
||||
|
||||
@@ -0,0 +1,99 @@
|
||||
<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="type">
|
||||
<el-input v-model.trim="form.type" placeholder="请输入类型" />
|
||||
</el-form-item>
|
||||
<el-form-item label="挂饰图片" prop="imageUrl">
|
||||
<single-upload
|
||||
v-model="form.imageUrl"
|
||||
style="width: 100px; height: 100px"
|
||||
:upload-url="uploadUrl"
|
||||
@upload-success="handleUploadSuccess"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item 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 type="primary" @click="save">确 定</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { doEdit, doAdd } from '@/api/spring/avatar/decor'
|
||||
import SingleUpload from '@/components/SingleUpload'
|
||||
|
||||
export default {
|
||||
name: 'AppManagementEdit',
|
||||
components: { SingleUpload },
|
||||
data() {
|
||||
return {
|
||||
id: '',
|
||||
form: {
|
||||
imageUrl: '',
|
||||
type: '',
|
||||
isEnabled: true,
|
||||
},
|
||||
rules: {
|
||||
imageUrl: [{ required: true, trigger: 'blur', message: '请上传挂饰图片' }],
|
||||
isEnabled: [{ required: true, trigger: 'blur', message: '请选择是否启用' }],
|
||||
},
|
||||
title: '',
|
||||
dialogFormVisible: false,
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
uploadUrl() {
|
||||
return `${process.env.VUE_APP_API_BASE_URL}/management/api/common/upload`
|
||||
},
|
||||
},
|
||||
created() {},
|
||||
methods: {
|
||||
handleUploadSuccess(url) {
|
||||
this.form.imageUrl = url
|
||||
},
|
||||
showEdit(row) {
|
||||
if (!row) {
|
||||
this.title = '添加'
|
||||
} else {
|
||||
this.title = '编辑'
|
||||
this.form = {
|
||||
imageUrl: row.imageUrl,
|
||||
type: row.type,
|
||||
isEnabled: row.isEnabled,
|
||||
}
|
||||
this.id = row.id
|
||||
}
|
||||
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) {
|
||||
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()
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
})
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
195
src/views/spring/avatar/avatarDecor/index.vue
Normal file
195
src/views/spring/avatar/avatarDecor/index.vue
Normal file
@@ -0,0 +1,195 @@
|
||||
<template>
|
||||
<div class="appManagement-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-plus" type="primary" @click="handleBatchAdd">批量添加</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.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">
|
||||
<el-table-column align="center" label="排序" prop="sort" show-overflow-tooltip />
|
||||
<el-table-column align="center" label="类型" prop="type" show-overflow-tooltip />
|
||||
|
||||
<el-table-column align="center" label="挂饰" width="100">
|
||||
<template slot-scope="scope">
|
||||
<el-tooltip class="item" :content="scope.row.id" effect="dark" placement="top">
|
||||
<el-image fit="cover" :preview-src-list="[scope.row.imageUrl]" :src="scope.row.imageUrl" style="width: 50px; height: 50px" />
|
||||
</el-tooltip>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="是否启用" show-overflow-tooltip>
|
||||
<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" label="操作">
|
||||
<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" />
|
||||
<batch-image-add ref="batchAdd" :do-add="doAdd" has-type @fetch-data="fetchData" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { doDelete, getList, toggleEnable, doMoveUp, doMoveDown, doAdd } from '@/api/spring/avatar/decor'
|
||||
import Edit from './components/AppManagementEdit'
|
||||
import BatchImageAdd from '@/components/BatchImageAdd'
|
||||
|
||||
export default {
|
||||
name: 'AvatarDecor',
|
||||
components: { Edit, BatchImageAdd },
|
||||
data() {
|
||||
return {
|
||||
doAdd: doAdd,
|
||||
list: null,
|
||||
listLoading: true,
|
||||
layout: 'total, sizes, prev, pager, next, jumper',
|
||||
total: 0,
|
||||
selectRows: '',
|
||||
elementLoadingText: '正在加载...',
|
||||
queryForm: {
|
||||
pageNo: 1,
|
||||
pageSize: 10,
|
||||
keyword: '',
|
||||
},
|
||||
timeOutID: null,
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.fetchData()
|
||||
},
|
||||
|
||||
beforeDestroy() {
|
||||
clearTimeout(this.timeOutID)
|
||||
},
|
||||
methods: {
|
||||
setSelectRows(val) {
|
||||
this.selectRows = val
|
||||
},
|
||||
handleEdit(row) {
|
||||
if (row && row.id) {
|
||||
this.$refs['edit'].showEdit(row)
|
||||
} else {
|
||||
this.$refs['edit'].showEdit()
|
||||
}
|
||||
},
|
||||
handleBatchAdd() {
|
||||
this.$refs['batchAdd'].show()
|
||||
},
|
||||
handleDelete(row) {
|
||||
if (row.id) {
|
||||
this.$baseConfirm('你确定要删除当前项吗', null, async () => {
|
||||
const { msg } = await doDelete({ ids: [row.id] })
|
||||
this.$baseMessage(msg, 'success')
|
||||
this.fetchData()
|
||||
})
|
||||
} else {
|
||||
if (this.selectRows.length > 0) {
|
||||
const ids = this.selectRows.map((item) => item.id).join()
|
||||
this.$baseConfirm('你确定要删除选中项吗', null, async () => {
|
||||
const { msg } = await doDelete({ ids: ids.split(',') })
|
||||
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
|
||||
const { data } = await getList(this.queryForm)
|
||||
this.list = data.list
|
||||
this.total = data.totalCount
|
||||
this.timeOutID = setTimeout(() => {
|
||||
this.listLoading = false
|
||||
}, 300)
|
||||
},
|
||||
async handleToggleEnable(row, val) {
|
||||
const prev = row.isEnabled
|
||||
row.isEnabled = val
|
||||
try {
|
||||
const { msg } = await toggleEnable(row.id, val)
|
||||
if (msg) this.$baseMessage(msg, 'success')
|
||||
this.fetchData()
|
||||
} catch (e) {
|
||||
row.isEnabled = prev
|
||||
this.$baseMessage('更新失败', 'error')
|
||||
}
|
||||
},
|
||||
async handleMoveUp(row) {
|
||||
try {
|
||||
const { msg } = await doMoveUp(row.id)
|
||||
if (msg) this.$baseMessage(msg, 'success')
|
||||
this.fetchData()
|
||||
} catch (e) {
|
||||
this.$baseMessage('操作失败', 'error')
|
||||
}
|
||||
},
|
||||
async handleMoveDown(row) {
|
||||
try {
|
||||
const { msg } = await doMoveDown(row.id)
|
||||
if (msg) this.$baseMessage(msg, 'success')
|
||||
this.fetchData()
|
||||
} catch (e) {
|
||||
this.$baseMessage('操作失败', 'error')
|
||||
}
|
||||
},
|
||||
isFirstEnabled(row) {
|
||||
if (!this.list || this.list.length === 0) return false
|
||||
const enabled = this.list.filter((item) => item.isEnabled)
|
||||
if (enabled.length === 0) return false
|
||||
return enabled[0].id === row.id
|
||||
},
|
||||
isLastEnabled(row) {
|
||||
if (!this.list || this.list.length === 0) return false
|
||||
const enabled = this.list.filter((item) => item.isEnabled)
|
||||
if (enabled.length === 0) return false
|
||||
return enabled[enabled.length - 1].id === row.id
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
@@ -0,0 +1,99 @@
|
||||
<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="type">
|
||||
<el-input v-model.trim="form.type" placeholder="请输入类型" />
|
||||
</el-form-item>
|
||||
<el-form-item label="头像框" prop="imageUrl">
|
||||
<single-upload
|
||||
v-model="form.imageUrl"
|
||||
style="width: 100px; height: 100px"
|
||||
:upload-url="uploadUrl"
|
||||
@upload-success="handleUploadSuccess"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item 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 type="primary" @click="save">确 定</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { doEdit, doAdd } from '@/api/spring/avatar/frame'
|
||||
import SingleUpload from '@/components/SingleUpload'
|
||||
|
||||
export default {
|
||||
name: 'AppManagementEdit',
|
||||
components: { SingleUpload },
|
||||
data() {
|
||||
return {
|
||||
id: '',
|
||||
form: {
|
||||
imageUrl: '',
|
||||
type: '',
|
||||
isEnabled: true,
|
||||
},
|
||||
rules: {
|
||||
imageUrl: [{ required: true, trigger: 'blur', message: '请上传头像框图片' }],
|
||||
isEnabled: [{ required: true, trigger: 'blur', message: '请选择是否启用' }],
|
||||
},
|
||||
title: '',
|
||||
dialogFormVisible: false,
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
uploadUrl() {
|
||||
return `${process.env.VUE_APP_API_BASE_URL}/management/api/common/upload`
|
||||
},
|
||||
},
|
||||
created() {},
|
||||
methods: {
|
||||
handleUploadSuccess(url) {
|
||||
this.form.imageUrl = url
|
||||
},
|
||||
showEdit(row) {
|
||||
if (!row) {
|
||||
this.title = '添加'
|
||||
} else {
|
||||
this.title = '编辑'
|
||||
this.form = {
|
||||
imageUrl: row.imageUrl,
|
||||
type: row.type,
|
||||
isEnabled: row.isEnabled,
|
||||
}
|
||||
this.id = row.id
|
||||
}
|
||||
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) {
|
||||
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()
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
})
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
195
src/views/spring/avatar/avatarFrame/index.vue
Normal file
195
src/views/spring/avatar/avatarFrame/index.vue
Normal file
@@ -0,0 +1,195 @@
|
||||
<template>
|
||||
<div class="appManagement-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-plus" type="primary" @click="handleBatchAdd">批量添加</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.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">
|
||||
<el-table-column align="center" label="排序" prop="sort" show-overflow-tooltip />
|
||||
<el-table-column align="center" label="类型" prop="type" show-overflow-tooltip />
|
||||
|
||||
<el-table-column align="center" label="头像框" width="100">
|
||||
<template slot-scope="scope">
|
||||
<el-tooltip class="item" :content="scope.row.id" effect="dark" placement="top">
|
||||
<el-image fit="cover" :preview-src-list="[scope.row.imageUrl]" :src="scope.row.imageUrl" style="width: 50px; height: 50px" />
|
||||
</el-tooltip>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="是否启用" show-overflow-tooltip>
|
||||
<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" label="操作">
|
||||
<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" />
|
||||
<batch-image-add ref="batchAdd" :do-add="doAdd" has-type @fetch-data="fetchData" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { doDelete, getList, toggleEnable, doMoveUp, doMoveDown, doAdd } from '@/api/spring/avatar/frame'
|
||||
import Edit from './components/AppManagementEdit'
|
||||
import BatchImageAdd from '@/components/BatchImageAdd'
|
||||
|
||||
export default {
|
||||
name: 'AvatarFrame',
|
||||
components: { Edit, BatchImageAdd },
|
||||
data() {
|
||||
return {
|
||||
doAdd: doAdd,
|
||||
list: null,
|
||||
listLoading: true,
|
||||
layout: 'total, sizes, prev, pager, next, jumper',
|
||||
total: 0,
|
||||
selectRows: '',
|
||||
elementLoadingText: '正在加载...',
|
||||
queryForm: {
|
||||
pageNo: 1,
|
||||
pageSize: 10,
|
||||
keyword: '',
|
||||
},
|
||||
timeOutID: null,
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.fetchData()
|
||||
},
|
||||
|
||||
beforeDestroy() {
|
||||
clearTimeout(this.timeOutID)
|
||||
},
|
||||
methods: {
|
||||
setSelectRows(val) {
|
||||
this.selectRows = val
|
||||
},
|
||||
handleEdit(row) {
|
||||
if (row && row.id) {
|
||||
this.$refs['edit'].showEdit(row)
|
||||
} else {
|
||||
this.$refs['edit'].showEdit()
|
||||
}
|
||||
},
|
||||
handleBatchAdd() {
|
||||
this.$refs['batchAdd'].show()
|
||||
},
|
||||
handleDelete(row) {
|
||||
if (row.id) {
|
||||
this.$baseConfirm('你确定要删除当前项吗', null, async () => {
|
||||
const { msg } = await doDelete({ ids: [row.id] })
|
||||
this.$baseMessage(msg, 'success')
|
||||
this.fetchData()
|
||||
})
|
||||
} else {
|
||||
if (this.selectRows.length > 0) {
|
||||
const ids = this.selectRows.map((item) => item.id).join()
|
||||
this.$baseConfirm('你确定要删除选中项吗', null, async () => {
|
||||
const { msg } = await doDelete({ ids: ids.split(',') })
|
||||
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
|
||||
const { data } = await getList(this.queryForm)
|
||||
this.list = data.list
|
||||
this.total = data.totalCount
|
||||
this.timeOutID = setTimeout(() => {
|
||||
this.listLoading = false
|
||||
}, 300)
|
||||
},
|
||||
async handleToggleEnable(row, val) {
|
||||
const prev = row.isEnabled
|
||||
row.isEnabled = val
|
||||
try {
|
||||
const { msg } = await toggleEnable(row.id, val)
|
||||
if (msg) this.$baseMessage(msg, 'success')
|
||||
this.fetchData()
|
||||
} catch (e) {
|
||||
row.isEnabled = prev
|
||||
this.$baseMessage('更新失败', 'error')
|
||||
}
|
||||
},
|
||||
async handleMoveUp(row) {
|
||||
try {
|
||||
const { msg } = await doMoveUp(row.id)
|
||||
if (msg) this.$baseMessage(msg, 'success')
|
||||
this.fetchData()
|
||||
} catch (e) {
|
||||
this.$baseMessage('操作失败', 'error')
|
||||
}
|
||||
},
|
||||
async handleMoveDown(row) {
|
||||
try {
|
||||
const { msg } = await doMoveDown(row.id)
|
||||
if (msg) this.$baseMessage(msg, 'success')
|
||||
this.fetchData()
|
||||
} catch (e) {
|
||||
this.$baseMessage('操作失败', 'error')
|
||||
}
|
||||
},
|
||||
isFirstEnabled(row) {
|
||||
if (!this.list || this.list.length === 0) return false
|
||||
const enabled = this.list.filter((item) => item.isEnabled)
|
||||
if (enabled.length === 0) return false
|
||||
return enabled[0].id === row.id
|
||||
},
|
||||
isLastEnabled(row) {
|
||||
if (!this.list || this.list.length === 0) return false
|
||||
const enabled = this.list.filter((item) => item.isEnabled)
|
||||
if (enabled.length === 0) return false
|
||||
return enabled[enabled.length - 1].id === row.id
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
@@ -0,0 +1,99 @@
|
||||
<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="imageUrl">
|
||||
<single-upload
|
||||
v-model="form.imageUrl"
|
||||
style="width: 100px; height: 100px"
|
||||
:upload-url="uploadUrl"
|
||||
@upload-success="handleUploadSuccess"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="类型" prop="type">
|
||||
<el-input v-model.trim="form.type" placeholder="请输入类型" />
|
||||
</el-form-item>
|
||||
<el-form-item 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 type="primary" @click="save">确 定</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { doEdit, doAdd } from '@/api/spring/avatar'
|
||||
import SingleUpload from '@/components/SingleUpload'
|
||||
|
||||
export default {
|
||||
name: 'AppManagementEdit',
|
||||
components: { SingleUpload },
|
||||
data() {
|
||||
return {
|
||||
id: '',
|
||||
form: {
|
||||
imageUrl: '',
|
||||
type: '',
|
||||
isEnabled: true,
|
||||
},
|
||||
rules: {
|
||||
imageUrl: [{ required: true, trigger: 'blur', message: '请上传头像图片' }],
|
||||
isEnabled: [{ required: true, trigger: 'blur', message: '请选择是否启用' }],
|
||||
},
|
||||
title: '',
|
||||
dialogFormVisible: false,
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
uploadUrl() {
|
||||
return `${process.env.VUE_APP_API_BASE_URL}/management/api/common/upload`
|
||||
},
|
||||
},
|
||||
created() {},
|
||||
methods: {
|
||||
handleUploadSuccess(url) {
|
||||
this.form.imageUrl = url
|
||||
},
|
||||
showEdit(row) {
|
||||
if (!row) {
|
||||
this.title = '添加'
|
||||
} else {
|
||||
this.title = '编辑'
|
||||
this.form = {
|
||||
imageUrl: row.imageUrl,
|
||||
type: row.type,
|
||||
isEnabled: row.isEnabled,
|
||||
}
|
||||
this.id = row.id
|
||||
}
|
||||
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) {
|
||||
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()
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
})
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
195
src/views/spring/avatar/systemAvatar/index.vue
Normal file
195
src/views/spring/avatar/systemAvatar/index.vue
Normal file
@@ -0,0 +1,195 @@
|
||||
<template>
|
||||
<div class="appManagement-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-plus" type="primary" @click="handleBatchAdd">批量添加</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.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">
|
||||
<el-table-column align="center" label="排序" prop="sort" show-overflow-tooltip />
|
||||
|
||||
<el-table-column align="center" label="类型" prop="type" show-overflow-tooltip />
|
||||
<el-table-column align="center" label="头像" width="100">
|
||||
<template slot-scope="scope">
|
||||
<el-tooltip class="item" :content="scope.row.id" effect="dark" placement="top">
|
||||
<el-image fit="cover" :preview-src-list="[scope.row.imageUrl]" :src="scope.row.imageUrl" style="width: 50px; height: 50px" />
|
||||
</el-tooltip>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="是否启用" show-overflow-tooltip>
|
||||
<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" label="操作">
|
||||
<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" />
|
||||
<batch-image-add ref="batchAdd" :do-add="doAdd" has-type @fetch-data="fetchData" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { doDelete, getList, toggleEnable, doMoveUp, doMoveDown, doAdd } from '@/api/spring/avatar'
|
||||
import Edit from './components/AppManagementEdit'
|
||||
import BatchImageAdd from '@/components/BatchImageAdd'
|
||||
|
||||
export default {
|
||||
name: 'SystemAvatar',
|
||||
components: { Edit, BatchImageAdd },
|
||||
data() {
|
||||
return {
|
||||
doAdd: doAdd,
|
||||
list: null,
|
||||
listLoading: true,
|
||||
layout: 'total, sizes, prev, pager, next, jumper',
|
||||
total: 0,
|
||||
selectRows: '',
|
||||
elementLoadingText: '正在加载...',
|
||||
queryForm: {
|
||||
pageNo: 1,
|
||||
pageSize: 10,
|
||||
keyword: '',
|
||||
},
|
||||
timeOutID: null,
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.fetchData()
|
||||
},
|
||||
|
||||
beforeDestroy() {
|
||||
clearTimeout(this.timeOutID)
|
||||
},
|
||||
methods: {
|
||||
setSelectRows(val) {
|
||||
this.selectRows = val
|
||||
},
|
||||
handleEdit(row) {
|
||||
if (row && row.id) {
|
||||
this.$refs['edit'].showEdit(row)
|
||||
} else {
|
||||
this.$refs['edit'].showEdit()
|
||||
}
|
||||
},
|
||||
handleBatchAdd() {
|
||||
this.$refs['batchAdd'].show()
|
||||
},
|
||||
handleDelete(row) {
|
||||
if (row.id) {
|
||||
this.$baseConfirm('你确定要删除当前项吗', null, async () => {
|
||||
const { msg } = await doDelete({ ids: [row.id] })
|
||||
this.$baseMessage(msg, 'success')
|
||||
this.fetchData()
|
||||
})
|
||||
} else {
|
||||
if (this.selectRows.length > 0) {
|
||||
const ids = this.selectRows.map((item) => item.id).join()
|
||||
this.$baseConfirm('你确定要删除选中项吗', null, async () => {
|
||||
const { msg } = await doDelete({ ids: ids.split(',') })
|
||||
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
|
||||
const { data } = await getList(this.queryForm)
|
||||
this.list = data.list
|
||||
this.total = data.totalCount
|
||||
this.timeOutID = setTimeout(() => {
|
||||
this.listLoading = false
|
||||
}, 300)
|
||||
},
|
||||
async handleToggleEnable(row, val) {
|
||||
const prev = row.isEnabled
|
||||
row.isEnabled = val
|
||||
try {
|
||||
const { msg } = await toggleEnable(row.id, val)
|
||||
if (msg) this.$baseMessage(msg, 'success')
|
||||
this.fetchData()
|
||||
} catch (e) {
|
||||
row.isEnabled = prev
|
||||
this.$baseMessage('更新失败', 'error')
|
||||
}
|
||||
},
|
||||
async handleMoveUp(row) {
|
||||
try {
|
||||
const { msg } = await doMoveUp(row.id)
|
||||
if (msg) this.$baseMessage(msg, 'success')
|
||||
this.fetchData()
|
||||
} catch (e) {
|
||||
this.$baseMessage('操作失败', 'error')
|
||||
}
|
||||
},
|
||||
async handleMoveDown(row) {
|
||||
try {
|
||||
const { msg } = await doMoveDown(row.id)
|
||||
if (msg) this.$baseMessage(msg, 'success')
|
||||
this.fetchData()
|
||||
} catch (e) {
|
||||
this.$baseMessage('操作失败', 'error')
|
||||
}
|
||||
},
|
||||
isFirstEnabled(row) {
|
||||
if (!this.list || this.list.length === 0) return false
|
||||
const enabled = this.list.filter((item) => item.isEnabled)
|
||||
if (enabled.length === 0) return false
|
||||
return enabled[0].id === row.id
|
||||
},
|
||||
isLastEnabled(row) {
|
||||
if (!this.list || this.list.length === 0) return false
|
||||
const enabled = this.list.filter((item) => item.isEnabled)
|
||||
if (enabled.length === 0) return false
|
||||
return enabled[enabled.length - 1].id === row.id
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
@@ -12,8 +12,11 @@
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-select v-model="queryForm.fortuneLevel" clearable placeholder="请选择幸运等级" @change="queryData">
|
||||
<el-option label="吉祥" value="1" />
|
||||
<el-option label="大吉" value="2" />
|
||||
<el-option label="吉签" value="1" />
|
||||
<el-option label="中吉签" value="2" />
|
||||
<el-option label="上吉签" value="3" />
|
||||
<el-option label="上上签" value="4" />
|
||||
<el-option label="大吉签" value="5" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
@@ -36,7 +39,17 @@
|
||||
<el-table-column align="center" label="标题" prop="title" show-overflow-tooltip />
|
||||
<el-table-column align="center" label="幸运等级" show-overflow-tooltip>
|
||||
<template #default="{ row }">
|
||||
{{ row.fortuneLevel === '1' ? '吉祥' : row.fortuneLevel === '2' ? '大吉' : '普通' }}
|
||||
{{
|
||||
row.fortuneLevel === '1'
|
||||
? '吉签'
|
||||
: row.fortuneLevel === '2'
|
||||
? '中吉签'
|
||||
: row.fortuneLevel === '3'
|
||||
? '上吉签'
|
||||
: row.fortuneLevel === '4'
|
||||
? '上上签'
|
||||
: '大吉签'
|
||||
}}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="是否启用" show-overflow-tooltip>
|
||||
|
||||
255
src/views/spring/user/saveRecord/index.vue
Normal file
255
src/views/spring/user/saveRecord/index.vue
Normal file
@@ -0,0 +1,255 @@
|
||||
<template>
|
||||
<div class="save-record-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-left-panel :span="12">
|
||||
<el-form :inline="true" :model="queryForm" @submit.native.prevent>
|
||||
<el-form-item>
|
||||
<el-input v-model.trim="queryForm.keyword" clearable placeholder="请输入查询条件" />
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-select v-model="queryForm.scene" clearable placeholder="请选择保存场景" @change="queryData">
|
||||
<el-option label="祝福卡片" value="card_generate" />
|
||||
<el-option label="抽签" value="fortune_draw" />
|
||||
<el-option label="壁纸" value="wallpaper_download" />
|
||||
<el-option label="头像" value="avatar_download" />
|
||||
</el-select>
|
||||
</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-left-panel>
|
||||
</vab-query-form>
|
||||
|
||||
<el-table v-loading="listLoading" :data="list" :element-loading-text="elementLoadingText" @selection-change="setSelectRows">
|
||||
<el-table-column align="center" label="保存内容" width="100">
|
||||
<template slot-scope="scope">
|
||||
<el-tooltip class="item" :content="scope.row.id" effect="dark" placement="top">
|
||||
<el-image fit="cover" :preview-src-list="[scope.row.imageUrl]" :src="scope.row.imageUrl" style="width: 50px; height: 50px" />
|
||||
</el-tooltip>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="保存类型" show-overflow-tooltip>
|
||||
<template #default="{ row }">
|
||||
{{ row.type === 1 ? '祝福卡片' : row.type === 2 ? '抽签' : row.type === 3 ? '壁纸' : '头像' }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="left" label="信息" show-overflow-tooltip>
|
||||
<template #default="{ row }">
|
||||
<div>
|
||||
<!-- <div>
|
||||
<strong>保存Token:</strong>
|
||||
{{ row.shareToken }}
|
||||
</div>
|
||||
<div>
|
||||
<strong>保存渠道:</strong>
|
||||
{{ row.shareChannel || '--' }}
|
||||
</div> -->
|
||||
<div>
|
||||
<strong>设备:</strong>
|
||||
<template v-if="row.deviceId">
|
||||
<el-link type="primary" :underline="false" @click="goToDevice(row.deviceId)">{{ row.deviceModel || row.deviceId }}</el-link>
|
||||
</template>
|
||||
<template v-else>--</template>
|
||||
</div>
|
||||
<div>
|
||||
<strong>内容id:</strong>
|
||||
<template v-if="row.cardId">
|
||||
<el-link type="primary" :underline="false" @click="goToContent(row)">{{ row.cardId }}</el-link>
|
||||
</template>
|
||||
<template v-else>--</template>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="left" label="作者信息" show-overflow-tooltip>
|
||||
<template #default="{ row }">
|
||||
<div class="author-cell">
|
||||
<img alt="avatar" class="author-avatar" :src="row?.fromUser?.avatar" />
|
||||
<div class="author-meta">
|
||||
<div>
|
||||
<strong>id:</strong>
|
||||
{{ row?.fromUser?.id || '--' }}
|
||||
</div>
|
||||
<div>
|
||||
<strong>昵称:</strong>
|
||||
{{ row?.fromUser?.nickname || '--' }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="创建时间" show-overflow-tooltip>
|
||||
<template #default="{ row }">
|
||||
{{ formatTime(row.createdAt) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<!-- <el-table-column label="操作" show-overflow-tooltip width="200">
|
||||
<template #default="{ row }">
|
||||
<el-button type="text" @click="handleEdit(row)">编辑</el-button>
|
||||
<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"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { getSaveList } from '@/api/spring/user'
|
||||
import { formatTime } from '@/utils'
|
||||
|
||||
export default {
|
||||
name: 'SaveRecord',
|
||||
data() {
|
||||
return {
|
||||
host: 'https://file.lihailezzc.com/',
|
||||
list: null,
|
||||
listLoading: true,
|
||||
layout: 'total, sizes, prev, pager, next, jumper',
|
||||
total: 0,
|
||||
selectRows: '',
|
||||
elementLoadingText: '正在加载...',
|
||||
queryForm: {
|
||||
pageNo: 1,
|
||||
pageSize: 10,
|
||||
scene: '',
|
||||
keyword: '',
|
||||
},
|
||||
timeOutID: null,
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.fetchData()
|
||||
},
|
||||
|
||||
beforeDestroy() {
|
||||
clearTimeout(this.timeOutID)
|
||||
},
|
||||
methods: {
|
||||
formatTime,
|
||||
setSelectRows(val) {
|
||||
this.selectRows = val
|
||||
},
|
||||
handleEdit(row) {
|
||||
if (row.id) {
|
||||
this.$refs['edit'].showEdit(row)
|
||||
} else {
|
||||
this.$refs['edit'].showEdit()
|
||||
}
|
||||
},
|
||||
handleDelete(row) {
|
||||
if (row.id) {
|
||||
this.$baseConfirm('你确定要删除当前项吗', null, async () => {
|
||||
const { msg } = await doDelete({ ids: [row.id] })
|
||||
this.$baseMessage(msg, 'success')
|
||||
this.fetchData()
|
||||
})
|
||||
} else {
|
||||
if (this.selectRows.length > 0) {
|
||||
const ids = this.selectRows.map((item) => item.id).join()
|
||||
this.$baseConfirm('你确定要删除选中项吗', null, async () => {
|
||||
const { msg } = await doDelete({ ids: ids.split(',') })
|
||||
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()
|
||||
},
|
||||
goToDevice(deviceId) {
|
||||
this.$router.push({ path: '/spring/user/userChat', query: { deviceId } })
|
||||
},
|
||||
goToContent(row) {
|
||||
if (row.scene === 'card_generate') {
|
||||
this.$router.push({ path: '/spring/blessing/generateRecord', query: { id: row.cardId } })
|
||||
} else if (row.scene === 'fortune_draw') {
|
||||
this.$router.push({ path: '/spring/blessing/viewRecord', query: { id: row.cardId } })
|
||||
} else if (row.scene === 'wallpaper_download') {
|
||||
this.$router.push({ path: '/spring/blessing/shareRecord', query: { id: row.cardId } })
|
||||
} else {
|
||||
this.$router.push({ path: '/spring/user/avatar', query: { id: row.cardId } })
|
||||
}
|
||||
},
|
||||
async fetchData() {
|
||||
this.listLoading = true
|
||||
const { data } = await getSaveList(this.queryForm)
|
||||
this.list = data.list
|
||||
this.total = data.totalCount
|
||||
this.timeOutID = setTimeout(() => {
|
||||
this.listLoading = false
|
||||
}, 300)
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.author-option {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
.author-avatar {
|
||||
width: 24px;
|
||||
height: 24px;
|
||||
border-radius: 50%;
|
||||
object-fit: cover;
|
||||
margin-right: 8px;
|
||||
}
|
||||
.author-name {
|
||||
font-size: 14px;
|
||||
}
|
||||
.author-cell {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 12px;
|
||||
}
|
||||
.author-avatar {
|
||||
width: 50px;
|
||||
height: 50px;
|
||||
object-fit: cover;
|
||||
border-radius: 50%;
|
||||
}
|
||||
.author-meta {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
.image-grid {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.grid-image {
|
||||
width: 80px;
|
||||
height: 80px;
|
||||
object-fit: cover;
|
||||
border-radius: 8px;
|
||||
}
|
||||
</style>
|
||||
@@ -11,11 +11,11 @@
|
||||
<el-input v-model.trim="queryForm.keyword" clearable placeholder="请输入查询条件" />
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-select v-model="queryForm.type" clearable placeholder="请选择分享类型" @change="queryData">
|
||||
<el-option label="祝福卡片" :value="1" />
|
||||
<el-option label="抽签" :value="2" />
|
||||
<el-option label="壁纸" :value="3" />
|
||||
<el-option label="头像" :value="4" />
|
||||
<el-select v-model="queryForm.scene" clearable placeholder="请选择分享场景" @change="queryData">
|
||||
<el-option label="祝福卡片" value="card_generate" />
|
||||
<el-option label="抽签" value="fortune_draw" />
|
||||
<el-option label="壁纸" value="wallpaper_download" />
|
||||
<el-option label="头像" value="avatar_download" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
@@ -108,7 +108,7 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { getShareList } from '@/api/spring/blessing/generateRecord'
|
||||
import { getShareList } from '@/api/spring/user'
|
||||
import { formatTime } from '@/utils'
|
||||
|
||||
export default {
|
||||
@@ -125,7 +125,7 @@
|
||||
queryForm: {
|
||||
pageNo: 1,
|
||||
pageSize: 10,
|
||||
type: '',
|
||||
scene: '',
|
||||
keyword: '',
|
||||
},
|
||||
timeOutID: null,
|
||||
@@ -124,11 +124,11 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { getList } from '@/api/spring/blessing/generateRecord'
|
||||
import { getViewList } from '@/api/spring/user'
|
||||
import { formatTime } from '@/utils'
|
||||
|
||||
export default {
|
||||
name: 'GenerateRecord',
|
||||
name: 'ViewRecord',
|
||||
data() {
|
||||
return {
|
||||
host: 'https://file.lihailezzc.com/',
|
||||
@@ -209,7 +209,7 @@
|
||||
},
|
||||
async fetchData() {
|
||||
this.listLoading = true
|
||||
const { data } = await getList(this.queryForm)
|
||||
const { data } = await getViewList(this.queryForm)
|
||||
this.list = data.list
|
||||
this.total = data.totalCount
|
||||
this.timeOutID = setTimeout(() => {
|
||||
@@ -0,0 +1,111 @@
|
||||
<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="type">
|
||||
<el-select v-model="form.type" allow-create default-first-option filterable placeholder="请选择壁纸类型" style="width: 100%">
|
||||
<el-option v-for="item in typeList" :key="item.id" :label="item.name" :value="item.id" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="壁纸图片" prop="imageUrl">
|
||||
<single-upload
|
||||
v-model="form.imageUrl"
|
||||
style="width: 100px; height: 100px"
|
||||
:upload-url="uploadUrl"
|
||||
@upload-success="handleUploadSuccess"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item 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 type="primary" @click="save">确 定</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { doEdit, doAdd } from '@/api/spring/wallpaper/system'
|
||||
import { getAllList } from '@/api/spring/wallpaper/type'
|
||||
import SingleUpload from '@/components/SingleUpload'
|
||||
|
||||
export default {
|
||||
name: 'SystemWallpaperEdit',
|
||||
components: { SingleUpload },
|
||||
data() {
|
||||
return {
|
||||
id: '',
|
||||
form: {
|
||||
type: '',
|
||||
imageUrl: '',
|
||||
isEnabled: true,
|
||||
},
|
||||
rules: {
|
||||
type: [{ required: true, trigger: 'change', message: '请选择壁纸类型' }],
|
||||
imageUrl: [{ required: true, trigger: 'blur', message: '请上传壁纸图片' }],
|
||||
isEnabled: [{ required: true, trigger: 'blur', message: '请选择是否启用' }],
|
||||
},
|
||||
title: '',
|
||||
dialogFormVisible: false,
|
||||
typeList: [],
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
uploadUrl() {
|
||||
return `${process.env.VUE_APP_API_BASE_URL}/management/api/common/upload`
|
||||
},
|
||||
},
|
||||
created() {
|
||||
this.fetchTypeList()
|
||||
},
|
||||
methods: {
|
||||
async fetchTypeList() {
|
||||
const { data } = await getAllList()
|
||||
this.typeList = data || []
|
||||
},
|
||||
handleUploadSuccess(url) {
|
||||
this.form.imageUrl = url
|
||||
},
|
||||
showEdit(row) {
|
||||
this.fetchTypeList()
|
||||
if (!row) {
|
||||
this.title = '添加'
|
||||
} else {
|
||||
this.title = '编辑'
|
||||
this.form = {
|
||||
type: row.type,
|
||||
imageUrl: row.imageUrl,
|
||||
isEnabled: row.isEnabled,
|
||||
}
|
||||
this.id = row.id
|
||||
}
|
||||
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) {
|
||||
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()
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
})
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
189
src/views/spring/wallpaper/system/index.vue
Normal file
189
src/views/spring/wallpaper/system/index.vue
Normal file
@@ -0,0 +1,189 @@
|
||||
<template>
|
||||
<div class="appManagement-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-plus" type="primary" @click="handleBatchAdd">批量添加</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.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">
|
||||
<el-table-column align="center" label="排序" prop="sort" show-overflow-tooltip />
|
||||
<el-table-column align="center" label="类型" prop="categoryName" show-overflow-tooltip />
|
||||
<el-table-column align="center" label="壁纸" width="100">
|
||||
<template slot-scope="scope">
|
||||
<el-tooltip class="item" :content="scope.row.id" effect="dark" placement="top">
|
||||
<el-image fit="cover" :preview-src-list="[scope.row.imageUrl]" :src="scope.row.imageUrl" style="width: 50px; height: 50px" />
|
||||
</el-tooltip>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="是否启用" show-overflow-tooltip>
|
||||
<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" label="操作">
|
||||
<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" />
|
||||
<batch-image-add ref="batchAdd" :do-add="doAdd" :has-type="true" :type-list="typeList" @fetch-data="fetchData" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { doDelete, getList, toggleEnable, doMoveUp, doMoveDown, doAdd } from '@/api/spring/wallpaper/system'
|
||||
import { getAllList } from '@/api/spring/wallpaper/type'
|
||||
import Edit from './components/AppManagementEdit'
|
||||
import BatchImageAdd from '@/components/BatchImageAdd'
|
||||
|
||||
export default {
|
||||
name: 'SystemWallpaper',
|
||||
components: { Edit, BatchImageAdd },
|
||||
data() {
|
||||
return {
|
||||
doAdd,
|
||||
typeList: [],
|
||||
list: null,
|
||||
listLoading: true,
|
||||
layout: 'total, sizes, prev, pager, next, jumper',
|
||||
total: 0,
|
||||
selectRows: '',
|
||||
elementLoadingText: '正在加载...',
|
||||
queryForm: {
|
||||
pageNo: 1,
|
||||
pageSize: 10,
|
||||
keyword: '',
|
||||
},
|
||||
timeOutID: null,
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.fetchData()
|
||||
this.fetchTypeList()
|
||||
},
|
||||
|
||||
beforeDestroy() {
|
||||
clearTimeout(this.timeOutID)
|
||||
},
|
||||
methods: {
|
||||
async fetchTypeList() {
|
||||
const { data } = await getAllList()
|
||||
this.typeList = data || []
|
||||
},
|
||||
handleBatchAdd() {
|
||||
this.$refs['batchAdd'].show()
|
||||
},
|
||||
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.id) {
|
||||
this.$baseConfirm('你确定要删除当前项吗', null, async () => {
|
||||
const { msg } = await doDelete({ ids: [row.id] })
|
||||
this.$baseMessage(msg, 'success')
|
||||
this.fetchData()
|
||||
})
|
||||
}
|
||||
},
|
||||
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
|
||||
const { data } = await getList(this.queryForm)
|
||||
this.list = data.list
|
||||
this.total = data.totalCount
|
||||
this.timeOutID = setTimeout(() => {
|
||||
this.listLoading = false
|
||||
}, 300)
|
||||
},
|
||||
async handleToggleEnable(row, val) {
|
||||
const prev = row.isEnabled
|
||||
row.isEnabled = val
|
||||
try {
|
||||
const { msg } = await toggleEnable(row.id, val)
|
||||
if (msg) this.$baseMessage(msg, 'success')
|
||||
this.fetchData()
|
||||
} catch (e) {
|
||||
row.isEnabled = prev
|
||||
this.$baseMessage('更新失败', 'error')
|
||||
}
|
||||
},
|
||||
async handleMoveUp(row) {
|
||||
try {
|
||||
const { msg } = await doMoveUp(row.id)
|
||||
if (msg) this.$baseMessage(msg, 'success')
|
||||
this.fetchData()
|
||||
} catch (e) {
|
||||
this.$baseMessage('操作失败', 'error')
|
||||
}
|
||||
},
|
||||
async handleMoveDown(row) {
|
||||
try {
|
||||
const { msg } = await doMoveDown(row.id)
|
||||
if (msg) this.$baseMessage(msg, 'success')
|
||||
this.fetchData()
|
||||
} catch (e) {
|
||||
this.$baseMessage('操作失败', 'error')
|
||||
}
|
||||
},
|
||||
isFirstEnabled(row) {
|
||||
if (!this.list || this.list.length === 0) return false
|
||||
const enabled = this.list.filter((item) => item.isEnabled)
|
||||
if (enabled.length === 0) return false
|
||||
return enabled[0].id === row.id
|
||||
},
|
||||
isLastEnabled(row) {
|
||||
if (!this.list || this.list.length === 0) return false
|
||||
const enabled = this.list.filter((item) => item.isEnabled)
|
||||
if (enabled.length === 0) return false
|
||||
return enabled[enabled.length - 1].id === row.id
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
@@ -0,0 +1,79 @@
|
||||
<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" />
|
||||
</el-form-item>
|
||||
<el-form-item 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 type="primary" @click="save">确 定</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { doEdit, doAdd } from '@/api/spring/wallpaper/type'
|
||||
|
||||
export default {
|
||||
name: 'WallpaperTypeEdit',
|
||||
data() {
|
||||
return {
|
||||
id: '',
|
||||
form: {
|
||||
name: '',
|
||||
isEnabled: true,
|
||||
},
|
||||
rules: {
|
||||
name: [{ required: true, trigger: 'blur', message: '请输入类型名称' }],
|
||||
isEnabled: [{ required: true, trigger: 'blur', message: '请选择是否启用' }],
|
||||
},
|
||||
title: '',
|
||||
dialogFormVisible: false,
|
||||
}
|
||||
},
|
||||
created() {},
|
||||
methods: {
|
||||
showEdit(row) {
|
||||
if (!row) {
|
||||
this.title = '添加'
|
||||
} else {
|
||||
this.title = '编辑'
|
||||
this.form = {
|
||||
name: row.name,
|
||||
isEnabled: row.isEnabled,
|
||||
}
|
||||
this.id = row.id
|
||||
}
|
||||
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) {
|
||||
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()
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
})
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
168
src/views/spring/wallpaper/type/index.vue
Normal file
168
src/views/spring/wallpaper/type/index.vue
Normal file
@@ -0,0 +1,168 @@
|
||||
<template>
|
||||
<div class="appManagement-container">
|
||||
<vab-query-form>
|
||||
<vab-query-form-left-panel :span="12">
|
||||
<el-button icon="el-icon-plus" type="primary" @click="handleEdit">添加</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.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">
|
||||
<el-table-column align="center" label="排序" prop="sort" show-overflow-tooltip />
|
||||
<el-table-column align="center" label="类型名称" prop="name" show-overflow-tooltip />
|
||||
<el-table-column align="center" label="是否启用" show-overflow-tooltip>
|
||||
<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" label="操作">
|
||||
<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/wallpaper/type'
|
||||
import Edit from './components/AppManagementEdit'
|
||||
|
||||
export default {
|
||||
name: 'WallpaperType',
|
||||
components: { Edit },
|
||||
data() {
|
||||
return {
|
||||
list: null,
|
||||
listLoading: true,
|
||||
layout: 'total, sizes, prev, pager, next, jumper',
|
||||
total: 0,
|
||||
selectRows: '',
|
||||
elementLoadingText: '正在加载...',
|
||||
queryForm: {
|
||||
pageNo: 1,
|
||||
pageSize: 10,
|
||||
keyword: '',
|
||||
},
|
||||
timeOutID: null,
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.fetchData()
|
||||
},
|
||||
|
||||
beforeDestroy() {
|
||||
clearTimeout(this.timeOutID)
|
||||
},
|
||||
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.id) {
|
||||
this.$baseConfirm('你确定要删除当前项吗', null, async () => {
|
||||
const { msg } = await doDelete({ ids: [row.id] })
|
||||
this.$baseMessage(msg, 'success')
|
||||
this.fetchData()
|
||||
})
|
||||
}
|
||||
},
|
||||
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
|
||||
const { data } = await getList(this.queryForm)
|
||||
this.list = data.list
|
||||
this.total = data.totalCount
|
||||
this.timeOutID = setTimeout(() => {
|
||||
this.listLoading = false
|
||||
}, 300)
|
||||
},
|
||||
async handleToggleEnable(row, val) {
|
||||
const prev = row.isEnabled
|
||||
row.isEnabled = val
|
||||
try {
|
||||
const { msg } = await toggleEnable(row.id, val)
|
||||
if (msg) this.$baseMessage(msg, 'success')
|
||||
this.fetchData()
|
||||
} catch (e) {
|
||||
row.isEnabled = prev
|
||||
this.$baseMessage('更新失败', 'error')
|
||||
}
|
||||
},
|
||||
async handleMoveUp(row) {
|
||||
try {
|
||||
const { msg } = await doMoveUp(row.id)
|
||||
if (msg) this.$baseMessage(msg, 'success')
|
||||
this.fetchData()
|
||||
} catch (e) {
|
||||
this.$baseMessage('操作失败', 'error')
|
||||
}
|
||||
},
|
||||
async handleMoveDown(row) {
|
||||
try {
|
||||
const { msg } = await doMoveDown(row.id)
|
||||
if (msg) this.$baseMessage(msg, 'success')
|
||||
this.fetchData()
|
||||
} catch (e) {
|
||||
this.$baseMessage('操作失败', 'error')
|
||||
}
|
||||
},
|
||||
isFirstEnabled(row) {
|
||||
if (!this.list || this.list.length === 0) return false
|
||||
const enabled = this.list.filter((item) => item.isEnabled)
|
||||
if (enabled.length === 0) return false
|
||||
return enabled[0].id === row.id
|
||||
},
|
||||
isLastEnabled(row) {
|
||||
if (!this.list || this.list.length === 0) return false
|
||||
const enabled = this.list.filter((item) => item.isEnabled)
|
||||
if (enabled.length === 0) return false
|
||||
return enabled[enabled.length - 1].id === row.id
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
Reference in New Issue
Block a user