7 Commits

Author SHA1 Message Date
@fawn-nine
af3572fbec 用户课程管理 2024-06-24 15:50:42 +08:00
@fawn-nine
0ce171f1c0 上传功能优化 2024-06-19 12:05:34 +08:00
@fawn-nine
a9d9780521 课程添加关联书籍 2024-06-17 13:52:54 +08:00
@fawn-nine
ead4a02b3a 视频管理添加排序 2024-06-13 13:19:23 +08:00
@fawn-nine
1cbd4deb98 Merge branch 'martekSort' 2024-06-12 16:44:41 +08:00
@fawn-nine
59f791e491 修改视频排序 2024-06-11 13:23:26 +08:00
@fawn-nine
bc64bdc971 1 2024-06-11 13:18:09 +08:00
11 changed files with 997 additions and 22 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

@@ -98,16 +98,24 @@
:key="index"
>
<div style="width:120px">视频/音频ID</div>
<div style="width:300px; margin-right:10px; margin-left:10px">
<div style="width:120px">视频/音频ID</div>
<div style="width:250px; margin-right:10px; margin-left:10px">
<el-input
style=""
v-model="item.video"
placeholder="请输入视频/音频ID"
></el-input>
</div>
<div class="flexbox" style="align-items:center;" >
<span style="display:inline-block; width:60px">排序</span>
<el-input
style=""
v-model="item.sort"
placeholder="排序"
></el-input>
</div>
<div style="margin-right:10px; height:38px">
<el-form-item label="加密类型" prop="type">
<el-form-item label="加密类型" prop="type" label-width="100px">
<el-select
v-model="item.type"
filterable
@@ -240,9 +248,9 @@ export default {
// ]
},
video_audio_url: [
{ video: "" ,type:0,id:0}
{ video: "" ,type:1,id:0,sort:0}
],
obj:{ video: "" ,type:0,id:0},
obj:{ video: "" ,type:1,id:0,sort:0},
splitsTypeList: [],
dataRule: {},
chapterId:null,

View File

