@@ -116,3 +116,15 @@ page { | |||
.fr{ | |||
float: right; | |||
} | |||
.canWrap{ | |||
position: fixed; | |||
bottom: -2000rpx; | |||
left: 0rpx; | |||
width: 100%; | |||
height: 100%; | |||
overflow: visible; | |||
} | |||
.canWrap canvas{ | |||
width: 690rpx; | |||
height: 450rpx; | |||
} |
@@ -1,3 +1,4 @@ | |||
@import "../../../app.wxss"; | |||
.container { | |||
background: #fff; | |||
width: 92%; | |||
@@ -3,6 +3,7 @@ const config = require("../../../config/config.js"); | |||
const Http = require("../../../utils/HttpBasics"); | |||
let app = getApp(); | |||
const imgurl = require("../../../utils/imgurl"); | |||
const QR = require("../../../utils/memberqrcode.js"); | |||
//券详情页面 | |||
Page({ | |||
data: { | |||
@@ -165,7 +166,8 @@ Page({ | |||
TYPE:"couponorder", | |||
ID: options.quancode | |||
}) | |||
util.qrcode("qrcode", url, 350, 350); | |||
// util.qrcode("qrcode", url, 350, 350); | |||
that.createQrCode(url, "qrcode", 350, 350); | |||
}) | |||
.catch(err => { | |||
wx.showToast({ | |||
@@ -176,6 +178,15 @@ Page({ | |||
}); | |||
}) | |||
}, | |||
createQrCode: function (url, canvasId, cavW, cavH) { | |||
//调用插件中的draw方法,绘制二维码图片 | |||
let that = this; | |||
QR.api.draw(url, canvasId, cavW, cavH, function (res) { | |||
that.setData({ | |||
tempFilePath: res | |||
}) | |||
}); | |||
}, | |||
phone: function (e) { | |||
let that = this; | |||
if (e.currentTarget.dataset.merchantlinkphone) { | |||
@@ -36,9 +36,13 @@ | |||
<image wx:if="{{data.couponOrderStatus==3}}" src="{{wm03Url}}" mode='widthFix'></image> | |||
<image wx:if="{{data.couponOrderStatus==0&&data.validStatus==0}}" src="{{wm04Url}}" mode='widthFix'></image> | |||
<view class="panel" wx:if="{{data.couponOrderStatus==0&&data.validStatus!=0}}"> | |||
<view class="qrcode"> | |||
<!-- <view class="qrcode"> | |||
<canvas canvas-id="qrcode" /> | |||
</view> --> | |||
<view class="canWrap"> | |||
<canvas canvas-id="qrcode" style="width: 1200rpx; height: 800rpx;" /> | |||
</view> | |||
<image src="{{tempFilePath}}" mode="aspectFit" /> | |||
<view class="barnum buy"> | |||
<text>优惠券码:</text>{{code}}</view> | |||
</view> | |||
@@ -2,7 +2,6 @@ const extConfig = wx.getExtConfigSync ? wx.getExtConfigSync() : {} | |||
const Http = require("../../utils/HttpBasics"); | |||
const imgurl = require("../../utils/imgurl"); | |||
const config = require("../../config/config"); | |||
const QR = require("../../utils/memberqrcode.js"); | |||
let app = getApp(); | |||
Page({ | |||
/** | |||
@@ -1,8 +1,9 @@ | |||
let util = require("../../utils/util"); | |||
// let util = require("../../utils/util"); | |||
let Http = require("../../utils/HttpBasics"); | |||
let config = require("../../config/config.js"); | |||
let app = getApp(); | |||
const imgurl = require("../../utils/imgurl"); | |||
const QR = require("../../utils/memberqrcode.js"); | |||
Page({ | |||
data: { | |||
lineUrl: imgurl.line.url, | |||
@@ -51,9 +52,8 @@ Page({ | |||
}, | |||
onLoad: function (options) { | |||
let that = this; | |||
console.log(options) | |||
let value = JSON.stringify({ END: "C", TYPE: "couponorder", ID: options.quancode}) | |||
util.qrcode("qrcode", value, 350, 350); | |||
that.createQrCode(value, "qrcode", 350, 350); | |||
that.setData({ | |||
code: options.quancode, | |||
title: options.title, | |||
@@ -131,14 +131,15 @@ Page({ | |||
* 1 已经核销成功 | |||
*/ | |||
}, | |||
// onShow(options) { | |||
// console.log("屏幕的亮度") | |||
// setTimeout(function () { | |||
// wx.setScreenBrightness({ | |||
// value: 1, | |||
// }) | |||
// }, 200) | |||
// }, | |||
createQrCode: function (url, canvasId, cavW, cavH) { | |||
//调用插件中的draw方法,绘制二维码图片 | |||
let that = this; | |||
QR.api.draw(url, canvasId, cavW, cavH, function (res) { | |||
that.setData({ | |||
tempFilePath: res | |||
}) | |||
}); | |||
}, | |||
onUnload: function () { | |||
let that = this; | |||
clearInterval(that.data.setInter); | |||
@@ -2,6 +2,7 @@ | |||
<view class="title">{{title}}</view> | |||
<view class="subtitle">{{subtitle}}</view> | |||
<image class='line' src='{{lineUrl}}' mode="widthFix"></image> | |||
<!-- | |||
couponorderstatus | |||
0 未使用 | |||
@@ -16,9 +17,10 @@ | |||
<image wx:if="{{couponorderstatus==3}}" src="{{wm03Url}}" mode='widthFix'></image> | |||
<image wx:if="{{couponorderstatus==0&&validStatus==0}}" src="{{wm04Url}}" mode='widthFix'></image> | |||
<view class="panel" wx:if="{{couponorderstatus==0&&validStatus!=0}}"> | |||
<view class="qrcode"> | |||
<canvas canvas-id="qrcode" /> | |||
<view class="canWrap"> | |||
<canvas canvas-id="qrcode" style="width: 1200rpx; height: 800rpx;" /> | |||
</view> | |||
<image src="{{tempFilePath}}" mode="aspectFit" /> | |||
<view class="barnum buy"><text>兑换码:</text>{{code}}</view> | |||
</view> | |||
</view> | |||
@@ -1,3 +1,4 @@ | |||
@import "../../app.wxss"; | |||
page { | |||
background: #02c0ff; | |||
} | |||
@@ -37,13 +38,12 @@ page { | |||
} | |||
.panel, .zhuangtai image { | |||
width:600rpx; | |||
display:block; | |||
border-radius:10rpx; | |||
margin:0 auto; | |||
padding:0; | |||
z-index:10000000000; | |||
width:500rpx; | |||
display:block; | |||
border-radius:10rpx; | |||
margin:0 auto; | |||
padding:0; | |||
z-index:10000000000; | |||
} | |||
.pane2 { | |||
@@ -2,9 +2,7 @@ var config = require("../../config/config.js"); | |||
var app = getApp(); | |||
const Http = require("../../utils/HttpBasics"); | |||
const QR = require("../../utils/memberqrcode.js"); | |||
const BR = require("../../utils/barcode.js"); | |||
const imgurl = require("../../utils/imgurl"); | |||
const util = require("../../utils/util"); | |||
Page({ | |||
/** | |||
* 页面的初始数据 | |||
@@ -27,6 +25,7 @@ Page({ | |||
*/ | |||
onShow: function () { | |||
let that = this; | |||
console.log("渲染开始") | |||
Http.get({ | |||
url: config.api.getDiscountInfo, | |||
data: {} | |||
@@ -36,6 +35,7 @@ Page({ | |||
level: res.data.level ? res.data.level : '' | |||
}) | |||
that.qrcode(res.data.id); | |||
that.setData({ | |||
memberId: res.data.id | |||
}) | |||
@@ -51,6 +51,7 @@ Page({ | |||
}) | |||
}) | |||
}, | |||
goback: function () { | |||
wx.switchTab({ | |||
url: '/pages/main/index', | |||
@@ -68,18 +69,22 @@ Page({ | |||
ID: memberId, | |||
}); | |||
that.createQrCode(url, "mycanvas2", size.w, size.h); | |||
// util.barcode('barcode',memberId, 600, 150); | |||
}, | |||
createQrCode: function (url, canvasId, cavW, cavH) { | |||
//调用插件中的draw方法,绘制二维码图片 | |||
QR.api.draw(url, canvasId, cavW, cavH); | |||
let that = this; | |||
QR.api.draw(url, canvasId, cavW, cavH,function(res){ | |||
that.setData({ | |||
tempFilePath: res | |||
}) | |||
}); | |||
}, | |||
//适配不同屏幕大小的canvas | |||
setCanvasSize: function () { | |||
var size = {}; | |||
try { | |||
var res = wx.getSystemInfoSync(); | |||
var scale = 750 / 300; | |||
var scale = 750 / 400; | |||
//不同屏幕下canvas的适配比例;设计稿是750宽 | |||
var width = res.windowWidth / scale; | |||
var height = width; | |||
@@ -1,8 +1,9 @@ | |||
<button class='goback' bindtap='goback'><image src='{{wmhome}}' mode="widthFix"></image></button> | |||
<view class='code'> | |||
<!-- <text style='margin-bottom:20rpx;'>会员码</text> --> | |||
<!-- <canvas canvas-id="barcode" id='barcode' /> --> | |||
<canvas canvas-id="mycanvas2" id='mycanvas2' /> | |||
<view class="canWrap"> | |||
<canvas canvas-id="mycanvas2" style="width: 1200rpx; height: 800rpx;" /> | |||
</view> | |||
<image src="{{tempFilePath}}" mode="aspectFit" /> | |||
<text>会员码:{{memberId}}</text> | |||
</view> | |||
<view class='con'> | |||
@@ -1,3 +1,4 @@ | |||
@import "../../app.wxss"; | |||
Page{ | |||
background: #fc5b24; | |||
} | |||
@@ -132,7 +133,7 @@ Page{ | |||
background: #fff; | |||
margin: 0 auto; | |||
border-radius:10rpx; | |||
padding: 10rpx 0 40rpx; | |||
padding: 20rpx 0 40rpx; | |||
} | |||
.code text{ | |||
color: #666; | |||
@@ -144,4 +145,9 @@ Page{ | |||
width: 600rpx; | |||
height: 150rpx; | |||
margin: 0 auto 10rpx; | |||
} | |||
.code image{ | |||
display: block; | |||
width: 500rpx; | |||
margin: 0 auto; | |||
} |
@@ -16,6 +16,7 @@ Page({ | |||
activeUrl: imgurl.active.url, | |||
dingUrl: imgurl.ding.url, | |||
quansUrl: imgurl.quans.url, | |||
wmintegral: imgurl.wmintegral.url, | |||
cardiconUrl: imgurl.cardicon.url, | |||
cheUrl: imgurl.che.url, | |||
giftUrl: imgurl.gift.url, | |||
@@ -73,7 +73,7 @@ | |||
<navigator url="/pages/integralmall/index"> | |||
<view class="user-btn app-border-bottom"> | |||
<view> | |||
<image class='icons' src="{{cardiconUrl}}" mode='widthFix'></image>积分商城</view> | |||
<image class='icons' src="{{wmintegral}}" mode='widthFix'></image>积分商城</view> | |||
<view> | |||
<text class="couponnum" wx:if="{{couponNum2=='couponNum2'}}"></text> | |||
<text class="iconfont icon-right"></text> | |||
@@ -49,11 +49,11 @@ module.exports = { | |||
'name': '' | |||
}, | |||
'cardicon': { | |||
'url': baseUrl + 'cardicon.png', | |||
'url': baseUrl + 'cardicon1.png', | |||
'name': '' | |||
}, | |||
'che': { | |||
'url': baseUrl + 'che.png', | |||
'url': baseUrl + 'che1.png', | |||
'name': '' | |||
}, | |||
'choice': { | |||
@@ -77,7 +77,7 @@ module.exports = { | |||
'name': '' | |||
}, | |||
'ding': { | |||
'url': baseUrl + 'ding.png', | |||
'url': baseUrl + 'ding1.png', | |||
'name': '' | |||
}, | |||
'dingdan': { | |||
@@ -237,11 +237,11 @@ module.exports = { | |||
'name': '' | |||
}, | |||
'quan': { | |||
'url': baseUrl + 'quan.png', | |||
'url': baseUrl + 'quan1.png', | |||
'name': '' | |||
}, | |||
'quans': { | |||
'url': baseUrl + 'quans.png', | |||
'url': baseUrl + 'quans1.png', | |||
'name': '' | |||
}, | |||
'ques_bg': { | |||
@@ -265,7 +265,7 @@ module.exports = { | |||
'name': '' | |||
}, | |||
'rule': { | |||
'url': baseUrl + 'rule.png', | |||
'url': baseUrl + 'rule1.png', | |||
'name': '' | |||
}, | |||
'shanchuGray': { | |||
@@ -329,7 +329,7 @@ module.exports = { | |||
'name': '' | |||
}, | |||
'wenti': { | |||
'url': baseUrl + 'wenti.png', | |||
'url': baseUrl + 'wenti1.png', | |||
'name': '' | |||
}, | |||
'wm01': { | |||
@@ -498,11 +498,11 @@ module.exports = { | |||
}, | |||
'wmbarginicon': { | |||
'url': baseUrl + 'wmbarginicon.png', | |||
'url': baseUrl + 'wmbarginicon1.png', | |||
'name': '我的砍价' | |||
}, | |||
'wmspellgroup': { | |||
'url': baseUrl + 'wmspellgroup.png', | |||
'url': baseUrl + 'wmspellgroup1.png', | |||
'name': '我的拼团' | |||
}, | |||
'leftarrows': { | |||
@@ -564,5 +564,9 @@ module.exports = { | |||
'wangmeimeicredit':{ | |||
'url': baseUrl + "wangmeimeicredit.png", | |||
'name': '积分背景' | |||
}, | |||
'wmintegral': { | |||
'url': baseUrl + "wmintegral.png", | |||
'name': '积分商城' | |||
} | |||
} |
@@ -750,7 +750,7 @@ | |||
/** | |||
* 新增$this参数,传入组件的this,兼容在组件中生成 | |||
*/ | |||
draw: function (str, canvas, cavW, cavH, $this, ecc) { | |||
draw: function (str, canvas, cavW, cavH,cb,$this, ecc) { | |||
var that = this; | |||
ecclevel = ecc || ecclevel; | |||
canvas = canvas || _canvas; | |||
@@ -763,9 +763,9 @@ | |||
str = that.utf16to8(str);//增加中文显示 | |||
var frame = that.getFrame(str), | |||
// 组件中生成qrcode需要绑定this | |||
ctx = wx.createCanvasContext(canvas,$this), | |||
px = Math.round(size / (width + 8)); | |||
// 组件中生成qrcode需要绑定this | |||
ctx = wx.createCanvasContext(canvas,$this), | |||
px = Math.round(size / (width + 8)); | |||
var roundedSize = px * (width + 8), | |||
offset = Math.floor((size - roundedSize) / 2); | |||
size = roundedSize; | |||
@@ -780,10 +780,28 @@ | |||
} | |||
} | |||
} | |||
ctx.draw(); | |||
ctx.draw(false, setTimeout(function () { | |||
wx.canvasToTempFilePath({ | |||
x: 0, | |||
y: 0, | |||
width: cavW, | |||
height: cavH, | |||
destWidth: cavW, | |||
destHeight: cavH, | |||
canvasId: canvas, | |||
fail: function (res) { | |||
console.log(res) | |||
}, | |||
success: function (res) { | |||
console.log(res.tempFilePath) | |||
if (cb) { | |||
cb(res.tempFilePath); | |||
}; | |||
} | |||
}) | |||
},200)); | |||
} | |||
} | |||
module.exports = { api } | |||
// exports.draw = api; | |||
})(); |