Commit c86ac337 by zhangquan

二维码定位

1 parent 0f35ea2d
......@@ -58,6 +58,12 @@ class ActivityApi {
...data
})
}
getActivityVisitorList(data) {
return api.post({
method: `scrm.api.busassistant.activity.createQrCode`,
...data
})
}
}
export default ActivityApi
\ No newline at end of file
......@@ -2,6 +2,7 @@ const navStyle = "background-color: #fff";
import { senceData } from "~/pages/tab/discovery/constant/data";
import Draw from "~/utils/Draw.js";
import { IMG_URL } from "~/utils/constantData.js";
import ActivityApi from '~/api/activityApi/index'
const IMGURL = IMG_URL
Page({
/**
......@@ -11,7 +12,7 @@ Page({
navStyle,
headerHeight: 0,
senceData,
actNum: 0,
actNum: 3,
// 模态框
isShow: true,
......@@ -92,16 +93,15 @@ Page({
},
// 下载海报
download() {
if(this.data.posterUrl){
wx.saveImageToPhotosAlbum({
filePath: this.data.posterUrl, //仅为示例,并非真实的资源
success (res) {
console.log('res: ', res);
wx.$api.showToast('图片下载成功!')
}
})
}
this.modelClose();
},
//模态框关闭
......@@ -125,57 +125,56 @@ Page({
* 生命周期函数--监听页面加载
*/
onLoad(options) {
// actNum,activeNavIdx
let { actNum, imgHeightArr } = this.data;
//所有的长度
let imgAllHeight = imgHeightArr[actNum].reduce((total, current) => {
return total + current;
});
// 缺少视频的长度(前4张)+二维码的长度 (单位rpx)
let erCodeHeight =
imgHeightArr[actNum].slice(0, 4).reduce((total, current) => {
return total + current;
}) +
98 * 2;
console.log("imgAllHeight: ", imgAllHeight);
let W= 750 / 4
let H = imgAllHeight / 4
let drawFun = new Draw({
width: W,
height: H
});
console.log(`${IMGURL}scene/longpic${
actNum + 1
}.png`)
let imgList = [
{
x: 0,
y: 0,
width: W,
height: H,
url: `${IMGURL}scene/longpic${
actNum + 1
}.png`,
},
{
// x: 245*2,
// y: erCodeHeight-11,
x:0,
y:0,
width: 120*2,
height: 120*2,
url: `https://img02.glsx.com.cn/weapp/resource/saas/business-assistant/index/discovery_prod1.png`, //二维码
},
];
drawFun.begin({
imageList: imgList,
}).then(res => {
console.log('posterUrl.path',res)
this.setData({
posterUrl: res.path,
});
})
if(this.data.isShow){
let { actNum } = this.data;
let img = `${IMGURL}scene/longpic${actNum + 1}.png`
wx.showLoading({
title: '加载图片中',
})
wx.getImageInfo({
src: img,
success:(res)=> {
ActivityApi.getActivityVisitorList({
actNum, activeNavIdx: 0
}).then(response => {
let imgW = res.width/5, imgH =res.height/5;
this.setData({
imgH: (imgH/imgW)*450
})
let drawFun = new Draw({
width: imgW,
height: imgH
});
let imgList = [
{
x: 0,
y: 0,
width: imgW,
height: imgH,
url: img,
},
{
x:imgW-64,
y: imgH-496-64,
width: 64,
height: 64,
url: response, //二维码
},
];
drawFun.begin({
imageList: imgList,
}).then(resp => {
console.log('posterUrl.path',resp)
this.setData({
posterUrl: resp.path,
});
wx.hideLoading()
})
console.log(response,'response')
})
}
})
}
},
/**
......
......@@ -15,8 +15,8 @@ page{
top: 20%;
left: 50%;
transform: translateX(-50%);
width: 225px;
height: 311px;
width: 450rpx;
height: 622rpx;
// background-color: red;
overflow: auto;
.img {
......@@ -31,23 +31,23 @@ page{
left: 0;
bottom: 0;
width: 100%;
height: 154px;
height: 308rpx;
background: #ffffff;
border-radius: 8px 8px 0 0;
border-radius: 16rpx 16rpx 0 0;
.top {
display: flex;
justify-content: space-around;
.btn {
padding-top: 16px;
padding-top: 32rpx;
}
.img {
display: block;
margin: 0 auto 8px;
width: 40px;
height: 40px;
margin: 0 auto 16rpx;
width: 80rpx;
height: 80rpx;
}
.name {
font-size: 12px;
font-size: 24rpx;
color: #323436;
text-align: center;
line-height: 32rpx;
......@@ -63,12 +63,12 @@ page{
}
}
.btom {
margin: 18px auto 0;
width: 343px;
height: 44px;
line-height: 44px;
border: 1px solid #eeeeee;
border-radius: 4px;
margin: 36rpx auto 0;
width: 686rpx;
height: 88rpx;
line-height: 88rpx;
border: 2rpx solid #eeeeee;
border-radius: 8rpx;
text-align: center;
}
}
......
......@@ -7,14 +7,13 @@
<product actNum="{{actNum}}" senceData="{{senceData}}" isShare="{{true}}"/>
<!-- 分享弹框 -->
<view class="share-wrap" wx:if="{{isShow}}">
<view class="img-wrap">
<image class="img" style="height:{{imgHeight}}px" src="{{posterUrl}}" bindload="onloadFn" />
<view class="img-wrap" wx:if="{{posterUrl}}">
<image class="img" style="height:{{imgH}}rpx" src="{{posterUrl}}" bindload="onloadFn" />
<!-- <block wx:for="{{imgList}}" wx:key="*this">
<image class="img" src="{{item}}"/>
</block> -->
</view>
<button></button>
<view class="btns">
<view class="btns" wx:if="{{posterUrl}}">
<view class="top">
<view class="btn" wx:for="{{btnList}}" wx:key="name" bindtap="handleClick" data-index="{{index}}">
<block wx:if="{{index == 0}}">
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!