From 4b29db5ec67fe0a7d2a6102eff3567219bfb8e81 Mon Sep 17 00:00:00 2001
From: meo <18801474720@163.com>
Date: Sun, 28 Apr 2019 20:41:38 +0800
Subject: [PATCH] =?UTF-8?q?[=E4=BA=8C=E7=BB=B4=E7=A0=81=EF=BC=8C=E5=9B=BE?=
=?UTF-8?q?=E6=A0=87][=E4=BF=AE=E6=94=B9]:[=E4=BA=8C=E7=BB=B4=E7=A0=81?=
=?UTF-8?q?=E5=92=8C=E5=9B=BE=E6=A0=87=E7=9A=84=E9=9C=80=E6=94=B9]?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app.wxss | 12 +++++++++
pages/cardorder/detail/index.wxss | 1 +
pages/couponorder/detail/index.js | 13 +++++++++-
pages/couponorder/detail/index.wxml | 6 ++++-
pages/index/index.js | 1 -
pages/orderquanma/index.js | 23 +++++++++--------
pages/orderquanma/index.wxml | 6 +++--
pages/orderquanma/index.wxss | 14 +++++-----
pages/specialcourtesy/specialcourtesy.js | 15 +++++++----
pages/specialcourtesy/specialcourtesy.wxml | 7 ++---
pages/specialcourtesy/specialcourtesy.wxss | 8 +++++-
pages/user/index.js | 1 +
pages/user/index.wxml | 2 +-
utils/imgurl.js | 22 +++++++++-------
utils/memberqrcode.js | 30 +++++++++++++++++-----
15 files changed, 113 insertions(+), 48 deletions(-)
diff --git a/app.wxss b/app.wxss
index e3106eb..1bdde14 100644
--- a/app.wxss
+++ b/app.wxss
@@ -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;
+}
diff --git a/pages/cardorder/detail/index.wxss b/pages/cardorder/detail/index.wxss
index e4bd287..4b2d85e 100644
--- a/pages/cardorder/detail/index.wxss
+++ b/pages/cardorder/detail/index.wxss
@@ -1,3 +1,4 @@
+@import "../../../app.wxss";
.container {
background: #fff;
width: 92%;
diff --git a/pages/couponorder/detail/index.js b/pages/couponorder/detail/index.js
index 768ba8a..484b970 100644
--- a/pages/couponorder/detail/index.js
+++ b/pages/couponorder/detail/index.js
@@ -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) {
diff --git a/pages/couponorder/detail/index.wxml b/pages/couponorder/detail/index.wxml
index 5fd2532..e033f73 100644
--- a/pages/couponorder/detail/index.wxml
+++ b/pages/couponorder/detail/index.wxml
@@ -36,9 +36,13 @@
-
+
+
+
+
优惠券码:{{code}}
diff --git a/pages/index/index.js b/pages/index/index.js
index b4176dc..4f7ea9c 100644
--- a/pages/index/index.js
+++ b/pages/index/index.js
@@ -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({
/**
diff --git a/pages/orderquanma/index.js b/pages/orderquanma/index.js
index a442e18..1b54735 100644
--- a/pages/orderquanma/index.js
+++ b/pages/orderquanma/index.js
@@ -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);
diff --git a/pages/orderquanma/index.wxml b/pages/orderquanma/index.wxml
index 47f6ee8..4e43fc2 100644
--- a/pages/orderquanma/index.wxml
+++ b/pages/orderquanma/index.wxml
@@ -2,6 +2,7 @@
{{title}}
{{subtitle}}
+
-
-
+
+
+
+
会员码:{{memberId}}
diff --git a/pages/specialcourtesy/specialcourtesy.wxss b/pages/specialcourtesy/specialcourtesy.wxss
index 18d4976..ba2cb27 100644
--- a/pages/specialcourtesy/specialcourtesy.wxss
+++ b/pages/specialcourtesy/specialcourtesy.wxss
@@ -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;
}
\ No newline at end of file
diff --git a/pages/user/index.js b/pages/user/index.js
index 0a1b505..c4e5790 100644
--- a/pages/user/index.js
+++ b/pages/user/index.js
@@ -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,
diff --git a/pages/user/index.wxml b/pages/user/index.wxml
index d0ca51f..5352587 100644
--- a/pages/user/index.wxml
+++ b/pages/user/index.wxml
@@ -73,7 +73,7 @@
- 积分商城
+ 积分商城
diff --git a/utils/imgurl.js b/utils/imgurl.js
index d90a037..af57fc8 100644
--- a/utils/imgurl.js
+++ b/utils/imgurl.js
@@ -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': '积分商城'
}
}
\ No newline at end of file
diff --git a/utils/memberqrcode.js b/utils/memberqrcode.js
index 0eb5d61..bb7df5f 100644
--- a/utils/memberqrcode.js
+++ b/utils/memberqrcode.js
@@ -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;
-
})();
\ No newline at end of file