Compare commits
33 Commits
db2dcaf64e
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a62e6819a4 | ||
|
|
8da0826109 | ||
|
|
e0171415c3 | ||
|
|
162c7d6c53 | ||
|
|
2f321651cb | ||
|
|
903581937a | ||
|
|
ce3a5f9c34 | ||
|
|
1800a7faa4 | ||
|
|
94ad0f79b0 | ||
|
|
85c588dc4f | ||
|
|
ccadda41d8 | ||
|
|
e29475e38f | ||
|
|
2b9a6e109c | ||
|
|
2a6b88619e | ||
|
|
eac6eec9e3 | ||
|
|
911a182143 | ||
|
|
69fd59dada | ||
|
|
43f38207bf | ||
|
|
23b0ae35af | ||
|
|
1d3258ee0d | ||
|
|
4a90afd968 | ||
|
|
d50af82fb8 | ||
|
|
f524b4e00f | ||
|
|
61bf50afc7 | ||
|
|
1867d5aa55 | ||
|
|
82b3d7a36d | ||
|
|
bbf7cab816 | ||
|
|
33d4a02a5d | ||
|
|
718fdd7826 | ||
|
|
0ec5aa2228 | ||
|
|
d36a2ca5f1 | ||
|
|
780facd765 | ||
|
|
e2366f9036 |
@@ -53,3 +53,11 @@ export function toggleEnable(id, isEnabled) {
|
||||
data: { isEnabled },
|
||||
})
|
||||
}
|
||||
|
||||
export function getCreateList(data) {
|
||||
return request({
|
||||
url: '/management/api/spring/avatar/create/list',
|
||||
method: 'get',
|
||||
params: data,
|
||||
})
|
||||
}
|
||||
|
||||
@@ -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,
|
||||
})
|
||||
}
|
||||
|
||||
55
src/api/spring/blessing/titleTemplate/index.js
Normal file
55
src/api/spring/blessing/titleTemplate/index.js
Normal file
@@ -0,0 +1,55 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
export function getList(data) {
|
||||
return request({
|
||||
url: '/management/api/spring/blessing/title_template/list',
|
||||
method: 'get',
|
||||
params: data,
|
||||
})
|
||||
}
|
||||
|
||||
export function doAdd(data) {
|
||||
return request({
|
||||
url: '/management/api/spring/blessing/title_template',
|
||||
method: 'post',
|
||||
data,
|
||||
})
|
||||
}
|
||||
|
||||
export function doEdit(id, data) {
|
||||
return request({
|
||||
url: `/management/api/spring/blessing/title_template/${id}`,
|
||||
method: 'put',
|
||||
data,
|
||||
})
|
||||
}
|
||||
|
||||
export function doDelete(data) {
|
||||
return request({
|
||||
url: '/management/api/spring/blessing/title_template/delete',
|
||||
method: 'put',
|
||||
data,
|
||||
})
|
||||
}
|
||||
|
||||
export function doMoveUp(id) {
|
||||
return request({
|
||||
url: `/management/api/spring/blessing/title_template/moveUp/${id}`,
|
||||
method: 'patch',
|
||||
})
|
||||
}
|
||||
|
||||
export function doMoveDown(id) {
|
||||
return request({
|
||||
url: `/management/api/spring/blessing/title_template/moveDown/${id}`,
|
||||
method: 'patch',
|
||||
})
|
||||
}
|
||||
|
||||
export function toggleEnable(id, isEnabled) {
|
||||
return request({
|
||||
url: `/management/api/spring/blessing/title_template/enable/${id}`,
|
||||
method: 'patch',
|
||||
data: { isEnabled },
|
||||
})
|
||||
}
|
||||
41
src/api/spring/daily/greeting.js
Normal file
41
src/api/spring/daily/greeting.js
Normal file
@@ -0,0 +1,41 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
export function getList(params) {
|
||||
return request({
|
||||
url: '/management/api/spring/greeting/list',
|
||||
method: 'get',
|
||||
params,
|
||||
})
|
||||
}
|
||||
|
||||
export function doAdd(data) {
|
||||
return request({
|
||||
url: '/management/api/spring/greeting/create',
|
||||
method: 'post',
|
||||
data,
|
||||
})
|
||||
}
|
||||
|
||||
export function doEdit(id, data) {
|
||||
return request({
|
||||
url: `/management/api/spring/greeting/update/${id}`,
|
||||
method: 'put',
|
||||
data,
|
||||
})
|
||||
}
|
||||
|
||||
export function doDelete(data) {
|
||||
return request({
|
||||
url: '/management/api/spring/greeting/delete',
|
||||
method: 'put',
|
||||
data,
|
||||
})
|
||||
}
|
||||
|
||||
export function toggleEnable(id, isEnabled) {
|
||||
return request({
|
||||
url: `/management/api/spring/greeting/enable/${id}`,
|
||||
method: 'patch',
|
||||
data: { isEnabled },
|
||||
})
|
||||
}
|
||||
62
src/api/spring/daily/scene.js
Normal file
62
src/api/spring/daily/scene.js
Normal file
@@ -0,0 +1,62 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
export function getList(params) {
|
||||
return request({
|
||||
url: '/management/api/spring/greeting-scene/list',
|
||||
method: 'get',
|
||||
params,
|
||||
})
|
||||
}
|
||||
|
||||
export function doAdd(data) {
|
||||
return request({
|
||||
url: '/management/api/spring/greeting-scene/create',
|
||||
method: 'post',
|
||||
data,
|
||||
})
|
||||
}
|
||||
|
||||
export function doEdit(id, data) {
|
||||
return request({
|
||||
url: `/management/api/spring/greeting-scene/update/${id}`,
|
||||
method: 'put',
|
||||
data,
|
||||
})
|
||||
}
|
||||
|
||||
export function doDelete(data) {
|
||||
return request({
|
||||
url: '/management/api/spring/greeting-scene/delete',
|
||||
method: 'put',
|
||||
data,
|
||||
})
|
||||
}
|
||||
|
||||
export function doMoveUp(id) {
|
||||
return request({
|
||||
url: `/management/api/spring/greeting-scene/moveUp/${id}`,
|
||||
method: 'patch',
|
||||
})
|
||||
}
|
||||
|
||||
export function doMoveDown(id) {
|
||||
return request({
|
||||
url: `/management/api/spring/greeting-scene/moveDown/${id}`,
|
||||
method: 'patch',
|
||||
})
|
||||
}
|
||||
|
||||
export function doMoveToTop(id) {
|
||||
return request({
|
||||
url: `/management/api/spring/greeting-scene/moveToTop/${id}`,
|
||||
method: 'patch',
|
||||
})
|
||||
}
|
||||
|
||||
export function toggleEnable(id, isEnabled) {
|
||||
return request({
|
||||
url: `/management/api/spring/greeting-scene/enable/${id}`,
|
||||
method: 'patch',
|
||||
data: { isEnabled },
|
||||
})
|
||||
}
|
||||
@@ -8,6 +8,14 @@ export function getList(data) {
|
||||
})
|
||||
}
|
||||
|
||||
export function getDrawList(data) {
|
||||
return request({
|
||||
url: 'management/api/spring/fortune/card/draw/list',
|
||||
method: 'get',
|
||||
params: data,
|
||||
})
|
||||
}
|
||||
|
||||
export function doAdd(data) {
|
||||
return request({
|
||||
url: '/management/api/spring/fortune/card',
|
||||
|
||||
55
src/api/spring/index/index.js
Normal file
55
src/api/spring/index/index.js
Normal file
@@ -0,0 +1,55 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
export function getList(data) {
|
||||
return request({
|
||||
url: '/management/api/spring/index/recommend/list',
|
||||
method: 'get',
|
||||
params: data,
|
||||
})
|
||||
}
|
||||
|
||||
export function doAdd(data) {
|
||||
return request({
|
||||
url: '/management/api/spring/index/recommend',
|
||||
method: 'post',
|
||||
data,
|
||||
})
|
||||
}
|
||||
|
||||
export function doDelete(data) {
|
||||
return request({
|
||||
url: '/management/api/spring/index/recommend/delete',
|
||||
method: 'put',
|
||||
data,
|
||||
})
|
||||
}
|
||||
|
||||
export function doMoveUp(id) {
|
||||
return request({
|
||||
url: `/management/api/spring/index/recommend/moveUp/${id}`,
|
||||
method: 'patch',
|
||||
})
|
||||
}
|
||||
|
||||
export function doMoveDown(id) {
|
||||
return request({
|
||||
url: `/management/api/spring/index/recommend/moveDown/${id}`,
|
||||
method: 'patch',
|
||||
})
|
||||
}
|
||||
|
||||
export function toggleEnable(id, isEnabled) {
|
||||
return request({
|
||||
url: `/management/api/spring/index/recommend/enable/${id}`,
|
||||
method: 'patch',
|
||||
data: { isEnabled },
|
||||
})
|
||||
}
|
||||
|
||||
export function getItemDetail(data) {
|
||||
return request({
|
||||
url: '/management/api/spring/index/recommend/check',
|
||||
method: 'get',
|
||||
params: data,
|
||||
})
|
||||
}
|
||||
63
src/api/spring/index/tips.js
Normal file
63
src/api/spring/index/tips.js
Normal file
@@ -0,0 +1,63 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
export function getList(data) {
|
||||
return request({
|
||||
url: '/management/api/spring/index/tips/list',
|
||||
method: 'get',
|
||||
params: data,
|
||||
})
|
||||
}
|
||||
|
||||
export function doAdd(data) {
|
||||
return request({
|
||||
url: '/management/api/spring/index/tips',
|
||||
method: 'post',
|
||||
data,
|
||||
})
|
||||
}
|
||||
|
||||
export function doEdit(id, data) {
|
||||
return request({
|
||||
url: `/management/api/spring/index/tips/${id}`,
|
||||
method: 'put',
|
||||
data,
|
||||
})
|
||||
}
|
||||
|
||||
export function doDelete(data) {
|
||||
return request({
|
||||
url: '/management/api/spring/index/tips/delete',
|
||||
method: 'put',
|
||||
data,
|
||||
})
|
||||
}
|
||||
|
||||
export function doMoveUp(id) {
|
||||
return request({
|
||||
url: `/management/api/spring/index/tips/moveUp/${id}`,
|
||||
method: 'patch',
|
||||
})
|
||||
}
|
||||
|
||||
export function doMoveDown(id) {
|
||||
return request({
|
||||
url: `/management/api/spring/index/tips/moveDown/${id}`,
|
||||
method: 'patch',
|
||||
})
|
||||
}
|
||||
|
||||
export function toggleEnable(id, isEnabled) {
|
||||
return request({
|
||||
url: `/management/api/spring/index/tips/enable/${id}`,
|
||||
method: 'patch',
|
||||
data: { isEnabled },
|
||||
})
|
||||
}
|
||||
|
||||
export function getItemDetail(data) {
|
||||
return request({
|
||||
url: '/management/api/spring/index/tips/check',
|
||||
method: 'get',
|
||||
params: data,
|
||||
})
|
||||
}
|
||||
39
src/api/spring/index/topic.js
Normal file
39
src/api/spring/index/topic.js
Normal file
@@ -0,0 +1,39 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
export function getList(data) {
|
||||
return request({
|
||||
url: '/management/api/spring/card/special-topic/list',
|
||||
method: 'get',
|
||||
params: data,
|
||||
})
|
||||
}
|
||||
|
||||
export function createTopic(data) {
|
||||
return request({
|
||||
url: '/management/api/spring/card/special-topic/create',
|
||||
method: 'post',
|
||||
data,
|
||||
})
|
||||
}
|
||||
|
||||
export function updateTopic(id, data) {
|
||||
return request({
|
||||
url: `/management/api/spring/card/special-topic/update/${id}`,
|
||||
method: 'put',
|
||||
data,
|
||||
})
|
||||
}
|
||||
|
||||
export function enableTopic(id) {
|
||||
return request({
|
||||
url: `/management/api/spring/card/special-topic/enable/${id}`,
|
||||
method: 'patch',
|
||||
})
|
||||
}
|
||||
|
||||
export function disableTopic(id) {
|
||||
return request({
|
||||
url: `/management/api/spring/card/special-topic/disable/${id}`,
|
||||
method: 'patch',
|
||||
})
|
||||
}
|
||||
@@ -7,3 +7,51 @@ export function getUserList(data) {
|
||||
params: data,
|
||||
})
|
||||
}
|
||||
|
||||
export function getVipUserList(data) {
|
||||
return request({
|
||||
url: '/management/api/spring/user/vip/list',
|
||||
method: 'get',
|
||||
params: data,
|
||||
})
|
||||
}
|
||||
|
||||
export function getUserOrderList(data) {
|
||||
return request({
|
||||
url: '/management/api/spring/user/order/list',
|
||||
method: 'get',
|
||||
params: data,
|
||||
})
|
||||
}
|
||||
|
||||
export function getUserFeedbackList(data) {
|
||||
return request({
|
||||
url: '/management/api/common/feedback/list',
|
||||
method: 'get',
|
||||
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 },
|
||||
})
|
||||
}
|
||||
9
src/api/suspiciousRequest/index.js
Normal file
9
src/api/suspiciousRequest/index.js
Normal file
@@ -0,0 +1,9 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
export function getList(data) {
|
||||
return request({
|
||||
url: '/management/api/suspicious-request/list',
|
||||
method: 'get',
|
||||
params: data,
|
||||
})
|
||||
}
|
||||
@@ -7,3 +7,11 @@ export function getDeviceList(data) {
|
||||
params: data,
|
||||
})
|
||||
}
|
||||
|
||||
export function getTrackingLogsList(data) {
|
||||
return request({
|
||||
url: 'management/api/system/tracking-logs/list',
|
||||
method: 'get',
|
||||
params: data,
|
||||
})
|
||||
}
|
||||
|
||||
@@ -6,22 +6,37 @@
|
||||
ref="upload"
|
||||
accept="image/*"
|
||||
:action="uploadUrl"
|
||||
drag
|
||||
:file-list="fileList"
|
||||
:headers="uploadHeaders"
|
||||
list-type="picture-card"
|
||||
:multiple="true"
|
||||
:on-preview="handlePreview"
|
||||
:on-remove="handleRemove"
|
||||
:on-success="handleSuccess"
|
||||
>
|
||||
<i class="el-icon-plus"></i>
|
||||
<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-input v-model.trim="type" placeholder="请输入类型" />
|
||||
<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" />
|
||||
@@ -48,6 +63,10 @@
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
typeList: {
|
||||
type: Array,
|
||||
default: () => [],
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
|
||||
@@ -55,6 +55,64 @@ export const asyncRoutes = [
|
||||
name: 'SpringMini',
|
||||
meta: { title: '新春祝福', icon: 'gift', permissions: ['admin'] },
|
||||
children: [
|
||||
{
|
||||
path: 'daily-index',
|
||||
component: EmptyLayout,
|
||||
alwaysShow: true,
|
||||
redirect: 'noRedirect',
|
||||
name: 'DailyIndex',
|
||||
meta: {
|
||||
title: '每日问候',
|
||||
icon: 'clover',
|
||||
permissions: ['admin'],
|
||||
},
|
||||
children: [
|
||||
{
|
||||
path: 'scene',
|
||||
name: 'Scene',
|
||||
component: () => import('@/views/spring/daily/scene/index'),
|
||||
meta: { title: '场景配置', icon: 'setting' },
|
||||
},
|
||||
{
|
||||
path: 'greeting',
|
||||
name: 'Greeting',
|
||||
component: () => import('@/views/spring/daily/greeting/index'),
|
||||
meta: { title: '问候语配置', icon: 'setting' },
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
path: 'index',
|
||||
component: EmptyLayout,
|
||||
alwaysShow: true,
|
||||
redirect: 'noRedirect',
|
||||
name: 'Index',
|
||||
meta: {
|
||||
title: '首页',
|
||||
icon: 'clover',
|
||||
permissions: ['admin'],
|
||||
},
|
||||
children: [
|
||||
{
|
||||
path: 'recommend',
|
||||
name: 'Recommend',
|
||||
component: () => import('@/views/spring/index/recommend/index'),
|
||||
meta: { title: '推介列表', icon: 'list' },
|
||||
},
|
||||
{
|
||||
path: 'topic',
|
||||
name: 'Topic',
|
||||
component: () => import('@/views/spring/index/topic/index'),
|
||||
meta: { title: '贺卡专题', icon: 'list' },
|
||||
},
|
||||
{
|
||||
path: 'tips',
|
||||
name: 'tips',
|
||||
component: () => import('@/views/spring/index/tips/index'),
|
||||
meta: { title: '首页跳转', icon: 'list' },
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
path: 'blessing',
|
||||
component: EmptyLayout,
|
||||
@@ -73,6 +131,12 @@ export const asyncRoutes = [
|
||||
component: () => import('@/views/spring/blessing/template/index'),
|
||||
meta: { title: '祝福卡模版' },
|
||||
},
|
||||
{
|
||||
path: 'titleTemplate',
|
||||
name: 'titleTemplate',
|
||||
component: () => import('@/views/spring/blessing/titleTemplate/index'),
|
||||
meta: { title: '图片标题模版' },
|
||||
},
|
||||
{
|
||||
path: 'contentTemplate',
|
||||
name: 'contentTemplate',
|
||||
@@ -87,6 +151,32 @@ 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,
|
||||
@@ -117,6 +207,12 @@ export const asyncRoutes = [
|
||||
component: () => import('@/views/spring/avatar/avatarDecor/index'),
|
||||
meta: { title: '头像挂饰' },
|
||||
},
|
||||
{
|
||||
path: 'record',
|
||||
name: 'AvatarRecord',
|
||||
component: () => import('@/views/spring/avatar/record/index'),
|
||||
meta: { title: '头像记录' },
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
@@ -137,6 +233,12 @@ export const asyncRoutes = [
|
||||
component: () => import('@/views/spring/fortune/card/index'),
|
||||
meta: { title: '抽签卡片' },
|
||||
},
|
||||
{
|
||||
path: 'drawRecord',
|
||||
name: 'DrawRecord',
|
||||
component: () => import('@/views/spring/fortune/drawRecord/index'),
|
||||
meta: { title: '抽签记录' },
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
@@ -157,196 +259,220 @@ export const asyncRoutes = [
|
||||
component: () => import('@/views/spring/user/user/index'),
|
||||
meta: { title: '用户' },
|
||||
},
|
||||
{
|
||||
path: 'vipUser',
|
||||
name: 'VipUser',
|
||||
component: () => import('@/views/spring/user/vipUser/index'),
|
||||
meta: { title: '会员用户' },
|
||||
},
|
||||
{
|
||||
path: 'userOrder',
|
||||
name: 'UserOrder',
|
||||
component: () => import('@/views/spring/user/order/index'),
|
||||
meta: { title: '订单' },
|
||||
},
|
||||
{
|
||||
path: 'userChat',
|
||||
name: 'UserChat',
|
||||
component: () => import('@/views/spring/user/device/index'),
|
||||
meta: { title: '设备' },
|
||||
},
|
||||
{
|
||||
path: 'feedback',
|
||||
name: 'Feedback',
|
||||
component: () => import('@/views/spring/user/feedback/index'),
|
||||
meta: { title: '用户反馈' },
|
||||
},
|
||||
{
|
||||
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: '查看记录' },
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
path: '/maomaotou',
|
||||
component: Layout,
|
||||
redirect: 'noRedirect',
|
||||
name: 'CxshMini',
|
||||
meta: { title: '猫猫头', icon: 'cat', permissions: ['admin'] },
|
||||
children: [
|
||||
{
|
||||
path: 'cat',
|
||||
component: EmptyLayout,
|
||||
alwaysShow: true,
|
||||
redirect: 'noRedirect',
|
||||
name: 'cat',
|
||||
meta: {
|
||||
title: '猫猫',
|
||||
icon: 'cat',
|
||||
permissions: ['admin'],
|
||||
},
|
||||
children: [
|
||||
{
|
||||
path: 'cat',
|
||||
name: 'Cat',
|
||||
component: () => import('@/views/maomao/cat/cat/index'),
|
||||
meta: { title: '猫猫' },
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
path: 'post',
|
||||
component: EmptyLayout,
|
||||
alwaysShow: true,
|
||||
redirect: 'noRedirect',
|
||||
name: 'Post',
|
||||
meta: {
|
||||
title: '帖子',
|
||||
icon: 'post',
|
||||
permissions: ['admin'],
|
||||
},
|
||||
children: [
|
||||
{
|
||||
path: 'post',
|
||||
name: 'Post',
|
||||
component: () => import('@/views/maomao/post/post/index'),
|
||||
meta: { title: '帖子' },
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
path: 'user',
|
||||
component: EmptyLayout,
|
||||
alwaysShow: true,
|
||||
redirect: 'noRedirect',
|
||||
name: 'User',
|
||||
meta: {
|
||||
title: '用户',
|
||||
icon: 'user',
|
||||
permissions: ['admin'],
|
||||
},
|
||||
children: [
|
||||
{
|
||||
path: 'user',
|
||||
name: 'User',
|
||||
component: () => import('@/views/maomao/user/user/index'),
|
||||
meta: { title: '用户' },
|
||||
},
|
||||
{
|
||||
path: 'userChat',
|
||||
name: 'UserChat',
|
||||
component: () => import('@/views/maomao/user/chat/index'),
|
||||
meta: { title: '聊天' },
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
path: '/cxshMini',
|
||||
component: Layout,
|
||||
redirect: 'noRedirect',
|
||||
name: 'CxshMini',
|
||||
meta: { title: '小程序', icon: 'comment', permissions: ['admin', 'csxh_admin', 'csxh_user'] },
|
||||
children: [
|
||||
{
|
||||
path: 'home',
|
||||
component: EmptyLayout,
|
||||
alwaysShow: true,
|
||||
redirect: 'noRedirect',
|
||||
name: 'Home',
|
||||
meta: {
|
||||
title: '首页',
|
||||
icon: 'home',
|
||||
permissions: ['admin', 'csxh_admin', 'csxh_user'],
|
||||
},
|
||||
children: [
|
||||
{
|
||||
path: 'banner',
|
||||
name: 'Banner',
|
||||
component: () => import('@/views/cxshMini/home/banner/index'),
|
||||
meta: { title: '轮播图' },
|
||||
},
|
||||
{
|
||||
path: 'news',
|
||||
name: 'News',
|
||||
component: () => import('@/views/cxshMini/home/news/index'),
|
||||
meta: { title: '花絮动态' },
|
||||
},
|
||||
{
|
||||
path: 'createNews',
|
||||
name: 'CreateNews',
|
||||
component: () => import('@/views/cxshMini/home/createNews/index'),
|
||||
meta: { title: '新建花絮' },
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
path: 'anli',
|
||||
component: EmptyLayout,
|
||||
alwaysShow: true,
|
||||
redirect: 'noRedirect',
|
||||
name: 'Anli',
|
||||
meta: {
|
||||
title: '精彩案例',
|
||||
icon: 'handshake',
|
||||
permissions: ['admin', 'csxh_admin', 'csxh_user'],
|
||||
},
|
||||
children: [
|
||||
{
|
||||
path: 'article',
|
||||
name: 'Article',
|
||||
component: () => import('@/views/cxshMini/anli/article/index'),
|
||||
meta: { title: '新建案例' },
|
||||
},
|
||||
{
|
||||
path: 'list',
|
||||
name: 'List',
|
||||
component: () => import('@/views/cxshMini/anli/list/index'),
|
||||
meta: { title: '案例列表' },
|
||||
},
|
||||
{
|
||||
path: 'category',
|
||||
name: 'Category',
|
||||
component: () => import('@/views/cxshMini/anli/category/index'),
|
||||
meta: { title: '案例分类' },
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
path: 'lianxi',
|
||||
component: EmptyLayout,
|
||||
alwaysShow: true,
|
||||
redirect: 'noRedirect',
|
||||
name: 'Lianxi',
|
||||
meta: {
|
||||
title: '联系我们',
|
||||
icon: 'user-friends',
|
||||
permissions: ['admin', 'csxh_admin', 'csxh_user'],
|
||||
},
|
||||
children: [
|
||||
{
|
||||
path: 'member',
|
||||
name: 'Member',
|
||||
component: () => import('@/views/cxshMini/lianxi/member/index'),
|
||||
meta: { title: '成员' },
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
// {
|
||||
// path: '/maomaotou',
|
||||
// component: Layout,
|
||||
// redirect: 'noRedirect',
|
||||
// name: 'CxshMini',
|
||||
// meta: { title: '猫猫头', icon: 'cat', permissions: ['admin'] },
|
||||
// children: [
|
||||
// {
|
||||
// path: 'cat',
|
||||
// component: EmptyLayout,
|
||||
// alwaysShow: true,
|
||||
// redirect: 'noRedirect',
|
||||
// name: 'cat',
|
||||
// meta: {
|
||||
// title: '猫猫',
|
||||
// icon: 'cat',
|
||||
// permissions: ['admin'],
|
||||
// },
|
||||
// children: [
|
||||
// {
|
||||
// path: 'cat',
|
||||
// name: 'Cat',
|
||||
// component: () => import('@/views/maomao/cat/cat/index'),
|
||||
// meta: { title: '猫猫' },
|
||||
// },
|
||||
// ],
|
||||
// },
|
||||
// {
|
||||
// path: 'post',
|
||||
// component: EmptyLayout,
|
||||
// alwaysShow: true,
|
||||
// redirect: 'noRedirect',
|
||||
// name: 'Post',
|
||||
// meta: {
|
||||
// title: '帖子',
|
||||
// icon: 'post',
|
||||
// permissions: ['admin'],
|
||||
// },
|
||||
// children: [
|
||||
// {
|
||||
// path: 'post',
|
||||
// name: 'Post',
|
||||
// component: () => import('@/views/maomao/post/post/index'),
|
||||
// meta: { title: '帖子' },
|
||||
// },
|
||||
// ],
|
||||
// },
|
||||
// {
|
||||
// path: 'user',
|
||||
// component: EmptyLayout,
|
||||
// alwaysShow: true,
|
||||
// redirect: 'noRedirect',
|
||||
// name: 'User',
|
||||
// meta: {
|
||||
// title: '用户',
|
||||
// icon: 'user',
|
||||
// permissions: ['admin'],
|
||||
// },
|
||||
// children: [
|
||||
// {
|
||||
// path: 'user',
|
||||
// name: 'User',
|
||||
// component: () => import('@/views/maomao/user/user/index'),
|
||||
// meta: { title: '用户' },
|
||||
// },
|
||||
// {
|
||||
// path: 'userChat',
|
||||
// name: 'UserChat',
|
||||
// component: () => import('@/views/maomao/user/chat/index'),
|
||||
// meta: { title: '聊天' },
|
||||
// },
|
||||
// ],
|
||||
// },
|
||||
// ],
|
||||
// },
|
||||
// {
|
||||
// path: '/cxshMini',
|
||||
// component: Layout,
|
||||
// redirect: 'noRedirect',
|
||||
// name: 'CxshMini',
|
||||
// meta: { title: '小程序', icon: 'comment', permissions: ['admin', 'csxh_admin', 'csxh_user'] },
|
||||
// children: [
|
||||
// {
|
||||
// path: 'home',
|
||||
// component: EmptyLayout,
|
||||
// alwaysShow: true,
|
||||
// redirect: 'noRedirect',
|
||||
// name: 'Home',
|
||||
// meta: {
|
||||
// title: '首页',
|
||||
// icon: 'home',
|
||||
// permissions: ['admin', 'csxh_admin', 'csxh_user'],
|
||||
// },
|
||||
// children: [
|
||||
// {
|
||||
// path: 'banner',
|
||||
// name: 'Banner',
|
||||
// component: () => import('@/views/cxshMini/home/banner/index'),
|
||||
// meta: { title: '轮播图' },
|
||||
// },
|
||||
// {
|
||||
// path: 'news',
|
||||
// name: 'News',
|
||||
// component: () => import('@/views/cxshMini/home/news/index'),
|
||||
// meta: { title: '花絮动态' },
|
||||
// },
|
||||
// {
|
||||
// path: 'createNews',
|
||||
// name: 'CreateNews',
|
||||
// component: () => import('@/views/cxshMini/home/createNews/index'),
|
||||
// meta: { title: '新建花絮' },
|
||||
// },
|
||||
// ],
|
||||
// },
|
||||
// {
|
||||
// path: 'anli',
|
||||
// component: EmptyLayout,
|
||||
// alwaysShow: true,
|
||||
// redirect: 'noRedirect',
|
||||
// name: 'Anli',
|
||||
// meta: {
|
||||
// title: '精彩案例',
|
||||
// icon: 'handshake',
|
||||
// permissions: ['admin', 'csxh_admin', 'csxh_user'],
|
||||
// },
|
||||
// children: [
|
||||
// {
|
||||
// path: 'article',
|
||||
// name: 'Article',
|
||||
// component: () => import('@/views/cxshMini/anli/article/index'),
|
||||
// meta: { title: '新建案例' },
|
||||
// },
|
||||
// {
|
||||
// path: 'list',
|
||||
// name: 'List',
|
||||
// component: () => import('@/views/cxshMini/anli/list/index'),
|
||||
// meta: { title: '案例列表' },
|
||||
// },
|
||||
// {
|
||||
// path: 'category',
|
||||
// name: 'Category',
|
||||
// component: () => import('@/views/cxshMini/anli/category/index'),
|
||||
// meta: { title: '案例分类' },
|
||||
// },
|
||||
// ],
|
||||
// },
|
||||
// {
|
||||
// path: 'lianxi',
|
||||
// component: EmptyLayout,
|
||||
// alwaysShow: true,
|
||||
// redirect: 'noRedirect',
|
||||
// name: 'Lianxi',
|
||||
// meta: {
|
||||
// title: '联系我们',
|
||||
// icon: 'user-friends',
|
||||
// permissions: ['admin', 'csxh_admin', 'csxh_user'],
|
||||
// },
|
||||
// children: [
|
||||
// {
|
||||
// path: 'member',
|
||||
// name: 'Member',
|
||||
// component: () => import('@/views/cxshMini/lianxi/member/index'),
|
||||
// meta: { title: '成员' },
|
||||
// },
|
||||
// ],
|
||||
// },
|
||||
// ],
|
||||
// },
|
||||
/* {
|
||||
path: "/test",
|
||||
component: Layout,
|
||||
@@ -563,6 +689,12 @@ export const asyncRoutes = [
|
||||
component: () => import('@/views/personnelManagement/accessLogManagement/index'),
|
||||
meta: { title: '访问日志' },
|
||||
},
|
||||
{
|
||||
path: 'suspiciousRequest',
|
||||
name: 'SuspiciousRequest',
|
||||
component: () => import('@/views/personnelManagement/suspiciousRequest/index'),
|
||||
meta: { title: '异常请求' },
|
||||
},
|
||||
{
|
||||
path: 'uploadedFileManagement',
|
||||
name: 'UploadedFileManagement',
|
||||
|
||||
26
src/utils/blessing.js
Normal file
26
src/utils/blessing.js
Normal file
@@ -0,0 +1,26 @@
|
||||
/**
|
||||
* 根据场景值获取场景名称
|
||||
* @param {string} scene - 场景值
|
||||
* @returns {string} - 场景名称
|
||||
*/
|
||||
const sceneMap = {
|
||||
card_generate: '祝福卡片',
|
||||
fortune_draw: '抽签',
|
||||
wallpaper_download: '壁纸',
|
||||
avatar_download: '头像',
|
||||
card_generate_index: '祝福卡片分享首页',
|
||||
fortune_draw_index: '抽签分享首页',
|
||||
wallpaper_download_index: '壁纸分享首页',
|
||||
avatar_download_index: '头像分享首页',
|
||||
index: '分享首页',
|
||||
mine: '我的页面分享',
|
||||
}
|
||||
|
||||
export function getSceneName(scene) {
|
||||
return sceneMap[scene] || scene
|
||||
}
|
||||
|
||||
export const getThumbUrl = (url, w = 200, h = 200) => {
|
||||
if (!url) return ''
|
||||
return `${url}?imageView2/1/w/${w}/h/${h}/q/80`
|
||||
}
|
||||
@@ -70,14 +70,27 @@ export function formatTime(time, option) {
|
||||
const now = new Date()
|
||||
const diff = (now - time) / 1000
|
||||
|
||||
if (diff < 30) {
|
||||
return '刚刚'
|
||||
} else if (diff < 3600) {
|
||||
return `${Math.ceil(diff / 60)}分钟前`
|
||||
} else if (diff < 3600 * 24) {
|
||||
return `${Math.ceil(diff / 3600)}小时前`
|
||||
} else if (diff < 3600 * 24 * 2) {
|
||||
return '1天前'
|
||||
if (diff < 0) {
|
||||
const absDiff = Math.abs(diff)
|
||||
if (absDiff < 30) {
|
||||
return '刚刚'
|
||||
} else if (absDiff < 3600) {
|
||||
return `${Math.ceil(absDiff / 60)}分钟后`
|
||||
} else if (absDiff < 3600 * 24) {
|
||||
return `${Math.ceil(absDiff / 3600)}小时后`
|
||||
} else if (absDiff < 3600 * 24 * 2) {
|
||||
return '1天后'
|
||||
}
|
||||
} else {
|
||||
if (diff < 30) {
|
||||
return '刚刚'
|
||||
} else if (diff < 3600) {
|
||||
return `${Math.ceil(diff / 60)}分钟前`
|
||||
} else if (diff < 3600 * 24) {
|
||||
return `${Math.ceil(diff / 3600)}小时前`
|
||||
} else if (diff < 3600 * 24 * 2) {
|
||||
return '1天前'
|
||||
}
|
||||
}
|
||||
|
||||
if (option) {
|
||||
|
||||
528
src/views/index/components/TrackingCharts.vue
Normal file
528
src/views/index/components/TrackingCharts.vue
Normal file
@@ -0,0 +1,528 @@
|
||||
<template>
|
||||
<div class="tracking-charts">
|
||||
<el-row :gutter="20" style="margin-bottom: 20px">
|
||||
<el-col :span="4">
|
||||
<el-card shadow="never">
|
||||
<div style="font-size: 14px; color: #909399">当前上报总数</div>
|
||||
<div style="font-size: 24px; font-weight: bold; color: #303133; margin-top: 5px">{{ list.length }}</div>
|
||||
</el-card>
|
||||
</el-col>
|
||||
<el-col :span="4">
|
||||
<el-card shadow="never">
|
||||
<div style="font-size: 14px; color: #909399">用户数</div>
|
||||
<div style="font-size: 24px; font-weight: bold; color: #303133; margin-top: 5px">{{ userOptions.length }}</div>
|
||||
</el-card>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<el-card class="filter-card" shadow="never">
|
||||
<el-form :inline="true" :model="queryForm" size="small" @submit.native.prevent>
|
||||
<el-form-item label="App">
|
||||
<el-select v-model="queryForm.appId" filterable>
|
||||
<el-option v-for="(label, value) in appMap" :key="value" :label="label" :value="value">
|
||||
<span style="float: left">{{ label }}</span>
|
||||
<span style="float: right; color: #8492a6; font-size: 13px">{{ value }}</span>
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="User ID">
|
||||
<el-select v-model="queryForm.userId" allow-create clearable default-first-option filterable placeholder="请输入或选择User ID">
|
||||
<el-option v-for="item in userOptions" :key="item.value" :label="item.label" :value="item.value">
|
||||
<span style="float: left">{{ item.label }}</span>
|
||||
<span v-if="item.value !== item.label" style="float: right; color: #8492a6; font-size: 13px; margin-left: 20px">
|
||||
{{ item.value }}
|
||||
</span>
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="事件名称">
|
||||
<el-select v-model="queryForm.eventName" clearable filterable placeholder="全部事件">
|
||||
<el-option v-for="(label, value) in eventNameMap" :key="value" :label="label" :value="value">
|
||||
<span style="float: left">{{ label }}</span>
|
||||
<span style="float: right; color: #8492a6; font-size: 13px">{{ value }}</span>
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="事件类型">
|
||||
<el-select v-model="queryForm.eventType" clearable placeholder="全部类型">
|
||||
<el-option v-for="(label, value) in eventTypeMap" :key="value" :label="label" :value="value" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="时间范围">
|
||||
<el-date-picker
|
||||
v-model="queryForm.dateRange"
|
||||
:default-time="['00:00:00', '23:59:59']"
|
||||
end-placeholder="结束日期"
|
||||
:picker-options="pickerOptions"
|
||||
range-separator="至"
|
||||
start-placeholder="开始日期"
|
||||
type="datetimerange"
|
||||
value-format="yyyy-MM-dd HH:mm:ss"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button icon="el-icon-search" type="primary" @click="handleQuery">查询</el-button>
|
||||
<el-button icon="el-icon-refresh" @click="resetQuery">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-card>
|
||||
|
||||
<div v-loading="loading" class="charts-container">
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="24">
|
||||
<el-card class="chart-card" shadow="never">
|
||||
<div slot="header"><span>时段趋势</span></div>
|
||||
<v-chart autoresize class="chart" :option="trendOption" />
|
||||
</el-card>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<el-row :gutter="20" style="margin-top: 20px">
|
||||
<el-col :span="12">
|
||||
<el-card class="chart-card" shadow="never">
|
||||
<div slot="header"><span>事件名称分布</span></div>
|
||||
<v-chart autoresize class="chart" :option="eventNameOption" @click="handleEventNameClick" />
|
||||
</el-card>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-card class="chart-card" shadow="never">
|
||||
<div slot="header"><span>事件类型分布</span></div>
|
||||
<v-chart autoresize class="chart" :option="eventTypeOption" @click="handleEventTypeClick" />
|
||||
</el-card>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<el-row :gutter="20" style="margin-top: 20px">
|
||||
<el-col :span="24">
|
||||
<el-card class="chart-card" shadow="never">
|
||||
<div slot="header"><span>页面访问排行</span></div>
|
||||
<v-chart autoresize class="chart" :option="pageOption" />
|
||||
</el-card>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<el-row :gutter="20" style="margin-top: 20px">
|
||||
<el-col :span="24">
|
||||
<el-card shadow="never">
|
||||
<div slot="header" style="display: flex; justify-content: space-between; align-items: center">
|
||||
<span>
|
||||
详细日志列表
|
||||
<span v-if="filterText" style="font-size: 12px; color: #666">({{ filterText }})</span>
|
||||
</span>
|
||||
<el-button v-if="isFiltered" size="mini" type="text" @click="clearFilter">清除筛选</el-button>
|
||||
</div>
|
||||
<el-table :data="paginatedList" style="width: 100%">
|
||||
<el-table-column label="时间" prop="createdAt" width="160">
|
||||
<template slot-scope="{ row }">
|
||||
{{ formatTime(row.createdAt) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="事件名称" prop="eventName" show-overflow-tooltip>
|
||||
<template slot-scope="{ row }">
|
||||
{{ eventNameMap[row.eventName] || row.eventName }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="事件类型" prop="eventType" show-overflow-tooltip>
|
||||
<template slot-scope="{ row }">
|
||||
{{ eventTypeMap[row.eventType] || row.eventType }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="页面" prop="page" show-overflow-tooltip />
|
||||
<el-table-column label="元素ID" prop="elementId" show-overflow-tooltip />
|
||||
<el-table-column label="访问地址" prop="address" show-overflow-tooltip />
|
||||
<el-table-column label="元素内容" prop="elementContent" show-overflow-tooltip />
|
||||
<el-table-column label="User ID" prop="userId" show-overflow-tooltip>
|
||||
<template slot-scope="{ row }">
|
||||
<el-link type="primary" :underline="false" @click="goToUser(row.userId)">{{ row.userId }}</el-link>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<el-pagination
|
||||
background
|
||||
:current-page="currentPage"
|
||||
layout="total, sizes, prev, pager, next, jumper"
|
||||
:page-size="pageSize"
|
||||
:page-sizes="[10, 20, 50, 100]"
|
||||
style="margin-top: 20px; text-align: right"
|
||||
:total="total"
|
||||
@current-change="handleCurrentChange"
|
||||
@size-change="handleSizeChange"
|
||||
/>
|
||||
</el-card>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { getTrackingLogsList } from '@/api/system'
|
||||
import { use } from 'echarts/core'
|
||||
import { CanvasRenderer } from 'echarts/renderers'
|
||||
import { LineChart, PieChart, BarChart } from 'echarts/charts'
|
||||
import { GridComponent, TooltipComponent, LegendComponent, TitleComponent } from 'echarts/components'
|
||||
import VChart from 'vue-echarts'
|
||||
import dayjs from 'dayjs'
|
||||
import { groupBy, countBy } from 'lodash'
|
||||
import { eventNameMap, eventTypeMap, appMap, userMap } from '../utils'
|
||||
|
||||
use([CanvasRenderer, LineChart, PieChart, BarChart, GridComponent, TooltipComponent, LegendComponent, TitleComponent])
|
||||
|
||||
export default {
|
||||
name: 'TrackingCharts',
|
||||
components: {
|
||||
VChart,
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
eventNameMap,
|
||||
eventTypeMap,
|
||||
appMap,
|
||||
userMap,
|
||||
loading: false,
|
||||
queryForm: {
|
||||
appId: '69665538a49b8ae3be50fe5d',
|
||||
userId: '',
|
||||
eventName: '',
|
||||
eventType: '',
|
||||
dateRange: [],
|
||||
},
|
||||
userOptions: [],
|
||||
pickerOptions: {
|
||||
shortcuts: [
|
||||
{
|
||||
text: '今天',
|
||||
onClick(picker) {
|
||||
const end = new Date()
|
||||
const start = new Date()
|
||||
start.setHours(0, 0, 0, 0)
|
||||
end.setHours(23, 59, 59, 999)
|
||||
picker.$emit('pick', [start, end])
|
||||
},
|
||||
},
|
||||
{
|
||||
text: '昨天',
|
||||
onClick(picker) {
|
||||
const end = new Date()
|
||||
const start = new Date()
|
||||
start.setTime(start.getTime() - 3600 * 1000 * 24)
|
||||
start.setHours(0, 0, 0, 0)
|
||||
end.setTime(end.getTime() - 3600 * 1000 * 24)
|
||||
end.setHours(23, 59, 59, 999)
|
||||
picker.$emit('pick', [start, end])
|
||||
},
|
||||
},
|
||||
{
|
||||
text: '最近一周',
|
||||
onClick(picker) {
|
||||
const end = new Date()
|
||||
const start = new Date()
|
||||
start.setTime(start.getTime() - 3600 * 1000 * 24 * 7)
|
||||
picker.$emit('pick', [start, end])
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
list: [],
|
||||
filteredList: [],
|
||||
currentPage: 1,
|
||||
pageSize: 10,
|
||||
isFiltered: false,
|
||||
filterText: '',
|
||||
trendOption: {},
|
||||
eventNameOption: {},
|
||||
eventTypeOption: {},
|
||||
pageOption: {},
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
total() {
|
||||
return this.filteredList.length
|
||||
},
|
||||
paginatedList() {
|
||||
const start = (this.currentPage - 1) * this.pageSize
|
||||
const end = start + this.pageSize
|
||||
return this.filteredList.slice(start, end)
|
||||
},
|
||||
},
|
||||
created() {
|
||||
// 默认选中今天
|
||||
const end = new Date()
|
||||
const start = new Date()
|
||||
start.setHours(0, 0, 0, 0)
|
||||
end.setHours(23, 59, 59, 999)
|
||||
this.queryForm.dateRange = [dayjs(start).format('YYYY-MM-DD HH:mm:ss'), dayjs(end).format('YYYY-MM-DD HH:mm:ss')]
|
||||
|
||||
this.fetchData()
|
||||
},
|
||||
methods: {
|
||||
formatTime(time) {
|
||||
return dayjs(time).format('YYYY-MM-DD HH:mm:ss')
|
||||
},
|
||||
async fetchData() {
|
||||
this.loading = true
|
||||
try {
|
||||
const params = {
|
||||
appId: this.queryForm.appId,
|
||||
userId: this.queryForm.userId || undefined,
|
||||
eventName: this.queryForm.eventName || undefined,
|
||||
eventType: this.queryForm.eventType || undefined,
|
||||
startTime: this.queryForm.dateRange ? this.queryForm.dateRange[0] : undefined,
|
||||
endTime: this.queryForm.dateRange ? this.queryForm.dateRange[1] : undefined,
|
||||
pageNo: 1,
|
||||
pageSize: 10000, // 获取足够多的数据进行前端统计,或者应该依赖后端聚合接口
|
||||
}
|
||||
|
||||
const { data } = await getTrackingLogsList(params)
|
||||
this.list = data.list || []
|
||||
|
||||
// 如果没有筛选用户,则更新用户选项列表
|
||||
if (!this.queryForm.userId) {
|
||||
const userIds = this.list.map((item) => item.userId).filter(Boolean)
|
||||
const uniqueUsers = [...new Set(userIds)]
|
||||
this.userOptions = uniqueUsers.map((id) => ({ value: id, label: this.userMap[id] || id }))
|
||||
}
|
||||
|
||||
this.filteredList = [...this.list]
|
||||
this.isFiltered = false
|
||||
this.filterText = ''
|
||||
this.currentPage = 1
|
||||
this.processData()
|
||||
} catch (error) {
|
||||
console.error(error)
|
||||
this.$baseMessage('获取数据失败', 'error')
|
||||
} finally {
|
||||
this.loading = false
|
||||
}
|
||||
},
|
||||
handleQuery() {
|
||||
this.fetchData()
|
||||
},
|
||||
resetQuery() {
|
||||
this.queryForm.appId = '69665538a49b8ae3be50fe5d'
|
||||
this.queryForm.userId = ''
|
||||
this.queryForm.eventName = ''
|
||||
this.queryForm.eventType = ''
|
||||
const end = new Date()
|
||||
const start = new Date()
|
||||
start.setHours(0, 0, 0, 0)
|
||||
end.setHours(23, 59, 59, 999)
|
||||
this.queryForm.dateRange = [dayjs(start).format('YYYY-MM-DD HH:mm:ss'), dayjs(end).format('YYYY-MM-DD HH:mm:ss')]
|
||||
this.fetchData()
|
||||
},
|
||||
handleSizeChange(val) {
|
||||
this.pageSize = val
|
||||
this.currentPage = 1
|
||||
},
|
||||
handleCurrentChange(val) {
|
||||
this.currentPage = val
|
||||
},
|
||||
clearFilter() {
|
||||
this.filteredList = [...this.list]
|
||||
this.isFiltered = false
|
||||
this.filterText = ''
|
||||
this.currentPage = 1
|
||||
},
|
||||
goToUser(userId) {
|
||||
if (!userId) return
|
||||
this.$router.push({
|
||||
path: '/spring/user/user',
|
||||
query: { userId },
|
||||
})
|
||||
},
|
||||
handleEventNameClick(params) {
|
||||
const name = params.name
|
||||
// name 可能是中文映射名,需要反向查找 key,或者在 processData 时把 key 存入
|
||||
// 简单起见,processData 中 name 已经是中文名或者 key 了。
|
||||
// 如果我们用中文名展示,过滤时比较麻烦。
|
||||
// 最好在 processData 中让 echarts data item 包含原始 key。
|
||||
|
||||
// 重新检查 processData
|
||||
// const eventNameData = Object.keys(eventNameCounts).map((key) => ({
|
||||
// name: this.eventNameMap[key] || key,
|
||||
// value: eventNameCounts[key],
|
||||
// key: key // 添加原始 key
|
||||
// }))
|
||||
|
||||
const key = params.data.key || params.name // 如果没有 key 属性,回退到 name
|
||||
this.filteredList = this.list.filter((item) => {
|
||||
const itemKey = item.eventName
|
||||
const itemName = this.eventNameMap[itemKey] || itemKey
|
||||
// 如果 params.data.key 存在,则精确匹配 key
|
||||
if (params.data.key) {
|
||||
return item.eventName === params.data.key
|
||||
}
|
||||
return itemName === name
|
||||
})
|
||||
this.isFiltered = true
|
||||
this.filterText = `筛选事件: ${name}`
|
||||
this.currentPage = 1
|
||||
},
|
||||
handleEventTypeClick(params) {
|
||||
const name = params.name
|
||||
const key = params.data.key || params.name
|
||||
this.filteredList = this.list.filter((item) => {
|
||||
if (params.data.key) {
|
||||
return item.eventType === params.data.key
|
||||
}
|
||||
const itemKey = item.eventType
|
||||
const itemName = this.eventTypeMap[itemKey] || itemKey
|
||||
return itemName === name
|
||||
})
|
||||
this.isFiltered = true
|
||||
this.filterText = `筛选类型: ${name}`
|
||||
this.currentPage = 1
|
||||
},
|
||||
processData() {
|
||||
// 1. 时段趋势
|
||||
const logsByHour = groupBy(this.list, (item) => dayjs(item.createdAt).format('HH:00'))
|
||||
const hours = []
|
||||
const counts = []
|
||||
for (let i = 0; i < 24; i++) {
|
||||
const hour = `${String(i).padStart(2, '0')}:00`
|
||||
hours.push(hour)
|
||||
counts.push(logsByHour[hour] ? logsByHour[hour].length : 0)
|
||||
}
|
||||
this.trendOption = {
|
||||
tooltip: {
|
||||
trigger: 'axis',
|
||||
},
|
||||
xAxis: {
|
||||
type: 'category',
|
||||
data: hours,
|
||||
},
|
||||
yAxis: {
|
||||
type: 'value',
|
||||
},
|
||||
series: [
|
||||
{
|
||||
data: counts,
|
||||
type: 'line',
|
||||
smooth: true,
|
||||
areaStyle: {},
|
||||
},
|
||||
],
|
||||
}
|
||||
|
||||
// 2. 事件名称分布
|
||||
const eventNameCounts = countBy(this.list, 'eventName')
|
||||
const eventNameData = Object.keys(eventNameCounts).map((key) => ({
|
||||
name: this.eventNameMap[key] || key,
|
||||
value: eventNameCounts[key],
|
||||
key: key, // 保存原始key
|
||||
}))
|
||||
this.eventNameOption = {
|
||||
tooltip: {
|
||||
trigger: 'item',
|
||||
formatter: '{b}: {c} ({d}%)',
|
||||
},
|
||||
legend: {
|
||||
orient: 'vertical',
|
||||
left: 'left',
|
||||
},
|
||||
series: [
|
||||
{
|
||||
name: '事件名称',
|
||||
type: 'pie',
|
||||
radius: '50%',
|
||||
data: eventNameData,
|
||||
emphasis: {
|
||||
itemStyle: {
|
||||
shadowBlur: 10,
|
||||
shadowOffsetX: 0,
|
||||
shadowColor: 'rgba(0, 0, 0, 0.5)',
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
}
|
||||
|
||||
// 3. 事件类型分布
|
||||
const eventTypeCounts = countBy(this.list, 'eventType')
|
||||
const eventTypeData = Object.keys(eventTypeCounts).map((key) => ({
|
||||
name: this.eventTypeMap[key] || key,
|
||||
value: eventTypeCounts[key],
|
||||
key: key, // 保存原始key
|
||||
}))
|
||||
this.eventTypeOption = {
|
||||
tooltip: {
|
||||
trigger: 'item',
|
||||
formatter: '{b}: {c} ({d}%)',
|
||||
},
|
||||
legend: {
|
||||
orient: 'vertical',
|
||||
left: 'left',
|
||||
},
|
||||
series: [
|
||||
{
|
||||
name: '事件类型',
|
||||
type: 'pie',
|
||||
radius: '50%',
|
||||
data: eventTypeData,
|
||||
emphasis: {
|
||||
itemStyle: {
|
||||
shadowBlur: 10,
|
||||
shadowOffsetX: 0,
|
||||
shadowColor: 'rgba(0, 0, 0, 0.5)',
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
}
|
||||
|
||||
// 4. 页面访问排行
|
||||
const pageCounts = countBy(this.list, 'page')
|
||||
// 排序并取前10
|
||||
const sortedPages = Object.keys(pageCounts)
|
||||
.sort((a, b) => pageCounts[b] - pageCounts[a])
|
||||
.slice(0, 10)
|
||||
const pageData = sortedPages.map((key) => pageCounts[key])
|
||||
|
||||
this.pageOption = {
|
||||
tooltip: {
|
||||
trigger: 'axis',
|
||||
axisPointer: {
|
||||
type: 'shadow',
|
||||
},
|
||||
},
|
||||
grid: {
|
||||
left: '3%',
|
||||
right: '4%',
|
||||
bottom: '3%',
|
||||
containLabel: true,
|
||||
},
|
||||
xAxis: {
|
||||
type: 'value',
|
||||
boundaryGap: [0, 0.01],
|
||||
},
|
||||
yAxis: {
|
||||
type: 'category',
|
||||
data: sortedPages,
|
||||
},
|
||||
series: [
|
||||
{
|
||||
name: '访问次数',
|
||||
type: 'bar',
|
||||
data: pageData,
|
||||
},
|
||||
],
|
||||
}
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.tracking-charts {
|
||||
padding: 20px;
|
||||
}
|
||||
.filter-card {
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
.chart-card {
|
||||
height: 400px;
|
||||
}
|
||||
.chart {
|
||||
height: 300px;
|
||||
}
|
||||
</style>
|
||||
@@ -1,569 +1,19 @@
|
||||
<template>
|
||||
<div class="index-container">
|
||||
<!-- <el-row :gutter="20">
|
||||
<el-col :lg="24" :md="24" :sm="24" :xl="24" :xs="24">
|
||||
<el-alert v-if="noticeList">
|
||||
<div style="display: flex; align-items: center; justify-content: center">
|
||||
<a href="https://github.com/zxwk1998/vue-admin-better" target="_blank">
|
||||
<img
|
||||
src="https://img.shields.io/github/stars/zxwk1998/vue-admin-better?style=flat-square&label=Stars&logo=github"
|
||||
style="margin-right: 10px"
|
||||
/>
|
||||
</a>
|
||||
<p v-html="noticeList.notice"></p>
|
||||
</div>
|
||||
</el-alert>
|
||||
</el-col>
|
||||
<el-col :lg="6" :md="12" :sm="24" :xl="6" :xs="24">
|
||||
<el-card shadow="never">
|
||||
<div slot="header">
|
||||
<span>访问量</span>
|
||||
</div>
|
||||
<vab-chart autoresize :option="fwl" />
|
||||
<div class="bottom">
|
||||
<span>
|
||||
日均访问量:
|
||||
|
||||
{{ config1.endVal }}
|
||||
</span>
|
||||
</div>
|
||||
</el-card>
|
||||
</el-col>
|
||||
<el-col :lg="6" :md="12" :sm="24" :xl="6" :xs="24">
|
||||
<el-card shadow="never">
|
||||
<div slot="header">
|
||||
<span>授权数</span>
|
||||
</div>
|
||||
<vab-chart autoresize :option="sqs" />
|
||||
<div class="bottom">
|
||||
<span>
|
||||
总授权数:
|
||||
{{ config2.endVal }}
|
||||
</span>
|
||||
</div>
|
||||
</el-card>
|
||||
</el-col>
|
||||
|
||||
<el-col v-for="(item, index) in iconList" :key="index" :lg="3" :md="3" :sm="6" :xl="3" :xs="12">
|
||||
<router-link target="_blank" :to="item.link">
|
||||
<el-card class="icon-panel" shadow="never">
|
||||
<vab-icon :icon="['fas', item.icon]" :style="{ color: item.color }" />
|
||||
<p>{{ item.title }}</p>
|
||||
</el-card>
|
||||
</router-link>
|
||||
</el-col>
|
||||
|
||||
<el-col :lg="11" :md="24" :sm="24" :xl="11" :xs="24">
|
||||
<el-card class="card" shadow="never">
|
||||
<div slot="header">
|
||||
<span>依赖信息</span>
|
||||
<div style="float: right">部署时间:{{ updateTime }}</div>
|
||||
</div>
|
||||
|
||||
<table class="table">
|
||||
<tr>
|
||||
<td>@vue/cli版本</td>
|
||||
<td>{{ devDependencies['@vue/cli-service'] }}</td>
|
||||
<td>vue版本</td>
|
||||
<td>{{ dependencies['vue'] }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>vuex版本</td>
|
||||
<td>{{ dependencies['vuex'] }}</td>
|
||||
<td>vue-router版本</td>
|
||||
<td>{{ dependencies['vue-router'] }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>element-ui版本</td>
|
||||
<td>{{ dependencies['element-ui'] }}</td>
|
||||
<td>axios版本</td>
|
||||
<td>{{ dependencies['axios'] }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>eslint版本</td>
|
||||
<td>{{ devDependencies['eslint'] }}</td>
|
||||
<td>prettier版本</td>
|
||||
<td>{{ devDependencies['prettier'] }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>sass版本</td>
|
||||
<td>{{ devDependencies['sass'] }}</td>
|
||||
<td>mockjs版本</td>
|
||||
<td>{{ dependencies['mockjs'] }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>layouts版本</td>
|
||||
<td>{{ dependencies['layouts'] }}</td>
|
||||
<td>lodash版本</td>
|
||||
<td>{{ dependencies['lodash'] }}</td>
|
||||
</tr>
|
||||
</table>
|
||||
<br />
|
||||
<el-alert :closable="false" :title="userAgent" type="info" />
|
||||
<br />
|
||||
</el-card>
|
||||
</el-col>
|
||||
<el-col :lg="13" :md="13" :sm="24" :xl="13" :xs="24">
|
||||
<el-card shadow="never">
|
||||
<div slot="header">
|
||||
<span>其他信息</span>
|
||||
</div>
|
||||
<div style="text-align: center">
|
||||
<vab-colorful-icon icon-class="vab" style="font-size: 140px" />
|
||||
<h1 style="font-size: 30px">vue-admin-better</h1>
|
||||
</div>
|
||||
<div class="bottom-btn"></div>
|
||||
</el-card>
|
||||
</el-col>
|
||||
</el-row> -->
|
||||
<tracking-charts />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
// import VabChart from '@/plugins/echarts'
|
||||
import { dependencies, devDependencies } from '../../../package.json'
|
||||
import { getNoticeList } from '@/api/notice'
|
||||
import TrackingCharts from './components/TrackingCharts'
|
||||
|
||||
export default {
|
||||
name: 'Index',
|
||||
components: {
|
||||
// VabChart,
|
||||
TrackingCharts,
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
timer: 0,
|
||||
updateTime: process.env.VUE_APP_UPDATE_TIME,
|
||||
nodeEnv: process.env.NODE_ENV,
|
||||
dependencies: dependencies,
|
||||
devDependencies: devDependencies,
|
||||
config1: {
|
||||
startVal: 0,
|
||||
endVal: this.$baseLodash.random(20000, 60000),
|
||||
decimals: 0,
|
||||
prefix: '',
|
||||
suffix: '',
|
||||
separator: ',',
|
||||
duration: 8000,
|
||||
},
|
||||
config2: {
|
||||
startVal: 0,
|
||||
endVal: this.$baseLodash.random(1000, 20000),
|
||||
decimals: 0,
|
||||
prefix: '',
|
||||
suffix: '',
|
||||
separator: ',',
|
||||
duration: 8000,
|
||||
},
|
||||
config3: {
|
||||
startVal: 0,
|
||||
endVal: this.$baseLodash.random(1000, 20000),
|
||||
decimals: 0,
|
||||
prefix: '',
|
||||
suffix: '',
|
||||
separator: ',',
|
||||
duration: 8000,
|
||||
},
|
||||
|
||||
//访问量
|
||||
fwl: {
|
||||
color: ['#1890FF', '#36CBCB', '#4ECB73', '#FBD437', '#F2637B', '#975FE5'],
|
||||
backgroundColor: 'rgba(252,252,252,0)',
|
||||
grid: {
|
||||
top: '4%',
|
||||
left: '2%',
|
||||
right: '4%',
|
||||
bottom: '0%',
|
||||
containLabel: true,
|
||||
},
|
||||
xAxis: [
|
||||
{
|
||||
type: 'category',
|
||||
boundaryGap: false,
|
||||
data: [],
|
||||
axisTick: {
|
||||
alignWithLabel: true,
|
||||
},
|
||||
},
|
||||
],
|
||||
yAxis: [
|
||||
{
|
||||
type: 'value',
|
||||
},
|
||||
],
|
||||
series: [
|
||||
{
|
||||
name: '访问量',
|
||||
type: 'line',
|
||||
data: [],
|
||||
smooth: true,
|
||||
areaStyle: {},
|
||||
},
|
||||
],
|
||||
},
|
||||
//授权数
|
||||
sqs: {
|
||||
color: ['#1890FF', '#36CBCB', '#4ECB73', '#FBD437', '#F2637B', '#975FE5'],
|
||||
backgroundColor: 'rgba(252,252,252,0)',
|
||||
grid: {
|
||||
top: '4%',
|
||||
left: '2%',
|
||||
right: '4%',
|
||||
bottom: '0%',
|
||||
containLabel: true,
|
||||
},
|
||||
xAxis: [
|
||||
{
|
||||
type: 'category',
|
||||
/*boundaryGap: false,*/
|
||||
data: ['0时', '4时', '8时', '12时', '16时', '20时', '24时'],
|
||||
axisTick: {
|
||||
alignWithLabel: true,
|
||||
},
|
||||
},
|
||||
],
|
||||
yAxis: [
|
||||
{
|
||||
type: 'value',
|
||||
},
|
||||
],
|
||||
series: [
|
||||
{
|
||||
name: '授权数',
|
||||
type: 'bar',
|
||||
barWidth: '60%',
|
||||
data: [10, 52, 20, 33, 39, 33, 22],
|
||||
},
|
||||
],
|
||||
},
|
||||
//词云
|
||||
cy: {
|
||||
grid: {
|
||||
top: '4%',
|
||||
left: '2%',
|
||||
right: '4%',
|
||||
bottom: '0%',
|
||||
},
|
||||
series: [
|
||||
{
|
||||
type: 'wordCloud',
|
||||
gridSize: 15,
|
||||
sizeRange: [12, 40],
|
||||
rotationRange: [0, 0],
|
||||
width: '100%',
|
||||
height: '100%',
|
||||
textStyle: {
|
||||
normal: {
|
||||
color() {
|
||||
const arr = ['#5470c6', '#91cc75', '#fac858', '#ee6666', '#73c0de', '#975FE5']
|
||||
let index = Math.floor(Math.random() * arr.length)
|
||||
return arr[index]
|
||||
},
|
||||
},
|
||||
},
|
||||
data: [
|
||||
{
|
||||
name: 'vue-admin-better',
|
||||
value: 15000,
|
||||
},
|
||||
{
|
||||
name: 'element',
|
||||
value: 10081,
|
||||
},
|
||||
{
|
||||
name: 'beautiful',
|
||||
value: 9386,
|
||||
},
|
||||
|
||||
{
|
||||
name: 'vue',
|
||||
value: 6500,
|
||||
},
|
||||
{
|
||||
name: 'zxwk1998',
|
||||
value: 6000,
|
||||
},
|
||||
{
|
||||
name: 'good',
|
||||
value: 4500,
|
||||
},
|
||||
{
|
||||
name: 'success',
|
||||
value: 3800,
|
||||
},
|
||||
{
|
||||
name: 'never',
|
||||
value: 3000,
|
||||
},
|
||||
{
|
||||
name: 'boy',
|
||||
value: 2500,
|
||||
},
|
||||
{
|
||||
name: 'girl',
|
||||
value: 2300,
|
||||
},
|
||||
{
|
||||
name: 'github',
|
||||
value: 2000,
|
||||
},
|
||||
{
|
||||
name: 'hbuilder',
|
||||
value: 1900,
|
||||
},
|
||||
{
|
||||
name: 'dcloud',
|
||||
value: 1800,
|
||||
},
|
||||
{
|
||||
name: 'china',
|
||||
value: 1700,
|
||||
},
|
||||
{
|
||||
name: '1204505056',
|
||||
value: 1600,
|
||||
},
|
||||
{
|
||||
name: '972435319',
|
||||
value: 1500,
|
||||
},
|
||||
{
|
||||
name: 'young',
|
||||
value: 1200,
|
||||
},
|
||||
{
|
||||
name: 'old',
|
||||
value: 1100,
|
||||
},
|
||||
{
|
||||
name: 'vuex',
|
||||
value: 900,
|
||||
},
|
||||
{
|
||||
name: 'router',
|
||||
value: 800,
|
||||
},
|
||||
{
|
||||
name: 'money',
|
||||
value: 700,
|
||||
},
|
||||
{
|
||||
name: 'qingdao',
|
||||
value: 800,
|
||||
},
|
||||
{
|
||||
name: 'yantai',
|
||||
value: 9000,
|
||||
},
|
||||
{
|
||||
name: 'author is very cool',
|
||||
value: 9200,
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
|
||||
//更新日志
|
||||
reverse: true,
|
||||
activities: [],
|
||||
noticeList: [],
|
||||
//其他信息
|
||||
userAgent: navigator.userAgent,
|
||||
//卡片图标
|
||||
iconList: [
|
||||
{
|
||||
icon: 'video',
|
||||
title: '视频播放器',
|
||||
link: '/vab/player',
|
||||
color: '#ffc069',
|
||||
},
|
||||
{
|
||||
icon: 'table',
|
||||
title: '表格',
|
||||
link: '/vab/table/comprehensiveTable',
|
||||
color: '#5cdbd3',
|
||||
},
|
||||
{
|
||||
icon: 'laptop-code',
|
||||
title: '源码',
|
||||
link: 'https://github.com/zxwk1998/vue-admin-better',
|
||||
color: '#b37feb',
|
||||
},
|
||||
{
|
||||
icon: 'book',
|
||||
title: '书籍',
|
||||
link: '',
|
||||
color: '#69c0ff',
|
||||
},
|
||||
{
|
||||
icon: 'bullhorn',
|
||||
title: '公告',
|
||||
link: '',
|
||||
color: '#ff85c0',
|
||||
},
|
||||
{
|
||||
icon: 'gift',
|
||||
title: '礼物',
|
||||
link: '',
|
||||
color: '#ffd666',
|
||||
},
|
||||
|
||||
{
|
||||
icon: 'balance-scale-left',
|
||||
title: '公平的世界',
|
||||
link: '',
|
||||
color: '#ff9c6e',
|
||||
},
|
||||
{
|
||||
icon: 'coffee',
|
||||
title: '休息一下',
|
||||
link: '',
|
||||
color: '#95de64',
|
||||
},
|
||||
],
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.fetchData()
|
||||
},
|
||||
beforeDestroy() {
|
||||
clearInterval(this.timer)
|
||||
},
|
||||
mounted() {
|
||||
let base = +new Date(2020, 1, 1)
|
||||
let oneDay = 24 * 3600 * 1000
|
||||
let date = []
|
||||
|
||||
let data = [Math.random() * 1500]
|
||||
let now = new Date(base)
|
||||
|
||||
const addData = (shift) => {
|
||||
now = [now.getFullYear(), now.getMonth() + 1, now.getDate()].join('/')
|
||||
date.push(now)
|
||||
data.push(this.$baseLodash.random(20000, 60000))
|
||||
|
||||
if (shift) {
|
||||
date.shift()
|
||||
data.shift()
|
||||
}
|
||||
|
||||
now = new Date(+new Date(now) + oneDay)
|
||||
}
|
||||
|
||||
for (let i = 1; i < 6; i++) {
|
||||
addData()
|
||||
}
|
||||
addData(true)
|
||||
this.fwl.xAxis[0].data = date
|
||||
this.fwl.series[0].data = data
|
||||
this.timer = setInterval(() => {
|
||||
addData(true)
|
||||
this.fwl.xAxis[0].data = date
|
||||
this.fwl.series[0].data = data
|
||||
}, 3000)
|
||||
},
|
||||
methods: {
|
||||
handleClick(e) {
|
||||
this.$baseMessage(`点击了${e.name},这里可以写跳转`)
|
||||
},
|
||||
handleZrClick() {},
|
||||
handleChangeTheme() {
|
||||
this.$baseEventBus.$emit('theme')
|
||||
},
|
||||
async fetchData() {
|
||||
const res = await getNoticeList()
|
||||
this.noticeList = res.data
|
||||
},
|
||||
return {}
|
||||
},
|
||||
}
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
.index-container {
|
||||
padding: 0 !important;
|
||||
margin: 0 !important;
|
||||
background: #f5f7f8 !important;
|
||||
|
||||
::v-deep {
|
||||
.el-alert {
|
||||
padding: $base-padding;
|
||||
|
||||
&--info.is-light {
|
||||
min-height: 82px;
|
||||
padding: $base-padding;
|
||||
margin-bottom: 15px;
|
||||
color: #909399;
|
||||
background-color: $base-color-white;
|
||||
border: 1px solid #ebeef5;
|
||||
}
|
||||
}
|
||||
|
||||
.el-card__body {
|
||||
.echarts {
|
||||
width: 100%;
|
||||
height: 115px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.card {
|
||||
::v-deep {
|
||||
.el-card__body {
|
||||
.echarts {
|
||||
width: 100%;
|
||||
height: 305px;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.bottom {
|
||||
padding-top: 20px;
|
||||
margin-top: 5px;
|
||||
color: #595959;
|
||||
text-align: left;
|
||||
border-top: 1px solid $base-border-color;
|
||||
}
|
||||
|
||||
.table {
|
||||
width: 100%;
|
||||
color: #666;
|
||||
border-collapse: collapse;
|
||||
background-color: #fff;
|
||||
|
||||
td {
|
||||
position: relative;
|
||||
min-height: 20px;
|
||||
padding: 9px 15px;
|
||||
font-size: 14px;
|
||||
line-height: 20px;
|
||||
border: 1px solid #e6e6e6;
|
||||
|
||||
&:nth-child(odd) {
|
||||
width: 20%;
|
||||
text-align: right;
|
||||
background-color: #f7f7f7;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.icon-panel {
|
||||
height: 117px;
|
||||
text-align: center;
|
||||
cursor: pointer;
|
||||
|
||||
svg {
|
||||
font-size: 40px;
|
||||
}
|
||||
|
||||
p {
|
||||
margin-top: 10px;
|
||||
}
|
||||
}
|
||||
|
||||
.bottom-btn {
|
||||
button {
|
||||
margin: 5px 10px 15px 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
39
src/views/index/utils/index.js
Normal file
39
src/views/index/utils/index.js
Normal file
@@ -0,0 +1,39 @@
|
||||
export const eventNameMap = {
|
||||
avatar_load_more: '头像加载更多',
|
||||
avatar_page_visit: '头像页访问',
|
||||
fortune_page_visit: '抽签页访问',
|
||||
greeting_page_visit: '祝福页访问',
|
||||
mine_page_visit: '我的页访问',
|
||||
make_page_visit: '制作页访问',
|
||||
index_page_visit: '首页访问',
|
||||
card_tpl_choose: '选择祝福卡片模板',
|
||||
card_title_choose: '选择祝福卡片标题',
|
||||
avatar_choose_album: '选择头像相册',
|
||||
index_function_select: '首页功能选择',
|
||||
index_goto_make: '首页推荐跳转',
|
||||
index_recommend_click: '首页推荐点击',
|
||||
wallpaper_page_visit: '壁纸页访问',
|
||||
wallpaper_preview_click: '壁纸预览点击',
|
||||
card_text_choose: '选择祝福卡片文本',
|
||||
}
|
||||
|
||||
export const eventTypeMap = {
|
||||
jump: '跳转',
|
||||
click: '点击',
|
||||
select: '选择',
|
||||
load_more: '加载更多',
|
||||
visit: '访问',
|
||||
}
|
||||
|
||||
export const appMap = {
|
||||
'69665538a49b8ae3be50fe5d': '新春祝福',
|
||||
}
|
||||
|
||||
export const userMap = {
|
||||
'697efa4082f6cf96027632b8': '姐夫',
|
||||
'69886ce32e3c1bb264902e29': '爸爸',
|
||||
'6985a7c7f76d8026019f4e28': '妈妈',
|
||||
'697a34996c4283e7b5904dbd': '哎萌',
|
||||
'6973765449d17414b66970a2': '我',
|
||||
'697da7f1af55ae2451863526': '姐姐',
|
||||
}
|
||||
134
src/views/personnelManagement/suspiciousRequest/index.vue
Normal file
134
src/views/personnelManagement/suspiciousRequest/index.vue
Normal file
@@ -0,0 +1,134 @@
|
||||
<template>
|
||||
<div class="suspiciousRequest-container">
|
||||
<vab-query-form>
|
||||
<vab-query-form-right-panel :span="24">
|
||||
<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-input v-model.trim="queryForm.ip" clearable placeholder="IP" />
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-input v-model.trim="queryForm.path" clearable placeholder="请求路径" />
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-date-picker
|
||||
v-model="queryForm.timeRange"
|
||||
end-placeholder="结束日期"
|
||||
format="yyyy-MM-dd HH:mm:ss"
|
||||
range-separator="至"
|
||||
start-placeholder="开始日期"
|
||||
type="datetimerange"
|
||||
value-format="yyyy-MM-dd HH:mm:ss"
|
||||
@change="handleDateChange"
|
||||
/>
|
||||
</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="用户" show-overflow-tooltip>
|
||||
<template slot-scope="{ row }">
|
||||
{{ row.userName || row.userId }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="应用" show-overflow-tooltip>
|
||||
<template slot-scope="{ row }">
|
||||
{{ row.appName || row.appId }}
|
||||
</template>
|
||||
</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="reason" show-overflow-tooltip />
|
||||
<el-table-column align="center" label="UserAgent" prop="userAgent" show-overflow-tooltip />
|
||||
<el-table-column align="center" label="创建时间" show-overflow-tooltip>
|
||||
<template #default="{ row }">
|
||||
{{ formatTime(row.createdAt) }}
|
||||
</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 { getList } from '@/api/suspiciousRequest'
|
||||
import { formatTime } from '@/utils'
|
||||
|
||||
export default {
|
||||
name: 'SuspiciousRequest',
|
||||
data() {
|
||||
return {
|
||||
list: null,
|
||||
listLoading: true,
|
||||
layout: 'total, sizes, prev, pager, next, jumper',
|
||||
total: 0,
|
||||
elementLoadingText: '正在加载...',
|
||||
queryForm: {
|
||||
pageNo: 1,
|
||||
pageSize: 10,
|
||||
userId: '',
|
||||
ip: '',
|
||||
path: '',
|
||||
startTime: '',
|
||||
endTime: '',
|
||||
timeRange: [],
|
||||
},
|
||||
timeOutID: null,
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.fetchData()
|
||||
},
|
||||
beforeDestroy() {
|
||||
clearTimeout(this.timeOutID)
|
||||
},
|
||||
methods: {
|
||||
formatTime,
|
||||
handleDateChange(val) {
|
||||
if (val) {
|
||||
this.queryForm.startTime = val[0]
|
||||
this.queryForm.endTime = val[1]
|
||||
} else {
|
||||
this.queryForm.startTime = ''
|
||||
this.queryForm.endTime = ''
|
||||
}
|
||||
this.queryData()
|
||||
},
|
||||
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)
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
@@ -18,7 +18,7 @@
|
||||
<el-table-column align="center" label="图片" width="100">
|
||||
<template slot-scope="scope">
|
||||
<el-tooltip class="item" :content="scope.row.name" effect="dark" placement="top">
|
||||
<img alt="image" :src="scope.row.url" style="width: 50px; height: 50px; object-fit: cover" />
|
||||
<el-image fit="cover" :preview-src-list="[scope.row.url]" :src="getThumbUrl(scope.row.url)" style="width: 50px; height: 50px" />
|
||||
</el-tooltip>
|
||||
</template>
|
||||
</el-table-column>
|
||||
@@ -56,6 +56,7 @@
|
||||
<script>
|
||||
import { getList } from '@/api/uploadedFileManagement'
|
||||
import { formatTime } from '@/utils'
|
||||
import { getThumbUrl } from '@/utils/blessing'
|
||||
|
||||
export default {
|
||||
name: 'UploadedFileManagement',
|
||||
@@ -84,6 +85,7 @@
|
||||
},
|
||||
methods: {
|
||||
formatTime,
|
||||
getThumbUrl,
|
||||
setSelectRows(val) {
|
||||
this.selectRows = val
|
||||
},
|
||||
|
||||
@@ -18,6 +18,14 @@
|
||||
</vab-query-form>
|
||||
|
||||
<el-table v-loading="listLoading" :data="list" :element-loading-text="elementLoadingText">
|
||||
<el-table-column align="center" label="ID" prop="id" show-overflow-tooltip>
|
||||
<template #default="{ row }">
|
||||
<span style="cursor: pointer" @click="handleCopyId(row.id)">
|
||||
<i class="el-icon-copy-document" />
|
||||
{{ row.id }}
|
||||
</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="排序" prop="sort" show-overflow-tooltip />
|
||||
<el-table-column align="center" label="类型" prop="type" show-overflow-tooltip />
|
||||
|
||||
@@ -93,6 +101,15 @@
|
||||
clearTimeout(this.timeOutID)
|
||||
},
|
||||
methods: {
|
||||
handleCopyId(text) {
|
||||
const input = document.createElement('input')
|
||||
input.value = text
|
||||
document.body.appendChild(input)
|
||||
input.select()
|
||||
document.execCommand('copy')
|
||||
document.body.removeChild(input)
|
||||
this.$baseMessage('复制成功', 'success')
|
||||
},
|
||||
setSelectRows(val) {
|
||||
this.selectRows = val
|
||||
},
|
||||
|
||||
@@ -18,6 +18,14 @@
|
||||
</vab-query-form>
|
||||
|
||||
<el-table v-loading="listLoading" :data="list" :element-loading-text="elementLoadingText">
|
||||
<el-table-column align="center" label="ID" show-overflow-tooltip>
|
||||
<template #default="{ row }">
|
||||
<span style="cursor: pointer" @click="handleCopyId(row.id)">
|
||||
<i class="el-icon-copy-document" />
|
||||
{{ row.id }}
|
||||
</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="排序" prop="sort" show-overflow-tooltip />
|
||||
<el-table-column align="center" label="类型" prop="type" show-overflow-tooltip />
|
||||
|
||||
@@ -93,6 +101,15 @@
|
||||
clearTimeout(this.timeOutID)
|
||||
},
|
||||
methods: {
|
||||
handleCopyId(text) {
|
||||
const input = document.createElement('input')
|
||||
input.value = text
|
||||
document.body.appendChild(input)
|
||||
input.select()
|
||||
document.execCommand('copy')
|
||||
document.body.removeChild(input)
|
||||
this.$baseMessage('复制成功', 'success')
|
||||
},
|
||||
setSelectRows(val) {
|
||||
this.selectRows = val
|
||||
},
|
||||
|
||||
182
src/views/spring/avatar/record/index.vue
Normal file
182
src/views/spring/avatar/record/index.vue
Normal file
@@ -0,0 +1,182 @@
|
||||
<template>
|
||||
<div class="avatar-record-container">
|
||||
<vab-query-form>
|
||||
<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-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="left" label="信息" show-overflow-tooltip>
|
||||
<template #default="{ row }">
|
||||
<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>
|
||||
</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>
|
||||
<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 { getCreateList } from '@/api/spring/avatar'
|
||||
import { formatTime } from '@/utils'
|
||||
|
||||
export default {
|
||||
name: 'AvatarRecord',
|
||||
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,
|
||||
keyword: '',
|
||||
},
|
||||
timeOutID: null,
|
||||
}
|
||||
},
|
||||
created() {
|
||||
const { id } = this.$route.query || {}
|
||||
if (id) {
|
||||
this.queryForm.keyword = id
|
||||
this.queryForm.pageNo = 1
|
||||
}
|
||||
this.fetchData()
|
||||
},
|
||||
|
||||
beforeDestroy() {
|
||||
clearTimeout(this.timeOutID)
|
||||
},
|
||||
methods: {
|
||||
formatTime,
|
||||
setSelectRows(val) {
|
||||
this.selectRows = val
|
||||
},
|
||||
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 } })
|
||||
},
|
||||
async fetchData() {
|
||||
this.listLoading = true
|
||||
const { data } = await getCreateList(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>
|
||||
@@ -18,6 +18,15 @@
|
||||
</vab-query-form>
|
||||
|
||||
<el-table v-loading="listLoading" :data="list" :element-loading-text="elementLoadingText">
|
||||
<el-table-column align="center" label="ID" prop="id" show-overflow-tooltip>
|
||||
<template #default="{ row }">
|
||||
<span style="cursor: pointer" @click="handleCopyId(row.id)">
|
||||
<i class="el-icon-copy-document" />
|
||||
{{ row.id }}
|
||||
</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column align="center" label="排序" prop="sort" show-overflow-tooltip />
|
||||
|
||||
<el-table-column align="center" label="类型" prop="type" show-overflow-tooltip />
|
||||
@@ -93,6 +102,15 @@
|
||||
clearTimeout(this.timeOutID)
|
||||
},
|
||||
methods: {
|
||||
handleCopyId(text) {
|
||||
const input = document.createElement('input')
|
||||
input.value = text
|
||||
document.body.appendChild(input)
|
||||
input.select()
|
||||
document.execCommand('copy')
|
||||
document.body.removeChild(input)
|
||||
this.$baseMessage('复制成功', 'success')
|
||||
},
|
||||
setSelectRows(val) {
|
||||
this.selectRows = val
|
||||
},
|
||||
|
||||
@@ -4,6 +4,9 @@
|
||||
<el-form-item label="模版内容" prop="content">
|
||||
<el-input v-model="form.content" autocomplete="off" :rows="6" type="textarea" />
|
||||
</el-form-item>
|
||||
<el-form-item label="场景" prop="scene">
|
||||
<el-input v-model="form.scene" autocomplete="off" placeholder="请输入场景(可为空)" />
|
||||
</el-form-item>
|
||||
<el-form-item v-if="!form.name" label="是否启用" prop="isEnabled">
|
||||
<el-switch v-model="form.isEnabled" active-text="启用" :active-value="true" inactive-text="禁用" :inactive-value="false" />
|
||||
</el-form-item>
|
||||
@@ -26,6 +29,7 @@
|
||||
id: '',
|
||||
form: {
|
||||
content: '',
|
||||
scene: '',
|
||||
isEnabled: true,
|
||||
},
|
||||
rules: {
|
||||
@@ -53,6 +57,7 @@
|
||||
this.title = '编辑'
|
||||
this.form = {
|
||||
content: row.content,
|
||||
scene: row.scene,
|
||||
isEnabled: row.isEnabled,
|
||||
}
|
||||
this.id = row.id
|
||||
|
||||
@@ -64,24 +64,6 @@
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="left" label="交互信息" show-overflow-tooltip>
|
||||
<template #default="{ row }">
|
||||
<div>
|
||||
<div>
|
||||
<strong>查看数:</strong>
|
||||
{{ row.viewCount }}
|
||||
</div>
|
||||
<div>
|
||||
<strong>分享数:</strong>
|
||||
{{ row.shareCount }}
|
||||
</div>
|
||||
<div>
|
||||
<strong>保存数:</strong>
|
||||
{{ row.saveCount }}
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="left" label="作者信息" show-overflow-tooltip>
|
||||
<template #default="{ row }">
|
||||
<div class="author-cell">
|
||||
|
||||
@@ -4,6 +4,9 @@
|
||||
<el-form-item label="模版名称" prop="name">
|
||||
<el-input v-model="form.name" autocomplete="off" />
|
||||
</el-form-item>
|
||||
<el-form-item label="场景" prop="scene">
|
||||
<el-input v-model="form.scene" autocomplete="off" placeholder="请输入场景(可为空)" />
|
||||
</el-form-item>
|
||||
<el-form-item label="卡片图片" prop="imageUrl">
|
||||
<single-upload
|
||||
v-model="form.imageUrl"
|
||||
@@ -36,6 +39,7 @@
|
||||
id: '',
|
||||
form: {
|
||||
name: '',
|
||||
scene: '',
|
||||
imageUrl: '',
|
||||
isEnabled: true,
|
||||
},
|
||||
@@ -65,6 +69,7 @@
|
||||
this.title = '编辑'
|
||||
this.form = {
|
||||
name: row.name,
|
||||
scene: row.scene,
|
||||
imageUrl: row.imageUrl,
|
||||
isEnabled: row.isEnabled,
|
||||
}
|
||||
|
||||
@@ -24,7 +24,12 @@
|
||||
<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-image
|
||||
fit="cover"
|
||||
:preview-src-list="[scope.row.imageUrl]"
|
||||
:src="getThumbUrl(scope.row.imageUrl)"
|
||||
style="width: 50px; height: 50px"
|
||||
/>
|
||||
</el-tooltip>
|
||||
</template>
|
||||
</el-table-column>
|
||||
@@ -64,6 +69,7 @@
|
||||
<script>
|
||||
import { doDelete, getList, toggleEnable, doMoveUp, doMoveDown } from '@/api/spring/blessing/template'
|
||||
import { formatTime } from '@/utils'
|
||||
import { getThumbUrl } from '@/utils/blessing'
|
||||
import Edit from './components/AppManagementEdit'
|
||||
|
||||
export default {
|
||||
@@ -99,6 +105,7 @@
|
||||
clearTimeout(this.timeOutID)
|
||||
},
|
||||
methods: {
|
||||
getThumbUrl,
|
||||
setSelectRows(val) {
|
||||
this.selectRows = val
|
||||
},
|
||||
|
||||
@@ -0,0 +1,105 @@
|
||||
<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="scene">
|
||||
<el-input v-model="form.scene" autocomplete="off" 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 v-if="!form.name" 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/blessing/titleTemplate/index'
|
||||
import SingleUpload from '@/components/SingleUpload'
|
||||
|
||||
export default {
|
||||
name: 'AppManagementEdit',
|
||||
components: { SingleUpload },
|
||||
data() {
|
||||
return {
|
||||
id: '',
|
||||
form: {
|
||||
name: '',
|
||||
scene: '',
|
||||
imageUrl: '',
|
||||
isEnabled: true,
|
||||
},
|
||||
rules: {
|
||||
name: [{ required: true, trigger: 'blur', message: '请输入卡片名称' }],
|
||||
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 = {
|
||||
name: row.name,
|
||||
scene: row.scene,
|
||||
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>
|
||||
205
src/views/spring/blessing/titleTemplate/index.vue
Normal file
205
src/views/spring/blessing/titleTemplate/index.vue
Normal file
@@ -0,0 +1,205 @@
|
||||
<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-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.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 show-overflow-tooltip type="selection" /> -->
|
||||
<el-table-column align="center" label="排序" prop="sort" 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="getThumbUrl(scope.row.imageUrl)"
|
||||
style="width: 50px; height: 50px"
|
||||
/>
|
||||
</el-tooltip>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="标题" prop="name" show-overflow-tooltip />
|
||||
<el-table-column align="center" label="使用次数" prop="useCount" 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/blessing/titleTemplate/index'
|
||||
import { formatTime } from '@/utils'
|
||||
import { getThumbUrl } from '@/utils/blessing'
|
||||
import Edit from './components/AppManagementEdit'
|
||||
|
||||
export default {
|
||||
name: 'TitleTemplateManagement',
|
||||
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: '',
|
||||
fortuneLevel: '',
|
||||
},
|
||||
timeOutID: null,
|
||||
}
|
||||
},
|
||||
created() {
|
||||
const { templateId } = this.$route.query || {}
|
||||
if (templateId) {
|
||||
this.queryForm.keyword = templateId
|
||||
this.queryForm.pageNo = 1
|
||||
}
|
||||
this.fetchData()
|
||||
},
|
||||
|
||||
beforeDestroy() {
|
||||
clearTimeout(this.timeOutID)
|
||||
},
|
||||
methods: {
|
||||
getThumbUrl,
|
||||
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()
|
||||
},
|
||||
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>
|
||||
87
src/views/spring/daily/greeting/components/GreetingEdit.vue
Normal file
87
src/views/spring/daily/greeting/components/GreetingEdit.vue
Normal file
@@ -0,0 +1,87 @@
|
||||
<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="sceneId">
|
||||
<el-select v-model="form.sceneId" placeholder="请选择场景" style="width: 100%">
|
||||
<el-option v-for="item in sceneList" :key="item.id" :label="item.name" :value="item.id" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="祝福语" prop="content">
|
||||
<el-input v-model="form.content" autocomplete="off" :rows="4" type="textarea" />
|
||||
</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 type="primary" @click="save">确 定</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { doAdd, doEdit } from '@/api/spring/daily/greeting'
|
||||
import { getList as getSceneList } from '@/api/spring/daily/scene'
|
||||
|
||||
export default {
|
||||
name: 'GreetingEdit',
|
||||
data() {
|
||||
return {
|
||||
form: {
|
||||
sceneId: '',
|
||||
content: '',
|
||||
isEnabled: true,
|
||||
},
|
||||
rules: {
|
||||
sceneId: [{ required: true, trigger: 'change', message: '请选择场景' }],
|
||||
content: [{ required: true, trigger: 'blur', message: '请输入祝福语内容' }],
|
||||
isEnabled: [{ required: true, trigger: 'blur', message: '请选择是否启用' }],
|
||||
},
|
||||
title: '',
|
||||
dialogFormVisible: false,
|
||||
sceneList: [],
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.fetchSceneList()
|
||||
},
|
||||
methods: {
|
||||
async fetchSceneList() {
|
||||
const { data } = await getSceneList({ pageNo: 1, pageSize: 100 })
|
||||
this.sceneList = data.list || []
|
||||
},
|
||||
showEdit(row) {
|
||||
if (!row) {
|
||||
this.title = '添加'
|
||||
this.form = {
|
||||
sceneId: '',
|
||||
content: '',
|
||||
isEnabled: true,
|
||||
}
|
||||
} else {
|
||||
this.title = '编辑'
|
||||
this.form = Object.assign({}, row)
|
||||
}
|
||||
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) {
|
||||
const { msg } = this.form.id ? await doEdit(this.form.id, this.form) : await doAdd(this.form)
|
||||
this.$baseMessage(msg, 'success')
|
||||
this.$emit('fetch-data')
|
||||
this.close()
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
})
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
158
src/views/spring/daily/greeting/index.vue
Normal file
158
src/views/spring/daily/greeting/index.vue
Normal file
@@ -0,0 +1,158 @@
|
||||
<template>
|
||||
<div class="greeting-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.sceneId" clearable placeholder="请选择场景" @change="queryData">
|
||||
<el-option v-for="item in sceneList" :key="item.id" :label="item.name" :value="item.id" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-input v-model.trim="queryForm.content" 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="handleSelectionChange">
|
||||
<el-table-column show-overflow-tooltip type="selection" width="55" />
|
||||
<el-table-column align="center" label="场景" prop="sceneId" show-overflow-tooltip>
|
||||
<template slot-scope="{ row }">
|
||||
{{ getSceneName(row.sceneId) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="祝福语内容" prop="content" show-overflow-tooltip />
|
||||
<el-table-column align="center" label="是否启用" show-overflow-tooltip width="100">
|
||||
<template slot-scope="{ row }">
|
||||
<el-switch :active-value="true" :inactive-value="false" :value="row.isEnabled" @change="handleStatusChange(row, $event)" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="操作" show-overflow-tooltip width="150">
|
||||
<template slot-scope="{ 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"
|
||||
/>
|
||||
<greeting-edit ref="edit" @fetch-data="fetchData" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { getList, doDelete, toggleEnable } from '@/api/spring/daily/greeting'
|
||||
import { getList as getSceneList } from '@/api/spring/daily/scene'
|
||||
import GreetingEdit from './components/GreetingEdit'
|
||||
|
||||
export default {
|
||||
name: 'Greeting',
|
||||
components: { GreetingEdit },
|
||||
data() {
|
||||
return {
|
||||
list: null,
|
||||
listLoading: true,
|
||||
layout: 'total, sizes, prev, pager, next, jumper',
|
||||
total: 0,
|
||||
elementLoadingText: '正在加载...',
|
||||
queryForm: {
|
||||
pageNo: 1,
|
||||
pageSize: 10,
|
||||
sceneId: '',
|
||||
content: '',
|
||||
},
|
||||
selectRows: '',
|
||||
sceneList: [],
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.fetchSceneList()
|
||||
this.fetchData()
|
||||
},
|
||||
methods: {
|
||||
async fetchSceneList() {
|
||||
const { data } = await getSceneList({ pageNo: 1, pageSize: 100 })
|
||||
this.sceneList = data.list || []
|
||||
},
|
||||
getSceneName(sceneId) {
|
||||
const scene = this.sceneList.find((item) => item.id === sceneId)
|
||||
return scene ? scene.name : sceneId
|
||||
},
|
||||
handleSelectionChange(val) {
|
||||
this.selectRows = val
|
||||
},
|
||||
handleEdit(row) {
|
||||
if (row.id) {
|
||||
this.$refs['edit'].showEdit(row)
|
||||
} else {
|
||||
this.$refs['edit'].showEdit()
|
||||
}
|
||||
},
|
||||
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.listLoading = false
|
||||
},
|
||||
async handleStatusChange(row, newVal) {
|
||||
try {
|
||||
await toggleEnable(row.id, newVal)
|
||||
row.isEnabled = newVal
|
||||
this.$baseMessage(`${newVal ? '启用' : '禁用'}成功`, 'success')
|
||||
} catch (e) {
|
||||
this.$baseMessage(`${newVal ? '启用' : '禁用'}失败`, 'error')
|
||||
this.fetchData()
|
||||
}
|
||||
},
|
||||
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)
|
||||
this.$baseConfirm('你确定要删除选中项吗', null, async () => {
|
||||
const { msg } = await doDelete({ ids })
|
||||
this.$baseMessage(msg, 'success')
|
||||
this.fetchData()
|
||||
})
|
||||
} else {
|
||||
this.$baseMessage('未选中任何行', 'error')
|
||||
return false
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
9
src/views/spring/daily/index.vue
Normal file
9
src/views/spring/daily/index.vue
Normal file
@@ -0,0 +1,9 @@
|
||||
<template>
|
||||
<router-view />
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: 'Daily',
|
||||
}
|
||||
</script>
|
||||
107
src/views/spring/daily/scene/components/SceneEdit.vue
Normal file
107
src/views/spring/daily/scene/components/SceneEdit.vue
Normal file
@@ -0,0 +1,107 @@
|
||||
<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="场景Key" prop="scene">
|
||||
<el-input v-model="form.scene" autocomplete="off" placeholder="请输入场景Key (e.g., vitality)" />
|
||||
</el-form-item>
|
||||
<el-form-item label="图标" prop="icon">
|
||||
<el-input v-model="form.icon" autocomplete="off" placeholder="请输入图标 (e.g., 😊)" />
|
||||
</el-form-item>
|
||||
<el-form-item label="默认祝福语ID" prop="greetingId">
|
||||
<el-input v-model="form.greetingId" autocomplete="off" placeholder="请输入默认祝福语ID" />
|
||||
</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 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 type="primary" @click="save">确 定</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { doAdd, doEdit } from '@/api/spring/daily/scene'
|
||||
import SingleUpload from '@/components/SingleUpload'
|
||||
|
||||
export default {
|
||||
name: 'SceneEdit',
|
||||
components: { SingleUpload },
|
||||
data() {
|
||||
return {
|
||||
form: {
|
||||
name: '',
|
||||
scene: '',
|
||||
icon: '',
|
||||
greetingId: '',
|
||||
imageUrl: '',
|
||||
isEnabled: true,
|
||||
},
|
||||
rules: {
|
||||
name: [{ required: true, trigger: 'blur', message: '请输入场景名称' }],
|
||||
scene: [{ required: true, trigger: 'blur', message: '请输入场景Key' }],
|
||||
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 = '添加'
|
||||
this.form = {
|
||||
name: '',
|
||||
scene: '',
|
||||
icon: '',
|
||||
greetingId: '',
|
||||
imageUrl: '',
|
||||
isEnabled: true,
|
||||
}
|
||||
} else {
|
||||
this.title = '编辑'
|
||||
this.form = Object.assign({}, row)
|
||||
}
|
||||
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) {
|
||||
const { msg } = this.form.id ? await doEdit(this.form.id, this.form) : await doAdd(this.form)
|
||||
this.$baseMessage(msg, 'success')
|
||||
this.$emit('fetch-data')
|
||||
this.close()
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
})
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
173
src/views/spring/daily/scene/index.vue
Normal file
173
src/views/spring/daily/scene/index.vue
Normal file
@@ -0,0 +1,173 @@
|
||||
<template>
|
||||
<div class="scene-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-input v-model.trim="queryForm.name" 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="handleSelectionChange">
|
||||
<el-table-column show-overflow-tooltip type="selection" width="55" />
|
||||
<el-table-column align="center" label="排序" prop="sort" show-overflow-tooltip width="80" />
|
||||
<el-table-column align="center" label="场景名称" prop="name" show-overflow-tooltip />
|
||||
<el-table-column align="center" label="场景Key" prop="scene" show-overflow-tooltip />
|
||||
<el-table-column align="center" label="图标" prop="icon" show-overflow-tooltip />
|
||||
<el-table-column align="center" label="背景图" width="100">
|
||||
<template slot-scope="scope">
|
||||
<el-image
|
||||
v-if="scope.row.imageUrl"
|
||||
fit="cover"
|
||||
:preview-src-list="[scope.row.imageUrl]"
|
||||
:src="getThumbUrl(scope.row.imageUrl)"
|
||||
style="width: 50px; height: 50px"
|
||||
/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="默认祝福语ID" prop="greetingId" show-overflow-tooltip />
|
||||
<el-table-column align="center" label="是否启用" show-overflow-tooltip width="100">
|
||||
<template slot-scope="{ row }">
|
||||
<el-switch :active-value="true" :inactive-value="false" :value="row.isEnabled" @change="handleStatusChange(row, $event)" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="操作" show-overflow-tooltip width="200">
|
||||
<template slot-scope="{ row }">
|
||||
<el-button type="text" @click="handleEdit(row)">编辑</el-button>
|
||||
<el-button type="text" @click="handleMoveUp(row)">上移</el-button>
|
||||
<el-button type="text" @click="handleMoveDown(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"
|
||||
/>
|
||||
<scene-edit ref="edit" @fetch-data="fetchData" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { getList, doDelete, toggleEnable, doMoveUp, doMoveDown } from '@/api/spring/daily/scene'
|
||||
import { getThumbUrl } from '@/utils/blessing'
|
||||
import SceneEdit from './components/SceneEdit'
|
||||
|
||||
export default {
|
||||
name: 'Scene',
|
||||
components: { SceneEdit },
|
||||
data() {
|
||||
return {
|
||||
list: null,
|
||||
listLoading: true,
|
||||
layout: 'total, sizes, prev, pager, next, jumper',
|
||||
total: 0,
|
||||
elementLoadingText: '正在加载...',
|
||||
queryForm: {
|
||||
pageNo: 1,
|
||||
pageSize: 10,
|
||||
name: '',
|
||||
},
|
||||
selectRows: '',
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.fetchData()
|
||||
},
|
||||
methods: {
|
||||
getThumbUrl,
|
||||
handleSelectionChange(val) {
|
||||
this.selectRows = val
|
||||
},
|
||||
handleEdit(row) {
|
||||
if (row.id) {
|
||||
this.$refs['edit'].showEdit(row)
|
||||
} else {
|
||||
this.$refs['edit'].showEdit()
|
||||
}
|
||||
},
|
||||
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.listLoading = false
|
||||
},
|
||||
async handleStatusChange(row, newVal) {
|
||||
try {
|
||||
await toggleEnable(row.id, newVal)
|
||||
row.isEnabled = newVal
|
||||
this.$baseMessage(`${newVal ? '启用' : '禁用'}成功`, 'success')
|
||||
} catch (e) {
|
||||
this.$baseMessage(`${newVal ? '启用' : '禁用'}失败`, 'error')
|
||||
this.fetchData()
|
||||
}
|
||||
},
|
||||
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)
|
||||
this.$baseConfirm('你确定要删除选中项吗', null, async () => {
|
||||
const { msg } = await doDelete({ ids })
|
||||
this.$baseMessage(msg, 'success')
|
||||
this.fetchData()
|
||||
})
|
||||
} else {
|
||||
this.$baseMessage('未选中任何行', 'error')
|
||||
return false
|
||||
}
|
||||
}
|
||||
},
|
||||
async handleMoveUp(row) {
|
||||
try {
|
||||
await doMoveUp(row.id)
|
||||
this.$baseMessage('上移成功', 'success')
|
||||
this.fetchData()
|
||||
} catch (e) {
|
||||
// error handled by request interceptor usually
|
||||
}
|
||||
},
|
||||
async handleMoveDown(row) {
|
||||
try {
|
||||
await doMoveDown(row.id)
|
||||
this.$baseMessage('下移成功', 'success')
|
||||
this.fetchData()
|
||||
} catch (e) {
|
||||
// error handled by request interceptor usually
|
||||
}
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
@@ -31,7 +31,12 @@
|
||||
<el-table-column align="center" label="卡片" width="100">
|
||||
<template slot-scope="scope">
|
||||
<el-tooltip class="item" :content="scope.row.title" effect="dark" placement="top">
|
||||
<el-image fit="cover" :preview-src-list="[scope.row.imageUrl]" :src="scope.row.imageUrl" style="width: 50px; height: 50px" />
|
||||
<el-image
|
||||
fit="cover"
|
||||
:preview-src-list="[scope.row.imageUrl]"
|
||||
:src="getThumbUrl(scope.row.imageUrl)"
|
||||
style="width: 50px; height: 50px"
|
||||
/>
|
||||
</el-tooltip>
|
||||
</template>
|
||||
</el-table-column>
|
||||
@@ -82,6 +87,7 @@
|
||||
import { doDelete, getList } from '@/api/spring/fortune/card'
|
||||
import { formatTime } from '@/utils'
|
||||
import Edit from './components/AppManagementEdit'
|
||||
import { getThumbUrl } from '@/utils/blessing'
|
||||
|
||||
export default {
|
||||
name: 'AppManagement',
|
||||
@@ -111,6 +117,7 @@
|
||||
clearTimeout(this.timeOutID)
|
||||
},
|
||||
methods: {
|
||||
getThumbUrl,
|
||||
setSelectRows(val) {
|
||||
this.selectRows = val
|
||||
},
|
||||
|
||||
200
src/views/spring/fortune/drawRecord/index.vue
Normal file
200
src/views/spring/fortune/drawRecord/index.vue
Normal file
@@ -0,0 +1,200 @@
|
||||
<template>
|
||||
<div class="draw-record-container">
|
||||
<vab-query-form>
|
||||
<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-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="getThumbUrl(scope.row.imageUrl)"
|
||||
style="width: 50px; height: 50px"
|
||||
/>
|
||||
</el-tooltip>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<!-- <el-table-column align="left" label="信息" show-overflow-tooltip>
|
||||
<template #default="{ row }">
|
||||
<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="goToCard(row.cardId)">{{ 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>
|
||||
<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 { getDrawList } from '@/api/spring/fortune/card'
|
||||
import { formatTime } from '@/utils'
|
||||
import { getThumbUrl } from '@/utils/blessing'
|
||||
|
||||
export default {
|
||||
name: 'DrawRecord',
|
||||
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,
|
||||
keyword: '',
|
||||
},
|
||||
timeOutID: null,
|
||||
}
|
||||
},
|
||||
created() {
|
||||
const { id } = this.$route.query || {}
|
||||
if (id) {
|
||||
this.queryForm.keyword = id
|
||||
this.queryForm.pageNo = 1
|
||||
}
|
||||
this.fetchData()
|
||||
},
|
||||
|
||||
beforeDestroy() {
|
||||
clearTimeout(this.timeOutID)
|
||||
},
|
||||
methods: {
|
||||
getThumbUrl,
|
||||
formatTime,
|
||||
setSelectRows(val) {
|
||||
this.selectRows = val
|
||||
},
|
||||
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 } })
|
||||
},
|
||||
goToCard(cardId) {
|
||||
// Assuming there is a card detail or list page, but for now just placeholder or link to card list
|
||||
this.$router.push({ path: '/spring/fortune/card', query: { id: cardId } })
|
||||
},
|
||||
async fetchData() {
|
||||
this.listLoading = true
|
||||
const { data } = await getDrawList(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>
|
||||
180
src/views/spring/index/recommend/components/RecommendEdit.vue
Normal file
180
src/views/spring/index/recommend/components/RecommendEdit.vue
Normal file
@@ -0,0 +1,180 @@
|
||||
<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="scene">
|
||||
<el-select v-model="form.scene" placeholder="请选择场景" style="width: 100%" @change="handleSceneChange">
|
||||
<el-option label="祝福卡片" value="card_generate" />
|
||||
<el-option label="头像" value="avatar_download" />
|
||||
<!-- <el-option label="抽签" value="fortune_draw" /> -->
|
||||
<!-- <el-option label="壁纸" value="wallpaper_download" /> -->
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="类型" prop="type">
|
||||
<el-select v-model="form.type" placeholder="请选择类型" style="width: 100%">
|
||||
<el-option v-for="item in typeOptions" :key="item.value" :label="item.label" :value="item.value" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="资源ID" prop="recommendId">
|
||||
<div style="display: flex; gap: 10px">
|
||||
<el-input v-model="form.recommendId" placeholder="请输入资源ID" @blur="handleCheckId" />
|
||||
<el-button :loading="checking" type="primary" @click="handleCheckId">查询</el-button>
|
||||
</div>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item v-if="previewImage" label="预览">
|
||||
<el-image :preview-src-list="[previewImage]" :src="previewImage" style="width: 100px; height: 100px; border-radius: 4px" />
|
||||
</el-form-item>
|
||||
|
||||
<template v-if="canSave">
|
||||
<el-form-item label="推荐标题" prop="title">
|
||||
<el-input v-model="form.title" placeholder="请输入推荐标题" />
|
||||
</el-form-item>
|
||||
<el-form-item label="推荐内容" prop="content">
|
||||
<el-input v-model="form.content" placeholder="请输入推荐内容" :rows="2" type="textarea" />
|
||||
</el-form-item>
|
||||
</template>
|
||||
|
||||
<el-form-item label="标签" prop="tag">
|
||||
<el-select v-model="form.tag" placeholder="请选择标签" style="width: 100%">
|
||||
<el-option label="最新" value="new" />
|
||||
<el-option label="热门" value="hot" />
|
||||
<el-option label="精选" value="featured" />
|
||||
<el-option label="爆款" value="hot2" />
|
||||
<el-option label="无" value="" />
|
||||
</el-select>
|
||||
</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 :disabled="!canSave" type="primary" @click="save">确 定</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { doAdd, getItemDetail } from '@/api/spring/index/index'
|
||||
|
||||
export default {
|
||||
name: 'RecommendEdit',
|
||||
data() {
|
||||
return {
|
||||
form: {
|
||||
scene: '',
|
||||
type: '',
|
||||
recommendId: '',
|
||||
tag: '',
|
||||
isEnabled: true,
|
||||
imageUrl: '',
|
||||
title: '',
|
||||
content: '',
|
||||
},
|
||||
rules: {
|
||||
scene: [{ required: true, trigger: 'change', message: '请选择场景' }],
|
||||
type: [{ required: true, trigger: 'change', message: '请选择类型' }],
|
||||
recommendId: [{ required: true, trigger: 'blur', message: '请输入资源ID' }],
|
||||
title: [{ required: true, trigger: 'blur', message: '请输入推荐标题' }],
|
||||
content: [{ required: true, trigger: 'blur', message: '请输入推荐内容' }],
|
||||
},
|
||||
title: '添加推介',
|
||||
dialogFormVisible: false,
|
||||
typeOptions: [],
|
||||
previewImage: '',
|
||||
checking: false,
|
||||
canSave: false,
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
handleSceneChange(val) {
|
||||
this.form.type = ''
|
||||
this.typeOptions = []
|
||||
if (val === 'card_generate') {
|
||||
this.typeOptions = [{ label: '祝福卡', value: 'card' }]
|
||||
this.form.type = 'card'
|
||||
} else if (val === 'avatar_download') {
|
||||
this.typeOptions = [
|
||||
{ label: '头像', value: 'avatar' },
|
||||
{ label: '头像框', value: 'frame' },
|
||||
{ label: '头像饰品', value: 'decor' },
|
||||
]
|
||||
} else if (val === 'fortune_draw') {
|
||||
this.typeOptions = [{ label: '签文', value: 'fortune' }]
|
||||
this.form.type = 'fortune'
|
||||
} else if (val === 'wallpaper_download') {
|
||||
this.typeOptions = [{ label: '壁纸', value: 'wallpaper' }]
|
||||
this.form.type = 'wallpaper'
|
||||
}
|
||||
},
|
||||
async handleCheckId() {
|
||||
if (!this.form.scene || !this.form.type || !this.form.recommendId) {
|
||||
this.$baseMessage('请先完善场景、类型和资源ID', 'warning')
|
||||
return
|
||||
}
|
||||
this.checking = true
|
||||
this.canSave = false
|
||||
this.previewImage = ''
|
||||
try {
|
||||
const { data } = await getItemDetail({
|
||||
scene: this.form.scene,
|
||||
type: this.form.type,
|
||||
id: this.form.recommendId,
|
||||
})
|
||||
if (data && data.imageUrl) {
|
||||
this.previewImage = data.imageUrl
|
||||
this.form.imageUrl = data.imageUrl
|
||||
this.canSave = true
|
||||
this.$baseMessage('查询成功', 'success')
|
||||
} else {
|
||||
this.$baseMessage('未找到对应资源', 'error')
|
||||
}
|
||||
} catch (e) {
|
||||
// Error handled by request interceptor usually, but safe to reset here
|
||||
} finally {
|
||||
this.checking = false
|
||||
}
|
||||
},
|
||||
showEdit() {
|
||||
this.title = '添加推介'
|
||||
this.form = {
|
||||
scene: '',
|
||||
type: '',
|
||||
recommendId: '',
|
||||
tag: '',
|
||||
isEnabled: true,
|
||||
imageUrl: '',
|
||||
title: '',
|
||||
content: '',
|
||||
}
|
||||
this.previewImage = ''
|
||||
this.canSave = false
|
||||
this.typeOptions = []
|
||||
this.dialogFormVisible = true
|
||||
this.$nextTick(() => {
|
||||
this.$refs['form'].clearValidate()
|
||||
})
|
||||
},
|
||||
close() {
|
||||
this.$refs['form'].resetFields()
|
||||
this.dialogFormVisible = false
|
||||
},
|
||||
save() {
|
||||
this.$refs['form'].validate(async (valid) => {
|
||||
if (valid) {
|
||||
const { msg } = await doAdd(this.form)
|
||||
this.$baseMessage(msg, 'success')
|
||||
this.$emit('fetch-data')
|
||||
this.close()
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
})
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
159
src/views/spring/index/recommend/index.vue
Normal file
159
src/views/spring/index/recommend/index.vue
Normal file
@@ -0,0 +1,159 @@
|
||||
<template>
|
||||
<div class="recommend-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-button icon="el-icon-refresh" type="primary" @click="fetchData">刷新</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 width="80" />
|
||||
|
||||
<el-table-column align="center" label="图片" width="100">
|
||||
<template slot-scope="scope">
|
||||
<el-tooltip class="item" :content="scope.row.resourceId" effect="dark" placement="top">
|
||||
<el-image
|
||||
fit="cover"
|
||||
:preview-src-list="[scope.row.imageUrl]"
|
||||
:src="getThumbUrl(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 }">
|
||||
{{ getSceneName(row.scene) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column align="center" label="类型" prop="type" show-overflow-tooltip />
|
||||
|
||||
<el-table-column align="center" label="资源ID" prop="resourceId" show-overflow-tooltip />
|
||||
|
||||
<el-table-column align="center" label="标签" show-overflow-tooltip>
|
||||
<template #default="{ row }">
|
||||
<el-tag v-if="row.tag === 'new'" type="success">最新</el-tag>
|
||||
<el-tag v-else-if="row.tag === 'hot'" type="danger">热门</el-tag>
|
||||
<el-tag v-else-if="row.tag === 'featured'" type="info">精选</el-tag>
|
||||
<el-tag v-else-if="row.tag === 'hot2'" type="warning">爆款</el-tag>
|
||||
<span v-else>{{ row.tag || '--' }}</span>
|
||||
</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 :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>
|
||||
|
||||
<edit ref="edit" @fetch-data="fetchData" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { getList, doDelete, doMoveUp, doMoveDown, toggleEnable } from '@/api/spring/index/index'
|
||||
import { getSceneName, getThumbUrl } from '@/utils/blessing'
|
||||
import Edit from './components/RecommendEdit'
|
||||
|
||||
export default {
|
||||
name: 'RecommendManagement',
|
||||
components: { Edit },
|
||||
data() {
|
||||
return {
|
||||
list: null,
|
||||
listLoading: true,
|
||||
elementLoadingText: '正在加载...',
|
||||
queryForm: { pageNo: 1, pageSize: 10 },
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.fetchData()
|
||||
},
|
||||
methods: {
|
||||
getSceneName,
|
||||
getThumbUrl,
|
||||
handleEdit() {
|
||||
this.$refs['edit'].showEdit()
|
||||
},
|
||||
handleDelete(row) {
|
||||
this.$baseConfirm('你确定要删除当前项吗', null, async () => {
|
||||
const { msg } = await doDelete({ ids: [row.id] })
|
||||
this.$baseMessage(msg, 'success')
|
||||
this.fetchData()
|
||||
})
|
||||
},
|
||||
async fetchData() {
|
||||
this.listLoading = true
|
||||
const { data } = await getList(this.queryForm)
|
||||
this.list = data.list || data // Handle if list is directly returned or wrapped
|
||||
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>
|
||||
110
src/views/spring/index/tips/components/AppManagementEdit.vue
Normal file
110
src/views/spring/index/tips/components/AppManagementEdit.vue
Normal file
@@ -0,0 +1,110 @@
|
||||
<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="text">
|
||||
<el-input v-model="form.text" autocomplete="off" :rows="2" type="textarea" />
|
||||
</el-form-item>
|
||||
<el-form-item label="跳转地址" prop="url">
|
||||
<el-input v-model="form.url" autocomplete="off" />
|
||||
</el-form-item>
|
||||
<el-form-item label="标签" prop="tag">
|
||||
<el-select v-model="form.tag" placeholder="请选择标签" style="width: 100%">
|
||||
<el-option label="新品" value="new" />
|
||||
<el-option label="热门" value="hot" />
|
||||
<el-option label="爆款" value="hot2" />
|
||||
<el-option label="精选" value="featured" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="类型" prop="type">
|
||||
<el-select v-model="form.type" placeholder="请选择类型" style="width: 100%">
|
||||
<el-option label="默认" value="" />
|
||||
<el-option label="页面" value="path" />
|
||||
<el-option label="tab页" value="switchTab" />
|
||||
</el-select>
|
||||
</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/index/tips'
|
||||
|
||||
export default {
|
||||
name: 'AppManagementEdit',
|
||||
data() {
|
||||
return {
|
||||
id: '',
|
||||
form: {
|
||||
text: '',
|
||||
url: '',
|
||||
tag: '',
|
||||
type: '',
|
||||
isEnabled: true,
|
||||
},
|
||||
rules: {
|
||||
text: [{ required: true, trigger: 'blur', message: '请输入文案' }],
|
||||
url: [{ required: true, trigger: 'blur', message: '请输入跳转地址' }],
|
||||
isEnabled: [{ required: true, trigger: 'blur', message: '请选择是否启用' }],
|
||||
},
|
||||
title: '',
|
||||
dialogFormVisible: false,
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
showEdit(row) {
|
||||
if (!row) {
|
||||
this.title = '添加'
|
||||
this.form = {
|
||||
text: '',
|
||||
url: '',
|
||||
tag: '',
|
||||
type: '',
|
||||
isEnabled: true,
|
||||
}
|
||||
} else {
|
||||
this.title = '编辑'
|
||||
this.form = {
|
||||
text: row.text,
|
||||
url: row.url,
|
||||
tag: row.tag,
|
||||
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>
|
||||
205
src/views/spring/index/tips/index.vue
Normal file
205
src/views/spring/index/tips/index.vue
Normal file
@@ -0,0 +1,205 @@
|
||||
<template>
|
||||
<div class="tips-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-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="text" show-overflow-tooltip />
|
||||
<el-table-column align="center" label="跳转地址" prop="url" show-overflow-tooltip />
|
||||
<el-table-column align="center" label="标签" show-overflow-tooltip>
|
||||
<template #default="{ row }">
|
||||
<el-tag v-if="row.tag === 'new'" type="success">新品</el-tag>
|
||||
<el-tag v-else-if="row.tag === 'hot'" type="danger">热门</el-tag>
|
||||
<el-tag v-else-if="row.tag === 'hot2'" type="warning">爆款</el-tag>
|
||||
<el-tag v-else-if="row.tag === 'featured'" type="info">精选</el-tag>
|
||||
<span v-else>--</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="类型" show-overflow-tooltip>
|
||||
<template #default="{ row }">
|
||||
<span v-if="row.type === 'path'">页面</span>
|
||||
<span v-else-if="row.type === 'switchTab'">tab页</span>
|
||||
<span v-else>默认</span>
|
||||
</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" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { doDelete, getList, toggleEnable, doMoveUp, doMoveDown } from '@/api/spring/index/tips'
|
||||
import Edit from './components/AppManagementEdit'
|
||||
|
||||
export default {
|
||||
name: 'Tips',
|
||||
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()
|
||||
})
|
||||
} 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>
|
||||
|
||||
<style scoped>
|
||||
.content-cell {
|
||||
white-space: pre-wrap;
|
||||
word-break: break-word;
|
||||
line-height: 1.6;
|
||||
}
|
||||
</style>
|
||||
100
src/views/spring/index/topic/components/TopicEdit.vue
Normal file
100
src/views/spring/index/topic/components/TopicEdit.vue
Normal file
@@ -0,0 +1,100 @@
|
||||
<template>
|
||||
<el-dialog :title="title" :visible.sync="dialogFormVisible" width="600px" @close="close">
|
||||
<el-form ref="form" label-width="100px" :model="form" :rules="rules">
|
||||
<el-form-item label="场景" prop="scene">
|
||||
<el-input v-model="form.scene" placeholder="请输入场景" />
|
||||
</el-form-item>
|
||||
<el-form-item label="场景名称" prop="sceneName">
|
||||
<el-input v-model="form.sceneName" placeholder="请输入场景名称" />
|
||||
</el-form-item>
|
||||
<el-form-item label="场景描述" prop="sceneDesc">
|
||||
<el-input v-model="form.sceneDesc" placeholder="请输入场景描述" :rows="3" type="textarea" />
|
||||
</el-form-item>
|
||||
<el-form-item label="场景祝福" prop="sceneBlessing">
|
||||
<el-input v-model="form.sceneBlessing" placeholder="请输入场景祝福" :rows="3" type="textarea" />
|
||||
</el-form-item>
|
||||
<el-form-item label="按钮文本" prop="btnText">
|
||||
<el-input v-model="form.btnText" 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>
|
||||
<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 { createTopic, updateTopic } from '@/api/spring/index/topic'
|
||||
import SingleUpload from '@/components/SingleUpload'
|
||||
|
||||
export default {
|
||||
name: 'TopicEdit',
|
||||
components: { SingleUpload },
|
||||
data() {
|
||||
return {
|
||||
form: {
|
||||
scene: '',
|
||||
sceneName: '',
|
||||
sceneDesc: '',
|
||||
sceneBlessing: '',
|
||||
btnText: '',
|
||||
imageUrl: '',
|
||||
},
|
||||
rules: {
|
||||
scene: [{ required: true, trigger: 'change', message: '请选择场景' }],
|
||||
},
|
||||
title: '',
|
||||
dialogFormVisible: false,
|
||||
id: '',
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
uploadUrl() {
|
||||
return `${process.env.VUE_APP_API_BASE_URL}/management/api/common/upload`
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
handleUploadSuccess(url) {
|
||||
this.form.imageUrl = url
|
||||
},
|
||||
showEdit(row) {
|
||||
if (!row) {
|
||||
this.title = '添加专题'
|
||||
this.id = ''
|
||||
} else {
|
||||
this.title = '编辑专题'
|
||||
this.id = row.id
|
||||
this.form = Object.assign({}, row)
|
||||
}
|
||||
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) {
|
||||
const { msg } = this.id ? await updateTopic(this.id, this.form) : await createTopic(this.form)
|
||||
this.$baseMessage(msg, 'success')
|
||||
this.$emit('fetch-data')
|
||||
this.close()
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
})
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
139
src/views/spring/index/topic/index.vue
Normal file
139
src/views/spring/index/topic/index.vue
Normal file
@@ -0,0 +1,139 @@
|
||||
<template>
|
||||
<div class="topic-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="ID" prop="id" show-overflow-tooltip width="80" />
|
||||
<el-table-column align="center" label="场景" prop="scene" show-overflow-tooltip />
|
||||
<el-table-column align="center" label="场景名称" prop="sceneName" show-overflow-tooltip />
|
||||
<el-table-column align="center" label="场景描述" prop="sceneDesc" show-overflow-tooltip />
|
||||
<el-table-column align="center" label="场景祝福" prop="sceneBlessing" show-overflow-tooltip />
|
||||
<el-table-column align="center" label="按钮文本" prop="btnText" show-overflow-tooltip />
|
||||
<el-table-column align="center" label="背景图片" width="100">
|
||||
<template slot-scope="scope">
|
||||
<el-image
|
||||
v-if="scope.row.imageUrl"
|
||||
fit="cover"
|
||||
:preview-src-list="[scope.row.imageUrl]"
|
||||
:src="getThumbUrl(scope.row.imageUrl)"
|
||||
style="width: 50px; height: 50px"
|
||||
/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="是否启用" width="100">
|
||||
<template slot-scope="{ row }">
|
||||
<el-switch :active-value="true" :inactive-value="false" :value="row.isEnabled" @change="handleStatusChange(row, $event)" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="创建时间" show-overflow-tooltip width="160">
|
||||
<template slot-scope="{ row }">
|
||||
{{ formatTime(row.createdAt) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="操作" show-overflow-tooltip width="100">
|
||||
<template slot-scope="{ row }">
|
||||
<el-button type="text" @click="handleEdit(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"
|
||||
/>
|
||||
<topic-edit ref="edit" @fetch-data="fetchData" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { getList, enableTopic, disableTopic } from '@/api/spring/index/topic'
|
||||
import { formatTime } from '@/utils'
|
||||
import { getThumbUrl } from '@/utils/blessing'
|
||||
import TopicEdit from './components/TopicEdit'
|
||||
|
||||
export default {
|
||||
name: 'Topic',
|
||||
components: { TopicEdit },
|
||||
data() {
|
||||
return {
|
||||
list: null,
|
||||
listLoading: true,
|
||||
layout: 'total, sizes, prev, pager, next, jumper',
|
||||
total: 0,
|
||||
elementLoadingText: '正在加载...',
|
||||
queryForm: {
|
||||
pageNo: 1,
|
||||
pageSize: 10,
|
||||
keyword: '',
|
||||
},
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.fetchData()
|
||||
},
|
||||
methods: {
|
||||
formatTime,
|
||||
getThumbUrl,
|
||||
handleEdit(row) {
|
||||
if (row && row.id) {
|
||||
this.$refs['edit'].showEdit(row)
|
||||
} else {
|
||||
this.$refs['edit'].showEdit()
|
||||
}
|
||||
},
|
||||
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.listLoading = false
|
||||
},
|
||||
async handleStatusChange(row, newVal) {
|
||||
const action = newVal ? enableTopic : disableTopic
|
||||
const text = newVal ? '启用' : '禁用'
|
||||
try {
|
||||
await action(row.id)
|
||||
row.isEnabled = newVal
|
||||
this.$baseMessage(`${text}成功`, 'success')
|
||||
} catch (e) {
|
||||
this.$baseMessage(`${text}失败`, 'error')
|
||||
// Since we use :value, the switch might have visually toggled if we don't force update?
|
||||
// Actually, if we use :value and don't update row.isEnabled, Vue re-renders with old value?
|
||||
// Yes, usually.
|
||||
// But to be sure, we can force refresh or just rely on the fact that row.isEnabled wasn't updated.
|
||||
this.fetchData() // Refresh list to ensure consistent state
|
||||
}
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
182
src/views/spring/user/feedback/index.vue
Normal file
182
src/views/spring/user/feedback/index.vue
Normal file
@@ -0,0 +1,182 @@
|
||||
<template>
|
||||
<div class="feedback-container">
|
||||
<vab-query-form>
|
||||
<vab-query-form-left-panel :span="12">
|
||||
<el-form :inline="true" :model="queryForm" @submit.native.prevent>
|
||||
<el-form-item>
|
||||
<el-select v-model="queryForm.type" clearable placeholder="请选择反馈类型" @change="queryData">
|
||||
<el-option label="其他" :value="4" />
|
||||
<el-option label="功能建议" :value="1" />
|
||||
<el-option label="问题反馈" :value="2" />
|
||||
<el-option label="投诉" :value="3" />
|
||||
</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">
|
||||
<el-table-column align="center" label="类型" prop="type" width="100">
|
||||
<template #default="{ row }">
|
||||
<el-tag v-if="row.type === 1" type="success">功能建议</el-tag>
|
||||
<el-tag v-else-if="row.type === 2" type="warning">问题反馈</el-tag>
|
||||
<el-tag v-else-if="row.type === 3" type="danger">投诉</el-tag>
|
||||
<el-tag v-else type="info">其他</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="反馈内容" prop="content" show-overflow-tooltip />
|
||||
|
||||
<el-table-column align="center" label="图片" width="200">
|
||||
<template #default="{ row }">
|
||||
<div v-if="row.images && row.images.length" class="image-grid">
|
||||
<el-image
|
||||
v-for="(img, index) in row.images"
|
||||
:key="index"
|
||||
class="grid-image"
|
||||
:preview-src-list="row.images"
|
||||
:src="getThumbUrl(img)"
|
||||
/>
|
||||
</div>
|
||||
<span v-else>--</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column align="left" label="用户信息" show-overflow-tooltip>
|
||||
<template #default="{ row }">
|
||||
<div v-if="row.fromUser && row.fromUser.id" class="author-cell">
|
||||
<img alt="avatar" class="author-avatar" :src="getThumbUrl(row.fromUser.avatar)" />
|
||||
<div class="author-meta">
|
||||
<div>
|
||||
<strong>id:</strong>
|
||||
{{ row.fromUser.id || '--' }}
|
||||
</div>
|
||||
<div>
|
||||
<strong>昵称:</strong>
|
||||
{{ row.fromUser.nickname || '--' }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div v-else>
|
||||
<div>User ID: {{ row.userId }}</div>
|
||||
<div>App ID: {{ row.appId }}</div>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column align="center" label="设备信息" show-overflow-tooltip>
|
||||
<template #default="{ row }">
|
||||
<div>IP: {{ row.ip }}</div>
|
||||
<div>地址: {{ row.address }}</div>
|
||||
<div>
|
||||
Device ID:
|
||||
<el-link v-if="row.deviceId" type="primary" :underline="false" @click="goToDevice(row.deviceId)">
|
||||
{{ row.deviceId }}
|
||||
</el-link>
|
||||
<span v-else>--</span>
|
||||
</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>
|
||||
|
||||
<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 { getUserFeedbackList } from '@/api/spring/user'
|
||||
import { formatTime } from '@/utils'
|
||||
import { getThumbUrl } from '@/utils/blessing'
|
||||
|
||||
export default {
|
||||
name: 'UserFeedback',
|
||||
data() {
|
||||
return {
|
||||
list: null,
|
||||
listLoading: true,
|
||||
layout: 'total, sizes, prev, pager, next, jumper',
|
||||
total: 0,
|
||||
elementLoadingText: '正在加载...',
|
||||
queryForm: {
|
||||
pageNo: 1,
|
||||
pageSize: 10,
|
||||
type: '',
|
||||
},
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.fetchData()
|
||||
},
|
||||
methods: {
|
||||
formatTime,
|
||||
getThumbUrl,
|
||||
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 } })
|
||||
},
|
||||
async fetchData() {
|
||||
this.listLoading = true
|
||||
const { data } = await getUserFeedbackList(this.queryForm)
|
||||
this.list = data.list
|
||||
this.total = data.totalCount
|
||||
this.listLoading = false
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.image-grid {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 5px;
|
||||
}
|
||||
.grid-image {
|
||||
width: 50px;
|
||||
height: 50px;
|
||||
object-fit: cover;
|
||||
border-radius: 4px;
|
||||
}
|
||||
.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;
|
||||
}
|
||||
</style>
|
||||
163
src/views/spring/user/order/index.vue
Normal file
163
src/views/spring/user/order/index.vue
Normal file
@@ -0,0 +1,163 @@
|
||||
<template>
|
||||
<div class="user-order-container">
|
||||
<vab-query-form>
|
||||
<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.userId" clearable placeholder="请输入User ID" />
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-input v-model.trim="queryForm.outTradeNo" 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-left-panel>
|
||||
</vab-query-form>
|
||||
|
||||
<el-table v-loading="listLoading" :data="list" :element-loading-text="elementLoadingText">
|
||||
<el-table-column align="center" label="订单号" prop="outTradeNo" show-overflow-tooltip />
|
||||
|
||||
<el-table-column align="center" label="用户信息">
|
||||
<template #default="{ row }">
|
||||
<div v-if="row.detail" style="display: flex; align-items: center; justify-content: center">
|
||||
<img
|
||||
v-if="row.detail.avatar"
|
||||
:src="row.detail.avatar"
|
||||
style="width: 40px; height: 40px; border-radius: 50%; margin-right: 10px; object-fit: cover"
|
||||
/>
|
||||
<div style="text-align: left">
|
||||
<div>{{ row.detail.nickname || row.userId }}</div>
|
||||
<div style="font-size: 12px; color: #909399">
|
||||
ID:
|
||||
<el-link type="primary" :underline="false" @click="goToUser(row.userId)">{{ row.userId }}</el-link>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<el-link v-else type="primary" :underline="false" @click="goToUser(row.userId)">{{ row.userId }}</el-link>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column align="center" label="商品描述" prop="description" show-overflow-tooltip />
|
||||
|
||||
<el-table-column align="center" label="金额" prop="totalAmount" width="120">
|
||||
<template #default="{ row }">
|
||||
<span style="color: #f56c6c; font-weight: bold">¥{{ (row.totalAmount / 100).toFixed(2) }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column align="center" label="支付渠道">
|
||||
<template #default="{ row }">
|
||||
<el-tag v-if="row.provider === 'wechat'" size="small" type="success">微信</el-tag>
|
||||
<el-tag v-else-if="row.provider === 'alipay'" size="small" type="primary">支付宝</el-tag>
|
||||
<el-tag v-else-if="row.provider === 'douyin'" size="small" type="warning">抖音</el-tag>
|
||||
<span v-else>{{ row.provider }}</span>
|
||||
<div style="font-size: 12px; color: #909399; margin-top: 4px">{{ row.channel }}</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column align="center" label="状态" prop="tradeState" width="120">
|
||||
<template #default="{ row }">
|
||||
<el-tag v-if="row.tradeState === 'SUCCESS'" type="success">支付成功</el-tag>
|
||||
<el-tag v-else-if="row.tradeState === 'REFUND'" type="warning">已退款</el-tag>
|
||||
<el-tag v-else-if="row.tradeState === 'NOTPAY'" type="info">未支付</el-tag>
|
||||
<el-tag v-else-if="row.tradeState === 'CLOSED'" type="info">已关闭</el-tag>
|
||||
<el-tag v-else-if="row.tradeState === 'PAYERROR'" type="danger">支付失败</el-tag>
|
||||
<el-tag v-else>{{ row.tradeState }}</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column align="center" label="VIP计划" prop="vipPlanId" show-overflow-tooltip width="140">
|
||||
<template #default="{ row }">
|
||||
{{ row.vipPlanId || '-' }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column align="center" label="创建时间" prop="createdAt" width="170">
|
||||
<template #default="{ row }">
|
||||
{{ formatTime(row.createdAt) }}
|
||||
</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 { getUserOrderList } from '@/api/spring/user'
|
||||
import { formatTime } from '@/utils'
|
||||
|
||||
export default {
|
||||
name: 'UserOrder',
|
||||
data() {
|
||||
return {
|
||||
list: [],
|
||||
listLoading: true,
|
||||
layout: 'total, sizes, prev, pager, next, jumper',
|
||||
total: 0,
|
||||
elementLoadingText: '正在加载...',
|
||||
queryForm: {
|
||||
pageNo: 1,
|
||||
pageSize: 10,
|
||||
userId: '',
|
||||
outTradeNo: '',
|
||||
},
|
||||
}
|
||||
},
|
||||
created() {
|
||||
if (this.$route.query.userId) {
|
||||
this.queryForm.userId = this.$route.query.userId
|
||||
}
|
||||
this.fetchData()
|
||||
},
|
||||
methods: {
|
||||
formatTime,
|
||||
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 getUserOrderList(this.queryForm)
|
||||
this.list = data.list
|
||||
this.total = data.totalCount
|
||||
} catch (error) {
|
||||
console.error(error)
|
||||
} finally {
|
||||
this.listLoading = false
|
||||
}
|
||||
},
|
||||
goToUser(userId) {
|
||||
this.$router.push({
|
||||
path: '/spring/user/user',
|
||||
query: { userId },
|
||||
})
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.user-order-container {
|
||||
padding: 20px;
|
||||
}
|
||||
</style>
|
||||
270
src/views/spring/user/saveRecord/index.vue
Normal file
270
src/views/spring/user/saveRecord/index.vue
Normal file
@@ -0,0 +1,270 @@
|
||||
<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.userId" clearable placeholder="请输入用户id" />
|
||||
</el-form-item>
|
||||
<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="getThumbUrl(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 }">
|
||||
{{ getSceneName(row.scene) }}
|
||||
</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="getThumbUrl(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'
|
||||
import { getSceneName, getThumbUrl } from '@/utils/blessing'
|
||||
|
||||
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: '',
|
||||
userId: '',
|
||||
},
|
||||
timeOutID: null,
|
||||
}
|
||||
},
|
||||
created() {
|
||||
if (this.$route.query.userId) {
|
||||
this.queryForm.userId = this.$route.query.userId
|
||||
}
|
||||
this.fetchData()
|
||||
},
|
||||
|
||||
beforeDestroy() {
|
||||
clearTimeout(this.timeOutID)
|
||||
},
|
||||
methods: {
|
||||
formatTime,
|
||||
getSceneName,
|
||||
getThumbUrl,
|
||||
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>
|
||||
@@ -8,14 +8,17 @@
|
||||
<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-input v-model.trim="queryForm.userId" clearable placeholder="请输入用户id" />
|
||||
</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-input v-model.trim="queryForm.keyword" clearable placeholder="请输入 shareToken" />
|
||||
</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>
|
||||
@@ -29,13 +32,18 @@
|
||||
<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-image
|
||||
fit="cover"
|
||||
:preview-src-list="[scope.row?.detail?.imageUrl]"
|
||||
:src="getThumbUrl(scope.row?.detail?.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 ? '壁纸' : '头像' }}
|
||||
{{ getSceneName(row.scene) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="left" label="信息" show-overflow-tooltip>
|
||||
@@ -69,7 +77,7 @@
|
||||
<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" />
|
||||
<img alt="avatar" class="author-avatar" :src="getThumbUrl(row?.fromUser?.avatar)" />
|
||||
<div class="author-meta">
|
||||
<div>
|
||||
<strong>id:</strong>
|
||||
@@ -83,7 +91,7 @@
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="创建时间" show-overflow-tooltip>
|
||||
<el-table-column align="center" label="分享时间" show-overflow-tooltip>
|
||||
<template #default="{ row }">
|
||||
{{ formatTime(row.createdAt) }}
|
||||
</template>
|
||||
@@ -108,8 +116,9 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { getShareList } from '@/api/spring/blessing/generateRecord'
|
||||
import { getShareList } from '@/api/spring/user'
|
||||
import { formatTime } from '@/utils'
|
||||
import { getSceneName, getThumbUrl } from '@/utils/blessing'
|
||||
|
||||
export default {
|
||||
name: 'GenerateRecord',
|
||||
@@ -125,13 +134,20 @@
|
||||
queryForm: {
|
||||
pageNo: 1,
|
||||
pageSize: 10,
|
||||
type: '',
|
||||
scene: '',
|
||||
keyword: '',
|
||||
userId: '',
|
||||
},
|
||||
timeOutID: null,
|
||||
}
|
||||
},
|
||||
created() {
|
||||
if (this.$route.query.keyword) {
|
||||
this.queryForm.keyword = this.$route.query.keyword
|
||||
}
|
||||
if (this.$route.query.userId) {
|
||||
this.queryForm.userId = this.$route.query.userId
|
||||
}
|
||||
this.fetchData()
|
||||
},
|
||||
|
||||
@@ -140,6 +156,8 @@
|
||||
},
|
||||
methods: {
|
||||
formatTime,
|
||||
getSceneName,
|
||||
getThumbUrl,
|
||||
setSelectRows(val) {
|
||||
this.selectRows = val
|
||||
},
|
||||
@@ -8,7 +8,7 @@
|
||||
<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.permission" clearable placeholder="请输入查询条件" />
|
||||
<el-input v-model.trim="queryForm.userId" clearable placeholder="请输入查询条件" />
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button icon="el-icon-search" type="primary" @click="queryData">查询</el-button>
|
||||
@@ -44,20 +44,20 @@
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="left" label="小程序信息" show-overflow-tooltip>
|
||||
<el-table-column align="left" label="使用信息" show-overflow-tooltip>
|
||||
<template #default="{ row }">
|
||||
<div>
|
||||
<div>
|
||||
<strong>粉丝:</strong>
|
||||
{{ row.followers }}
|
||||
<strong>分享数:</strong>
|
||||
<el-link type="primary" :underline="false" @click="goToShareRecord(row.id)">{{ row.shareCount }}</el-link>
|
||||
</div>
|
||||
<div>
|
||||
<strong>关注数:</strong>
|
||||
{{ row.followings }}
|
||||
<strong>查看数:</strong>
|
||||
<el-link type="primary" :underline="false" @click="goToViewRecord(row.id)">{{ row.viewCount }}</el-link>
|
||||
</div>
|
||||
<div>
|
||||
<strong>好友:</strong>
|
||||
{{ row.friends }}
|
||||
<strong>保存数:</strong>
|
||||
<el-link type="primary" :underline="false" @click="goToSaveRecord(row.id)">{{ row.saveCount }}</el-link>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
@@ -104,12 +104,15 @@
|
||||
queryForm: {
|
||||
pageNo: 1,
|
||||
pageSize: 10,
|
||||
permission: '',
|
||||
userId: '',
|
||||
},
|
||||
timeOutID: null,
|
||||
}
|
||||
},
|
||||
created() {
|
||||
if (this.$route.query.userId) {
|
||||
this.queryForm.userId = this.$route.query.userId
|
||||
}
|
||||
this.fetchData()
|
||||
},
|
||||
|
||||
@@ -164,6 +167,15 @@
|
||||
goToDevice(deviceId) {
|
||||
this.$router.push({ path: '/spring/user/userChat', query: { deviceId } })
|
||||
},
|
||||
goToShareRecord(userId) {
|
||||
this.$router.push({ path: '/spring/user/shareRecord', query: { userId } })
|
||||
},
|
||||
goToViewRecord(userId) {
|
||||
this.$router.push({ path: '/spring/user/viewRecord', query: { userId } })
|
||||
},
|
||||
goToSaveRecord(userId) {
|
||||
this.$router.push({ path: '/spring/user/saveRecord', query: { userId } })
|
||||
},
|
||||
async fetchData() {
|
||||
this.listLoading = true
|
||||
const { data } = await getUserList(this.queryForm)
|
||||
|
||||
@@ -8,7 +8,15 @@
|
||||
<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.permission" clearable placeholder="请输入查询条件" />
|
||||
<el-input v-model.trim="queryForm.userId" 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>
|
||||
@@ -18,27 +26,36 @@
|
||||
</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">
|
||||
<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-image
|
||||
fit="cover"
|
||||
:preview-src-list="[scope.row?.detail?.imageUrl]"
|
||||
:src="getThumbUrl(scope.row?.detail?.imageUrl)"
|
||||
style="width: 50px; height: 50px"
|
||||
/>
|
||||
</el-tooltip>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="浏览类型" show-overflow-tooltip>
|
||||
<template #default="{ row }">
|
||||
{{ getSceneName(row.scene) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="left" label="信息" show-overflow-tooltip>
|
||||
<template #default="{ row }">
|
||||
<div>
|
||||
<div>
|
||||
<strong>节日:</strong>
|
||||
{{ row.year }}-{{ row.festival }}
|
||||
<strong>shareToken:</strong>
|
||||
<template v-if="row.shareToken">
|
||||
<el-link type="primary" :underline="false" @click="goToShareRecord(row.shareToken)">{{ row.shareToken }}</el-link>
|
||||
</template>
|
||||
<template v-else>--</template>
|
||||
</div>
|
||||
<div>
|
||||
<strong>祝福对象:</strong>
|
||||
{{ row.blessingTo || '--' }}
|
||||
</div>
|
||||
<div>
|
||||
<strong>祝福人:</strong>
|
||||
{{ row.blessingFrom || '--' }}
|
||||
<strong>是否是作者:</strong>
|
||||
{{ row.isOwner ? '是' : '否' }}
|
||||
</div>
|
||||
<div>
|
||||
<strong>设备:</strong>
|
||||
@@ -48,44 +65,16 @@
|
||||
<template v-else>--</template>
|
||||
</div>
|
||||
<div>
|
||||
<strong>模版id:</strong>
|
||||
<template v-if="row.templateId">
|
||||
<el-link type="primary" :underline="false" @click="goToTemplate(row.templateId)">{{ row.templateId }}</el-link>
|
||||
</template>
|
||||
<template v-else>--</template>
|
||||
</div>
|
||||
<div>
|
||||
<strong>内容id:</strong>
|
||||
<template v-if="row.blessingId">
|
||||
<el-link type="primary" :underline="false" @click="goToContentTemplate(row.blessingId)">{{ row.blessingId }}</el-link>
|
||||
</template>
|
||||
<template v-else>--</template>
|
||||
<strong>查看地址:</strong>
|
||||
{{ row.address }}
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="left" label="交互信息" show-overflow-tooltip>
|
||||
<el-table-column align="left" label="查看人" show-overflow-tooltip>
|
||||
<template #default="{ row }">
|
||||
<div>
|
||||
<div>
|
||||
<strong>查看数:</strong>
|
||||
{{ row.viewCount }}
|
||||
</div>
|
||||
<div>
|
||||
<strong>分享数:</strong>
|
||||
{{ row.shareCount }}
|
||||
</div>
|
||||
<div>
|
||||
<strong>保存数:</strong>
|
||||
{{ row.saveCount }}
|
||||
</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 v-if="row.userId" class="author-cell">
|
||||
<img alt="avatar" class="author-avatar" :src="getThumbUrl(row?.fromUser?.avatar)" />
|
||||
<div class="author-meta">
|
||||
<div>
|
||||
<strong>id:</strong>
|
||||
@@ -97,9 +86,10 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<span v-else>未登录用户</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="创建时间" show-overflow-tooltip>
|
||||
<el-table-column align="center" label="查看时间" show-overflow-tooltip>
|
||||
<template #default="{ row }">
|
||||
{{ formatTime(row.createdAt) }}
|
||||
</template>
|
||||
@@ -124,11 +114,12 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { getList } from '@/api/spring/blessing/generateRecord'
|
||||
import { getViewList } from '@/api/spring/user'
|
||||
import { formatTime } from '@/utils'
|
||||
import { getSceneName, getThumbUrl } from '@/utils/blessing'
|
||||
|
||||
export default {
|
||||
name: 'GenerateRecord',
|
||||
name: 'ViewRecord',
|
||||
data() {
|
||||
return {
|
||||
host: 'https://file.lihailezzc.com/',
|
||||
@@ -141,12 +132,17 @@
|
||||
queryForm: {
|
||||
pageNo: 1,
|
||||
pageSize: 10,
|
||||
permission: '',
|
||||
scene: '',
|
||||
keyword: '',
|
||||
userId: '',
|
||||
},
|
||||
timeOutID: null,
|
||||
}
|
||||
},
|
||||
created() {
|
||||
if (this.$route.query.userId) {
|
||||
this.queryForm.userId = this.$route.query.userId
|
||||
}
|
||||
this.fetchData()
|
||||
},
|
||||
|
||||
@@ -155,6 +151,8 @@
|
||||
},
|
||||
methods: {
|
||||
formatTime,
|
||||
getSceneName,
|
||||
getThumbUrl,
|
||||
setSelectRows(val) {
|
||||
this.selectRows = val
|
||||
},
|
||||
@@ -198,6 +196,9 @@
|
||||
this.queryForm.pageNo = 1
|
||||
this.fetchData()
|
||||
},
|
||||
goToShareRecord(shareToken) {
|
||||
this.$router.push({ path: '/spring/user/shareRecord', query: { keyword: shareToken } })
|
||||
},
|
||||
goToDevice(deviceId) {
|
||||
this.$router.push({ path: '/spring/user/userChat', query: { deviceId } })
|
||||
},
|
||||
@@ -209,7 +210,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(() => {
|
||||
268
src/views/spring/user/vipUser/index.vue
Normal file
268
src/views/spring/user/vipUser/index.vue
Normal file
@@ -0,0 +1,268 @@
|
||||
<template>
|
||||
<div class="cat-user-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.userId" 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-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="头像" show-overflow-tooltip>
|
||||
<template #default="{ row }">
|
||||
<img alt="image" :src="row.detail.avatar" style="width: 50px; height: 50px; object-fit: cover; border-radius: 50%" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="left" label="信息" show-overflow-tooltip>
|
||||
<template #default="{ row }">
|
||||
<div>
|
||||
<div>
|
||||
<strong>名称:</strong>
|
||||
{{ row.detail.nickname }}
|
||||
</div>
|
||||
<div>
|
||||
<strong>平台:</strong>
|
||||
{{ row.source }}
|
||||
</div>
|
||||
<div>
|
||||
<strong>设备 id:</strong>
|
||||
<template v-if="row.deviceId">
|
||||
<el-link type="primary" :underline="false" @click="goToDevice(row.deviceId)">{{ row.deviceId }}</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>
|
||||
<div>
|
||||
<strong>分享数:</strong>
|
||||
<el-link type="primary" :underline="false" @click="goToShareRecord(row.detail.id)">{{ row.shareCount }}</el-link>
|
||||
</div>
|
||||
<div>
|
||||
<strong>查看数:</strong>
|
||||
<el-link type="primary" :underline="false" @click="goToViewRecord(row.detail.id)">{{ row.viewCount }}</el-link>
|
||||
</div>
|
||||
<div>
|
||||
<strong>保存数:</strong>
|
||||
<el-link type="primary" :underline="false" @click="goToSaveRecord(row.detail.id)">{{ row.saveCount }}</el-link>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="left" label="会员时间" show-overflow-tooltip>
|
||||
<template #default="{ row }">
|
||||
<div>
|
||||
<div>
|
||||
<strong>开始时间:</strong>
|
||||
{{ formatTime(row.startAt) }}
|
||||
</div>
|
||||
<div>
|
||||
<strong>结束时间:</strong>
|
||||
{{ formatTime(row.endAt) }}
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="状态" show-overflow-tooltip>
|
||||
<template #default="{ row }">
|
||||
<el-tag v-if="isExpired(row.endAt)" type="danger">已过期</el-tag>
|
||||
<el-tag v-else type="success">生效中</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="剩余天数" show-overflow-tooltip>
|
||||
<template #default="{ row }">
|
||||
{{ getRemainingDays(row.endAt) }}
|
||||
</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 { getVipUserList } from '@/api/spring/user'
|
||||
import { formatTime } from '@/utils'
|
||||
|
||||
export default {
|
||||
name: 'VipUser',
|
||||
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,
|
||||
userId: '',
|
||||
},
|
||||
timeOutID: null,
|
||||
}
|
||||
},
|
||||
created() {
|
||||
if (this.$route.query.userId) {
|
||||
this.queryForm.userId = this.$route.query.userId
|
||||
}
|
||||
this.fetchData()
|
||||
},
|
||||
|
||||
beforeDestroy() {
|
||||
clearTimeout(this.timeOutID)
|
||||
},
|
||||
methods: {
|
||||
formatTime,
|
||||
parseDate(time) {
|
||||
if (typeof time === 'string' && !isNaN(Date.parse(time))) {
|
||||
return new Date(time)
|
||||
} else if (`${time}`.length === 10) {
|
||||
return new Date(parseInt(time) * 1000)
|
||||
} else {
|
||||
return new Date(+time)
|
||||
}
|
||||
},
|
||||
isExpired(time) {
|
||||
if (!time) return true
|
||||
const date = this.parseDate(time)
|
||||
if (isNaN(date.getTime())) return true
|
||||
return date.getTime() < Date.now()
|
||||
},
|
||||
getRemainingDays(time) {
|
||||
if (!time) return '--'
|
||||
const date = this.parseDate(time)
|
||||
if (isNaN(date.getTime())) return '--'
|
||||
const diff = date.getTime() - Date.now()
|
||||
if (diff < 0) return '0天'
|
||||
const days = Math.ceil(diff / (1000 * 60 * 60 * 24))
|
||||
return `${days}天`
|
||||
},
|
||||
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 } })
|
||||
},
|
||||
goToShareRecord(userId) {
|
||||
this.$router.push({ path: '/spring/user/shareRecord', query: { userId } })
|
||||
},
|
||||
goToViewRecord(userId) {
|
||||
this.$router.push({ path: '/spring/user/viewRecord', query: { userId } })
|
||||
},
|
||||
goToSaveRecord(userId) {
|
||||
this.$router.push({ path: '/spring/user/saveRecord', query: { userId } })
|
||||
},
|
||||
async fetchData() {
|
||||
this.listLoading = true
|
||||
const { data } = await getVipUserList(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;
|
||||
}
|
||||
.image-grid {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.grid-image {
|
||||
width: 80px;
|
||||
height: 80px;
|
||||
object-fit: cover;
|
||||
border-radius: 8px;
|
||||
}
|
||||
</style>
|
||||
@@ -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>
|
||||
217
src/views/spring/wallpaper/system/index.vue
Normal file
217
src/views/spring/wallpaper/system/index.vue
Normal file
@@ -0,0 +1,217 @@
|
||||
<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" @filter-change="handleFilterChange">
|
||||
<el-table-column align="center" label="排序" prop="sort" show-overflow-tooltip />
|
||||
<el-table-column
|
||||
align="center"
|
||||
column-key="categoryIds"
|
||||
:filter-multiple="true"
|
||||
:filters="typeFilters"
|
||||
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="getThumbUrl(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 { getThumbUrl } from '@/utils/blessing'
|
||||
import Edit from './components/AppManagementEdit'
|
||||
import BatchImageAdd from '@/components/BatchImageAdd'
|
||||
|
||||
export default {
|
||||
name: 'SystemWallpaper',
|
||||
components: { Edit, BatchImageAdd },
|
||||
data() {
|
||||
return {
|
||||
doAdd,
|
||||
getThumbUrl,
|
||||
typeList: [],
|
||||
typeFilters: [],
|
||||
list: null,
|
||||
listLoading: true,
|
||||
layout: 'total, sizes, prev, pager, next, jumper',
|
||||
total: 0,
|
||||
selectRows: '',
|
||||
elementLoadingText: '正在加载...',
|
||||
queryForm: {
|
||||
pageNo: 1,
|
||||
pageSize: 10,
|
||||
keyword: '',
|
||||
categoryIds: [],
|
||||
},
|
||||
timeOutID: null,
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.fetchData()
|
||||
this.fetchTypeList()
|
||||
},
|
||||
|
||||
beforeDestroy() {
|
||||
clearTimeout(this.timeOutID)
|
||||
},
|
||||
methods: {
|
||||
async fetchTypeList() {
|
||||
const { data } = await getAllList()
|
||||
this.typeList = data || []
|
||||
this.typeFilters = (data || []).map((item) => ({
|
||||
text: item.name,
|
||||
value: item.id,
|
||||
}))
|
||||
},
|
||||
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
|
||||
},
|
||||
handleFilterChange(filters) {
|
||||
console.log(filters)
|
||||
const values = filters.categoryIds || []
|
||||
this.queryForm.categoryIds = values.length ? values : []
|
||||
this.queryForm.pageNo = 1
|
||||
this.fetchData()
|
||||
},
|
||||
},
|
||||
}
|
||||
</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