Commit 457f82b9 by FE

modify username in poster page

parent 051b45b8
...@@ -23,6 +23,7 @@ class SharePoster extends Component { ...@@ -23,6 +23,7 @@ class SharePoster extends Component {
componentDidMount() { componentDidMount() {
this.getCodeWe(); this.getCodeWe();
http.get(`${API.home}/m/dist/posters/${getParam('courseId')}/${getParam('uid')}`).then((res) => { http.get(`${API.home}/m/dist/posters/${getParam('courseId')}/${getParam('uid')}`).then((res) => {
console.log(res);
if (res.data.code === 200) { if (res.data.code === 200) {
this.setState({ this.setState({
imgUrl: res.data.data.avatar, imgUrl: res.data.data.avatar,
...@@ -58,7 +59,7 @@ class SharePoster extends Component { ...@@ -58,7 +59,7 @@ class SharePoster extends Component {
var canvas = document.getElementById("canvas"), var canvas = document.getElementById("canvas"),
context = canvas.getContext("2d"); context = canvas.getContext("2d");
console.log(_this);
_this.getBase64(imgSrc1) _this.getBase64(imgSrc1)
// 背景图片合成 // 背景图片合成
.then((img) => { .then((img) => {
...@@ -84,7 +85,7 @@ class SharePoster extends Component { ...@@ -84,7 +85,7 @@ class SharePoster extends Component {
context.drawImage(qrCodeImg, 320, 685, 100, 100); context.drawImage(qrCodeImg, 320, 685, 100, 100);
context.fillStyle = imgList[index].username_color; context.fillStyle = imgList[index].username_color;
context.font = "16px serif"; context.font = "16px serif";
context.fillText('@' + _this.name, (avatarPositionX + avatarWidth) + 20, (avatarPositionY + avatarHeight / 2)); context.fillText('@' + _this.state.name, (avatarPositionX + avatarWidth) + 20, (avatarPositionY + avatarHeight / 2));
context.font = "14px serif"; context.font = "14px serif";
context.fillText('正在学习该课程', (avatarPositionX + avatarWidth) + 20, (avatarPositionY + avatarHeight / 2) + 20); context.fillText('正在学习该课程', (avatarPositionX + avatarWidth) + 20, (avatarPositionY + avatarHeight / 2) + 20);
context.restore(); context.restore();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment