优化推广码

master
chen 2022-08-17 15:52:02 +08:00
parent cdd874fe38
commit 27f402a493
5 changed files with 40 additions and 23 deletions

View File

@ -1,7 +1,7 @@
<template> <template>
<view> <view>
<view class="qrcode"> <view class="qrcode">
<canvas :style="{width:size+ 'px', height:size+ 'px', background:bgc}" canvas-id="couponQrcode"></canvas> <canvas :style="{width:size+ 'px', height:size+ 'px', background:bgc}" canvas-id="qrcode"></canvas>
</view> </view>
</view> </view>
</template> </template>
@ -68,7 +68,7 @@
} else { } else {
this.level = qrCode.CorrectLevel.L this.level = qrCode.CorrectLevel.L
} }
new qrCode('couponQrcode', { new qrCode('qrcode', {
text: this.text, text: this.text,
width: this.size, width: this.size,
height: this.size, height: this.size,
@ -80,15 +80,17 @@
usingIn: this //this usingIn: this //this
}) })
// //
uni.canvasToTempFilePath({ setTimeout(()=>{
canvasId: 'couponQrcode', uni.canvasToTempFilePath({
success: (res) => { canvasId: 'qrcode',
// H5tempFilePath base64 success: (res) => {
// console.log('yz-qr:', res.tempFilePath) // H5tempFilePath base64
this.canvasQrPath = res.tempFilePath // console.log('yz-qr:', res.tempFilePath)
this.$emit('update:qrPath', this.canvasQrPath) this.canvasQrPath = res.tempFilePath
} this.$emit('update:qrPath', this.canvasQrPath)
}, this); }
},that);
},200)
console.log('绘制完成'); console.log('绘制完成');
} }
@ -98,9 +100,9 @@
<style> <style>
.qrcode { .qrcode {
padding: 24rpx;
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
opacity: 0;
} }
</style> </style>

View File

@ -48,7 +48,7 @@
this.getCouresList(); this.getCouresList();
}, },
onReachBottom() { onReachBottom() {
if(this.total!=this.dataList.lenght){ if(this.total!=this.dataList.length){
this.page++; this.page++;
this.getCouresList(); this.getCouresList();
} }

View File

@ -2,10 +2,14 @@
<view> <view>
<status-container titlet="我的推广" returnc="#FFFFFF"> <status-container titlet="我的推广" returnc="#FFFFFF">
<view slot="content" style="margin-top: -20rpx;" v-if="loading"> <view slot="content" style="margin-top: -20rpx;" v-if="loading">
<view class="bacf pad-zy20 boxshow2"> <view class="bacf pad-zy20 boxshow2 posi-sticky" :style="{top:newtop+'px'}">
<view class="disjcac pad-sx30 bbot"> <view class="disjcac pad-sx30 bbot">
<!-- <image :src="personCode" mode="aspectFill" style="width: 242rpx;height: 242rpx;" lazy-load></image> --> <view v-if="personCode" class="">
<yz-qr ref="qrPath" :text="textstr" :size="124" :colorDark="'#000000'" :colorLight="'#FFFFFF'"></yz-qr> <image :src="personCode" mode="aspectFill" style="width: 124px;height: 124px;" lazy-load></image>
</view>
<view class="" v-else>
<yz-qr @update:qrPath="getPath" ref="qrPath" :text="textstr" :size="124" :colorDark="'#000000'" :colorLight="'#FFFFFF'"></yz-qr>
</view>
</view> </view>
<view class="disjbac pad-sx20 pad-zy10"> <view class="disjbac pad-sx20 pad-zy10">
<view class="fon22 col26">推广获取积分</view> <view class="fon22 col26">推广获取积分</view>
@ -44,6 +48,7 @@
}, },
data() { data() {
return { return {
newtop:uni.getSystemInfoSync().statusBarHeight + 42,
dataList:[], dataList:[],
page:1, page:1,
size:20, size:20,
@ -62,13 +67,16 @@
this.getExtend(); this.getExtend();
}, },
onReachBottom() { onReachBottom() {
if(this.total!=this.dataList.lenght){ if(this.total!=this.dataList.length){
this.page++; this.page++;
this.getExtend(); this.getExtend();
} }
}, },
methods: { methods: {
// 广 getPath(path){
this.personCode = path;
},
// 广
getExtend(){ getExtend(){
let params = { let params = {
action:'order', action:'order',

View File

@ -25,7 +25,7 @@
<view class="pad-zy20"> <view class="pad-zy20">
<view class="posir bacf disac fw pad-zy10 boxshow2 pad-x30" style="z-index: 1;"> <view class="posir bacf disac fw pad-zy10 boxshow2 pad-x30" style="z-index: 1;">
<view class="disjbac bbot width100 pad-sx20 pad-zy30" v-for="(item,index) in dataList" :key="index"> <view class="disjbac bbot width100 pad-sx20 pad-zy30" v-for="(item,index) in dataList" :key="index">
<view class="fon24 col-e42417">{{item.num}}</view> <view class="fon24 col-e42417">+{{item.num}}</view>
<view class="fon20" style="color: #676767;" v-if="item.created_at">{{item.created_at.slice(0,10).split('-').join('.')}}</view> <view class="fon20" style="color: #676767;" v-if="item.created_at">{{item.created_at.slice(0,10).split('-').join('.')}}</view>
</view> </view>
</view> </view>

View File

@ -4,8 +4,12 @@
<view slot="content" style="margin-top: -20rpx;"> <view slot="content" style="margin-top: -20rpx;">
<view class="bacf pad-zy20 boxshow2"> <view class="bacf pad-zy20 boxshow2">
<view class="disjcac pad-sx30 bbot"> <view class="disjcac pad-sx30 bbot">
<!-- <image :src="personCode" mode="aspectFill" style="width: 242rpx;height: 242rpx;" lazy-load></image> --> <view v-if="personCode" class="">
<yz-qr ref="qrPath" :text="textstr" :size="124" :colorDark="'#000000'" :colorLight="'#FFFFFF'"></yz-qr> <image :src="personCode" mode="aspectFill" style="width: 124px;height: 124px;" lazy-load></image>
</view>
<view class="" v-else>
<yz-qr @update:qrPath="getPath" ref="qrPath" :text="textstr" :size="124" :colorDark="'#000000'" :colorLight="'#FFFFFF'"></yz-qr>
</view>
</view> </view>
<view class="disjbac fon24 col26 pad-sx20 pad-zy10"> <view class="disjbac fon24 col26 pad-sx20 pad-zy10">
<view class="">代理登记</view> <view class="">代理登记</view>
@ -68,13 +72,16 @@
this.getExtend(); this.getExtend();
}, },
onReachBottom() { onReachBottom() {
if(this.total!=this.dataList.lenght){ if(this.total!=this.dataList.length){
this.page++; this.page++;
this.getExtend(); this.getExtend();
} }
}, },
methods: { methods: {
// 广 getPath(path){
this.personCode = path;
},
// 广
getExtend(){ getExtend(){
let params = { let params = {
action:'order', action:'order',