@@ -45,6 +45,43 @@
<img width="100%" :src="dataForm.image" alt="" />
</el-dialog>
</el-form-item>
<div v-if="relationProducts && relationProducts.length > 0" style="margin-bottom:20px">
<el-table
:data="relationProducts"
border
style="width: 100%;"
>
<el-table-column
prop="productName"
header-align="center"
align="center"
label="商品名"
>
</el-table-column>
<el-table-column
label="课程图"
header-align="center"
align="center"
width="100"
>
<template slot-scope="scope">
<div
v-if="scope.row.productImages"
style="width:100%;display: flex;
align-items: center;justify-content: center;"
>
<img :src="scope.row.productImages" alt="" width="40px" height="40px" />
</div>
</template>
</el-table-column>
<el-table-column width="100px">
<template slot-scope="scope">
<el-button plain type="danger" size="mini" @click="delPro(scope.$index)">删除</el-button>
</template>
</el-table-column>
</el-table>
</div>
<div style="text-align:center; margin-bottom:15px" ><el-button @click="showProTable" size="mini" type="primary">添加关联书籍</el-button></div>
<el-form-item label="课程介绍" prop="sort" style="margin-bottom: 140px;">
<div style="height: calc(620px - 120px)">
<el-upload
@@ -112,7 +149,7 @@ const toolbarOptions = [
export default {
components: {
quillEditor
},
},
data() {
return {
editorOption: {
@@ -140,6 +177,7 @@ export default {
},
placeholder: "请输入正文"
},
relationProducts :[],
baseUrl: global.baseUrl,
visible: false,
bookList: [
@@ -228,6 +266,7 @@ export default {
// relationId:0,
},
splitsTypeList: [],
courseId:undefined,
dataRule: {
// name: [
// { required: true, message: '书名不能为空', trigger: 'blur' }
@@ -286,8 +325,23 @@ export default {
created() {},
mounted() {
// this.restaurants = this.loadAll();
this.$bus.$on("linkList", (data) => {
console.log('获得列表',data)
if(data && data.length > 0){
this.relationProducts = this.relationProducts.concat(data)
}
})
},
methods: {
delPro(i){
console.log('i',i)
// this.$emit('delPro',i)
this.relationProducts.splice(i,1)
console.log('处理后的',this.relationProducts)
},
showProTable(){
this.$emit('showProTable',true)
},
contentUploadSuccess(res, file) {
// console.log(res)
let quill = this.$refs.myQuillEditor.quill;
@@ -319,6 +373,7 @@ export default {
init(row) {
console.log("11111", row);
if (row && row.id) {
this.courseId = row.id
this.$http
.request({
url: this.$http.adornUrl(this.urlList.info),
@@ -337,7 +392,11 @@ export default {
if (res && res.data.code === 0) {
var data = res.data.course;
console.log("data at line 357:", data);
if(res.data.shopProductList && res.data.shopProductList.length > 0){
this.relationProducts = res.data.shopProductList
}else{
this.relationProducts = []
}
if (data.image != "" && data.image != null) {
var img = {
name: "",
@@ -365,6 +424,15 @@ export default {
// this.$message.error("请选择图书类型");
// return
// }
let _relationProductIds = ''
if(this.relationProducts.length > 0){
let _list = [...this.relationProducts]
_list = _list.map(item => item.productId)
_relationProductIds = _list.join()
// console.log(_relationProductIds, _list,'_relationProductIds')
}
// console.log(_relationProductIds, _list,'_relationProductIds')
this.$refs["dataForm"].validate(valid => {
if (valid) {
this.$http({
@@ -381,7 +449,8 @@ export default {
title: this.dataForm.title,
sort: this.dataForm.sort,
image: this.dataForm.image,
content: this.dataForm.content
content: this.dataForm.content,
relationProductIds : _relationProductIds
})
}).then(({ data }) => {
if (data && data.code === 0) {
@@ -391,6 +460,8 @@ export default {
duration: 1500,
onClose: () => {
this.visible = false;
this.relationProductIds = []
this.relationProducts = []
this.$emit("refreshDataList");
}
});
@@ -429,6 +500,9 @@ export default {
},
handlereset() {
(this.fileList = []), (this.fileListNovel = []), (this.visible = false);
this.$emit('pclose')
this.relationProducts = []
this.courseId = undefined
},
handlePreview(file) {
console.log(file);

View File

@@ -31,6 +31,12 @@
align="center"
label="目录名称"
>
<template slot-scope="scope">
<div>
<span style="font-weight:bold; font-size:16px">{{ scope.row.title }}</span><br>
<span style="color:#999">( 创建时间{{ scope.row.createTime}} )</span>
</div>
</template>
</el-table-column>
<el-table-column
prop="sort"

View File

@@ -32,6 +32,12 @@
align="center"
label="章节名称"
>
<template slot-scope="scope">
<div>
<span style="font-weight:bold; font-size:16px">{{ scope.row.title }}</span><br>
<!-- <span style="color:#999">( 创建时间{{ scope.row.createTime}} )</span> -->
</div>
</template>
</el-table-column>
<el-table-column

View File

@@ -69,7 +69,8 @@
>
<template slot-scope="scope">
<div>
<span>{{ scope.row.title }}</span>
<span style="font-weight:bold; font-size:16px">{{ scope.row.title }}</span><br>
<span style="color:#999">( 创建时间{{ scope.row.createTime}} )</span>
</div>
</template>
</el-table-column>
@@ -338,8 +339,17 @@
<add-or-update
v-if="addOrUpdateVisible"
ref="addOrUpdate"
:relationProducts = relationProducts
@pclose = "pclose"
@showProTable = "showProTable"
@refreshDataList="getDataList"
></add-or-update>
<commonShopTable
ref="commonShopTable"
:currentId="courseId"
currentType="courseLinkPro"
@linkList="linkList"
></commonShopTable>
<el-dialog
title="课程引用一览"
:visible.sync="resListVisible"
@@ -382,6 +392,7 @@
</template>
<script>
import commonShopTable from "./shopproductTable.vue";
import AddOrUpdate from "./course-add-or-update";
export default {
data() {
@@ -404,9 +415,11 @@ export default {
children: []
}
],
courseId:"0",
dataForm: {
key: ""
key: "",
},
relationProducts:[],
query: {
type: "",
categoryId: "",
@@ -430,7 +443,8 @@ export default {
};
},
components: {
AddOrUpdate
AddOrUpdate,
commonShopTable
},
activated() {
if (this.$route.query.upPageInde != null) {
@@ -442,6 +456,32 @@ export default {
this.getTreeList(this.urlList.sociologyList, 2);
},
methods: {
delPro(val){
console.log(val,this.relationProducts)
let list = this.relationProducts
this.relationProducts = list.slice(1,1)
},
pclose(){
this.relationProducts = []
this.courseId = null
console.log('关闭了 ')
},
linkList(data){
console.log('父级',data)
if(data && data.length > 0){
this.relationProducts = data
}
},
showProTable(data){
console.log('data',data)
this.$nextTick(() => {
this.$refs.commonShopTable.open();
});
},
closeLink() {
this.resListVisible = false;
this.resList = [];
@@ -492,6 +532,7 @@ export default {
},
// 获取数据列表
getDataList() {
this.relationProducts = []
var data = {
page: this.pageIndex,
limit: this.pageSize,
@@ -553,7 +594,9 @@ export default {
},
// 新增 / 修改
addOrUpdateHandle(row) {
this.addOrUpdateVisible = true;
this.addOrUpdateVisible = true;
row ? this.courseId = row.id : ''
// this.courseId = row.id
this.$nextTick(() => {
this.$refs.addOrUpdate.init(row);
});

View File

@@ -116,6 +116,7 @@
:action="baseUrl + '/oss/fileoss'"
:on-remove="audioHandleRemove"
:on-success="audioUploadSuccess"
:before-upload="onprogress"
accept=".mp3"
:limit="1"
:file-list="audioFileList"
@@ -611,6 +612,9 @@ export default {
this.getDataList();
},
methods: {
onprogress(){
this.$message('上传中,请勿关闭或进行其他操作');
},
audioHandleRemove(file, fileList) {
console.log(file, fileList);
this.audioFileList = []
@@ -619,6 +623,7 @@ export default {
audioUploadSuccess(res, file) {
this.audioFileList = []
this.audioFileList.push(file)
this.$message.success('上传成功');
console.log(this.audioFileList,res, "上传成功");
this.addForm.media = res.url

View File

@@ -0,0 +1,361 @@
<template>
<div>
<el-drawer title="新增关联商品" v-if="drawer" :wrapperClosable="false" :visible.sync="drawer" :before-close="handleClose" destroy-on-close
direction="rtl" size="70%">
<div class="shop_drawer_box demo-drawer__content">
<div class="addFormBox">
<el-form ref="addForm" label-width="80px" :model="dataForm">
<el-form-item label="商品名称" prop="keywords" class="form_item">
<el-input size="small" placeholder="请输入商品名称" style="width: 100%" v-model="dataForm.keywords" clearable>
</el-input>
</el-form-item>
<el-form-item label="商品类型" prop="type" class="form_item">
<el-select size="small" v-model="dataForm.type" placeholder="请选择" style="width: 100%" clearable>
<el-option v-for="item in goodsTypeList" :key="item.dictType" :label="item.dictValue"
:value="item.dictType">
</el-option>
</el-select>
</el-form-item>
<el-form-item label="" class="form_item" label-width="20px" style="width: 160px !important">
<el-button type="primary" plain @click="
pageIndex = 1;
getDataList(bookMarketId);
" size="small">查询</el-button>
<el-button @click="handleReset()" size="small" plain>重置</el-button>
</el-form-item>
</el-form>
</div>
<el-table ref="table" height="80%" :data="dataList" :row-key="getRowKeys" border size="mini"
v-loading="dataListLoading" @selection-change="handleSelectionChange" style="width: 100%">
<!-- <el-table-column :reserve-selection="true" type="selection" header-align="center" align="center" width="50">
</el-table-column> -->
<!-- -->
<el-table-column label="商品ID" width="70" align="center" prop="productId">
<!-- <template slot-scope="scope">
{{ (pageIndex - 1) * pageSize + scope.$index + 1 }}
</template> -->
</el-table-column>
<el-table-column prop="productName" header-align="center" align="center" label="商品名称">
</el-table-column>
<el-table-column prop="price" width="120" header-align="center" align="center" sortable label="价格">
</el-table-column>
<el-table-column prop="activityPrice" width="120" header-align="center" align="center" sortable label="活动价">
</el-table-column>
<el-table-column prop="productStock" width="120" header-align="center" align="center" sortable label="库存">
</el-table-column>
<el-table-column header-align="center" align="center" label="商品图" width="120">
<template slot-scope="scope">
<img v-if="scope.row.productImages != ''" :src="scope.row.productImages" width="25" height="35"
class="tableImg" />
</template>
</el-table-column>
<el-table-column prop="productStock" width="120" header-align="center" align="center" sortable label="操作">
<template slot-scope="scope">
<el-button type="primary" plain size="mini" @click="addLink(scope.row, scope.$index)">添加</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>
<!-- <div class="demo-drawer__footer">
<div style="float: right; margin-top: 20px">
<el-button @click="close" size="small"> </el-button>
<el-button type="primary" @click="submit" :loading="loading" size="small">{{ loading ? "提交中 ..." : "确 定"
}}</el-button>
</div>
</div> -->
<!-- 弹窗, 新增 / 修改 -->
<!-- <add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getDataList" @showchooseBookf = "showchooseBookf"></add-or-update>
<choose-book v-if="chooseBookVisible" :bookIds = bookIds ref="chooseBook" :chooseBookVisible = chooseBookVisible @closeBookf = "closeBookf"></choose-book> -->
</div>
</el-drawer>
</div>
</template>
<script>
// import chooseBook from './chooseBook.vue'
// import AddOrUpdate from './shopproduct-add-or-update'
export default {
props: ["currentType", "currentId"],
data() {
return {
timer: null,
drawer: false,
loading: false,
multipleSelectionAll: [], // 所有选中的数据包含跨页数据
multipleSelection: [], // 当前页选中的数据
idKey: "productId", // 标识列表数据中每一行的唯一键的名称(需要按自己的数据改一下)
dataForm: {
type:'00'
},
bookMarketId: null,
dataList: [],
publishStatus: false,
pageIndex: 1,
pageSize: 10,
totalPage: 0,
dataListLoading: false,
dataListSelections: [],
addOrUpdateVisible: false,
chooseBookVisible: false,
bookIds: [],
goodsTypeList: [],
linkList:[]
};
},
components: {
// AddOrUpdate,
// chooseBook
},
activated() {
this.getDataList();
},
methods: {
addLink(row,i){
// 添加商品绑定
this.linkList.push(row)
console.log('linkList',this.linkList)
this.dataList.splice(i,1)
// this.getDataList()
},
handleReset() {
this.dataForm = {
type:'00'
};
this.pageIndex = 1;
this.getDataList();
},
submit() {
// var ids = this.multipleSelection.map((e) => e.productId).toString(",");
// this.$emit("submit", ids);
// console.log(
// "🚀 ~ submit ~ this.multipleSelection:",
// this.multipleSelection
// );
// this.drawer = false;
},
// 获取商品类型
getGoodsTypeList() {
this.$http({
url: this.$http.adornUrl("/book/sysdictdata/selectByType/goodsType"),
method: "get",
}).then(({ data }) => {
// console.log(data.dataList)
this.goodsTypeList = data.dataList;
});
},
handleClose(done) {
this.$bus.$emit("linkList", this.linkList );
this.linkList = []
// this.$emit("linkList", this.linkList)
done();
},
async open() {
this.drawer = true;
this.dataForm = {
type:'00'
};
this.pageIndex = 1;
await this.getGoodsTypeList();
await this.getDataList();
},
close() {
this.drawer = false;
},
getRowKeys(row) {
return row.productId;
},
handleSelectionChange(val) {
console.log("🚀 ~ handleSelectionChange ~ val:", val);
// table组件选中事件,记得加上@selection-change="handleSelectionChange"
this.multipleSelection = val;
// this.changePageCoreRecordData();
},
closeBookf() {
this.chooseBookVisible = false;
},
showchooseBookf(e) {
// 显示图书列表
this.chooseBookVisible = true;
// console.log(this.bookIds,'this.bookIds')
// this.$nextTick(() => {
// this.$refs.chooseBook.getBookList()
// this.bookIds = e.bookIds
// })
},
// 获取数据列表
async getDataList() {
var form = {
...this.dataForm,
keywords:this.dataForm.keywords ? this.dataForm.keywords : '',
page: this.pageIndex,
limit: this.pageSize,
id: this.currentId
// productId: "",
};
this.dataListLoading = true;
this.clear();
// let _url = "/master/shopProduct/listByPage"
// await this.$http({
// url: this.$http.adornUrl(_url),
// method: "post",
// data: {
// "current": form.page,
// "limit": form.limit,
// "productName": form.keywords,
// "goodsType": form.type
// },
// header: {
// //默认 无 说明:请求头
// "Content-Type": "application/json"
// }
// })
await this.$http({
url: this.$http.adornUrl(`/master/course/getProductListForCourse`),
method: "post",
data: this.$http.adornData({
"page": form.page,
"limit": form.limit,
"productName": form.keywords,
"goodsType": form.type,
"courseId": form.id
}),
})
.then(({ data }) => {
if (data && data.code === 0) {
this.dataList = data.shopProductListhopProducts.records;
this.totalPage = data.shopProductListhopProducts.total;
} else {
this.dataList = [];
this.totalPage = 0;
}
this.dataListLoading = false;
});
},
clear() {
// this.$refs.table.clearSelection();
this.multipleSelection = [];
},
// 每页数
sizeChangeHandle(val) {
// this.changePageCoreRecordData();
this.pageSize = val;
this.pageIndex = 1;
this.getDataList();
},
// 当前页
currentChangeHandle(val) {
// 改变页的时候调用一次
// this.changePageCoreRecordData();
this.pageIndex = val;
this.getDataList();
},
// 多选
selectionChangeHandle(val) {
this.dataListSelections = val;
},
// 新增 / 修改
addOrUpdateHandle(id) {
this.addOrUpdateVisible = true;
this.$nextTick(() => {
this.$refs.addOrUpdate.init(id);
});
},
// 删除
deleteHandle(id) {
var ids = id
? [id]
: this.dataListSelections.map((item) => {
return item.productId;
});
this.$confirm(
`确定对[id=${ids.join(",")}]进行[${id ? "删除" : "批量删除"}]操作?`,
"提示",
{
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
}
).then(() => {
this.$http({
url: this.$http.adornUrl("/book/shopproduct/delete"),
method: "post",
data: this.$http.adornData(ids, false),
}).then(({ data }) => {
if (data && data.code === 0) {
this.$message({
message: "操作成功",
type: "success",
duration: 1500,
onClose: () => {
this.getDataList();
},
});
} else {
this.$message.error(data.msg);
}
});
});
},
SwitchChange(event) {
/*点击时他会自动把你绑定的值变更,直接去请求数据就可以了*/
var parms = {
publishStatus: event.publishStatus,
productId: event.productId,
};
// console.log(parms)
this.$http({
url: this.$http.adornUrl("/book/shopproduct/update"),
method: "post",
data: parms,
})
.then((res) => {
this.$message({
message: "成功",
type: "success",
});
this.loading = false;
this.getDataList();
})
.catch((error) => {
this.loading = false;
console.log(error);
});
console.log(event);
},
},
};
</script>
<style lang="less" scoped>
.shop_drawer_box {
padding: 20px !important;
box-sizing: border-box;
width: 100%;
height: 100%;
}
.addFormBox {
width: 100%;
// overflow: hidden;
.form_item {
width: 33%;
float: left;
}
}
::v-deep.el-drawer__header {
margin-bottom: 10px !important;
}
</style>

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';