fix:项目初始化

This commit is contained in:
ouyangxiu
2025-06-10 17:11:41 +07:00
commit db9bffd2c5
713 changed files with 159746 additions and 0 deletions
@@ -0,0 +1,240 @@
<template>
<el-dialog :title="title" :visible.sync="Visible" width="900px" center class="ac-dialog" :close-on-click-modal="false" @close="close">
<el-form :inline="true" :model="form" :rules="rules" ref="form" class="demo-form-inline" label-width="80px" label-position="right">
<el-row :gutter="24">
<el-col :xs="12" :sm="12" :md="12" :lg="12" :xl="12">
<el-form-item label="封面">
<UploadImg @changeImgUrl="changeimgUrl" :img="form.cover"></UploadImg>
</el-form-item>
</el-col>
<el-col :xs="12" :sm="12" :md="12" :lg="12" :xl="12">
<el-form-item label="竖版封面">
<UploadImg @changeImgUrl="changeCoverVertical" :img="form.coverVertical"></UploadImg>
</el-form-item>
</el-col>
<el-col :xs="12" :sm="12" :md="12" :lg="12" :xl="12">
<el-form-item label="徽章">
<UploadImg @changeImgUrl="changeLogo" :img="form.logo"></UploadImg>
</el-form-item>
</el-col>
<el-col :xs="12" :sm="12" :md="12" :lg="12" :xl="12">
<el-form-item label="名称" prop="name">
<el-input v-model="form.name" placeholder="请输入活动名称" />
</el-form-item>
</el-col>
<el-col :xs="12" :sm="12" :md="12" :lg="12" :xl="12">
<el-form-item label="排序参数" prop="rank">
<el-input v-model.number="form.rank" placeholder="请输入排序" />
</el-form-item>
</el-col>
<el-col :xs="12" :sm="12" :md="12" :lg="12" :xl="12">
<el-form-item label="是否开启" prop="status">
<el-switch v-model="form.status" active-color="#13ce66" inactive-color="#ff4949"></el-switch>
</el-form-item>
</el-col>
<el-col :xs="12" :sm="12" :md="12" :lg="12" :xl="12">
<el-form-item label="充值数" prop="rechargeNum">
<el-input v-model.number="form.rechargeNum" placeholder="请输入充值数" />
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="24">
<el-col :xs="12">
<el-form-item label="奖励说明">
<el-input v-model="form.desc" placeholder="请输入奖励说明" type="textarea" :autosize="{ minRows: 2, maxRows: 8 }" style="width: 400px" />
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="24">
<el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24">
<el-form-item label="活动时间" prop="time">
<el-date-picker v-model="time" type="datetimerange" range-separator="至" value-format="yyyy-MM-ddTHH:mm:ss+08:00" start-placeholder="开始日期" end-placeholder="结束日期">
</el-date-picker>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="24">
<el-col :xs="12" :sm="12" :md="12" :lg="12" :xl="12">
<el-form-item label=" ">
<el-button @click="AddCapList" type="success">新增奖励</el-button>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="24" v-for="(item,index) in form.capList" :key="index">
<el-col :xs="9" :sm="9" :md="9" :lg="9" :xl="9">
<el-form-item label="集卡奖励">
<el-select placeholder="请选择集卡奖励" v-model="item.prizesType">
<el-option label="金币数量" :value="1" />
<el-option label="积分数量" :value="2" />
<el-option label="vip天数" :value="3" />
<el-option label="全部抽卡次数" :value="4" />
<el-option label="专题抽卡次数" :value="5" />
</el-select>
</el-form-item>
</el-col>
<el-col :xs="9" :sm="9" :md="9" :lg="9" :xl="9">
<el-form-item label="数量">
<el-input v-model.number="item.prizesNum" placeholder="请输入数量" />
</el-form-item>
</el-col>
<el-col :xs="6" :sm="6" :md="6" :lg="6" :xl="6">
<el-form-item label="操作">
<el-button @click="delCapList(item,index)" type="danger">删除奖励</el-button>
</el-form-item>
</el-col>
</el-row>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="Visible = false"> </el-button>
<el-button type="primary" @click="submit('form')"> </el-button>
</div>
</el-dialog>
</template>
<script>
import {
cardActivityAdd,
cardActivityUpdate,
} from '@/api/activity/cardActivity'
import moment from 'moment'
import UploadImg from '@/components/UploadImg/index'
export default {
name: 'AddOrEdit',
props: ['data'],
components: {
UploadImg,
},
data() {
return {
Visible: true,
title: '',
time: [],
// 表单数据
form: {
cover: undefined, // "string",封面
id: undefined, //0,表Id
name: undefined, // "string",名称
rank: undefined, // 0,排序
status: undefined, // true,是否启用
desc: undefined, //奖励说明
coverVertical: undefined, //竖版封面图
logo: undefined, //徽章
rechargeNum: undefined,
startAt: undefined,
endAt: undefined,
capList: [],
},
rules: {
rank: [{ required: true, message: '必填', trigger: 'blur' }],
},
}
},
mounted() {
this.title = this.data.title
if (this.title === '编辑') {
this.form = JSON.parse(JSON.stringify(this.data.data))
this.form.rechargeNum = this.form.rechargeNum / 100
this.form.capList.forEach((item) => {
if (item.prizesType === 1) {
item.prizesNum = item.prizesNum / 100
}
})
if (this.form.startAt && this.form.endAt) {
this.time = [
moment(this.form.startAt)
.utcOffset(480)
.format('yyyy-MM-DDTHH:mm:ss+08:00'),
moment(this.form.endAt)
.utcOffset(480)
.format('yyyy-MM-DDTHH:mm:ss+08:00'),
]
}
}
},
methods: {
//TODO:新增集卡活动列表数据
add(data) {
cardActivityAdd(data).then((res) => {
if (res.code === 200) {
this.Visible = false
this.$message.success('新增成功')
} else {
this.Visible = false
this.$message.error('新增失败')
}
})
},
//TODO:编辑集卡轰动列表数据
update(data) {
let param = {
id: data.id,
param: data,
}
cardActivityUpdate(param).then((res) => {
if (res.code === 200) {
this.Visible = false
this.$message.success('更新成功')
} else {
this.Visible = false
this.$message.error('更新失败')
}
})
},
AddCapList() {
if (this.form.capList) {
} else {
this.form.capList = []
}
this.form.capList.push({
prizesNum: 0,
prizesType: 1,
})
},
delCapList(item, index) {
this.form.capList.splice(index, 1)
},
// 提交按钮
submit(formName) {
this.$refs[formName].validate((valid) => {
if (valid) {
if (this.time && this.time.length) {
this.form.startAt = this.time[0]
this.form.endAt = this.time[1]
} else {
this.form.startAt = undefined
this.form.endAt = undefined
}
let param = JSON.parse(JSON.stringify(this.form))
param.capList.forEach((item) => {
if (item.prizesType === 1) {
item.prizesNum = item.prizesNum * 100
}
})
param.rechargeNum = param.rechargeNum * 100
if (this.title === '新增') {
this.add(param)
} else if (this.title === '编辑') {
this.update(param)
}
}
})
},
// 关闭编辑
close() {
this.$emit('close')
},
// 切换图片
changeimgUrl(data) {
this.form.cover = data
},
changeCoverVertical(data) {
this.form.coverVertical = data
},
changeLogo(data) {
this.form.logo = data
},
},
}
</script>
@@ -0,0 +1,144 @@
<template>
<el-dialog :close-on-click-modal="false" :title="title" :visible.sync="Visible" @close="close" center class="ac-dialog" width="700px">
<el-form :inline="true" :model="form" class="demo-form-inline" label-position="right" label-width="100px" ref="form">
<el-row :gutter="24">
<el-col :xs="12" :sm="12" :md="12" :lg="12" :xl="12">
<el-form-item label="封面">
<UploadImg @changeImgUrl="changeimgUrl" :img="form.cover"></UploadImg>
</el-form-item>
</el-col>
<el-col :xs="12" :sm="12" :md="12" :lg="12" :xl="12">
<el-form-item label="抽中数量" prop="publishNum">
<el-input v-model.number="form.publishNum" placeholder="请输入抽中数量" />
</el-form-item>
</el-col>
<el-col :xs="12" :sm="12" :md="12" :lg="12" :xl="12">
<el-form-item label="发布总数" prop="publishTotal">
<el-input v-model.number="form.publishTotal" placeholder="请输入发布总数" />
</el-form-item>
</el-col>
<el-col :xs="12" :sm="12" :md="12" :lg="12" :xl="12">
<el-form-item label="排序" prop="rank">
<el-input v-model.number="form.rank" placeholder="请输入排序" />
</el-form-item>
</el-col>
<el-col :xs="12" :sm="12" :md="12" :lg="12" :xl="12">
<el-form-item label="是否开启" prop="status">
<el-switch v-model="form.status" active-color="#13ce66" inactive-color="#ff4949"></el-switch>
</el-form-item>
</el-col>
<el-col :xs="12" :sm="12" :md="12" :lg="12" :xl="12">
<el-form-item label="奖品类型" prop="prizesType">
<el-select clearable placeholder="请选择类型" v-model.number="form.prizesType" style="width:163px">
<el-option :label="item.label" :value="item.value" v-for="item in prizesTypeList" :key="item" />
</el-select>
</el-form-item>
</el-col>
<el-col :xs="12" :sm="12" :md="12" :lg="12" :xl="12">
<el-form-item label="奖品数量" prop="prizesNum">
<el-input v-model.number="form.prizesNum" placeholder="请输入奖品数量" />
</el-form-item>
</el-col>
</el-row>
</el-form>
<div class="dialog-footer" slot="footer">
<el-button @click="Visible=false"> </el-button>
<el-button @click="submit('form')" type="primary"> </el-button>
</div>
</el-dialog>
</template>
<script>
import { cardinfoAdd, cardinfoUpdate } from '@/api/activity/cardActivity'
import UploadImg from '@/components/UploadImg/index'
import { prizesTypeList } from '@/filters/activity/cardActivity'
import { changeMoneyFen, changeMoneyYuan } from '@/filters'
export default {
name: 'AddCard',
props: ['data'],
components: {
UploadImg,
},
data() {
return {
Visible: true,
title: '',
prizesTypeList: prizesTypeList(),
// 表单数据
form: {
activityId: undefined, // 0,
cover: undefined, // "string",
publishNum: undefined, // 0,
publishTotal: undefined, // 0,
rank: undefined, // 0,
status: undefined, // true,
prizesType: undefined,
prizesNum: undefined,
},
}
},
mounted() {
this.title = this.data.title
this.form = JSON.parse(JSON.stringify(this.data.data))
if (this.form.prizesType === 1) {
this.form.prizesNum = this.form.prizesNum / 100
}
this.form.activityId = this.data.data.activityId
},
methods: {
//TODO:新增集卡活动数据
add(data) {
cardinfoAdd(data).then((res) => {
if (res.code === 200) {
this.Visible = false
this.$message.success('新增成功')
} else {
this.Visible = false
this.$message.error('新增失败')
}
})
},
//TODO:编辑集卡活动数据
update(data) {
let param = {
id: data.id,
param: data,
}
cardinfoUpdate(param).then((res) => {
if (res.code === 200) {
this.Visible = false
this.$message.success('更新成功')
} else {
this.Visible = false
this.$message.error('更新失败')
}
})
},
// 提交按钮
submit(formName) {
let param = JSON.parse(JSON.stringify(this.form))
if (param.prizesType === 1) {
param.prizesNum = changeMoneyFen(param.prizesNum)
}
this.$refs[formName].validate((valid) => {
if (valid) {
if (this.title === '新增') {
this.add(param)
} else if (this.title === '编辑') {
this.update(param)
}
}
})
},
// 关闭编辑
close() {
this.$emit('close', false)
},
// 切换图片
changeimgUrl(data) {
this.form.cover = data
},
},
}
</script>
@@ -0,0 +1,186 @@
<template>
<div>
<el-dialog title="卡片信息列表" :visible.sync="Visible" width="90%" center class="ac-dialog" :close-on-click-modal="false" @close="close">
<el-row class="table-form">
<el-form :inline="true" :model="searchData" class="form-inline" size="mini">
<el-form-item>
<el-button @click="getCardInfo" icon="el-icon-search" plain type="primary">搜索</el-button>
<el-button @click="add" icon="el-icon-circle-plus-outline" plain type="success">新增</el-button>
</el-form-item>
</el-form>
</el-row>
<el-row>
<el-col>
<el-table :data="resData" border height="600px" style="width: 100%" highlight-current-row>
<el-table-column align="center" label="排序">
<template slot-scope="scope">{{ scope.row.rank }}</template>
</el-table-column>
<el-table-column align="center" label="ID">
<template slot-scope="scope">{{ scope.row.id }}</template>
</el-table-column>
<el-table-column align="center" label="活动ID">
<template slot-scope="scope">{{ scope.row.activityId }}</template>
</el-table-column>
<el-table-column align="center" label="封面">
<template slot-scope="scope">
<ShowImg style="width:70px;height:40px;margin:0 auto" :urls="scope.row.cover"></ShowImg>
</template>
</el-table-column>
<el-table-column align="center" label="奖品类型">
<template slot-scope="scope">{{ scope.row.prizesType|changePrizesType }}</template>
</el-table-column>
<el-table-column align="center" label="奖品数量">
<template slot-scope="scope">{{scope.row.prizesType===1?scope.row.prizesNum/100 : scope.row.prizesNum }}</template>
</el-table-column>
<el-table-column align="center" label="发布总数">
<template slot-scope="scope">{{ scope.row.publishTotal }}</template>
</el-table-column>
<el-table-column align="center" label="抽中数量">
<template slot-scope="scope">{{ scope.row.publishNum }}</template>
</el-table-column>
<el-table-column align="center" label="状态">
<template slot-scope="scope">
<el-button :type="scope.row.status ? 'success' : 'danger'" plain size="mini">{{ scope.row.status ? "启用" : "关闭" }}</el-button>
</template>
</el-table-column>
<el-table-column align="center" label="创建时间" width="150px">
<template slot-scope="scope">{{ scope.row.createdAt|BeiJingTime }}</template>
</el-table-column>
<el-table-column align="center" label="更新时间" width="150px">
<template slot-scope="scope">{{ scope.row.updatedAt|BeiJingTime }}</template>
</el-table-column>
<el-table-column fixed="right" label="操作" width="200" align="center">
<template slot-scope="scope">
<el-button @click="eidtMedia(scope.$index, scope.row)" size="mini" type="primary">编辑</el-button>
<el-button @click="handleDelete(scope.$index, scope.row)" size="mini" type="danger">删除</el-button>
</template>
</el-table-column>
</el-table>
</el-col>
</el-row>
<div class="table-pagination">
<el-pagination :current-page="searchData.pageNum" :page-size="searchData.pageSize" :page-sizes="[10, 20, 30, 50, 100]" :total="total" @current-change="handleCurrentChange" @size-change="handleSizeChange" layout="total, sizes, prev, pager, next, jumper" />
</div>
<div slot="footer" class="dialog-footer">
<el-button @click="Visible = false"> </el-button>
<el-button type="primary" @click="submit('ruleForm')"> </el-button>
</div>
</el-dialog>
<Edit :data="editData" v-if="editVisible" @close="closeEdit" />
</div>
</template>
<script>
import { cardinfoList, cardinfoDel } from '@/api/activity/cardActivity'
import ShowImg from '@/components/ShowImg/index.vue'
import Edit from './addCard.vue'
export default {
name: 'ChannelRuleList',
props: ['data'],
components: {
ShowImg,
Edit,
},
data() {
return {
Visible: true,
// 表单数据
searchData: {
pageNum: 1,
pageSize: 10,
activityId: undefined,
},
rules: {},
resData: [],
total: 0,
editVisible: false,
editData: {
title: '新增',
data: {},
},
}
},
mounted() {
this.searchData.activityId = this.data.data.id
this.getCardInfo()
},
methods: {
// 新增按钮
add() {
this.editVisible = true
this.editData = {
title: '新增',
data: {
activityId: this.data.data.id,
},
}
},
// 提交按钮
submit(formName) {
this.$emit('close')
},
// 关闭编辑
close() {
this.$emit('close')
},
getCardInfo() {
cardinfoList(this.searchData).then((res) => {
if (res.code === 200) {
this.resData = res.data.list
this.total = res.data.total
} else {
this.$message.error('请求视频列表失败!')
}
})
},
// 删除按钮
handleDelete(index, row) {
this.$confirm('确定删除?', '警告', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
}).then(() => {
cardinfoDel({ id: row.id }).then((res) => {
this.getCardInfo()
this.$message.success('成功删除!')
})
})
},
// 编辑
eidtMedia(index, row) {
this.editVisible = true
this.editData = {
title: '编辑',
data: row,
}
},
// 关闭编辑弹窗
closeEdit() {
this.editData = {
title: '新增',
data: {},
}
this.editVisible = false
this.getCardInfo()
},
// 切换每页数据量
handleSizeChange(val) {
this.searchData.pageSize = val
this.getCardInfo()
},
// 切换页数
handleCurrentChange(val) {
this.searchData.pageNum = val
this.getCardInfo()
},
},
}
</script>
+205
View File
@@ -0,0 +1,205 @@
<template>
<div class="pf-warpper avlist">
<el-row class="table-form">
<el-form :inline="true" :model="searchData.param" class="form-inline" size="mini">
<el-form-item>
<el-input clearable placeholder="请输入名称" v-model="searchData.name" @clear="onClear('name')" />
</el-form-item>
<el-form-item>
<el-button @click="onSearch" icon="el-icon-search" plain type="primary">搜索</el-button>
<el-button @click="add" icon="el-icon-circle-plus-outline" plain type="success">新增</el-button>
</el-form-item>
</el-form>
</el-row>
<el-row>
<el-col>
<el-table :data="resData" element-loading-text="拼命加载中" border height="750" highlight-current-row style="width: 100%" v-loading="loading" :row-style="{ height: '70px' }">
<el-table-column align="center" label="ID" width="210">
<template slot-scope="scope">{{ scope.row.id }}</template>
</el-table-column>
<el-table-column align="center" label="排序" width="80">
<template slot-scope="scope">{{ scope.row.rank }}</template>
</el-table-column>
<el-table-column align="center" label="名称">
<template slot-scope="scope">{{ scope.row.name }}</template>
</el-table-column>
<el-table-column align="center" label="状态">
<template slot-scope="scope">
<el-button :type="scope.row.status ? 'success' : 'danger'" plain size="mini">{{ scope.row.status ? "开启" : "关闭" }}</el-button>
</template>
</el-table-column>
<el-table-column align="center" label="徽章" width="150">
<template slot-scope="scope">
<ShowImg style="width: 104px; height: 70px; margin: 0 auto" :urls="scope.row.logo"></ShowImg>
</template>
</el-table-column>
<el-table-column align="center" label="封面图" width="150">
<template slot-scope="scope">
<ShowImg style="width: 104px; height: 70px; margin: 0 auto" :urls="scope.row.cover"></ShowImg>
</template>
</el-table-column>
<el-table-column align="center" label="竖版封面">
<template slot-scope="scope">
<ShowImg style="width:40px; height:70px; margin: 0 auto" :urls="scope.row.coverVertical"></ShowImg>
</template>
</el-table-column>
<el-table-column align="center" label="奖励说明" width="300" show-overflow-tooltip>
<template slot-scope="scope">{{ scope.row.desc }}</template>
</el-table-column>
<el-table-column align="center" label="充值数" width="100">
<template slot-scope="scope">{{ scope.row.rechargeNum|changeMoneyYuan }}</template>
</el-table-column>
<el-table-column align="center" label="创建时间" width="160">
<template slot-scope="scope">{{ scope.row.createdAt | BeiJingTime }} </template>
</el-table-column>
<el-table-column align="center" label="更新时间" width="160">
<template slot-scope="scope">{{ scope.row.updatedAt | BeiJingTime }} </template>
</el-table-column>
<el-table-column align="center" fixed="right" label="操作" width="300">
<template slot-scope="scope">
<el-button @click="showCardInfo(scope.$index, scope.row)" size="mini" type="primary">查询卡片信息</el-button>
<el-button @click="handleEdit(scope.$index, scope.row)" size="mini" type="primary">编辑</el-button>
<el-button @click="handleDelete(scope.$index, scope.row)" size="mini" type="danger">删除</el-button>
</template>
</el-table-column>
</el-table>
</el-col>
</el-row>
<div class="table-pagination">
<el-pagination :current-page="searchData.pageNum" :page-size="searchData.pageSize" :page-sizes="[10, 20, 30, 50, 100]" :total="total" @current-change="handleCurrentChange" @size-change="handleSizeChange" layout="total, sizes, prev, pager, next, jumper" />
</div>
<!-- 新增及编辑 -->
<Edit :data="editData" v-if="editVisible" @close="closeEdit" />
<CardInfoList :data="editData" v-if="cardInfoListVisible" @close="closeEdit" />
</div>
</template>
<script>
// 引入模块
import Edit from './components/AddOrEdit'
import ShowImg from '@/components/ShowImg/index.vue'
import CardInfoList from './components/cardInfoList.vue'
import { cardActivityList, cardActivityDel } from '@/api/activity/cardActivity'
export default {
name: 'CardActivity',
components: {
Edit,
ShowImg,
CardInfoList,
},
data() {
return {
// 请求列表参数
searchData: {
pageNum: 1,
pageSize: 10,
name: undefined,
},
resData: [], // el-table表格数据
editVisible: false, // 新增或编辑弹出框
cardInfoListVisible: false,
total: 0, // 数据总条数
loading: true, // 列表加载状态
// 编辑数据
editData: {
title: '新增',
data: {},
},
}
},
mounted() {
this.getActivity()
},
methods: {
//TODO:请求集卡活动列表数据
getActivity() {
cardActivityList(this.searchData).then((res) => {
if (res.code === 200) {
this.resData = res.data.list
this.total = res.data.total
} else {
this.$message.error('请求列表失败!')
this.resData = []
this.total = 0
}
this.loading = false
})
},
//TODO:删除集卡活动列表数据
handleDelete(index, row) {
this.$confirm('确定删除?', '警告', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
}).then(() => {
cardActivityDel({ id: row.id }).then((res) => {
if (res.code === 200) {
this.getActivity()
this.$message.success('成功删除!')
} else {
this.$message.error('操作失败')
}
})
})
},
onSearch() {
this.searchData.pageNum = 1
this.searchData.pageSize = 10
this.getActivity()
},
showCardInfo(index, row) {
this.cardInfoListVisible = true
this.editData = {
title: '视频列表',
type: 3,
data: row,
}
},
// 切换每页数据量
handleSizeChange(val) {
this.searchData.pageSize = val
this.getActivity()
},
// 切换页数
handleCurrentChange(val) {
this.searchData.pageNum = val
this.getActivity()
},
// 新增按钮
add() {
this.editVisible = true
},
// 编辑按钮
handleEdit(index, row) {
this.editVisible = true
this.editData = {
title: '编辑',
data: row,
}
},
// 关闭编辑弹窗
closeEdit() {
this.editData = {
title: '新增',
data: {},
}
this.cardInfoListVisible = false
this.editVisible = false
this.getActivity()
},
// 清空某一项筛选列表
onClear(key) {
this.searchData[key] = undefined
this.getActivity()
},
},
}
</script>