feat: 完成引导页
This commit is contained in:
@@ -20,19 +20,19 @@ Page({
|
||||
const hasShowIntroduction =
|
||||
wx.getStorageSync('hasShowIntroduction') || false;
|
||||
|
||||
if (!hasShowIntroduction) {
|
||||
this.setData({
|
||||
cardList: [
|
||||
{ color: '#FF0000', word: '涂' },
|
||||
{ color: '#00FF00', word: '欢' },
|
||||
{ color: '#FF7F00', word: '鸦' },
|
||||
{ color: '#00FFFF', word: '迎' },
|
||||
{ color: '#FFFF00', word: '丫' },
|
||||
{ color: '#8A2BE2', word: '你' },
|
||||
],
|
||||
showIntroductionPopup: true,
|
||||
});
|
||||
}
|
||||
// if (!hasShowIntroduction) {
|
||||
this.setData({
|
||||
cardList: [
|
||||
{ color: '#FF0000', word: '涂' },
|
||||
{ color: '#00FF00', word: '欢' },
|
||||
{ color: '#FF7F00', word: '鸦' },
|
||||
{ color: '#00FFFF', word: '迎' },
|
||||
{ color: '#FFFF00', word: '丫' },
|
||||
{ color: '#8A2BE2', word: '你' },
|
||||
],
|
||||
showIntroductionPopup: true,
|
||||
});
|
||||
// }
|
||||
},
|
||||
|
||||
onReady() {
|
||||
@@ -71,6 +71,7 @@ Page({
|
||||
this.textDrawService = new TextDrawService(canvas, ctx);
|
||||
// textDrawService.draw();
|
||||
this.setData({ boxWidth, boxHeight });
|
||||
this.drawCanvas();
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -78,10 +79,15 @@ Page({
|
||||
|
||||
/** 变更cardList 并更新canvas */
|
||||
drawCanvas(
|
||||
updatedCardList: Array<{ color: string; word: string }>,
|
||||
updatedCardList?: Array<{ color: string; word: string }>,
|
||||
callback: () => void = () => {},
|
||||
) {
|
||||
this.setData({ cardList: updatedCardList }, callback);
|
||||
if (updatedCardList && updatedCardList.length > 0) {
|
||||
this.setData({ cardList: updatedCardList }, callback);
|
||||
} else {
|
||||
updatedCardList = this.data.cardList;
|
||||
}
|
||||
|
||||
this.textDrawService?.draw(updatedCardList);
|
||||
},
|
||||
|
||||
|
||||
Reference in New Issue
Block a user