瀏覽代碼

feat(卡券):我的券优化

zhoumuhao 3 年之前
父節點
當前提交
feddbacdbb

+ 11 - 13
pages/activityInfo/activityInfo.js

@@ -1,5 +1,5 @@
 const { default: activity } = require("../../api/activity");
-import drawQrcode from '../../utils/weapp.qrcode.js'
+import QRCode from '../../utils/weapp-qrcode.js'
 Page({
 
   /**
@@ -130,19 +130,17 @@ Page({
     _self.setData({
       codeId:res.codeId,
     })
-
     //根据codeId 生成二维码
-    drawQrcode({
-      width: 200,
-      height: 200,
-      canvasId: 'myQrcode',
-      text: 'https://oapi.shpr.top?id='+_self.data.codeId,
-      image: {
-        imageResource: '../../images/logo.png',
-        dx: 70,
-        dy: 70,
-        dWidth: 60,
-        dHeight: 60
+    new QRCode('myQrcode',{
+      // text: 'https://oapi.shpr.top?id='+_self.data.codeId,
+      text: 'https://oapi.shpr.top?id=Bg5740r78w',
+      width: 150,
+      height:150,
+      padding: 10, // 生成二维码四周自动留边宽度,不传入默认为0
+      correctLevel: QRCode.CorrectLevel.L, // 二维码可辨识度
+      callback: (res) => {
+        console.log(res.path)
+        // 接下来就可以直接调用微信小程序的api保存到本地或者将这张二维码直接画在海报上面去,看各自需求
       }
     })
   }

+ 2 - 3
pages/activityInfo/activityInfo.wxss

@@ -60,9 +60,8 @@ Page {
   margin-top: 15px;
 }
 .qrcode-img{
-  width: 146px;
-  height: 146px;
   margin-top: 28px;
+  margin-left: 300rpx;
 }
 .qrcode-title{
   width: 200px;
@@ -88,4 +87,4 @@ Page {
   height: 14px;
   font-weight: 400;
   color: #444444;
-}
+}

+ 2 - 1
pages/myCoupons/myCoupons.wxml

@@ -1,6 +1,6 @@
 <!--我的卡券-->
 <view class="coupon_outer">
-  <view class="coupon_li" wx:for="{{couponList}}" wx:for-index="index" wx:for-item="item">
+  <view class="coupon_li" wx:if="{{couponList.length>0}}" wx:for="{{couponList}}" wx:for-index="index" wx:for-item="item">
   <block wx:if="{{item.isFree==false}}">
     <view class="coupon_type" wx:if="{{item.coupon.type.value=='D'}}">折</view>
     <view class="coupon_type" wx:if="{{item.coupon.type.value=='C'}}">元</view>
@@ -22,4 +22,5 @@
     </view>
     <view class="use-button" bindtap="goUseCoupon">去使用</view>
   </view>
+  <image class="no-data" wx:if="{{couponList.length<=0}}"  src="../../images/no_data.png"></image>
 </view>

+ 7 - 0
pages/myCoupons/myCoupons.wxss

@@ -88,4 +88,11 @@
 } 
 .coupon-title-free>view:first-child {
   margin-left: 30rpx;
+}
+.no-data {
+  display: block;
+  width: 80%;
+  height: 300rpx;
+  margin: 0 auto;
+  margin-top: 300rpx;
 }

+ 1 - 1
project.private.config.json

@@ -15,7 +15,7 @@
         {
           "name": "pages/activityInfo/activityInfo",
           "pathName": "pages/activityInfo/activityInfo",
-          "query": "id=Bg5740r78w",
+          "query": "id=Bg5740r78w&mobile=18636653274",
           "scene": null
         },
         {