Forráskód Böngészése

联调生成用户海报二维码

bayi 1 éve
szülő
commit
0cd9507434

A különbségek nem kerülnek megjelenítésre, a fájl túl nagy
+ 4 - 1
api/global.js


+ 12 - 4
components/createPoster/index.js

@@ -1,13 +1,21 @@
+import {
+    createWxCode
+} from '~/api/global'
 Component({
     properties: {},
     data: {
         state: false,
-        img: ''
+        qrCode: ''
     },
     methods: {
-        open() {
+        async open() {
+            let qrCode = await createWxCode({
+                page: "/pages/index/index",
+                scene: `?uid=${wx.getStorageSync('uid')}`
+            })
             this.setData({
-                state: true
+                state: true,
+                qrCode
             })
         },
         closeMediaBox() {
@@ -34,7 +42,7 @@ Component({
                     pic.onload = () => {
                         ctx.drawImage(pic, 0, 0, 646, 959);
                         let pl = canvas.createImage();
-                        pl.src = 'https://mp.weixin.qq.com/cgi-bin/showqrcode?ticket=gQEs8TwAAAAAAAAAAS5odHRwOi8vd2VpeGluLnFxLmNvbS9xLzAyZzR0ZTE2T2M5N1UxYURaYU5CY1QAAgSHoQplAwQgHAAA'
+                        pl.src = this.data.qrCode
                         pl.onload = async () => {
                             ctx.drawImage(pl, 29, 756, 170, 170)
                             let {

+ 9 - 0
components/createPoster/index.less

@@ -31,6 +31,15 @@
             border-radius: 20rpx;
             overflow: hidden;
         }
+
+        .qrCode {
+            position: absolute;
+            left: 40rpx;
+            bottom: 30rpx;
+            width: 170rpx;
+            height: 170rpx;
+            border-radius: 50%;
+        }
     }
 
     .btns {

+ 2 - 1
components/createPoster/index.wxml

@@ -2,9 +2,10 @@
     <view class="poster">
         <image src="/static/lollipop.png" class="close" catchtap="closeMediaBox" />
         <image src="https://reader-wx.ai160.com/images/reader/pay/shareBg.jpg" class="img" />
+        <image src="{{qrCode}}" class="qrCode"/>
     </view>
     <view class="btns">
-        <view class="btn">立即分享</view>
+        <view class="btn" bindtap="open">立即分享</view>
         <view class="btn" bindtap="savePoster" style="background: linear-gradient(180deg, #FFB382 0%, #FFA45D 100%);">
             保存海报
         </view>

+ 8 - 0
components/createPoster/index.wxss

@@ -28,6 +28,14 @@
   border-radius: 20rpx;
   overflow: hidden;
 }
+.mediaBox .poster .qrCode {
+  position: absolute;
+  left: 40rpx;
+  bottom: 30rpx;
+  width: 170rpx;
+  height: 170rpx;
+  border-radius: 50%;
+}
 .mediaBox .btns {
   position: absolute;
   bottom: 0;

+ 0 - 1
salesperson/pages/lxDetail/index.json

@@ -2,6 +2,5 @@
     "usingComponents": {
         "emptyBg": "/components/empty/index"
     },
-    "disableScroll": true,
     "navigationBarTitleText": "收益报表"
 }

+ 0 - 1
salesperson/pages/saleOffice/index.js

@@ -28,7 +28,6 @@ Page({
     },
     async onShow() {
         let allIncome = await getSaleData()
-        console.log(allIncome);
         this.setData({
             allIncome
         })