1、月计划自动生成子项 2、微型课程 复制

This commit is contained in:
zhanglipeng
2021-09-06 11:33:39 +08:00
parent 3d35107e24
commit 284602e4ac
3 changed files with 78 additions and 21 deletions

View File

@ -36,8 +36,18 @@
size="mini"
icon="el-icon-printer"
@click="prints"
v-show="enable"
>打印</el-button
>
<el-button
type="primary"
plain
size="mini"
icon="el-icon-document-copy"
@click="copy(note)"
v-show="enable"
>复制</el-button
>
<div class="pad-left" v-html="note" ref="printMe"></div>
</div>
</el-card>
@ -48,11 +58,14 @@
<script>
import { treeselect, getMicrocourse } from "@/api/benyi/microcourse";
// 点击复制
import Clipboard from "clipboard";
export default {
name: "Microcoursestudy",
data() {
return {
enable: false,
// 主题整合名称
name: undefined,
// 主题整合id
@ -107,6 +120,7 @@ export default {
},
getMicrocourseDetails() {
getMicrocourse(this.id).then((response) => {
this.enable = true;
this.title1 = response.data.title;
this.note = response.data.contents;
});
@ -116,6 +130,32 @@ export default {
//console.log(this.$refs.printMe);
this.$print(this.$refs.printMe);
},
copy(data) {
let url = this.filter(data);
let oInput = document.createElement("input");
oInput.value = url;
document.body.appendChild(oInput);
oInput.select(); // 选择对象;
//console.log(oInput.value);
document.execCommand("Copy"); // 执行浏览器复制命令
this.$message({
message: "复制成功",
type: "success",
});
oInput.remove();
},
//过滤html标签
filter: function (html) {
return html
.replace(/<(?:.|\n)*?>/gm, "")
.replace(/(&rdquo;)/g, '"')
.replace(/&ldquo;/g, '"')
.replace(/&mdash;/g, "-")
.replace(/&nbsp;/g, "")
.replace(/&gt;/g, ">")
.replace(/&lt;/g, "<")
.replace(/<[\w\s"':=\/]*/, "");
},
},
};
</script>
@ -160,20 +200,20 @@ export default {
line-height: 40px;
}
// 禁止复制
div {
-webkit-touch-callout: none;
-webkit-user-select: none;
-khtml-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
}
// div {
// -webkit-touch-callout: none;
// -webkit-user-select: none;
// -khtml-user-select: none;
// -moz-user-select: none;
// -ms-user-select: none;
// user-select: none;
// }
.el-tree {
min-width: 100%;
display: inline-block;
}
.tree {
overflow:auto;
overflow: auto;
max-height: 600px;
}
</style>

View File

@ -466,19 +466,25 @@ export default {
this.open = true;
this.title = "填充主题整合周计划明细";
let arrTime = [];
arrTime.push(response.data.starttime);
arrTime.push(response.data.endtime);
if (response.data.starttime == null) {
} else {
arrTime.push(response.data.starttime);
arrTime.push(response.data.endtime);
}
this.form.starttime = arrTime;
var activityid = response.data.activityid.split(";");
var array = [];
//console.log(arr);
activityid.forEach(function (value, key, arr) {
//console.log(value); // 结果依次为123
if (value != "") {
array.push(parseInt(value));
}
});
this.themeactivityList = array;
if (activityid == null) {
} else {
var activityid = response.data.activityid.split(";");
var array = [];
//console.log(arr);
activityid.forEach(function (value, key, arr) {
//console.log(value); // 结果依次为123
if (value != "") {
array.push(parseInt(value));
}
});
this.themeactivityList = array;
}
});
},
/** 提交按钮 */