feat: draw card
This commit is contained in:
123
src/views/spring/fortune/card/components/AppManagementEdit.vue
Normal file
123
src/views/spring/fortune/card/components/AppManagementEdit.vue
Normal file
@@ -0,0 +1,123 @@
|
||||
<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="title">
|
||||
<el-input v-model="form.title" autocomplete="off" />
|
||||
</el-form-item>
|
||||
<el-form-item label="幸运等级" prop="fortuneLevel">
|
||||
<el-select v-model="form.fortuneLevel" placeholder="请选择幸运等级">
|
||||
<el-option label="吉祥" value="1" />
|
||||
<el-option label="大吉" value="2" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="描述内容" prop="content">
|
||||
<el-input v-model="form.content" autocomplete="off" />
|
||||
</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="weight">
|
||||
<el-input v-model="form.weight" 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/fortune/card'
|
||||
import SingleUpload from '@/components/SingleUpload'
|
||||
|
||||
export default {
|
||||
name: 'AppManagementEdit',
|
||||
components: { SingleUpload },
|
||||
data() {
|
||||
return {
|
||||
id: '',
|
||||
form: {
|
||||
title: '',
|
||||
fortuneLevel: '',
|
||||
content: '',
|
||||
imageUrl: '',
|
||||
keywords: '',
|
||||
weight: 1,
|
||||
isEnabled: true,
|
||||
},
|
||||
rules: {
|
||||
title: [{ required: true, trigger: 'blur', message: '请输入卡片标题' }],
|
||||
fortuneLevel: [{ required: true, trigger: 'blur', message: '请选择幸运等级' }],
|
||||
content: [{ required: true, trigger: 'blur', message: '请输入描述内容' }],
|
||||
imageUrl: [{ required: true, trigger: 'blur', message: '请上传卡片图片' }],
|
||||
weight: [{ 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 = {
|
||||
title: row.title,
|
||||
fortuneLevel: row.fortuneLevel,
|
||||
content: row.content,
|
||||
imageUrl: row.imageUrl,
|
||||
type: row.type,
|
||||
keywords: row.keywords,
|
||||
weight: row.weight,
|
||||
isEnabled: row.isEnabled,
|
||||
}
|
||||
this.id = row.id
|
||||
}
|
||||
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) {
|
||||
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>
|
||||
148
src/views/spring/fortune/card/index.vue
Normal file
148
src/views/spring/fortune/card/index.vue
Normal file
@@ -0,0 +1,148 @@
|
||||
<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="卡片" 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-tooltip>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column align="center" label="标题" prop="title" show-overflow-tooltip />
|
||||
<el-table-column align="center" label="幸运等级" show-overflow-tooltip>
|
||||
<template #default="{ row }">
|
||||
{{ row.fortuneLevel === '1' ? '吉祥' : row.fortuneLevel === '2' ? '大吉' : '普通' }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="是否启用" show-overflow-tooltip>
|
||||
<template #default="{ row }">
|
||||
{{ row.isEnabled ? '是' : '否' }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="描述" prop="content" show-overflow-tooltip />
|
||||
<el-table-column align="center" label="操作">
|
||||
<template slot-scope="scope">
|
||||
<el-button type="text" @click="handleEdit(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 } from '@/api/spring/fortune/card'
|
||||
import { formatTime } from '@/utils'
|
||||
import Edit from './components/AppManagementEdit'
|
||||
|
||||
export default {
|
||||
name: 'AppManagement',
|
||||
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.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)
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
102
src/views/spring/user/device/index.vue
Normal file
102
src/views/spring/user/device/index.vue
Normal file
@@ -0,0 +1,102 @@
|
||||
<template>
|
||||
<div class="sfg-device-container">
|
||||
<vab-query-form>
|
||||
<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.permission" 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="brand" show-overflow-tooltip />
|
||||
<el-table-column align="center" label="型号" prop="model" show-overflow-tooltip />
|
||||
<el-table-column align="center" label="系统版本" prop="system" show-overflow-tooltip />
|
||||
<el-table-column align="center" label="屏幕宽度(px)" prop="screenWidth" show-overflow-tooltip />
|
||||
<el-table-column align="center" label="屏幕高度(px)" prop="screenHeight" show-overflow-tooltip />
|
||||
<el-table-column align="center" label="像素比" prop="pixelRatio" show-overflow-tooltip />
|
||||
<el-table-column align="center" label="语言" prop="language" show-overflow-tooltip />
|
||||
<el-table-column align="center" label="版本号" prop="version" show-overflow-tooltip />
|
||||
<el-table-column align="center" label="基础库版本" prop="SDKVersion" 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 { getDeviceList } from '@/api/system'
|
||||
import { formatTime } from '@/utils'
|
||||
|
||||
export default {
|
||||
name: 'SFGDeviceManagement',
|
||||
data() {
|
||||
return {
|
||||
list: null,
|
||||
listLoading: true,
|
||||
layout: 'total, sizes, prev, pager, next, jumper',
|
||||
total: 0,
|
||||
selectRows: '',
|
||||
elementLoadingText: '正在加载...',
|
||||
queryForm: {
|
||||
pageNo: 1,
|
||||
pageSize: 10,
|
||||
permission: '',
|
||||
appId: '69665538a49b8ae3be50fe5d',
|
||||
},
|
||||
timeOutID: null,
|
||||
}
|
||||
},
|
||||
created() {
|
||||
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()
|
||||
},
|
||||
async fetchData() {
|
||||
this.listLoading = true
|
||||
const { data } = await getDeviceList(this.queryForm)
|
||||
this.list = data.list
|
||||
this.total = data.totalCount
|
||||
this.timeOutID = setTimeout(() => {
|
||||
this.listLoading = false
|
||||
}, 300)
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
201
src/views/spring/user/user/index.vue
Normal file
201
src/views/spring/user/user/index.vue
Normal file
@@ -0,0 +1,201 @@
|
||||
<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.permission" 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.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.nickname }}
|
||||
</div>
|
||||
<div>
|
||||
<strong>性别:</strong>
|
||||
{{ row.gender ? (row.gender === 'male' ? '男' : '女') : '未公开' }}
|
||||
</div>
|
||||
<div>
|
||||
<strong>平台:</strong>
|
||||
{{ row.platform }}
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="left" label="小程序信息" show-overflow-tooltip>
|
||||
<template #default="{ row }">
|
||||
<div>
|
||||
<div>
|
||||
<strong>粉丝:</strong>
|
||||
{{ row.followers }}
|
||||
</div>
|
||||
<div>
|
||||
<strong>关注数:</strong>
|
||||
{{ row.followings }}
|
||||
</div>
|
||||
<div>
|
||||
<strong>好友:</strong>
|
||||
{{ row.friends }}
|
||||
</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 { getList } from '@/api/maomaotou/user'
|
||||
import { formatTime } from '@/utils'
|
||||
|
||||
export default {
|
||||
name: 'User',
|
||||
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,
|
||||
permission: '',
|
||||
},
|
||||
timeOutID: null,
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.fetchData()
|
||||
},
|
||||
|
||||
beforeDestroy() {
|
||||
clearTimeout(this.timeOutID)
|
||||
},
|
||||
methods: {
|
||||
formatTime,
|
||||
setSelectRows(val) {
|
||||
this.selectRows = val
|
||||
},
|
||||
handleEdit(row) {
|
||||
if (row.id) {
|
||||
this.$refs['edit'].showEdit(row)
|
||||
} else {
|
||||
this.$refs['edit'].showEdit()
|
||||
}
|
||||
},
|
||||
handleDelete(row) {
|
||||
if (row.id) {
|
||||
this.$baseConfirm('你确定要删除当前项吗', null, async () => {
|
||||
const { msg } = await doDelete({ ids: [row.id] })
|
||||
this.$baseMessage(msg, 'success')
|
||||
this.fetchData()
|
||||
})
|
||||
} else {
|
||||
if (this.selectRows.length > 0) {
|
||||
const ids = this.selectRows.map((item) => item.id).join()
|
||||
this.$baseConfirm('你确定要删除选中项吗', null, async () => {
|
||||
const { msg } = await doDelete({ ids: ids.split(',') })
|
||||
this.$baseMessage(msg, 'success')
|
||||
this.fetchData()
|
||||
})
|
||||
} else {
|
||||
this.$baseMessage('未选中任何行', 'error')
|
||||
return false
|
||||
}
|
||||
}
|
||||
},
|
||||
handleSizeChange(val) {
|
||||
this.queryForm.pageSize = val
|
||||
this.fetchData()
|
||||
},
|
||||
handleCurrentChange(val) {
|
||||
this.queryForm.pageNo = val
|
||||
this.fetchData()
|
||||
},
|
||||
queryData() {
|
||||
this.queryForm.pageNo = 1
|
||||
this.fetchData()
|
||||
},
|
||||
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>
|
||||
|
||||
<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>
|
||||
Reference in New Issue
Block a user