This commit is contained in:
2023-07-11 20:12:08 +08:00
parent 0600bc4a0d
commit 3ee952eb90
2 changed files with 43 additions and 67 deletions

View File

@@ -137,7 +137,6 @@ export default {
data(){ data(){
return{ return{
// 月刊标号海报: // 月刊标号海报:
MonPage:'3',
currentImg:'', currentImg:'',
// 项目总数 // 项目总数
ProjectNum:0, ProjectNum:0,
@@ -154,24 +153,24 @@ export default {
// 初始化渲染页面 // 初始化渲染页面
mounted(){ mounted(){
// 绘制最新月刊 // 绘制最新月刊
this.addTextEvent(); // this.addTextEvent();
// // 填充画布: // // // 填充画布:
this.$nextTick(() => { // this.$nextTick(() => {
this.drawPage(); // this.drawPage();
}); // });
this.getMonely(); this.getMonely();
this.getProjectNum(); this.getProjectNum();
this.getLabel(); this.getLabel();
}, },
methods: { methods: {
drawPage(){ // drawPage(){
var that = this; // var that = this;
var fac = document.getElementsByClassName("3"); // var fac = document.getElementsByClassName("3");
fac.style.backgroundImage = that.currentImg; // fac.style.backgroundImage = that.currentImg;
}, // },
test(index){ test(index){
var that = this; // var that = this;
console.log(index); // console.log(index);
}, },
goBack() { goBack() {
window.history.go(-1); window.history.go(-1);
@@ -267,34 +266,34 @@ export default {
}); });
} }
}, },
backtoHome(){ // backtoHome(){
let pathInfo = this.$router.resolve({ // let pathInfo = this.$router.resolve({
path: '/Home', // path: '/Home',
query:{ // query:{
} // }
}) // })
window.open(pathInfo.href, '_self'); // window.open(pathInfo.href, '_self');
}, // },
addTextEvent() { // addTextEvent() {
var _this = this // var _this = this
let canvas = document.createElement("canvas"); // let canvas = document.createElement("canvas");
canvas.width = 600; // canvas.width = 600;
canvas.height = 400; // canvas.height = 400;
let myImage = new Image(); // let myImage = new Image();
myImage.src = "../../assets/images/最新月刊.png"; // 需要添加文字的图片 // myImage.src = "../../assets/images/最新月刊.png"; // 需要添加文字的图片
myImage.crossOrigin = "Anonymous"; // myImage.crossOrigin = "Anonymous";
let context = canvas.getContext("2d"); // let context = canvas.getContext("2d");
myImage.onload = function () { // myImage.onload = function () {
context.drawImage(myImage, 0, 0, canvas.width, canvas.height); // context.drawImage(myImage, 0, 0, canvas.width, canvas.height);
context.font = "20px Courier New"; // context.font = "20px Courier New";
context.fillStyle = 'red' // context.fillStyle = 'red'
// context.textAlign = 'end' //文字右对齐 // // context.textAlign = 'end' //文字右对齐
context.fillText("我是写入的文字", 250, 350); // 文字的内容和位置 // context.fillText("我是写入的文字", 250, 350); // 文字的内容和位置
let base64 = canvas.toDataURL("image/png"); // "image/png" 这里注意一下 // let base64 = canvas.toDataURL("image/png"); // "image/png" 这里注意一下
console.log(_this.currentImg); // console.log(_this.currentImg);
_this.currentImg = base64 // _this.currentImg = base64
} // }
} // }
} }
} }
</script> </script>

View File

@@ -166,27 +166,8 @@ export default {
} }
}, 10); }, 10);
// const that = this
// let timer = setInterval(() => {
// let ispeed = Math.floor(-that.scrollTop / 5)
// document.documentElement.scrollTop = document.body.scrollTop = that.scrollTop + ispeed
// if (that.scrollTop === 0) {
// clearInterval(timer)
// }
// }, 16)
}, },
// // 为了计算距离顶部的高度当高度大于60显示回顶部图标小于60则隐藏
// scrollToTop () {
// const that = this
// let scrollTop = window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop
// that.scrollTop = scrollTop
// if (that.scrollTop > 60) {
// that.btnFlag = true
// } else {
// that.btnFlag = false
// }
// },
//滚动
// 点击切换锚点: // 点击切换锚点:
goAnchor(id) { goAnchor(id) {
var anchor = document.getElementById(id); var anchor = document.getElementById(id);
@@ -233,11 +214,6 @@ export default {
initPage(){ initPage(){
this.MonthlyId = this.$route.query.MonethlyId; this.MonthlyId = this.$route.query.MonethlyId;
this.selectMonly = this.MonthlyId; this.selectMonly = this.MonthlyId;
// if(parseInt(this.selectMonly) == parseInt(1) || parseInt(this.MonethlyId) == parseInt(1)){
// this.$refs.LastBtn.style.display = "none"
// }else if(parseInt(this.selectMonly) == this.Monely || parseInt(this.MonethlyId) == this.Monely){
// this.$refs.NextBtn.style.display = "none"
// }
}, },
// test(){ // test(){
// console.log(this.MonType); // console.log(this.MonType);
@@ -272,8 +248,9 @@ export default {
that.MonTypePro=[]; that.MonTypePro=[];
Object.keys(that.MonList).forEach(key=>{ Object.keys(that.MonList).forEach(key=>{
that.MonTypePro.push(that.MonList[key]); that.MonTypePro.push(that.MonList[key]);
that.MonType.push(key);
}) })
// console.log(that.MonTypePro); console.log(that.MonTypePro);
}) })
}, },
// 月刊详情页面跳转 // 月刊详情页面跳转