Commit b7cefa1a by 高淑倩

modify: 优惠券条形码自适应

parent e9c33082
...@@ -25,7 +25,7 @@ wxService.page({ ...@@ -25,7 +25,7 @@ wxService.page({
}) })
this.getCouponDetail(cardno) this.getCouponDetail(cardno)
// 条形码 // 条形码
wxbarcode.barcode('barcode',cardno, 550, 150); wxbarcode.barcode('barcode', cardno, 600, 180);
}, },
// 查询单个优惠券 // 查询单个优惠券
......
<!--pages/userCenter.wxml--> <!--pages/userCenter.wxml-->
<view class='page-couponDetail'> <!--<view class='page-couponDetail'>
<view class='coupon-detail-content'> <view class='coupon-detail-content'>
<view class='coupon-detail-header'> <view class='coupon-detail-header'>
<view class='avatar-img'> <view class='avatar-img'>
...@@ -11,11 +11,28 @@ ...@@ -11,11 +11,28 @@
<image src='/assets/imgs/line.png'></image> <image src='/assets/imgs/line.png'></image>
</view> </view>
<view class='qr-code'> <view class='qr-code'>
<!-- <view class='top-code'>987876786</view>-->
<view class='code-img'> <view class='code-img'>
<canvas canvas-id="barcode" /> <canvas canvas-id="barcode" />
</view> </view>
<view class='bottom-code'>{{cardno}}</view> <view class='bottom-code'>{{cardno}}</view>
</view> </view>
</view> </view>
</view> </view>-->
<view class="container-coupon page">
<view class="panel">
<view class="qrcode">
<view class='avatar-img'>
<image src='/assets/imgs/avatar.png'></image>
</view>
<view class='title fs-36'>{{couponDetailTitle}}</view>
</view>
<view class='line'>
<image src='/assets/imgs/line.png'></image>
</view>
<view class="barcode">
<canvas canvas-id="barcode" />
</view>
<view class='bottom-code'>{{cardno}}</view>
</view>
</view>
\ No newline at end of file
/* pages/couponDetail/couponDetail.wxss */ /* pages/couponDetail/couponDetail.wxss */
canvas{ @import './../../base/base.wxss';
height: 80px!important; page {
background-color: #fff;
} }
.coupon-detail-content{ .page {
width: 642rpx; display: flex;
margin: 52rpx auto; flex-direction: column;
text-align: center; justify-content: center;
box-shadow: 0 0 30rpx 10rpx rgba(0,0,0,0.1); align-items: center;
} }
.avatar-img image{
width: 81rpx; .container-coupon {
height: 81rpx; padding-bottom: 10rpx;
margin-top: 58rpx;
} }
.title{
color: #333333; .panel {
margin-top: 66rpx; width:642rpx;
display: flex;
flex-direction: column;
justify-content: space-between;
align-items: stretch;
margin: 52rpx 60rpx;
box-sizing: border-box;
border-radius: 10rpx;
background-color: #fff;
box-shadow: 0 0 30rpx 10rpx rgba(0,0,0,0.1);
} }
.line image{
width: 642rpx; .barcode {
height: 42rpx; display: flex;
margin: 80rpx 0; height: 320rpx;
flex-direction: column;
justify-content: center;
align-items: center;
padding:0 20rpx;
box-sizing: border-box;
} }
.top-code{
font-size: 24rpx; .barnum {
color: #999999; width: 670rpx;
height: 100rpx;
line-height: 100rpx;
font-size: 38rpx;
font-weight: bold;
text-align: center;
letter-spacing: 10rpx;
white-space: nowrap;
} }
.code-img image{
.barcode > canvas {
width: 600rpx; width: 600rpx;
height: 150rpx; height: 200rpx;
} }
.code-img{
margin-top: 30rpx; .qrcode {
margin-left: 10px; display: flex;
flex-direction: column;
justify-content: flex-end;
align-items: center;
} }
.bottom-code{ .bottom-code{
font-size: 40rpx; font-size: 40rpx;
color: #05c35b; color: #05c35b;
display: flex;
flex-direction: column;
justify-content: flex-end;
align-items: center;
margin-top: 30rpx; margin-top: 30rpx;
padding-bottom: 140rpx;
}
.avatar-img image{
width: 81rpx;
height: 81rpx;
margin-top: 58rpx;
} }
.qr-code{ .title{
padding-bottom: 150rpx; color: #333333;
margin-top: 66rpx;
}
.line image{
width: 100%;
height: 42rpx;
margin: 40rpx 0;
} }
...@@ -60,6 +60,7 @@ wxService.page({ ...@@ -60,6 +60,7 @@ wxService.page({
this.getMemberPointInfo() this.getMemberPointInfo()
// 优惠券数量 // 优惠券数量
this.getMemberCouponInfo() this.getMemberCouponInfo()
}, },
// 查询积分信息 // 查询积分信息
getMemberPointInfo(){ getMemberPointInfo(){
......
{ {
"description": "项目配置文件", "description": "项目配置文件",
"packOptions": { "packOptions": {
...@@ -15,8 +14,8 @@ ...@@ -15,8 +14,8 @@
"compileType": "miniprogram", "compileType": "miniprogram",
"libVersion": "2.6.6", "libVersion": "2.6.6",
"appid": "wxc3b64b09b1d3dfc2", "appid": "wxc3b64b09b1d3dfc2",
"tempappid_wx":"wxc3b64b09b1d3dfc2", "tempappid_wx": "wxc3b64b09b1d3dfc2",
"tempappid_711":"wx358b56af62edbde1", "tempappid_711": "wx358b56af62edbde1",
"projectname": "7-Eleven", "projectname": "7-Eleven",
"debugOptions": { "debugOptions": {
"hidedInDevtools": [] "hidedInDevtools": []
...@@ -40,7 +39,7 @@ ...@@ -40,7 +39,7 @@
"list": [] "list": []
}, },
"miniprogram": { "miniprogram": {
"current": 12, "current": 3,
"list": [ "list": [
{ {
"id": -1, "id": -1,
...@@ -61,10 +60,10 @@ ...@@ -61,10 +60,10 @@
"query": "" "query": ""
}, },
{ {
"id": 6, "id": 3,
"name": "券码详情页", "name": "券码详情页",
"pathName": "pages/couponDetail/couponDetail", "pathName": "pages/couponDetail/couponDetail",
"query": "" "query": "cardno=24390355190533807720&title=新券"
}, },
{ {
"id": 7, "id": 7,
......
...@@ -47,7 +47,7 @@ function getAccountInfo() { ...@@ -47,7 +47,7 @@ function getAccountInfo() {
return accountInfo return accountInfo
} }
/*** /**
* 判断用户滑动 * 判断用户滑动
* 左滑还是右滑 * 左滑还是右滑
*/ */
...@@ -62,6 +62,26 @@ function getTouchData(endX, endY, startX, startY) { ...@@ -62,6 +62,26 @@ function getTouchData(endX, endY, startX, startY) {
} }
/** /**
* 全面屏
*/
function aspectRatio(h,w) {
let viewStyle = {}
let originalScale = h/w // view宽高比
wxService.getSystemInfo().then(res=>{
let windowscale = res.windowHeight/res.windowWidth
if(originalScale < windowscale){
viewStyle.width = res.windowWidth
viewStyle.height = (res.windowWidth * h) / w;
} else {
viewStyle.width = (res.windowHeight * w) / h
viewStyle.height = res.windowHeight
}
})
return viewStyle;
}
/**
* 解析 url 参数 * 解析 url 参数
*/ */
function parseUrl(query){ function parseUrl(query){
...@@ -241,5 +261,6 @@ module.exports = { ...@@ -241,5 +261,6 @@ module.exports = {
formatNumber: formatNumber, formatNumber: formatNumber,
logger: new Logger(), logger: new Logger(),
getTouchData, getTouchData,
getAccountInfo getAccountInfo,
aspectRatio
} }
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