|
@@ -17,6 +17,9 @@ Page({
|
|
bottom: '8cm',
|
|
bottom: '8cm',
|
|
left: '8cm',
|
|
left: '8cm',
|
|
},
|
|
},
|
|
|
|
+ fontContent: '可定制区域',
|
|
|
|
+ fontColor:'#fff',
|
|
|
|
+ fontSize:null,
|
|
isActive: '1', // 默认是正面
|
|
isActive: '1', // 默认是正面
|
|
|
|
|
|
obverseImgObject: {
|
|
obverseImgObject: {
|
|
@@ -29,28 +32,30 @@ Page({
|
|
fontColor: ['#ffffff','#000000', '#e70012', '#ff8500', '#fff100', '#22ad38', '#00b7f0', '#920784'],
|
|
fontColor: ['#ffffff','#000000', '#e70012', '#ff8500', '#fff100', '#22ad38', '#00b7f0', '#920784'],
|
|
isColor: '#ffffff', // 默认是白色
|
|
isColor: '#ffffff', // 默认是白色
|
|
addFontStatic: false, // 添加文字
|
|
addFontStatic: false, // 添加文字
|
|
|
|
+ inputFont:null
|
|
|
|
+
|
|
},
|
|
},
|
|
|
|
|
|
/**
|
|
/**
|
|
* 生命周期函数--监听页面加载
|
|
* 生命周期函数--监听页面加载
|
|
*/
|
|
*/
|
|
onLoad: function (options) {
|
|
onLoad: function (options) {
|
|
- let that = this;
|
|
|
|
- that.changeCupImg('1');
|
|
|
|
|
|
+
|
|
},
|
|
},
|
|
|
|
|
|
/**
|
|
/**
|
|
* 生命周期函数--监听页面初次渲染完成
|
|
* 生命周期函数--监听页面初次渲染完成
|
|
*/
|
|
*/
|
|
onReady: function () {
|
|
onReady: function () {
|
|
-
|
|
|
|
|
|
+ let that = this;
|
|
|
|
+ that.changeCupImg('1');
|
|
},
|
|
},
|
|
|
|
|
|
/**
|
|
/**
|
|
* 生命周期函数--监听页面显示
|
|
* 生命周期函数--监听页面显示
|
|
*/
|
|
*/
|
|
onShow: function () {
|
|
onShow: function () {
|
|
-
|
|
|
|
|
|
+
|
|
},
|
|
},
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -90,37 +95,45 @@ Page({
|
|
changeCupImg(index) {
|
|
changeCupImg(index) {
|
|
|
|
|
|
let canvasBg = this.data.obverseImgObject[index],that = this;
|
|
let canvasBg = this.data.obverseImgObject[index],that = this;
|
|
- wx.getSystemInfo({
|
|
|
|
- success: function (res) {
|
|
|
|
- let rpx = res.windowWidth / 750;
|
|
|
|
- const ctx = wx.createCanvasContext('madeContent');
|
|
|
|
- ctx.drawImage(canvasBg, 0, 0, 750 * rpx, 588 * rpx)
|
|
|
|
- ctx.draw();
|
|
|
|
- },
|
|
|
|
- })
|
|
|
|
|
|
+ // wx.getSystemInfo({
|
|
|
|
+ // success: function (res) {
|
|
|
|
+ // let rpx = res.windowWidth / 750;
|
|
|
|
+ // const ctx = wx.createCanvasContext('madeContent');
|
|
|
|
+ // ctx.drawImage(canvasBg, 0, 0, 750 * rpx, 588 * rpx)
|
|
|
|
+ // ctx.draw();
|
|
|
|
+ // setTimeout(()=>{
|
|
|
|
+ // that.handleCanvarToImg(that)
|
|
|
|
+ // },1000)
|
|
|
|
+ // },
|
|
|
|
+ // })
|
|
},
|
|
},
|
|
addFont(){ // 添加文字
|
|
addFont(){ // 添加文字
|
|
let that = this;
|
|
let that = this;
|
|
- wx.canvasToTempFilePath({
|
|
|
|
- x: 0,
|
|
|
|
- y: 0,
|
|
|
|
- width: 750,
|
|
|
|
- height: 588,
|
|
|
|
- canvasId: 'madeContent',
|
|
|
|
- success: function (res) {
|
|
|
|
- that.setData({
|
|
|
|
- radarImg: res.tempFilePath,
|
|
|
|
- })
|
|
|
|
- setTimeout(()=>{
|
|
|
|
- that.setData({
|
|
|
|
- addFontStatic: true
|
|
|
|
- })
|
|
|
|
- },200)
|
|
|
|
-
|
|
|
|
- }
|
|
|
|
- });
|
|
|
|
-
|
|
|
|
-
|
|
|
|
|
|
+ that.setData({
|
|
|
|
+ addFontStatic: true
|
|
|
|
+ })
|
|
|
|
+ },
|
|
|
|
+ fontCancel(){
|
|
|
|
+ this.setData({
|
|
|
|
+ addFontStatic: false
|
|
|
|
+ })
|
|
|
|
+ },
|
|
|
|
+ bindinput(e){
|
|
|
|
+ this.setData({
|
|
|
|
+ inputFont: e.detail.value,
|
|
|
|
+ })
|
|
|
|
+ },
|
|
|
|
+ fontConfirm(e){
|
|
|
|
+ console.log('点击完成', e.detail)
|
|
|
|
+ let that = this;
|
|
|
|
+ if (that.data.inputFont){
|
|
|
|
+ that.setData({
|
|
|
|
+ fontContent: that.data.inputFont,
|
|
|
|
+ fontColor: that.data.isColor,
|
|
|
|
+ fontSize:'88rpx',
|
|
|
|
+ addFontStatic: false
|
|
|
|
+ })
|
|
|
|
+ }
|
|
},
|
|
},
|
|
handleCanvarToImg(that){
|
|
handleCanvarToImg(that){
|
|
wx.canvasToTempFilePath({
|
|
wx.canvasToTempFilePath({
|