用户课程管理

This commit is contained in:
@fawn-nine
2024-06-24 15:50:42 +08:00
parent 0ce171f1c0
commit af3572fbec
4 changed files with 482 additions and 10 deletions

View File

@@ -64,6 +64,7 @@ const mainRoutes = {
{ path: '/course-courseChapter', component: _import('modules/course/courseChapter'), name: 'course-courseChapter', meta: { title: '课程目录章节列表', isTab: true } },
{ path: '/course-courseVideo', component: _import('modules/course/courseVideo'), name: 'course-courseVideo', meta: { title: '课程目录章节视频列表', isTab: true } },
{ path: '/course-sociologyList', component: _import('modules/course/sociologyList'), name: 'course-sociologyList', meta: { title: '国学标签列表', isTab: true } },
{ path: '/userCourse', component: _import('modules/user/userCourse'), name: 'userCourse', meta: { title: '用户课程列表', isTab: true } },
],
beforeEnter (to, from, next) {
let token = Vue.cookie.get('token')

View File

@@ -13,10 +13,10 @@
:disabled="dataListSelections.length <= 0">批量删除</el-button> -->
</el-form-item>
</el-form>
<el-table :data="dataList" border v-loading="dataListLoading" @selection-change="selectionChangeHandle"
<el-table :data="dataList" border v-loading="dataListLoading"
style="width: 100%;">
<el-table-column type="selection" header-align="center" align="center" width="50">
</el-table-column>
<!-- <el-table-column type="selection" header-align="center" align="center" width="50">
</el-table-column> -->
<!-- <el-table-column label="序号" width="70" align="center">
<template slot-scope="scope">
{{ (pageIndex - 1) * pageSize + scope.$index + 1 }}
@@ -29,14 +29,21 @@
label="用户ID">
</el-table-column>
<el-table-column prop="name" header-align="center" align="center" label="姓名">
<template slot-scope="scope">
<span>{{scope.row.name ? scope.row.name : '暂无用户名'}}</span>-
<span v-if="scope.row.vip == 0">普通用户</span>
<span v-else-if="scope.row.vip == 2">吴门医述VIP</span>
<span v-else-if="scope.row.vip == 1">超级VIP</span>
<span v-else-if="scope.row.vip == 3">众妙之门VIP</span>
</template>
</el-table-column>
<!-- <el-table-column prop="age" header-align="center" align="center" label="年龄">
</el-table-column> -->
<el-table-column prop="sex" header-align="center" align="center" label="性别">
<!-- <el-table-column prop="sex" header-align="center" align="center" label="性别">
<template slot-scope="scope">
<span v-if="scope.row.sex == 0">女</span><span v-if="scope.row.sex == 1">男</span><span v-if="scope.row.sex == 2">保密</span>
</template>
</el-table-column>
</el-table-column> -->
<el-table-column prop="avatar" header-align="center" align="center" label="头像">
<template slot-scope="scope">
<img v-if="scope.row.avatar && scope.row.avatar != ''" :src="scope.row.avatar" width="50" height="50" class="tableImg" />
@@ -76,10 +83,10 @@
align="center"
label="阅读时间">
</el-table-column> -->
<el-table-column prop="lastLoginTime" header-align="center" align="center" label="最后登录时间">
<!-- <el-table-column prop="lastLoginTime" header-align="center" align="center" label="最后登录时间">
</el-table-column>
<el-table-column prop="createTime" header-align="center" align="center" label="创建时间">
</el-table-column>
</el-table-column> -->
<!-- <el-table-column prop="updateTime" header-align="center" align="center" label="更新时间">
</el-table-column> -->
<!-- <el-table-column
@@ -97,7 +104,7 @@
更多操作<i class="el-icon-arrow-down el-icon--right"></i>
</span>
<el-dropdown-menu slot="dropdown">
<el-dropdown-item><el-button type="text" size="small" @click="ck(scope.row)">/扣天医币</el-button></el-dropdown-item>
<el-dropdown-item><el-button type="text" size="small" @click="ck(scope.row)">/扣天医币</el-button></el-dropdown-item>
<el-dropdown-item>
<router-link :to="{ path: 'user-point-memery', query: {'tel':scope.row.tel, 'id':scope.row.id} }">
<el-button type="text" size="small">/扣天医币记录</el-button>
@@ -105,6 +112,13 @@
</el-dropdown-item>
<el-dropdown-item><el-button type="text" size="small" @click="youhui(scope.row)">优惠券列表</el-button></el-dropdown-item>
<el-dropdown-item><el-button type="text" size="small" @click="resetPassword(scope.row)">修改密码</el-button></el-dropdown-item>
<el-dropdown-item>
<router-link :to="{ path: '/userCourse', query: {id:scope.row.id} }">
<el-button type="text" size="small">
用户课程管理
</el-button>
</router-link>
</el-dropdown-item>
<!-- <el-dropdown-item divided>蚵仔煎</el-dropdown-item> -->
</el-dropdown-menu>
</el-dropdown>
@@ -232,6 +246,10 @@
this.getcourpeList()
},
methods: {
// 用户课程
userCourse(val){
},
// 获取数据列表
getDataList() {
this.dataListLoading = true

View File

@@ -0,0 +1,453 @@
<template>
<div class="mod-config">
<el-form
:inline="true"
:model="dataForm"
@keyup.enter.native="getDataList()"
>
<el-form-item>
<el-button @click="showAddD" type="primary">开通课程</el-button>
</el-form-item>
<el-form-item>
<el-input v-model="dataForm.key" placeholder="请输入课程名" clearable>
</el-input>
</el-form-item>
<el-form-item >
<el-button
@click="
pageIndex = 1;
getDataList();
"
>查询</el-button
>
</el-form-item>
<el-form-item style="float:right">
<div v-if="user.id" class="flexbox userInfo">
<div>用户信息{{ user.name }}{{ user.tel }}</div>
<div>
<span v-if="user.vip == 0">普通用户</span>
<span v-else-if="user.vip == 2">吴门医述VIP</span>
<span v-else-if="user.vip == 1">超级VIP</span>
<span v-else-if="user.vip == 3">众妙之门VIP</span>
</div>
</div>
</el-form-item>
</el-form>
<el-table
:data="dataList"
border
v-loading="dataListLoading"
style="width: 100%;"
>
<el-table-column
prop="title"
header-align="center"
align="center"
label="课程名"
>
</el-table-column>
<el-table-column
prop="catalogueName"
header-align="center"
align="center"
label="分部"
>
</el-table-column>
<el-table-column
prop="startTime"
header-align="center"
align="center"
label="开通时间"
>
</el-table-column>
<el-table-column
prop="endTime"
header-align="center"
align="center"
label="到期时间"
>
</el-table-column>
<!-- <el-table-column
fixed="right"
header-align="center"
align="center"
width="150"
label="操作"
>
<template slot-scope="scope"> </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="total"
layout="total, sizes, prev, pager, next, jumper"
>
</el-pagination>
<el-dialog
title="开通课程"
:close-on-click-modal="false"
:visible.sync="youVisible"
append-to-body
width="60%"
@close="dialogClose"
>
<el-form
:model="youForm"
label-width="100px"
ref="youForm"
:rules="youFormRule"
>
<el-form-item label="用户">
{{ user.tel }} <span v-if="user.name != ''">{{ user.name }}</span>
<span v-if="user.vip == 0">普通用户</span>
<span v-else-if="user.vip == 2">吴门医述VIP</span>
<span v-else-if="user.vip == 1">超级VIP</span>
<span v-else-if="user.vip == 3">众妙之门VIP</span>
</el-form-item>
<div class="flexbox">
<div>
<el-form-item label="课程名:" prop="courseId">
<el-select
v-model="youForm.courseId"
filterable
remote
reserve-keyword
placeholder="请输入课程名并选择您要添加的课程"
:remote-method="remoteMethod"
:loading="totalLaoding"
@change="selectChange"
>
<el-option
v-for="item in options"
:key="item.id"
:label="item.title"
:value="item.id"
>
</el-option>
</el-select>
<!-- <el-input v-model="youForm.key" placeholder="" clearable></el-input> -->
</el-form-item>
</div>
<div v-if="youForm.cate.length > 0" style="margin-left:20px">
<el-form-item
label="请选择开通的分部:"
label-width="150px"
prop="catalogueId"
>
<div v-for="(item, index) in youForm.cate"
:key="index">
<el-radio
v-model="youForm.catalogueId"
:label="item.id"
>{{ item.title }}</el-radio
>
</div>
</el-form-item>
</div>
</div>
<el-form-item label="开通时长:" v-if="youForm.courseId" prop="days">
<el-select v-model="youForm.days" placeholder="请选择开通时长">
<el-option
v-for="item in timeOptions"
:key="item.value"
:label="item.label"
:value="item.value"
>
</el-option>
</el-select>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="dialogClose">取消</el-button>
<el-button @click="submit" type="primary">确认开通</el-button>
</span>
</el-dialog>
</div>
</template>
<script>
// import AddOrUpdate from './user-add-or-update'
export default {
data() {
return {
dataForm: {
key: ""
},
userId: this.$route.query.id,
user: {},
pointFormRules: {
pointAmount: [
{ required: true, message: "请输入金额", trigger: "blur" }
],
pointType: {
required: true,
message: "请选择操作类型",
trigger: "blur"
}
},
youFormRule: {
catalogueId: [
{ required: true, message: "请选择开通的分部", trigger: "blur" }
],
days: [{ required: true, message: "请选择开通时长", trigger: "blur" }]
},
options: [],
timeOptions: [
// 开通时长
{
value: "30",
label: "一个月"
},
{
value: "60",
label: "两个月"
},
{
value: "90",
label: "三个月"
},
{
value: "120",
label: "四个月"
},
{
value: "150",
label: "五个月"
},
{
value: "180",
label: "六个月"
},
{
value: "365",
label: "一年"
},
{
value: "730",
label: "两年"
}
],
dataList: [],
pageIndex: 1,
pageSize: 10,
totalPage: 0,
total: 0,
totalLaoding: false,
dataListLoading: false,
dataListSelections: [],
youVisible: false,
youForm: {
courseId: null,
cate: [],
catalogueId: null,
days: ""
}
};
},
components: {
// AddOrUpdate
},
created() {
console.log(this.$route.query);
console.log(this.userId, "onsole.log(this.$route.query)");
this.init();
},
activated() {
// this.getDataList()
// this.getcourpeList()
},
methods: {
submit() {
console.log(this.youForm, "youForm");
this.$refs['youForm'].validate(valid => {
if (valid) {
let data = {
userId:this.userId,
...this.youForm
}
delete data.cate
console.log('data',data)
this.$http({
url: this.$http.adornUrl("/master/userManage/addUserCourseBuy"),
method: "post",
data: this.$http.adornData(data)
})
.then(({ data }) => {
this.$message.success('开课成功!')
this.getDataList()
this.dialogClose()
})
.catch(e => {
console.log("表单提交报错");
});
}
});
},
dialogClose() {
this.youVisible = false;
this.$nextTick(() => {
this.youForm.cate = [];
this.options = [];
this.$refs["youForm"].resetFields();
console.log(this.youForm, "youForm");
});
console.log(this.youForm, "youForm");
},
selectChange(val) {
// console.log('val',val)
console.log("options", this.options);
// const _obj = this.options.find(item => item.id == val);
// this.youForm.cate = _obj.courseCatalogueEntityList;
// console.log(this.youForm.cate, "this.youForm.cate");
this.getCate(val)
},
remoteMethod(query) {
console.log(query, "query", this.youForm.key);
// return false
if (this.youForm.key !== "") {
let data = {
// page: this.pageIndex,
// limit: this.pageSize,
title: query, //关键字
// medicalId: "",
// sociologyId: "",
// type: 0
};
this.totalLaoding = true;
this.$http({
url: this.$http.adornUrl("/master/userManage/courseAndChildrenList"),
method: "post",
data: this.$http.adornData(data)
}).then(({ data }) => {
if (data && data.code === 0) {
this.options = data.list;
} else {
this.options = [];
}
this.totalLaoding = false;
});
} else {
this.options = [];
this.totalLaoding = false;
}
},
showAddD() {
this.youVisible = true;
},
init() {
if (!this.userId) {
setTimeout(() => {
this.init();
}, 1000);
}
this.$http({
url: this.$http.adornUrl(`/book/user/info/${this.userId}`),
method: "get",
params: this.$http.adornParams()
}).then(({ data }) => {
if (data && data.code === 0) {
this.user = data.user;
this.getDataList();
// if (data.user.avatar && data.user.avatar != "") {
// var img = {
// name: '',
// url: data.user.avatar
// }
// }
}
});
},
// 获取数据列表
getDataList() {
this.dataListLoading = true;
this.$http({
// url: this.$http.adornUrl('/book/user/list'),
url: this.$http.adornUrl("/master/userManage/getUserCourseList"),
method: "post",
data: this.$http.adornData({
userId: this.userId,
page: this.pageIndex,
limit: this.pageSize,
title: this.dataForm.key
})
})
.then(({ data }) => {
if (data && data.code === 0) {
console.log(data,'data')
this.dataList = data.result.records;
this.totalPage = data.result.pages;
this.total = data.result.total;
this.dataListLoading = false;
}
});
},
// 每页数
sizeChangeHandle(val) {
this.pageSize = val;
this.pageIndex = 1;
this.getDataList();
},
// 当前页
currentChangeHandle(val) {
this.pageIndex = val;
this.getDataList();
},
// // 多选
// selectionChangeHandle(val) {
// this.dataListSelections = val
// },
// 新增 / 修改
closeDia() {
this.adc = false;
this.$refs.pointForm.resetFields();
// this.pointForm.pointType == 0
},
getCate(id) {
this.$http({
url: this.$http.adornUrl("/master/userManage/catalogueListByCourse"),
method: "post",
data: this.$http.adornData({
"courseId": id
})
}).then(({ data }) => {
if (data && data.code === 0) {
console.log('data','data++++++++++++++++++++')
this.youForm.cate = data.list
// this.youForm.cate
}else{
this.youForm.cate = []
}
}).catch(e => {
console.log('数据报错')
});
}
},
};
</script>
<style lang="less" scoped>
.flexbox {
display: flex;
}
.userInfo {
margin-bottom: 20px;
}
.userInfo * {
font-size: 16px;
}
</style>

View File

@@ -5,9 +5,9 @@
window.SITE_CONFIG = {};
// api接口请求地址
// window.SITE_CONFIG['baseUrl'] = 'http://192.168.110.100:9200/pb';//张川川
window.SITE_CONFIG['baseUrl'] = 'http://192.168.110.100:9200/pb';//张川川
// window.SITE_CONFIG['baseUrl'] = 'http://59.110.212.44:9200/pb';
window.SITE_CONFIG['baseUrl'] = 'https://testapi.nuttyreading.com'; // 线上测试环境11
// window.SITE_CONFIG['baseUrl'] = 'https://testapi.nuttyreading.com'; // 线上测试环境11
// window.SITE_CONFIG['baseUrl'] = 'https://api.nuttyreading.com'; // 线上正式环境
// window.SITE_CONFIG['baseUrl'] = 'http://192.168.110.110:9200/pb';//磊哥
// window.SITE_CONFIG['baseUrl'] = 'http://59.110.212.44:9200/pb';