This commit is contained in:
@fawn-nine
2024-07-25 11:50:48 +08:00
5 changed files with 780 additions and 21 deletions

View File

@@ -1,8 +1,8 @@
<script type="text/javascript">
// const baseUrl = "http://168.110.100:9200/pb"; //张川川后端
// const baseUrl = 'http://59.110.212.44:9100/pb'
const baseUrl = 'https://testapi.nuttyreading.com'
// const baseUrl = 'https://api.nuttyreading.com'
// const baseUrl = 'https://testapi.nuttyreading.com'
const baseUrl = 'https://api.nuttyreading.com'
// function commonFun() {
// console.log("公共方法")
// }

View File

@@ -0,0 +1,361 @@
<template>
<el-dialog
width="800px"
:title="!dataForm.id ? '新增' : '修改'"
:close-on-click-modal="false"
:visible.sync="visible"
@close="handlereset"
style="height: auto;"
>
<div style="margin-bottom: 60px;">
<el-form
style="height: auto;"
class="addFormBox"
:model="dataForm"
:rules="dataRule"
ref="dataForm"
label-width="80px"
>
<el-form-item label="APP名称" prop="title">
{{ dataForm.title }}
</el-form-item>
<el-form-item label="链接地址" prop="url">
<el-input
v-model="dataForm.url"
placeholder="链接地址"
:rows="3"
></el-input>
</el-form-item>
</el-form>
</div>
<span slot="footer" class="dialog-footer">
<el-button @click="handlereset">取消</el-button>
<el-button type="primary" @click="dataFormSubmit()">确定</el-button>
</span>
</el-dialog>
</template>
<script>
import global from "../../common/common.vue"; //引入共用组间
import { quillEditor } from "vue-quill-editor";
import "quill/dist/quill.core.css";
import "quill/dist/quill.snow.css";
import "quill/dist/quill.bubble.css";
const toolbarOptions = [
["bold", "italic", "underline", "strike"], // 加粗,斜体,下划线,删除线
["blockquote", "code-block"], //引用,代码块
[{ header: 1 }, { header: 2 }], // 几级标题
[{ list: "ordered" }, { list: "bullet" }], // 有序列表,无序列表
[{ script: "sub" }, { script: "super" }], // 下角标,上角标
[{ indent: "-1" }, { indent: "+1" }], // 缩进
[{ direction: "rtl" }], // 文字输入方向
[{ size: ["small", false, "large", "huge"] }], // 字体大小
[{ header: [1, 2, 3, 4, 5, 6, false] }], // 标题
[{ color: [] }, { background: [] }], // 颜色选择
[
{
font: [
"SimSun",
"SimHei",
"Microsoft-YaHei",
"KaiTi",
"FangSong",
"Arial"
]
}
], // 字体
[{ align: [] }], // 居中
["clean"], // 清除样式,
["link", "image"] // 上传图片、上传视频
];
export default {
data() {
return {
baseUrl: global.baseUrl,
visible: false,
// 富文本编辑器配置
editorOption: {
modules: {
history: {
delay: 1000,
maxStack: 50,
userOnly: false
},
toolbar: {
container: toolbarOptions,
handlers: {
image: function(value) {
if (value) {
// 调用element的图片上传组件
document
.querySelector(".chapter-avatar-uploader input")
.click();
} else {
this.quill.format("image", false);
}
}
}
}
},
placeholder: "请输入正文"
},
bookList: [
{
dictType: 0,
dictValue: "普通"
},
{
dictType: 1,
dictValue: "中医经典"
},
{
dictType: 2,
dictValue: "国学经典"
}
],
medicaldesBookTypeList: [
{
dictType: 1,
dictValue: "中医基础"
},
{
dictType: 2,
dictValue: "中医经典"
},
{
dictType: 3,
dictValue: "各家学说"
},
{
dictType: 4,
dictValue: "中医临床"
},
{
dictType: 5,
dictValue: "文学"
},
{
dictType: 6,
dictValue: "哲学"
}
],
props: {
dictType: "",
dictValue: ""
},
gushuList: [],
linkList: [{ label: "外链", value: 1 }, { label: "富文本", value: 0 }],
restaurants: [],
author: "",
publisherList: [],
fileList: [],
fileListNovel: [],
dialogImageUrl: "",
dialogVisible: false,
dataForm: {
type: 1,
title: "",
isBook: 0, //是否是疯子读书
isMedical: 0, //是否是吴门医述
isSociology: 0 //是否是众妙之门
},
APPList: [
{ label: "疯子读书", value: 2, valueName: "isBook" },
{ label: "吴门医述", value: 3, valueName: "isMedical" },
{ label: "众妙之门", value: 1, valueName: "isSociology" }
],
dataRule: {
// url: [{ required: true, message: "链接地址不能为空", trigger: "blur" }]
},
urlList: {
// info: "/master/message/getMessageById",
add: "/master/apkConfig/setConfig"
}
};
},
components: {
quillEditor
},
created() {},
mounted() {
// this.restaurants = this.loadAll();
},
methods: {
changeType(e) {
console.log("e at line 256:", e);
if (e == 0) {
this.dataForm.content = "";
} else {
this.dataForm.url = "";
}
},
contentUploadSuccess(res, file) {
// console.log(res)
let quill = this.$refs.myQuillEditor.quill;
// 如果上传成功
if (res) {
// 获取光标所在位置
let length = quill.getSelection().index;
// 插入图片res为服务器返回的图片链接地址
quill.insertEmbed(length, "image", res.url);
// 调整光标到最后
quill.setSelection(length + 1);
} else {
// 提示信息需引入Message
this.$message.error("图片插入失败!");
}
},
// 失去焦点事件
onEditorBlur(quill) {
// console.log('editor blur!', quill)
},
// 获得焦点事件
onEditorFocus(quill) {
//console.log('editor focus!', quill)
},
// 准备富文本编辑器
onEditorReady(quill) {
// console.log('editor ready!', quill)
},
init(row) {this.dataForm = { ...row };this.visible = true;
this.$refs.dataForm.clearValidate();
// this.dataForm.id = row.id || 0
// this.dataForm.title = row.title || ''
},
// 表单提交
dataFormSubmit() {
this.$refs["dataForm"].validate(valid => {
if (valid) {
if (
this.dataForm.isBook == 0 &&
this.dataForm.isMedical == 0 &&
this.dataForm.isSociology == 0
) {
this.$message.error("请选择发布APP");
return;
}
console.log("this.dataForm.type at line 332:", this.dataForm);
if (
this.dataForm.type == 1 &&
(this.dataForm.url == "" || !this.dataForm.url)
) {
this.$message.error("请输入链接地址");
return;
}
this.$http
.request({
url: this.$http.adornUrl(this.urlList.add),
method: "POST",
data: this.dataForm,
header: {
//默认 无 说明:请求头
"Content-Type": "application/json"
}
})
.then(({ data }) => {
if (data && data.code === 0) {
this.$message({
message: "操作成功",
type: "success",
duration: 1500,
onClose: () => {
this.visible = false;
this.$emit("refreshDataList");
}
});
} else {
this.$message.error(data.msg);
}
});
}
});
},
handlePicSuccess(res, file) {
// console.log(res,'res')
if (res.msg == "success") {
this.dataForm.image = res.url;
this.fileList.push({
name: file.name,
url: res.url
});
// console.log(this.dataForm.image,'image')
this.$message.success("上传成功");
} else {
this.$message.error("上传失败");
}
},
handleRemove(file, fileList) {
this.dataForm.image = "";
this.fileList = [];
this.dataForm.noneBtnImg = fileList.length >= this.dataForm.limitCountImg;
},
handlePictureCardPreview(file) {
this.dataForm.image = file.url;
this.dialogVisible = true;
},
handleDownload(file) {
console.log(file);
},
handlereset() {
(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} 个文件`
);
},
beforeRemove(file, fileList) {
return this.$confirm(`确定移除 ${file.name}`);
},
handleRemoveNovel(file) {
this.dataForm.novel = "";
},
handleNovelSuccess(file) {
this.dataForm.novel = file.url;
}
// querySearch(queryString, cb) {
// var restaurants = this.restaurants;
// var results = queryString ? restaurants.filter(this.createFilter(queryString)) : restaurants;
// // 调用 callback 返回建议列表的数据
// console.log(results)
// cb(results);
// },
// createFilter(queryString) {
// return (restaurant) => {
// return (restaurant.value.toLowerCase().indexOf(queryString.toLowerCase()) === 0);
// };
// },
// handleSelect(item) {
// this.dataForm.authorId = item.id
// console.log(item);
// }
}
};
</script>
<style lang="scss" scoped>
::v-deep .isUpload {
.el-uploadfeng {
.el-upload--picture-card {
display: none !important;
}
}
}
/deep/ .addFormBox.el-form-item {
margin-bottom: 10px !important;
}
/deep/ .ql-container {
min-height: 400px !important ;
}
</style>

View File

@@ -0,0 +1,304 @@
<template>
<div class="mod-config" style="height: calc(100vh - 180px );">
<div style="height: calc(100% - 80px );">
<el-table
:data="dataList"
border
height="90%"
v-loading="dataListLoading"
style="width: 100%;"
>
<el-table-column
prop="title"
header-align="center"
align="center"
label="APP"
width="200"
>
<template slot-scope="scope">
<div>
{{ scope.row.title }}
<!-- <span v-if="scope.row.type == 0">疯子读书</span>
<span v-if="scope.row.type == 1">吴门医述</span>
<span v-if="scope.row.type == 2">众妙之门</span> -->
</div>
</template>
</el-table-column>
<el-table-column
prop="title"
header-align="center"
align="center"
label="安装包下载地址(安卓)"
>
<template slot-scope="scope">
<div>
{{ scope.row.url }}
<!-- <span v-if="scope.row.type == 0">富文本</span>
<span v-if="scope.row.type == 1">外链</span> -->
</div>
</template>
</el-table-column>
<!-- <el-table-column
width="200"
prop="createTime"
header-align="center"
align="center"
label="创建日期"
>
</el-table-column> -->
<el-table-column
fixed="right"
header-align="center"
align="center"
width="180"
label="操作"
>
<template slot-scope="scope">
<div>
<el-button
type="text"
size="small"
@click="addOrUpdateHandle(scope.row)"
>修改</el-button
>
<!-- <el-button
type="text"
size="small"
@click="deleteHandle(scope.row.id)"
>删除</el-button
> -->
</div>
</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"
style="padding: 10px 0; text-align: center;"
layout="total, sizes, prev, pager, next, jumper"
>
</el-pagination> -->
</div>
<!-- 弹窗, 新增 / 修改 -->
<add-or-update
v-if="addOrUpdateVisible"
ref="addOrUpdate"
@refreshDataList="getDataList"
></add-or-update>
</div>
</template>
<script>
import AddOrUpdate from "./course-add-or-update";
export default {
data() {
return {
linkList: [{ label: "外链", value: 1 }, { label: "富文本", value: 0 }],
selectQueryApp: null,
APPList: [
{ label: "疯子读书", value: 2, valueName: "isBook" },
{ label: "吴门医述", value: 3, valueName: "isMedical" },
{ label: "众妙之门", value: 1, valueName: "isSociology" }
],
dataForm: {
key: ""
},
query: {
type: "",
title: ""
},
dataList: [],
delFlag: false,
pageIndex: 1,
pageSize: 10,
totalPage: 0,
dataListLoading: false,
dataListSelections: [],
addOrUpdateVisible: false,
urlList: {
list: "/master/apkConfig/getConfig"
}
};
},
components: {
AddOrUpdate
},
activated() {
if (this.$route.query.upPageInde != null) {
this.pageIndex = this.$route.query.upPageIndex;
console.log(this.pageIndex);
}
this.getDataList();
},
methods: {
// 获取数据列表
getDataList() {
console.log("this.selectQueryApp at line 195:", this.selectQueryApp);
this.dataListLoading = true;
this.$http
.request({
url: this.$http.adornUrl(this.urlList.list),
method: "POST",
data: {},
header: {
//默认 无 说明:请求头
"Content-Type": "application/json"
}
})
.then(({ data }) => {
if (data && data.code === 0) {
this.dataList = data.list.configs;
// this.totalPage = data.result.total;
} else {
this.dataList = [];
// this.totalPage = 0;
}
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;
},
// 新增 / 修改
addOrUpdateHandle(row) {
this.addOrUpdateVisible = true;
this.$nextTick(() => {
this.$refs.addOrUpdate.init(row);
});
},
// 删除
deleteHandle(id) {
this.$confirm(
`确定对[id=${id}]进行[${id ? "删除" : "删除"}]操作?`,
"提示",
{
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}
).then(() => {
this.$http({
url: this.$http.adornUrl("/master/message/delMessage?id=" + id),
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 = {
delFlag: event.delFlag,
id: event.id
};
this.$http({
url: this.$http.adornUrl("/book/book/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);
},
chapterHandle(id, row) {
if (row.novel == "") {
this.$alert("请上传电子书文件后在进行此操作", "提示", {
confirmButtonText: "好的"
});
return false;
}
this.$http({
url: this.$http.adornUrl("/book/book/getChapter"),
method: "get",
params: this.$http.adornParams({
id: id
})
}).then(res => {
this.$message({
message: "成功",
type: "success"
});
this.loading = false;
this.getDataList();
});
},
contentHandle(id) {
this.$http({
url: this.$http.adornUrl("/book/bookchaptercontent/getBookVoices"),
method: "get",
params: this.$http.adornParams({
id: id
})
}).then(res => {
this.$message({
message: "成功",
type: "success"
});
this.loading = false;
this.getDataList();
});
},
voicesHandle(id) {
//allVoices
this.$http({
// url: this.$http.adornUrl('/book/bookchaptercontent/allVoices'),
url: this.$http.adornUrl("/book/bookchaptercontent/AllVOices"),
method: "get",
params: this.$http.adornParams({
id: id
})
}).then(res => {
console.log("book/bookchaptercontent/AllVOices");
this.$message({
message: "成功",
type: "success"
});
this.loading = false;
this.getDataList();
});
}
}
};
</script>

View File

@@ -42,6 +42,7 @@
</el-input-number>
</el-form-item>
<el-form-item
style="width: auto;"
label="是否为最终级"
prop="isLast"
label-width="120px"
@@ -58,14 +59,40 @@
>
</el-switch>
</el-form-item>
</el-form>
</div>
<div
style=" border: 1px dashed #bababa;"
v-if="currentNode && currentNode.data.isLast == 1"
></div>
</div>
<el-form-item
style="width: auto;"
label="图标"
prop="isLast"
label-width="80px"
class="form_item"
>
<el-upload
class="avatar-uploader"
:action="baseUrl + '/oss/fileoss'"
:show-file-list="false"
:on-success="handlePicSuccess"
>
<img v-if="fimages" :src="fimages" class="avatar" />
<i v-else class="el-icon-plus avatar-uploader-icon"></i>
</el-upload>
<i
class="el-icon-error delImgBtn"
style="font-size: 24px;"
@click="delImg()"
v-if="fimages != ''"
></i>
</el-form-item>
<div class="clear"></div>
</el-form>
<div class="clear"></div>
</div>
</div>
<div
style="width:100%; border: 1px dashed #bababa;float: left;"
v-if="currentNode && currentNode.data.isLast == 1"
></div>
<div
class="border_box tree_content_box"
v-if="currentNode && currentNode.data.isLast == 1"
@@ -208,6 +235,7 @@
</template>
<script>
import global from "@/views/common/common.vue"; //引入共用组间
// import AddOrUpdate from "./sociologyComponents/bookTagsForm.vue";
import AddOrUpdate from "./sociologyComponents/sociology-add-or-update";
import commonShop from "./sociologyComponents/shopproduct.vue";
@@ -218,6 +246,8 @@ import debounce from "lodash/debounce"; //导入lodash中的debounce
export default {
data() {
return {
fimages: "",
baseUrl: global.baseUrl,
isEdit: false,
checkAll: false,
dialogVisible: false,
@@ -285,6 +315,16 @@ export default {
this.getDataList();
},
methods: {
delImg() {
this.fimages = "";
this.addForm.icon = "";
},
handlePicSuccess(res, file) {
this.fimages = res.url;
this.addForm.icon = res.url;
this.$message.success("上传成功");
// console.log(res, "上传");
},
// 只可输入数字
UpNumber(e) {
e.target.value = e.target.value.replace(/[^\d]/g, "");
@@ -347,13 +387,13 @@ export default {
courseId: this.addForm.id
});
}
} else {
this.$message.error(data.msg);
}that.dialogVisible = false;
}
that.dialogVisible = false;
});
that.$forceUpdate()
that.$forceUpdate();
}, 200),
openTable() {
this.isEdit = false;
@@ -381,7 +421,13 @@ export default {
this.isFresh = true;
console.log("🚀 ~ getCommonShopDataList ~ type, id:", type, id);
this.currentNode = { data: { ...form } };
console.log('this.currentNode at line 423:', this.currentNode)
this.addForm = form;
if(form.icon){
this.fimages=form.icon
}else{
this.fimages=''
}
await this.getDataList();
// this.$refs.commonTree.setCurrentNodeShow();
@@ -421,6 +467,10 @@ export default {
this.$nextTick(async () => {
this.$refs.commonTree.setCurrentNodeShow(data.sociology.id);
this.addForm = data.sociology;
if(data.sociology.icon){
this.fimages = data.sociology.icon;
}
this.currentNode = { data: { ...data.sociology } };
this.$message({
message: "操作成功",
@@ -498,6 +548,7 @@ export default {
this.$refs.tree.setCheckedKeys([0]);
},
changeCurrentNode(val) {
this.changeCurrentNode = val;
this.$forceUpdate();
},
@@ -507,6 +558,7 @@ export default {
this.isFresh = true;
},
handleClickNodes(node, data, type) {
console.log('type at line 552:', type)
this.isEdit = false;
this.addForm = {};
// console.log(this.$refs.tree.handleClickNodes(), "当前选中节点");
@@ -530,12 +582,16 @@ export default {
isLast: 0,
pid: data.id,
sort: 0,
title: ""
title: "",
icon: "",
};
break;
}
this.addForm = { ...form };
console.log('this.addForm at line 581:', this.addForm)
if(this.addForm.icon){
this.fimages = this.addForm.icon;
}
this.$nextTick(() => {
this.$refs.commonShop.clear();
// this.$refs.commonShop.bookMarketId = null;
@@ -867,8 +923,8 @@ export default {
}
.border_box {
height: 100px;
margin-bottom: 10px;
height: 120px;
// margin-bottom: 10px;
.title_box {
display: flex;
@@ -913,7 +969,7 @@ export default {
}
.tree_content_box {
height: calc(100% - 110px) !important;
height: calc(100% - 120px) !important;
}
.mod-config {
@@ -995,13 +1051,17 @@ p {
// }
.addFormBox {
overflow: hidden;
// overflow: hidden;
// overflow: auto;
.form_item {
width: 33%;
margin-bottom: 0 !important;
float: left;
}
}
.clear{
clear: both;
}
.custom-tree-container {
height: calc(100% - 100px);
@@ -1024,4 +1084,38 @@ p {
width: calc(100% - 120px);
float: left;
}
.delImgBtn {
cursor: pointer;
position: absolute;
display: inline-block;
top: -10px;
right: -10px;
}
.el-upload {
border: 1px dashed #d9d9d9;
border-radius: 6px;
cursor: pointer;
position: relative;
}
.avatar-uploader .el-upload:hover {
border-color: rgb(162, 225, 218);
}
.avatar-uploader-icon {
border: 1px dashed #d9d9d9;
border-color: rgb(162, 225, 218);
font-size: 28px;
color: #8c939d;
width: 50px;
height: 50px;
line-height: 50px;
text-align: center;
}
.avatar {
width: 50px;
border: 1px dashed rgb(162, 225, 218);
background-color: #b0b0b09e;
// border-color: #409eff;
height: 50px;
display: block;
}
</style>

View File

@@ -5,10 +5,10 @@
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://api.nuttyreading.com'; // 线上正式环境
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';
// window.SITE_CONFIG['baseUrl'] = 'http://192.168.110.100:9200/pb';