Commit c86ac337 by zhangquan

二维码定位

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