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,166 @@
<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="ruleForm" class="demo-form-inline" label-width="120px" label-position="right">
<el-row :gutter="24">
<el-col :xs="12" :sm="12" :md="12" :lg="12" :xl="12">
<el-form-item label="排序">
<el-input placeholder="请输入排序" v-model.number="form.rank">
</el-input>
</el-form-item>
</el-col>
<el-col :xs="12" :sm="12" :md="12" :lg="12" :xl="12">
<el-form-item label="名称">
<el-input placeholder="请输入名称" v-model="form.name">
</el-input>
</el-form-item>
</el-col>
<el-col :xs="12" :sm="12" :md="12" :lg="12" :xl="12">
<el-form-item label="简介">
<el-input placeholder="请输入简介" v-model="form.introduction">
</el-input>
</el-form-item>
</el-col>
<el-col :xs="12" :sm="12" :md="12" :lg="12" :xl="12">
<el-form-item label="用户id">
<el-input placeholder="请输入用户id" v-model.number="form.userId">
</el-input>
</el-form-item>
</el-col>
<el-col :lg="12" :md="12" :sm="12" :xl="12" :xs="12">
<el-form-item label="价格">
<el-input v-model.number="form.price" placeholder="请输入价格" />
</el-form-item>
</el-col>
<el-col :xs="12" :sm="12" :md="12" :lg="12" :xl="12">
<el-form-item label="圈子图片">
<UploadImg @onRemove="onRemove('image')" @changeImgUrl="changeImage" :img="form.image"> </UploadImg>
</el-form-item>
</el-col>
<el-col :xs="12" :sm="12" :md="12" :lg="12" :xl="12">
<el-form-item label="圈子背景图">
<UploadImg @onRemove="onRemove('backgroundImage')" @changeImgUrl="changeBackgroundImage" :img="form.backgroundImage"> </UploadImg>
</el-form-item>
</el-col>
<el-col :xs="12" :sm="12" :md="12" :lg="12" :xl="12">
<el-form-item label="是否推荐">
<el-select placeholder="请选择是否推荐" v-model="form.recommend" style="width: 163px">
<el-option label="推荐" :value="true" />
<el-option label="不推荐" :value="false" />
</el-select>
</el-form-item>
</el-col>
<el-col :lg="12" :md="12" :sm="12" :xl="12" :xs="12">
<el-form-item label="虚拟订阅数">
<el-input v-model.number="form.fakeSubscribes" placeholder="请输入虚拟订阅数" />
</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('ruleForm')"> </el-button>
</div>
</el-dialog>
</template>
<script>
import { updateCircle,addCircle } from '@/api/user/circleList'
import UploadImg from '@/components/UploadImg/index'
import { changeMoneyFen, changeMoneyYuan } from '@/filters'
export default {
name: 'EditCircle',
props: ['data', 'creatData'],
data() {
return {
Visible: true,
title: '',
// 表单数据
form: {
name:undefined,
introduction:undefined, //简介
fakeSubscribes:undefined, // 虚拟订阅数
rank:undefined, // 排序
image:undefined,
backgroundImage:undefined,
recommend: undefined, // 是否推荐
price: undefined // 价格
},
}
},
components:{
UploadImg
},
mounted() {
this.title = this.data.title
if (this.title === '编辑') {
this.form = { ...this.data.data, ...{}}
this.form.price = changeMoneyYuan(this.data.data.price)
}
},
methods: {
// 移除图片地址到form表单
onRemove(key) {
this.form[key] = ''
},
changeImage(data){
this.form.image = data
},
changeBackgroundImage(data){
this.form.backgroundImage = data
},
// TODO:编辑圈子列表数据
update(data) {
updateCircle({ id: data.id, param: data }).then((res) => {
if (res.code === 200) {
this.$message.success('更新成功')
this.close()
} else {
this.$message.error(res.data)
}
})
},
// 新增 
add(data){
addCircle({...data}).then((res) => {
if (res.code === 200) {
this.$message.success('新增成功')
this.close()
} else {
this.$message.error(res.data)
}
})
},
// 添加图片地址到form表单
changeImageUrl(key, data) {
this.form[key] = data
},
// 提交按钮
submit(formName) {
this.form.price = changeMoneyFen(this.form.price)
this.$refs[formName].validate((valid) => {
if (valid) {
if(this.title === '编辑'){
this.update(this.form)
}else{
this.add(this.form)
}
} else {
return false
}
})
},
// 关闭编辑
close() {
this.$emit('close')
}
}
}
</script>
+283
View File
@@ -0,0 +1,283 @@
<template>
<div class="container">
<el-row class="table-form">
<el-form :inline="true" :model="searchData" class="form-inline" size="mini">
<el-form-item>
<el-input placeholder="请输入圈子ID" clearable v-model.number="searchData.circleId" @clear="onClear('circleId')" />
</el-form-item>
<el-form-item>
<el-input placeholder="请输入圈子名称" clearable v-model="searchData.name" @clear="onClear('name')" />
</el-form-item>
<el-form-item>
<el-input placeholder="请输入创建者ID" clearable v-model.number="searchData.userId" @clear="onClear('userId')" />
</el-form-item>
<el-form-item>
<el-select placeholder="请选推荐状态" clearable v-model="searchData.recommend" @clear="onClear('recommend')">
<el-option label="推荐" :value="true"></el-option>
<el-option label="不推荐" :value="false"></el-option>
</el-select>
</el-form-item>
<el-form-item>
<el-button @click="add" icon="el-icon-circle-plus-outline" plain type="success">新增</el-button>
<el-button @click="onSearch" icon="el-icon-search" plain type="primary">搜索</el-button>
<el-button @click="batchDel" icon="el-icon-search" plain type="primary">批量删除</el-button>
</el-form-item>
</el-form>
</el-row>
<el-row>
<el-col>
<el-table
:data="resData"
element-loading-text="拼命加载中"
border
height="750"
@selection-change="handleSelectionChange"
highlight-current-row
style="width: 100%"
v-loading="loading"
:row-style="{ height: '70px' }">
<el-table-column type="selection" width="50" fixed="left"> </el-table-column>
<el-table-column align="center" width="55px" label="排序">
<template slot-scope="scope">{{ scope.row.rank }}</template>
</el-table-column>
<el-table-column align="center" width="65px" label="圈子ID">
<template slot-scope="scope">{{ scope.row.id }}</template>
</el-table-column>
<el-table-column align="center" width="85px" label="创建者ID">
<template slot-scope="scope">{{ scope.row.userId }}</template>
</el-table-column>
<el-table-column align="center" width="65px" label="圈子名称">
<template slot-scope="scope">{{ scope.row.name }}</template>
</el-table-column>
<el-table-column align="center" show-overflow-tooltip width="65px" label="圈子简介">
<template slot-scope="scope">{{ scope.row.introduction }}</template>
</el-table-column>
<el-table-column align="center" width="85px" label="解锁圈子的价格">
<template slot-scope="scope">{{ scope.row.price / 100 }}</template>
</el-table-column>
<el-table-column align="center" width="85px" label="推荐状态">
<template slot-scope="scope">{{ scope.row.recommend ? '推荐' : '不推荐' }}</template>
</el-table-column>
<el-table-column align="center" width="155px" label="虚订阅数">
<template slot-scope="scope">{{ scope.row.fakeSubscribes }}</template>
</el-table-column>
<el-table-column align="center" label="圈子图片">
<template slot-scope="scope">
<ShowImg style="width: 40px; height: 40px; margin: 0 auto" :urls="scope.row.image"></ShowImg>
</template>
</el-table-column>
<el-table-column align="center" label="圈子背景图">
<template slot-scope="scope">
<ShowImg style="width: 40px; height: 40px; margin: 0 auto" :urls="scope.row.backgroundImage"></ShowImg>
</template>
</el-table-column>
<el-table-column align="center" width="155px" label="合集数量">
<template slot-scope="scope">{{ scope.row.comics }}</template>
</el-table-column>
<el-table-column align="center" width="155px" label="视频数量">
<template slot-scope="scope">{{ scope.row.videos }}</template>
</el-table-column>
<el-table-column align="center" width="155px" label="订阅数">
<template slot-scope="scope">{{ scope.row.subscribes }}</template>
</el-table-column>
<el-table-column align="center" width="155px" label="备注">
<template slot-scope="scope">{{ scope.row.remark }}</template>
</el-table-column>
<el-table-column align="center" width="90px" label="最新上架时间">
<template slot-scope="scope">{{ scope.row.contentAddedAt | BeiJingTime }}</template>
</el-table-column>
<el-table-column align="center" width="90px" label="创建时间">
<template slot-scope="scope">{{ scope.row.createdAt | BeiJingTime }}</template>
</el-table-column>
<el-table-column align="center" width="90px" label="更新时间">
<template slot-scope="scope">{{ scope.row.updatedAt | BeiJingTime }}</template>
</el-table-column>
<el-table-column align="center" fixed="right" label="操作" width="250">
<template slot-scope="scope">
<!-- <el-button @click="subscription(scope.$index, scope.row)" size="mini" type="primary">订阅价格
</el-button> -->
<el-button @click="handleEdit(scope.$index, scope.row)" size="mini" type="primary">编辑 </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>
<!-- 新增及编辑 -->
<EditCircle :data="editData" :creatData="creatData" v-if="editVisible" @close="closeEdit" />
</div>
</template>
<script>
import { circleListSearch, circleDelAll } from '@/api/user/circleList'
import EditCircle from './components/editCircle'
import ShowImg from '@/components/ShowImg/index.vue'
export default {
name: 'CircleList',
components: { EditCircle, ShowImg },
data() {
return {
// 请求列表参数
searchData: {
userId: undefined, // 创建者ID
circleId: undefined, // 圈子iID
pageNum: 1,
pageSize: 10,
name: undefined,
recommend: undefined
},
resData: [], // el-table表格数据
total: 0, // 数据总条数
loading: true, // 列表加载状态
editVisible: false, // 编辑圈子弹窗
SubscriptionPopup: false, // 订阅价格弹窗
auditVisible: false,
// 编辑数据
editData: {
title: '新增',
data: {}
},
// 创建圈子数据
creatData: {},
// 推荐状态
RecommendedStatus: [
{
value: '推荐'
}
],
selectArr: []
}
},
mounted() {
this.getCircleListSearch()
// 如果是从创建圈子进来的
if (this.$route.query.creat === '1') {
this.editVisible = true
const { creat, id, mobile } = this.$route.query
this.creatData = {
creat,
id,
mobile
}
}
},
methods: {
batchDel() {
if (this.selectArr.length) {
this.$confirm('确认批量删除?').then(() => {
const data = []
this.selectArr.forEach(item => {
data.push(item.id)
})
circleDelAll({ ids: data }).then(res => {
if (res.code === 200) {
this.$message.success('删除圈子成功')
} else {
this.$message.error('删除圈子失败')
}
})
})
} else {
return this.$message.error('请选择圈子')
}
},
// 新增按钮
add() {
this.editVisible = true
this.editData = {
title: '新增',
data: {}
}
},
// 批量选择
handleSelectionChange(val) {
this.selectArr = val
},
// TODO:请求圈子列表数据
getCircleListSearch() {
this.loading = true
circleListSearch(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
})
},
onSearch() {
this.searchData.pageNum = 1
this.searchData.pageSize = 10
this.getCircleListSearch()
},
// 清空某一项筛选列表
onClear(key) {
this.searchData[key] = undefined
this.getCircleListSearch()
},
subscription(index, row) {
this.SubscriptionPopup = true
this.editData = {
data: row
}
},
handleEdit(index, row) {
this.editVisible = true
this.editData = {
title: '编辑',
data: row
}
this.creatData = {}
},
handleCheck(row) {
this.auditVisible = true
this.editData = {
title: '审核',
data: row
}
},
// 切换每页数据量
handleSizeChange(val) {
this.searchData.pageSize = val
this.getCircleListSearch()
},
// 切换页数
handleCurrentChange(val) {
this.searchData.pageNum = val
this.getCircleListSearch()
},
// 关闭编辑弹窗
closeEdit() {
this.editData = {
title: '新增',
data: {}
}
this.editVisible = false
this.auditVisible = false
this.SubscriptionPopup = false
this.getCircleListSearch()
}
}
}
</script>
@/api/user/circleList