保存功能

This commit is contained in:
liuyuan
2025-04-10 13:33:40 +08:00
parent 93f487dcd9
commit 53c664331d
7 changed files with 766 additions and 8 deletions

View File

@@ -71,6 +71,9 @@ const mainRoutes = {
// { path: '/miniClassList8', component: _import('modules/miniClass/miniClassList8'), name: 'miniClassList8', meta: { title: 'miniClassList8', isTab: true } },
{ path: '/ClassType', component: _import('modules/miniClass/miniClassType'), name: 'ClassType', meta: { title: '班级类型管理', isTab: true } },
{ path: '/reLearn', component: _import('modules/order/reLearn'), name: 'reLearn', meta: { title: '复读订单', isTab: true } },
{ path: '/training-course-list', component: _import('modules/trainingCourse/training-course-list'), name: 'training-course-list', meta: { title: '培训班管理', isTab: true } },
{ path: '/training-course-user', component: _import('modules/trainingCourse/training-course-user'), name: 'training-course-user', meta: { title: '用户列表', isTab: true } },
],
beforeEnter (to, from, next) {
let token = Vue.cookie.get('token')

View File

@@ -67,9 +67,13 @@
align="center"
prop="productId"
>
<!-- <template slot-scope="scope">
{{ (pageIndex - 1) * pageSize + scope.$index + 1 }}
</template> -->
</el-table-column>
<el-table-column
prop="createTime"
header-align="center"
align="center"
label="创建时间"
>
</el-table-column>
<el-table-column
prop="productName"

View File

@@ -0,0 +1,455 @@
<template>
<div class="mod-config">
<el-form
:inline="true"
:model="dataForm"
@keyup.enter.native="getDataList()"
>
<el-form-item label="标题">
<el-input
v-model="dataForm.title"
placeholder="请输入标题"
clearable
>
</el-input>
</el-form-item>
<el-form-item label="年份">
<el-input
v-model="dataForm.year"
placeholder="请输入年份(YYYY)"
clearable
>
</el-input>
</el-form-item>
<el-form-item label="类型">
<el-select v-model="dataForm.type" placeholder="请选择">
<el-option label="线上" value="1">线上</el-option>
<el-option label="线下" value="2">线下</el-option>
</el-select>
</el-form-item>
<el-form-item>
<el-button
@click="
pageIndex = 1;
getDataList();
"
>查询</el-button
>
<el-button
type="primary"
@click="addOrUpdateHandle()"
>新增</el-button
>
</el-form-item>
</el-form>
<el-table
:data="dataList"
border
v-loading="dataListLoading"
style="width: 100%"
>
<el-table-column label="标题" align="center">
<template slot-scope="scope">{{ scope.row.title }}</template>
</el-table-column>
<el-table-column label="年份" align="center">
<template slot-scope="scope">{{ scope.row.year }}</template>
</el-table-column>
<el-table-column label="原价" align="center">
<template slot-scope="scope">{{ scope.row.fee }}</template>
</el-table-column>
<el-table-column label="vip价格" align="center">
<template slot-scope="scope">{{ scope.row.vipFee }}</template>
</el-table-column>
<el-table-column label="svip价格" align="center">
<template slot-scope="scope">{{ scope.row.svipFee }}</template>
</el-table-column>
<el-table-column label="湖粉价格" align="center">
<template slot-scope="scope">{{ scope.row.huFee }}</template>
</el-table-column>
<el-table-column label="活动类型" align="center" prop="type">
<template slot-scope="scope">
<span v-if="scope.row.type==1">线上</span>
<span v-else-if="scope.row.type==2">线下</span>
<span v-else>--</span>
</template>
</el-table-column>
<el-table-column label="报名状态" align="center" width="220">
<template slot-scope="scope">
<el-switch
@change="changeSingupFlag(scope.row)"
v-model="scope.row.singupFlag"
active-color="#13ce66"
inactive-color="#999"
:active-value="1"
:inactive-value="0"
active-text="可报名"
inactive-text="不可报名">
</el-switch>
</template>
</el-table-column>
<el-table-column label="创建时间" align="center" prop="createTime">
</el-table-column>
<el-table-column
fixed="right"
header-align="center"
align="center"
width="120"
label="操作"
>
<template slot-scope="scope">
<el-button
type="text"
size="small"
@click="editHandle(scope.row)"
>修改</el-button
>
<router-link :to="{ path: '/training-course-user', query: { id: scope.row.id } }">
<el-button
type="text"
size="small"
@click="userHandle(scope.row)"
>用户列表</el-button
>
</router-link>
</template>
</el-table-column>
</el-table>
<el-pagination
@size-change="sizeChangeHandle"
@current-change="currentChangeHandle"
:current-page="pageIndex"
:page-sizes="[10, 20, 50, 100]"
:page-size="pageSize"
:total="totalPage"
layout="total, sizes, prev, pager, next, jumper"
>
</el-pagination>
<!-- 弹窗, 新增 / 修改 -->
<el-dialog
:visible.sync="addOrUpdateVisible"
:title="titlesub"
class="dialog_box"
@close="cancleClose"
>
<el-form
:model="addForm"
ref="addFormRef"
:rules="addFormRule"
label-width="90px"
>
<el-form-item label="标题" prop="title">
<el-input v-model="addForm.title" placeholder="请输入标题"></el-input>
</el-form-item>
<el-form-item label="年份" prop="year">
<el-input v-model="addForm.year" placeholder="请输入年份(YYYY)"></el-input>
</el-form-item>
<el-form-item label="原价" prop="fee">
<el-input v-model="addForm.fee" placeholder="请输入原价"></el-input>
</el-form-item>
<el-form-item label="vip价格" prop="vipFee">
<el-input v-model="addForm.vipFee" placeholder="请输入vip价格"></el-input>
</el-form-item>
<el-form-item label="svip价格" prop="svipFee">
<el-input v-model="addForm.svipFee" placeholder="请输入svip价格"></el-input>
</el-form-item>
<el-form-item label="湖粉价格" prop="huFee">
<el-input v-model="addForm.huFee" placeholder="请输入湖粉价格"></el-input>
</el-form-item>
<el-form-item label="活动类型" prop="type">
<el-radio-group v-model="addForm.type">
<el-radio :label="1">线上</el-radio>
<el-radio :label="2">线下</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="报名状态" prop="singupFlag">
<el-switch
v-model="addForm.singupFlag"
active-color="#13ce66"
inactive-color="#999"
:active-value="1"
:inactive-value="0"
inactive-text="不可报名"
active-text="可报名"
>
</el-switch>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="cancleClose"> </el-button>
<el-button type="primary" @click="addOrEditCate"> </el-button>
</span>
</el-dialog>
</div>
</template>
<script>
export default {
data() {
// 通用校验规则:正数且大于 0
const validatePositiveNumber = (rule, value, callback) => {
if (!value) {
return callback(new Error('不能为空'));
}
if (!/^\d+(\.\d+)?$/.test(value)) {
return callback(new Error('必须是正数或小数'));
}
if (parseFloat(value) <= 0) {
return callback(new Error('必须大于 0'));
}
callback();
};
return {
dataForm: {
title: '',
type: '', //1线上 2线下
year: '',
singupFlag: '', //1可报名 0不可报名
},
addForm: {
id: "", //新增不传
title: "", //标题
type: 1, //1线上 2线下
icon: '',
year: '',
fee: '',
vipFee: '',
svipFee: '',
huFee: '',
singupFlag: 1, //1可报名 0不可报名
sort: 0
},
editId: "",
addFormRule: {
title: [
{
required: true,
message: "请输入标题",
},
],
year: [
{
required: true,
message: "请输入年份",
},
],
fee: [
{
required: true,
validator: validatePositiveNumber
},
],
},
dataList: [],
pageIndex: 1,
pageSize: 10,
totalPage: 0,
dataListLoading: false,
addOrUpdateVisible: false,
titlesub: '新增',
statusType: 0, //区分新增还是修改
};
},
created() {
this.getDataList();
},
methods: {
// 获取数据列表
getDataList() {
this.dataListLoading = true;
this.$http({
url: this.$http.adornUrl("/master/trainingClass/trainingClassList"),
method: "post",
data: this.$http.adornData({
current: this.pageIndex,
limit: this.pageSize,
title: this.dataForm.title,
type: this.dataForm.type,
year: this.dataForm.year,
singupFlag: this.dataForm.singupFlag
}),
}).then(({ data }) => {
if (data && data.code === 0) {
this.dataList = data.trainingClassList.records;
this.totalPage = data.trainingClassList.total;
}
this.dataListLoading = false;
});
},
//设置开关 修改数据
changeSingupFlag(data){
this.editCate(data);
},
//新增
addOrUpdateHandle(){
this.addOrUpdateVisible = true;
this.statusType = 0; //新增
this.titlesub = '新增';
this.$refs["addFormRef"].resetFields();
this.addForm = {
title: "", //标题
type: 1, //1线上 2线下
icon: '',
year: '',
fee: '',
vipFee: '',
svipFee: '',
huFee: '',
singupFlag: 1, //1可报名 0不可报名
sort: 0
}
},
//关闭
cancleClose(){
this.addOrUpdateVisible = false;
},
addOrEditCate(){
//如果是新增
if(this.statusType==0){
this.addCate();
}else if(this.statusType==1){ //如果是修改
this.editCate(this.addForm);
}
},
//取消
cancleClose(){
this.addOrUpdateVisible = false;
},
//确定
editCate(data){
this.$refs["addFormRef"].validate(valid => {
if (valid) {
this.$http({
url: this.$http.adornUrl("/master/trainingClass/editTrainingClass"),
method: "post",
data: this.$http.adornData({
id: data.id,
title: data.title,
type: data.type,
year: data.year,
singupFlag: data.singupFlag,
icon: data.icon,
fee: data.fee,
vipFee: data.vipFee,
svipFee: data.svipFee,
huFee: data.huFee,
sort: data.sort
}),
}).then(({ data }) => {
if (data && data.code === 0) {
this.$message({
message: "操作成功",
type: "success"
});
this.addOrUpdateVisible = false;
this.getDataList();
}
});
}
})
},
// 每页数
sizeChangeHandle(val) {
this.pageSize = val;
this.pageIndex = 1;
this.getDataList();
},
// 当前页
currentChangeHandle(val) {
this.pageIndex = val;
this.getDataList();
},
//新增
addCate(){
this.$refs["addFormRef"].validate(valid => {
if (valid) {
this.$http({
url: this.$http.adornUrl("/master/trainingClass/addTrainingClass"),
method: "post",
data: this.$http.adornData({
id: this.addForm.id,
title: this.addForm.title,
type: String(this.addForm.type),
year: this.addForm.year,
singupFlag: String(this.addForm.singupFlag),
icon: this.addForm.icon,
fee: this.addForm.fee,
vipFee: this.addForm.vipFee,
svipFee: this.addForm.svipFee,
huFee: this.addForm.huFee,
sort: this.addForm.sort
}),
}).then(({ data }) => {
if (data && data.code === 0) {
this.$message({
message: "操作成功",
type: "success"
});
this.addOrUpdateVisible = false;
this.getDataList();
}
});
}
})
},
//操作
//点击修改
editHandle(data){
this.addOrUpdateVisible = true;
this.titlesub = '修改';
this.statusType = 1; //修改
this.addForm.id = data.id;
this.addForm.title = data.title;
this.addForm.type = Number(data.type);
this.addForm.year = data.year;
this.addForm.singupFlag = Number(data.singupFlag);
this.addForm.icon = data.icon;
this.addForm.fee = data.fee;
this.addForm.vipFee = data.vipFee;
this.addForm.svipFee = data.svipFee;
this.addForm.huFee = data.huFee;
this.addForm.sort = data.sort;
},
//点击用户列表
userHandle(data){
console.log('用户列表')
},
},
};
</script>
<style lang="less" >
::v-deep.custom-height {
height: 370px;
}
.avatar-uploader {
height: 1px;
}
.general_editor {
height: 420px;
width: 1060px !important;
}
.editor_form {
height: 500px;
}
.dialog_box {
.el-form-item__content {
width: calc(100% - 90px) !important;
}
.form_item {
width: 100%;
display: flex;
align-items: center;
justify-content: space-between;
.el-form-item {
width: 290px;
}
}
}
</style>

View File

@@ -0,0 +1,283 @@
<template>
<div class="mod-config">
<el-form
:inline="true"
:model="dataForm"
@keyup.enter.native="getDataList()"
>
<el-form-item label="名称">
<el-input
v-model="dataForm.title"
placeholder="请输入名称"
clearable
>
</el-input>
</el-form-item>
<el-form-item label="手机号">
<el-input
v-model="dataForm.title"
placeholder="请输入手机号"
clearable
>
</el-input>
</el-form-item>
<el-form-item>
<el-button
@click="
pageIndex = 1;
getDataList();
"
>查询</el-button
>
<el-button
type="primary"
@click="addOrUpdateHandle()"
>新增</el-button
>
</el-form-item>
</el-form>
<el-table
:data="dataList"
border
v-loading="dataListLoading"
style="width: 100%"
>
<el-table-column label="用户ID" align="center" prop="id"></el-table-column>
<el-table-column label="姓名" align="center" prop="nickname">
<template slot-scope="scope">
<span>{{ scope.row.nickname ? scope.row.nickname : "暂无用户名" }}</span>
</template>
</el-table-column>
<el-table-column label="头像" align="center" prop="avatar">
<template slot-scope="scope">
<img
v-if="scope.row.avatar && scope.row.avatar != ''"
:src="scope.row.avatar"
width="50"
height="50"
/>
<img
v-else
src="../../../../static/img/morenAvavter.png"
width="50"
height="50"
/>
</template>
</el-table-column>
<el-table-column label="电话" align="center" prop="tel"></el-table-column>
<el-table-column label="邮箱" align="center" prop="email"></el-table-column>
<el-table-column label="创建时间" align="center" prop="createTime">
</el-table-column>
<el-table-column
fixed="right"
header-align="center"
align="center"
label="操作"
>
<template slot-scope="scope">
<el-button
type="text"
size="small"
>修改</el-button>
</template>
</el-table-column>
</el-table>
<el-pagination
@size-change="sizeChangeHandle"
@current-change="currentChangeHandle"
:current-page="pageIndex"
:page-sizes="[10, 20, 50, 100]"
:page-size="pageSize"
:total="totalPage"
layout="total, sizes, prev, pager, next, jumper"
>
</el-pagination>
<!-- 弹窗, 新增 / 修改 -->
<el-dialog
:visible.sync="addOrUpdateVisible"
:title="titlesub"
class="dialog_box"
@close="cancleClose"
>
<el-form
:model="addForm"
ref="addFormRef"
:rules="addFormRule"
label-width="90px"
>
<el-form-item label="姓名" prop="nickname">
<el-input v-model="addForm.nickname" placeholder="请输入姓名"></el-input>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="cancleClose"> </el-button>
<el-button type="primary" @click="addOrEditCate"> </el-button>
</span>
</el-dialog>
</div>
</template>
<script>
export default {
data() {
return {
trainingId: null,
dataForm: {
title: '',
},
addForm: {
id: "", //新增不传
title: "", //标题
},
editId: "",
addFormRule: {
title: [
{
required: true,
message: "请输入标题",
},
]
},
dataList: [],
pageIndex: 1,
pageSize: 10,
totalPage: 0,
dataListLoading: false,
addOrUpdateVisible: false,
titlesub: '新增',
statusType: 0, //区分新增还是修改
};
},
created() {
this.trainingId=this.$route.query.id;
this.getDataList();
},
methods: {
// 获取数据列表
getDataList() {
this.dataListLoading = true;
this.$http({
url: this.$http.adornUrl("/master/trainingClass/trainingClassUserList"),
method: "post",
data: this.$http.adornData({
current: this.pageIndex,
limit: this.pageSize,
trainingId: this.trainingId
}),
}).then(({ data }) => {
if (data && data.code === 0) {
this.dataList = data.trainingClassUserList.records;
this.totalPage = data.trainingClassUserList.total;
}
this.dataListLoading = false;
});
},
//新增
addOrUpdateHandle(){
this.addOrUpdateVisible = true;
this.statusType = 0; //新增
this.titlesub = '新增';
this.$refs["addFormRef"].resetFields();
this.addForm = {
title: "", //标题
}
},
//关闭
cancleClose(){
this.addOrUpdateVisible = false;
},
addOrEditCate(){
this.addCate();
},
//取消
cancleClose(){
this.addOrUpdateVisible = false;
},
// 每页数
sizeChangeHandle(val) {
this.pageSize = val;
this.pageIndex = 1;
this.getDataList();
},
// 当前页
currentChangeHandle(val) {
this.pageIndex = val;
this.getDataList();
},
//新增
addCate(){
this.$refs["addFormRef"].validate(valid => {
if (valid) {
this.$http({
url: this.$http.adornUrl("/master/trainingClass/addTrainingClass"),
method: "post",
data: this.$http.adornData({
id: this.addForm.id,
title: this.addForm.title,
type: String(this.addForm.type),
year: this.addForm.year,
singupFlag: String(this.addForm.singupFlag),
icon: this.addForm.icon,
fee: this.addForm.fee,
vipFee: this.addForm.vipFee,
svipFee: this.addForm.svipFee,
huFee: this.addForm.huFee,
sort: this.addForm.sort
}),
}).then(({ data }) => {
if (data && data.code === 0) {
this.$message({
message: "操作成功",
type: "success"
});
this.addOrUpdateVisible = false;
this.getDataList();
}
});
}
})
}
},
};
</script>
<style lang="less" >
::v-deep.custom-height {
height: 370px;
}
.avatar-uploader {
height: 1px;
}
.general_editor {
height: 420px;
width: 1060px !important;
}
.editor_form {
height: 500px;
}
.dialog_box {
.el-form-item__content {
width: calc(100% - 90px) !important;
}
.form_item {
width: 100%;
display: flex;
align-items: center;
justify-content: space-between;
.el-form-item {
width: 290px;
}
}
}
</style>

View File

@@ -233,10 +233,23 @@
},
//表单提交
dataFormSubmit() {
const days = Number(this.dataForm.days);
if(this.dataForm.file==''){
this.$message.error('请先上传文件');
return
}
if(isNaN(days)){
this.$message.error('开课时长必须是数字');
return
}
if(!Number.isInteger(days)){
this.$message.error('开课时长必须为整数');
return
}
if(days <= 0){
this.$message.error('开课时长必须大于0');
return
}
this.$refs["dataForm"].validate(valid => {
if (valid) {
@@ -246,7 +259,7 @@
method: "post",
data: this.$http.adornData({
catalogue_id: this.dataForm.catalogues.join(','),
days: Number(this.dataForm.days),
days: days,
list: this.resultData.has
})
}).then(({ data }) => {

View File

@@ -5,8 +5,8 @@
window.SITE_CONFIG = {};
// api接口请求地址
window.SITE_CONFIG['baseUrl'] = 'https://api.nuttyreading.com';
//window.SITE_CONFIG['baseUrl'] = 'http://192.168.110.100:9200/pb';
//window.SITE_CONFIG['baseUrl'] = 'https://api.nuttyreading.com';
window.SITE_CONFIG['baseUrl'] = 'http://192.168.110.100:9200/pb';
//window.SITE_CONFIG['baseUrl'] = 'http://192.168.110.110:9200/pb';
// cdn地址 = 域名 + 版本号

View File

@@ -5,8 +5,8 @@
window.SITE_CONFIG = {};
// api接口请求地址
window.SITE_CONFIG['baseUrl'] = 'https://api.nuttyreading.com'; // 线上正式环境
//window.SITE_CONFIG['baseUrl'] = 'http://192.168.110.100:9200/pb'; //川
//window.SITE_CONFIG['baseUrl'] = 'https://api.nuttyreading.com'; // 线上正式环境
window.SITE_CONFIG['baseUrl'] = 'http://192.168.110.100:9200/pb'; //川
//window.SITE_CONFIG['baseUrl'] = 'http://192.168.110.110:9200/pb'; //本地
// cdn地址 = 域名 + 版本号