|
@@ -951,6 +951,7 @@ export default {
|
|
|
"likePhraseList",
|
|
|
"likeWord",
|
|
|
"articleImg",
|
|
|
+ "printCount",
|
|
|
],
|
|
|
data() {
|
|
|
return {
|
|
@@ -1103,6 +1104,7 @@ export default {
|
|
|
printManyMenu: [], // 打印多篇文章目录
|
|
|
printManyDetails: [], // 最终确定打印文章内容详情
|
|
|
isPrintMore: false,
|
|
|
+ printCountNow: this.printCount,
|
|
|
};
|
|
|
},
|
|
|
created() {
|
|
@@ -1326,30 +1328,42 @@ export default {
|
|
|
article_id: this.articleId,
|
|
|
}).then((res) => {
|
|
|
if (res.status === 1) {
|
|
|
+ this.printCountNow = res.print_count;
|
|
|
if (res.print_count < 5) {
|
|
|
- getLogin(
|
|
|
- "/ShopServer/Client/PrintRecordManager/AddPrintRecord_Article",
|
|
|
- {
|
|
|
- goods_type: 21,
|
|
|
- article_id: this.articleId,
|
|
|
- }
|
|
|
- ).then((res) => {
|
|
|
- if (res.status === 1) {
|
|
|
- }
|
|
|
- });
|
|
|
- this.$nextTick(() => {
|
|
|
- this.$print(this.$refs["printArea"], {
|
|
|
- noPrint: ".noPrint",
|
|
|
- type: "html",
|
|
|
- scanStyles: true,
|
|
|
- showModal: true,
|
|
|
- // style: style,// 亦可使用引入的外部css;
|
|
|
- onStart: () => {
|
|
|
- // console.log("打印开始");
|
|
|
- },
|
|
|
- onEnd: () => {
|
|
|
- // console.log("打印完成");
|
|
|
- },
|
|
|
+ let str =
|
|
|
+ "剩余次数为" +
|
|
|
+ (5 - res.print_count) +
|
|
|
+ "次,是否确认打印?(每篇打印+下载次数共5次)";
|
|
|
+ this.$confirm(str, "提示", {
|
|
|
+ confirmButtonText: "确定",
|
|
|
+ cancelButtonText: "取消",
|
|
|
+ type: "warning",
|
|
|
+ }).then(() => {
|
|
|
+ getLogin(
|
|
|
+ "/ShopServer/Client/PrintRecordManager/AddPrintRecord_Article",
|
|
|
+ {
|
|
|
+ goods_type: 21,
|
|
|
+ article_id: this.articleId,
|
|
|
+ }
|
|
|
+ ).then((res) => {
|
|
|
+ if (res.status === 1) {
|
|
|
+ this.printCountNow++;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ this.$nextTick(() => {
|
|
|
+ this.$print(this.$refs["printArea"], {
|
|
|
+ noPrint: ".noPrint",
|
|
|
+ type: "html",
|
|
|
+ scanStyles: true,
|
|
|
+ showModal: true,
|
|
|
+ // style: style,// 亦可使用引入的外部css;
|
|
|
+ onStart: () => {
|
|
|
+ // console.log("打印开始");
|
|
|
+ },
|
|
|
+ onEnd: () => {
|
|
|
+ // console.log("打印完成");
|
|
|
+ },
|
|
|
+ });
|
|
|
});
|
|
|
});
|
|
|
} else {
|
|
@@ -1388,33 +1402,45 @@ export default {
|
|
|
article_id: this.articleId,
|
|
|
}).then((res) => {
|
|
|
if (res.status === 1) {
|
|
|
+ this.printCountNow = res.print_count;
|
|
|
if (res.print_count < 5) {
|
|
|
- getLogin(
|
|
|
- "/ShopServer/Client/PrintRecordManager/AddPrintRecord_Article",
|
|
|
- {
|
|
|
- goods_type: 21,
|
|
|
- article_id: this.articleId,
|
|
|
- }
|
|
|
- ).then((res) => {
|
|
|
- if (res.status === 1) {
|
|
|
- }
|
|
|
- });
|
|
|
- this.$nextTick(() => {
|
|
|
- this.isPrint = true;
|
|
|
- const element = document.getElementById("showWaterMark");
|
|
|
- const opt = {
|
|
|
- margin: [0, 0, 0, 0],
|
|
|
- useCORS: true,
|
|
|
- filename: title + ".pdf",
|
|
|
- image: { type: "jpeg", quality: 0.98 },
|
|
|
- html2canvas: { scale: 2 }, // 或其他自定义设置,例如scale可以放大内容以便更容易阅读和打印。
|
|
|
- jsPDF: { unit: "mm", format: "a4", orientation: "portrait" }, // A4尺寸的PDF,纵向打印。
|
|
|
- };
|
|
|
- html2pdf().set(opt).from(element).save();
|
|
|
+ let str =
|
|
|
+ "剩余次数为" +
|
|
|
+ (5 - res.print_count) +
|
|
|
+ "次,是否确认下载?(每篇打印+下载次数共5次)";
|
|
|
+ this.$confirm(str, "提示", {
|
|
|
+ confirmButtonText: "确定",
|
|
|
+ cancelButtonText: "取消",
|
|
|
+ type: "warning",
|
|
|
+ }).then(() => {
|
|
|
+ getLogin(
|
|
|
+ "/ShopServer/Client/PrintRecordManager/AddPrintRecord_Article",
|
|
|
+ {
|
|
|
+ goods_type: 21,
|
|
|
+ article_id: this.articleId,
|
|
|
+ }
|
|
|
+ ).then((res) => {
|
|
|
+ if (res.status === 1) {
|
|
|
+ this.printCountNow++;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ this.$nextTick(() => {
|
|
|
+ this.isPrint = true;
|
|
|
+ const element = document.getElementById("showWaterMark");
|
|
|
+ const opt = {
|
|
|
+ margin: [0, 0, 0, 0],
|
|
|
+ useCORS: true,
|
|
|
+ filename: title + ".pdf",
|
|
|
+ image: { type: "jpeg", quality: 0.98 },
|
|
|
+ html2canvas: { scale: 2 }, // 或其他自定义设置,例如scale可以放大内容以便更容易阅读和打印。
|
|
|
+ jsPDF: { unit: "mm", format: "a4", orientation: "portrait" }, // A4尺寸的PDF,纵向打印。
|
|
|
+ };
|
|
|
+ html2pdf().set(opt).from(element).save();
|
|
|
|
|
|
- setTimeout(() => {
|
|
|
- this.isPrint = false;
|
|
|
- }, 100);
|
|
|
+ setTimeout(() => {
|
|
|
+ this.isPrint = false;
|
|
|
+ }, 100);
|
|
|
+ });
|
|
|
});
|
|
|
} else {
|
|
|
this.$message.warning("每篇文章打印+下载次数共5次,现已达上限。");
|
|
@@ -1768,35 +1794,47 @@ export default {
|
|
|
article_id: this.articleId,
|
|
|
}).then((res) => {
|
|
|
if (res.status === 1) {
|
|
|
+ this.printCountNow = res.print_count;
|
|
|
if (res.print_count < 5) {
|
|
|
- getLogin(
|
|
|
- "/ShopServer/Client/PrintRecordManager/AddPrintRecord_Article",
|
|
|
- {
|
|
|
- goods_type: 21,
|
|
|
- article_id: this.articleId,
|
|
|
- }
|
|
|
- ).then((res) => {
|
|
|
- if (res.status === 1) {
|
|
|
- }
|
|
|
- });
|
|
|
- this.$nextTick(() => {
|
|
|
- this.$print(this.$refs["printAreaManys"], {
|
|
|
- noPrint: ".noPrint",
|
|
|
- type: "html",
|
|
|
- scanStyles: true,
|
|
|
- showModal: true,
|
|
|
- // style: style,// 亦可使用引入的外部css;
|
|
|
- onStart: () => {
|
|
|
- // console.log("打印开始");
|
|
|
- },
|
|
|
- onEnd: () => {
|
|
|
- // console.log("打印完成");
|
|
|
- },
|
|
|
+ let str =
|
|
|
+ "剩余次数为" +
|
|
|
+ (5 - res.print_count) +
|
|
|
+ "次,是否确认打印?(每篇打印+下载次数共5次)";
|
|
|
+ this.$confirm(str, "提示", {
|
|
|
+ confirmButtonText: "确定",
|
|
|
+ cancelButtonText: "取消",
|
|
|
+ type: "warning",
|
|
|
+ }).then(() => {
|
|
|
+ getLogin(
|
|
|
+ "/ShopServer/Client/PrintRecordManager/AddPrintRecord_Article",
|
|
|
+ {
|
|
|
+ goods_type: 21,
|
|
|
+ article_id: this.articleId,
|
|
|
+ }
|
|
|
+ ).then((res) => {
|
|
|
+ if (res.status === 1) {
|
|
|
+ this.printCountNow++;
|
|
|
+ }
|
|
|
});
|
|
|
+ this.$nextTick(() => {
|
|
|
+ this.$print(this.$refs["printAreaManys"], {
|
|
|
+ noPrint: ".noPrint",
|
|
|
+ type: "html",
|
|
|
+ scanStyles: true,
|
|
|
+ showModal: true,
|
|
|
+ // style: style,// 亦可使用引入的外部css;
|
|
|
+ onStart: () => {
|
|
|
+ // console.log("打印开始");
|
|
|
+ },
|
|
|
+ onEnd: () => {
|
|
|
+ // console.log("打印完成");
|
|
|
+ },
|
|
|
+ });
|
|
|
|
|
|
- this.loading = false;
|
|
|
- this.printManyFlag = false;
|
|
|
- this.isPrintMore = false;
|
|
|
+ this.loading = false;
|
|
|
+ this.printManyFlag = false;
|
|
|
+ this.isPrintMore = false;
|
|
|
+ });
|
|
|
});
|
|
|
} else {
|
|
|
this.loading = false;
|