Merge branch 'master' of https://gitee.com/wjl2008_admin/nuttyreading-master-html
This commit is contained in:
@@ -1,7 +1,16 @@
|
||||
<template>
|
||||
<el-dialog :title="!dataForm.id ? '新增' : '修改'" :close-on-click-modal="false" :visible.sync="visible"
|
||||
@close="handlereset">
|
||||
<el-form :model="dataForm" :rules="dataRule" ref="dataForm" label-width="80px">
|
||||
<el-dialog
|
||||
:title="!dataForm.id ? '新增' : '修改'"
|
||||
:close-on-click-modal="false"
|
||||
:visible.sync="visible"
|
||||
@close="handlereset"
|
||||
>
|
||||
<el-form
|
||||
:model="dataForm"
|
||||
:rules="dataRule"
|
||||
ref="dataForm"
|
||||
label-width="80px"
|
||||
>
|
||||
<el-form-item label="课程名" prop="title">
|
||||
<el-input v-model="dataForm.title" placeholder="课程名"></el-input>
|
||||
</el-form-item>
|
||||
@@ -9,30 +18,58 @@
|
||||
<el-row>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="类型" prop="type">
|
||||
<el-select v-model="dataForm.type" filterable
|
||||
placeholder="请选择类型">
|
||||
<el-select
|
||||
v-model="dataForm.type"
|
||||
filterable
|
||||
placeholder="请选择类型"
|
||||
>
|
||||
<!-- <el-option :key="0" label="无" :value="0"></el-option> -->
|
||||
<el-option v-for="item in typeList" :key="item.dictType" :label="item.dictValue" :value="item.dictType">
|
||||
<el-option
|
||||
v-for="item in typeList"
|
||||
:key="item.dictType"
|
||||
:label="item.dictValue"
|
||||
:value="item.dictType"
|
||||
>
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12" v-if='!this.dataForm.id'>
|
||||
<el-form-item label="是否同步创建商品" prop="needCreate" label-width="140px">
|
||||
<el-select v-model="dataForm.needCreate" filterable
|
||||
placeholder="请选择是否">
|
||||
<el-col :span="12" v-if="!this.dataForm.id">
|
||||
<el-form-item
|
||||
label="是否同步创建商品"
|
||||
prop="needCreate"
|
||||
label-width="140px"
|
||||
>
|
||||
<el-select
|
||||
v-model="dataForm.needCreate"
|
||||
filterable
|
||||
placeholder="请选择是否"
|
||||
>
|
||||
<!-- <el-option :key="0" label="无" :value="0"></el-option> -->
|
||||
<el-option v-for="item in needCreateList" :key="item.dictType" :label="item.dictValue" :value="item.dictType">
|
||||
<el-option
|
||||
v-for="item in needCreateList"
|
||||
:key="item.dictType"
|
||||
:label="item.dictValue"
|
||||
:value="item.dictType"
|
||||
>
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-form-item label="半年价格" prop="halfFee">
|
||||
<el-input v-model="dataForm.halfFee" placeholder="半年价格" :disabled='this.dataForm.id'></el-input>
|
||||
<el-input
|
||||
v-model="dataForm.halfFee"
|
||||
placeholder="半年价格"
|
||||
:disabled="this.dataForm.id"
|
||||
></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="全年价格" prop="fee">
|
||||
<el-input v-model="dataForm.fee" placeholder="全年价格" :disabled='this.dataForm.id'></el-input>
|
||||
<el-input
|
||||
v-model="dataForm.fee"
|
||||
placeholder="全年价格"
|
||||
:disabled="this.dataForm.id"
|
||||
></el-input>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="排序" prop="sort">
|
||||
@@ -167,16 +204,17 @@
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
|
||||
|
||||
<script>
|
||||
import global from '../../common/common.vue' //引入共用组间
|
||||
import debounce from "lodash/debounce"; //导入lodash中的debounce
|
||||
import global from "../../common/common.vue"; //引入共用组间
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
baseUrl: global.baseUrl,
|
||||
visible: false,
|
||||
typeList: [{ //类型0免费1普通收费2超v课程
|
||||
typeList: [
|
||||
{
|
||||
//类型0免费1普通收费2超v课程
|
||||
dictType: 0,
|
||||
dictValue: "免费"
|
||||
},
|
||||
@@ -189,7 +227,9 @@
|
||||
dictValue: "超v课程"
|
||||
}
|
||||
],
|
||||
needCreateList: [{ ////是否同步创建商品0否1是
|
||||
needCreateList: [
|
||||
{
|
||||
////是否同步创建商品0否1是
|
||||
dictType: 0,
|
||||
dictValue: "否"
|
||||
},
|
||||
@@ -198,7 +238,8 @@
|
||||
dictValue: "是"
|
||||
}
|
||||
],
|
||||
medicaldesBookTypeList: [{
|
||||
medicaldesBookTypeList: [
|
||||
{
|
||||
dictType: 1,
|
||||
dictValue: "中医基础"
|
||||
},
|
||||
@@ -221,95 +262,97 @@
|
||||
{
|
||||
dictType: 6,
|
||||
dictValue: "哲学"
|
||||
},
|
||||
}
|
||||
],
|
||||
props: {
|
||||
dictType: '',
|
||||
dictValue: ''
|
||||
dictType: "",
|
||||
dictValue: ""
|
||||
},
|
||||
gushuList: [],
|
||||
authorList: [],
|
||||
restaurants: [],
|
||||
author: '',
|
||||
author: "",
|
||||
publisherList: [],
|
||||
fileList: [],
|
||||
fileListNovel: [],
|
||||
dialogImageUrl: '',
|
||||
dialogImageUrl: "",
|
||||
dialogVisible: false,
|
||||
dataForm: {
|
||||
"id": 0,
|
||||
"courseId": 0,
|
||||
"type": 0, //类型0免费1普通收费2超v课程
|
||||
"title": "",
|
||||
"halfFee": 0, //半年价格
|
||||
"fee": 0, //全年价格
|
||||
"sort": 1,
|
||||
"needCreate": 0 //是否同步创建商品0否1是
|
||||
id: 0,
|
||||
courseId: 0,
|
||||
type: 0, //类型0免费1普通收费2超v课程
|
||||
title: "",
|
||||
halfFee: 0, //半年价格
|
||||
fee: 0, //全年价格
|
||||
sort: 1,
|
||||
needCreate: 0 //是否同步创建商品0否1是
|
||||
},
|
||||
splitsTypeList: [],
|
||||
dataRule: {
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
dataRule: {}
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.getBookList()
|
||||
this.loadAll()
|
||||
this.getBookList();
|
||||
this.loadAll();
|
||||
},
|
||||
mounted() {
|
||||
// this.restaurants = this.loadAll();
|
||||
},
|
||||
methods: {
|
||||
init(row, courseid) {
|
||||
console.log('row2', row)
|
||||
this.dataForm = row || {}
|
||||
this.dataForm.courseId = courseid || ''
|
||||
this.visible = true
|
||||
|
||||
console.log("row2", row);
|
||||
this.dataForm = row || {};
|
||||
this.dataForm.courseId = courseid || "";
|
||||
this.visible = true;
|
||||
},
|
||||
// 表单提交
|
||||
dataFormSubmit() {
|
||||
console.log('11111', this.dataForm.medicaldesBookType)
|
||||
|
||||
dataFormSubmit: debounce(async function() {
|
||||
console.log("11111", this.dataForm.medicaldesBookType);
|
||||
// if (this.dataForm.medicaldesBookType.length == 0) {
|
||||
// this.$message.error("请选择图书类型");
|
||||
// return
|
||||
// }
|
||||
this.$refs['dataForm'].validate((valid) => {
|
||||
this.$refs["dataForm"].validate(valid => {
|
||||
if (valid) {
|
||||
this.$http({
|
||||
url: this.$http.adornUrl(`${!this.dataForm.id ? '/master/course/addCourseCatalogue' : '/master/course/editCourseCatalogue'}`),
|
||||
method: 'post',
|
||||
url: this.$http.adornUrl(
|
||||
`${
|
||||
!this.dataForm.id
|
||||
? "/master/course/addCourseCatalogue"
|
||||
: "/master/course/editCourseCatalogue"
|
||||
}`
|
||||
),
|
||||
method: "post",
|
||||
data: this.$http.adornData({
|
||||
'courseId': this.dataForm.courseId || undefined,
|
||||
'id': this.dataForm.id || undefined,
|
||||
'title': this.dataForm.title,
|
||||
"type": this.dataForm.type, //类型0免费1普通收费2超v课程
|
||||
"halfFee": this.dataForm.halfFee, //半年价格
|
||||
"fee": this.dataForm.fee, //全年价格
|
||||
"sort": this.dataForm.sort,
|
||||
"needCreate": this.dataForm.needCreate //是否同步创建商品0否1是
|
||||
courseId: this.dataForm.courseId || undefined,
|
||||
id: this.dataForm.id || undefined,
|
||||
title: this.dataForm.title,
|
||||
type: this.dataForm.type, //类型0免费1普通收费2超v课程
|
||||
halfFee: this.dataForm.halfFee, //半年价格
|
||||
fee: this.dataForm.fee, //全年价格
|
||||
sort: this.dataForm.sort,
|
||||
needCreate: this.dataForm.needCreate //是否同步创建商品0否1是
|
||||
})
|
||||
}).then(({
|
||||
data
|
||||
}) => {
|
||||
}).then(({ data }) => {
|
||||
if (data && data.code === 0) {
|
||||
this.$message({
|
||||
message: '操作成功',
|
||||
type: 'success',
|
||||
message: "操作成功",
|
||||
type: "success",
|
||||
duration: 1500,
|
||||
onClose: () => {
|
||||
this.visible = false
|
||||
this.$emit('refreshDataList')
|
||||
this.visible = false;
|
||||
this.$emit("refreshDataList");
|
||||
}
|
||||
})
|
||||
});
|
||||
} else {
|
||||
this.$message.error(data.msg)
|
||||
this.$message.error(data.msg);
|
||||
}
|
||||
})
|
||||
});
|
||||
}
|
||||
})
|
||||
},
|
||||
});
|
||||
}, 200),
|
||||
// 表单提交
|
||||
|
||||
handlePicSuccess(res, file) {
|
||||
if (res.msg == "success") {
|
||||
this.dataForm.images = res.url;
|
||||
@@ -321,69 +364,63 @@
|
||||
//图书分类
|
||||
getBookList() {
|
||||
this.$http({
|
||||
url: this.$http.adornUrl('/book/sysdictdata/selectByType/book_type'),
|
||||
method: 'get',
|
||||
url: this.$http.adornUrl("/book/sysdictdata/selectByType/book_type"),
|
||||
method: "get"
|
||||
// params: this.$http.adornParams({
|
||||
// 'type': 'book_type',
|
||||
// })
|
||||
}).then(({
|
||||
data
|
||||
}) => {
|
||||
console.log(data)
|
||||
}).then(({ data }) => {
|
||||
console.log(data);
|
||||
// this.bookList = data.dataList
|
||||
})
|
||||
});
|
||||
|
||||
// 获取图书拆分类型
|
||||
this.$http({
|
||||
url: this.$http.adornUrl('/book/sysdictdata/selectByType/splitsType'),
|
||||
method: 'get',
|
||||
}).then(({
|
||||
data
|
||||
}) => {
|
||||
this.splitsTypeList = data.dataList
|
||||
})
|
||||
|
||||
url: this.$http.adornUrl("/book/sysdictdata/selectByType/splitsType"),
|
||||
method: "get"
|
||||
}).then(({ data }) => {
|
||||
this.splitsTypeList = data.dataList;
|
||||
});
|
||||
|
||||
// 获取古书
|
||||
this.$http({
|
||||
url: this.$http.adornUrl('/book/book/getAncientBooks'),
|
||||
method: 'post',
|
||||
}).then(({
|
||||
data
|
||||
}) => {
|
||||
this.gushuList= data.books
|
||||
})
|
||||
|
||||
url: this.$http.adornUrl("/book/book/getAncientBooks"),
|
||||
method: "post"
|
||||
}).then(({ data }) => {
|
||||
this.gushuList = data.books;
|
||||
});
|
||||
},
|
||||
handleRemove(file) {
|
||||
this.dataForm.images = '';
|
||||
this.dataForm.images = "";
|
||||
},
|
||||
handlePictureCardPreview(file) {
|
||||
this.dataForm.images = file.url;
|
||||
this.dialogVisible = true;
|
||||
},
|
||||
handleDownload(file) {
|
||||
console.log(file)
|
||||
console.log(file);
|
||||
},
|
||||
handlereset() {
|
||||
this.fileList = [],
|
||||
this.fileListNovel = [],
|
||||
this.visible = false
|
||||
(this.fileList = []), (this.fileListNovel = []), (this.visible = false);
|
||||
},
|
||||
handlePreview(file) {
|
||||
console.log(file);
|
||||
},
|
||||
handleExceed(files, fileList) {
|
||||
this.$message.warning(`当前限制选择 3 个文件,本次选择了 ${files.length} 个文件,共选择了 ${files.length + fileList.length} 个文件`);
|
||||
this.$message.warning(
|
||||
`当前限制选择 3 个文件,本次选择了 ${
|
||||
files.length
|
||||
} 个文件,共选择了 ${files.length + fileList.length} 个文件`
|
||||
);
|
||||
},
|
||||
beforeRemove(file, fileList) {
|
||||
return this.$confirm(`确定移除 ${file.name}?`);
|
||||
},
|
||||
handleRemoveNovel(file) {
|
||||
this.dataForm.novel = '';
|
||||
this.dataForm.novel = "";
|
||||
},
|
||||
handleNovelSuccess(file) {
|
||||
this.dataForm.novel = file.url
|
||||
this.dataForm.novel = file.url;
|
||||
},
|
||||
// querySearch(queryString, cb) {
|
||||
// var restaurants = this.restaurants;
|
||||
@@ -399,28 +436,22 @@
|
||||
// },
|
||||
loadAll() {
|
||||
this.$http({
|
||||
url: this.$http.adornUrl('/book/author/bookAuthorList'),
|
||||
method: 'get',
|
||||
}).then(({
|
||||
data
|
||||
}) => {
|
||||
this.authorList = data.list
|
||||
})
|
||||
url: this.$http.adornUrl("/book/author/bookAuthorList"),
|
||||
method: "get"
|
||||
}).then(({ data }) => {
|
||||
this.authorList = data.list;
|
||||
});
|
||||
this.$http({
|
||||
url: this.$http.adornUrl('/book/publisher/publisherList'),
|
||||
method: 'get',
|
||||
}).then(({
|
||||
data
|
||||
}) => {
|
||||
this.publisherList = data.list
|
||||
})
|
||||
|
||||
},
|
||||
url: this.$http.adornUrl("/book/publisher/publisherList"),
|
||||
method: "get"
|
||||
}).then(({ data }) => {
|
||||
this.publisherList = data.list;
|
||||
});
|
||||
}
|
||||
// handleSelect(item) {
|
||||
// this.dataForm.authorId = item.id
|
||||
// console.log(item);
|
||||
// }
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user