Commit 9f28d9de by 前端

Merge branch 'v3.0' into 'zhangxw_dev_3.0'

V3.0

See merge request !33
2 parents 74e2c989 c6e2f5d0
...@@ -66,6 +66,12 @@ class ActivityApi { ...@@ -66,6 +66,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
// pages/checkProduct/checkProduct.js
// const navStyle = "background-color: transparent;";
import { IMG_URL } from "~/utils/constantData.js";
const navStyle = "background-color: #fff"; 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 { IMG_URL } from "~/utils/constantData.js";
import ActivityApi from '~/api/activityApi/index'
const IMGURL = IMG_URL
Page({ Page({
/** /**
* 页面的初始数据 * 页面的初始数据
...@@ -12,8 +12,44 @@ Page({ ...@@ -12,8 +12,44 @@ Page({
navStyle, navStyle,
headerHeight: 0, headerHeight: 0,
senceData, senceData,
actNum: 3,
// 模态框 // 模态框
isShow: true, isShow: true,
btnList: [
{
src: `${IMGURL}wechat.png`,
name: "微信转发",
},
{
src: `${IMGURL}down.png`,
name: "下载为海报",
},
],
imgHeightArr: [
[1110, 1290, 596, 744, 490, 1532],
[2168, 1290, 596, 830, 490, 752],
[1110, 1290, 596, 984, 490],
[678, 1266, 1398, 830, 490, 1666],
],
posterUrl: "", //海报url
},
observers: {
actNum: function (actNum) {
let imgList = [
`${IMGURL}index/scene${actNum + 1}1.png`,
`${IMGURL}index/scene${actNum + 1}2.png`,
`${IMGURL}index/scene${actNum + 1}3.png`,
`${IMGURL}index/scene${actNum + 1}4.png`,
`${IMGURL}index/scene${actNum + 1}5.png`,
];
if (actNum != 2) {
imgList.push(`${IMGURL}index/scene${actNum + 1}6.png`);
}
this.setData({
imgList,
});
},
}, },
navbarReady(e) { navbarReady(e) {
let { let {
...@@ -32,15 +68,52 @@ Page({ ...@@ -32,15 +68,52 @@ Page({
navStyle: scrollTop == 0 ? navStyle : `background-color:${color};` navStyle: scrollTop == 0 ? navStyle : `background-color:${color};`
}) })
}, },
modelcloseFn(e) { // 分享按钮
sharehandle() {
this.setData({ this.setData({
isShow: e.detail, isShow: true,
}); });
}, },
// 分享按钮 // 分享按钮
sharehandle() { handleClick(e) {
let { index } = e.currentTarget.dataset;
switch (index) {
case 0:
this.wechatFn();
break;
case 1:
this.download();
break;
}
},
// 微信转发
wechatFn() {
// this.data.onShareAppMessage()
this.modelClose();
},
// 下载海报
download() {
if(this.data.posterUrl){
wx.saveImageToPhotosAlbum({
filePath: this.data.posterUrl, //仅为示例,并非真实的资源
success (res) {
console.log('res: ', res);
wx.$api.showToast('图片下载成功!')
}
})
}
this.modelClose();
},
//模态框关闭
modelClose() {
this.setData({ this.setData({
isShow: true, isShow: false
});
},
// 图片加载事件
onloadFn(event) {
this.setData({
imgHeight: (event.detail.height * 0.2).toFixed(0),
}); });
}, },
onRouter(options) { onRouter(options) {
...@@ -52,7 +125,56 @@ Page({ ...@@ -52,7 +125,56 @@ Page({
* 生命周期函数--监听页面加载 * 生命周期函数--监听页面加载
*/ */
onLoad(options) { onLoad(options) {
// actNum,activeNavIdx 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')
})
}
})
}
}, },
/** /**
......
{ {
"usingComponents": { "usingComponents": {
"product": "../tab/discovery/components/product/product", "product": "../tab/discovery/components/product/product"
"shareModel":"../tab/discovery/components/shareModel/shareModel"
}, },
"navigationBarTitleText": "特色产品", "navigationBarTitleText": "特色产品",
"onReachBottomDistance": 10, "onReachBottomDistance": 10,
......
...@@ -2,3 +2,74 @@ ...@@ -2,3 +2,74 @@
page{ page{
background-color: #fff; background-color: #fff;
} }
.share-wrap {
position: fixed;
top: 0;
left: 0;
bottom: 0;
right: 0;
background: rgba(0, 0, 0, 0.5);
z-index: 1;
.img-wrap {
position: absolute;
top: 20%;
left: 50%;
transform: translateX(-50%);
width: 450rpx;
height: 622rpx;
// background-color: red;
overflow: auto;
.img {
width: 100%;
// height: auto;
height: 60%;
background-color: #fff;
}
}
.btns {
position: absolute;
left: 0;
bottom: 0;
width: 100%;
height: 308rpx;
background: #ffffff;
border-radius: 16rpx 16rpx 0 0;
.top {
display: flex;
justify-content: space-around;
.btn {
padding-top: 32rpx;
}
.img {
display: block;
margin: 0 auto 16rpx;
width: 80rpx;
height: 80rpx;
}
.name {
font-size: 24rpx;
color: #323436;
text-align: center;
line-height: 32rpx;
}
.btn-wechat{
width: auto;
margin: 0;
padding: 0;
background-color: #fff;
&::after{
border:none;
}
}
}
.btom {
margin: 36rpx auto 0;
width: 686rpx;
height: 88rpx;
line-height: 88rpx;
border: 2rpx solid #eeeeee;
border-radius: 8rpx;
text-align: center;
}
}
}
\ No newline at end of file \ No newline at end of file
...@@ -6,4 +6,28 @@ ...@@ -6,4 +6,28 @@
<product actNum="{{actNum}}" senceData="{{senceData}}" isShare="{{true}}"/> <product actNum="{{actNum}}" senceData="{{senceData}}" isShare="{{true}}"/>
<!-- 分享弹框 --> <!-- 分享弹框 -->
<shareModel actNum="{{actNum}}" isShow="{{isShow}}" bindmodelclose="modelcloseFn" /> <view class="share-wrap" wx:if="{{isShow}}">
<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>
<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}}">
<button open-type="share" class="btn-wechat">
<image class="img" src="{{item.src}}" />
<view class="name">{{item.name}}</view>
</button>
</block>
<block wx:else>
<image class="img" src="{{item.src}}" />
<view class="name">{{item.name}}</view>
</block>
</view>
</view>
<view class="btom" bindtap="modelClose">取消</view>
</view>
</view>
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!