Commit 7739db9f by 谢中龙

修改字段

parent 1635f2b4
......@@ -122,8 +122,8 @@
"pages/scratch/scratch",
"pages/scratchRule/scratchRule",
"pages/sign/sign",
"pages/liveSubscrib/liveSubscrib",
"pages/activityOrder/activityOrder"
"pages/activityOrder/activityOrder",
"pages/activityPoster/activityPoster"
]
}
],
......
......@@ -11,7 +11,7 @@
<view class="brand-title">{{cardTitle}}</view>
</view>
<view class="card-img-wrap">
<image class="card-img" src="{{cardUrl}}" mode="aspectFit"></image>
<image class="card-img" src="{{cardUrl}}" mode="widthFix"></image>
</view>
<view wx:if="{{explainList.length}}">
<block wx:for="{{explainList}}" wx:for-item="item" wx:key="{{index}}">
......
......@@ -66,9 +66,10 @@
margin-top: 23rpx;
padding-bottom: 20rpx;
}
.card-img{
width: 100%;
/* height: 410rpx; */
min-height: 410rpx;
max-height: 530rpx;
}
......
......@@ -160,8 +160,21 @@ Component({
//处理活动预约
hanlderOrderActivity(info){
//判断用户是否已经预约过此活动
this.userHasOrderedActivity(info.id,info);
//判断活动是否可预约
wxService.post(`/marketing/bookingActivitySet/checkActivityTakeeffect?id=${info.id}`).then(res => {
if(res){
if(res.data.data){
//判断用户是否已经预约过此活动
this.userHasOrderedActivity(info.id,info);
}
else{
wx.showToast({
title: '不在活动预约时间范围内',
icon : 'none'
});
}
}
});
},
//判断活动是否已经预约过
userHasOrderedActivity(id,info){
......
......@@ -111,8 +111,21 @@ Component({
},
//处理活动预约
hanlderOrderActivity(info){
//判断用户是否已经预约过此活动
this.userHasOrderedActivity(info.id,info);
//判断活动是否可预约
wxService.post(`/marketing/bookingActivitySet/checkActivityTakeeffect?id=${info.id}`).then(res => {
if(res){
if(res.data.data){
//判断用户是否已经预约过此活动
this.userHasOrderedActivity(info.id,info);
}
else{
wx.showToast({
title: '不在活动预约时间范围内',
icon : 'none'
});
}
}
});
},
//判断活动是否已经预约过
userHasOrderedActivity(id,info){
......@@ -130,7 +143,6 @@ Component({
}
}
else{
console.log(data)
wx.showModal({
title : '预约成功',
showCancel: false,
......
......@@ -6,7 +6,7 @@
// 修改 BRANCH_ID 为对应的商户id
// app.js 中brandId 修改为对应
const PROJECT_ENV = 'dev' // 生产 prod, 开发 dev, 测试 test , 测试门户 test_store, 预生产 pre
const PROJECT_ENV = 'test' // 生产 prod, 开发 dev, 测试 test , 测试门户 test_store, 预生产 pre
//仅生产环境时 配置 :
//3001 3001 , wx313ec36b710125d4 有直播
//2006 泰华 , wx40fec8944623c8b3 有直播 //门户 wx833d5ece112fc3fd
......@@ -27,7 +27,7 @@ const PROJECT_ENV = 'dev' // 生产 prod, 开发 dev, 测试 test , 测试门户
//2002 巴黎贝甜 wx21968cb3a486d4ab
//2014 包小姐与鞋先生 wxa00302e2f53dd9c5
const BRANCH_ID = 1001
const BRANCH_ID = 1002
const isMall = true
// const needMock = '' //
......
......@@ -11,63 +11,65 @@
</scroll-view>
<scroll-view class="nav-contents clear-box" scroll-y="true" wx:if="{{currentFirstCategory.id}}">
<!-- 二级分类 -->
<view class="second-category" wx:if="{{!currentFirstCategory.hasThirdChildren}}">
<!-- 无三级分类时 -->
<!-- 显示一级图片 -->
<view class="img-con">
<image
data-id="{{currentFirstCategory.id}}"
data-label="{{currentFirstCategory.label}}"
bindtap="onTapToGoodsList"
src="{{currentFirstCategory.image ? currentFirstCategory.image : defaultWidthCategoryImg}}"
mode="widthFix"></image>
</view>
<view class="menu-list">
<view wx:for="{{secondCategory}}" wx:key="*this" wx:for-index="k" wx:for-item="second" class="menu-third">
<view data-name="{{second.label}}"
data-id="{{second.id}}"
data-item="{{second}}"
data-label="{{second.label}}"
bindtap="onTapToGoodsList">
<image src="{{second.image ? second.image : defaultCategoryImg}}" class="thr-menu-image" mode="aspectFill"/>
<view class="thr-menu-name">{{second.label}}</view>
<view class="pd30 clear-box">
<!-- 二级分类 -->
<view class="second-category" wx:if="{{!currentFirstCategory.hasThirdChildren}}">
<!-- 无三级分类时 -->
<!-- 显示一级图片 -->
<view class="img-con">
<image
data-id="{{currentFirstCategory.id}}"
data-label="{{currentFirstCategory.label}}"
bindtap="onTapToGoodsList"
src="{{currentFirstCategory.image ? currentFirstCategory.image : defaultWidthCategoryImg}}"
mode="widthFix"></image>
</view>
<view class="menu-list">
<view wx:for="{{secondCategory}}" wx:key="*this" wx:for-index="k" wx:for-item="second" class="menu-third">
<view data-name="{{second.label}}"
data-id="{{second.id}}"
data-item="{{second}}"
data-label="{{second.label}}"
bindtap="onTapToGoodsList">
<image src="{{second.image ? second.image : defaultCategoryImg}}" class="thr-menu-image" mode="aspectFill"/>
<view class="thr-menu-name">{{second.label}}</view>
</view>
</view>
</view>
</view>
</view>
</view>
<!-- 有三级分类时 -->
<view class="second-category" wx:if="{{currentFirstCategory.hasThirdChildren}}">
<view class="category-item" wx:for="{{secondCategory}}" wx:key="*this" wx:for-item="item">
<view class="img-con">
<image
data-id="{{item.id}}"
data-item="{{item}}"
data-label="{{item.label}}"
bindtap="onTapToGoodsList"
src="{{item.image ? item.image : defaultWidthCategoryImg}}" mode="widthFix"></image>
</view>
<view class="more"
data-id="{{item.id}}"
data-label="{{item.label}}"
bindtap="onTapToGoodsList">
<label>{{item.label}}</label>
<view class="right-more">
全部 <image src="/assets/imgs/arrow-right.png" mode="aspectFit"></image>
<!-- 有三级分类时 -->
<view class="second-category" wx:if="{{currentFirstCategory.hasThirdChildren}}">
<view class="category-item" wx:for="{{secondCategory}}" wx:key="*this" wx:for-item="item">
<view class="img-con">
<image
data-id="{{item.id}}"
data-item="{{item}}"
data-label="{{item.label}}"
bindtap="onTapToGoodsList"
src="{{item.image ? item.image : defaultWidthCategoryImg}}" mode="widthFix"></image>
</view>
</view>
<!-- 具体的布局 -->
<view class="menu-list">
<view wx:for="{{item.children}}" wx:key="*this" wx:for-index="k" wx:for-item="third" class="menu-third">
<view data-id="{{third.id}}" data-name="{{third.label}}"
data-id="{{third.id}}"
data-label="{{third.label}}"
bindtap="onTapToGoodsList">
<image src="{{third.image ? third.image : defaultCategoryImg}}" class="thr-menu-image" mode="aspectFill"/>
<view class="thr-menu-name">{{third.label}}</view>
</view>
<view class="more"
data-id="{{item.id}}"
data-label="{{item.label}}"
bindtap="onTapToGoodsList">
<label>{{item.label}}</label>
<view class="right-more">
全部 <image src="/assets/imgs/arrow-right.png" mode="aspectFit"></image>
</view>
</view>
</view>
<!-- 具体的布局 -->
<view class="menu-list">
<view wx:for="{{item.children}}" wx:key="*this" wx:for-index="k" wx:for-item="third" class="menu-third">
<view data-id="{{third.id}}" data-name="{{third.label}}"
data-id="{{third.id}}"
data-label="{{third.label}}"
bindtap="onTapToGoodsList">
<image src="{{third.image ? third.image : defaultCategoryImg}}" class="thr-menu-image" mode="aspectFill"/>
<view class="thr-menu-name">{{third.label}}</view>
</view>
</view>
</view>
</view>
</view>
</view>
</scroll-view>
......
......@@ -57,7 +57,6 @@ page {
.nav-contents {
flex: 1;
width: 75%;
padding: 30rpx;
}
.nav-content {
......@@ -125,7 +124,7 @@ page {
margin-bottom: 30rpx;
}
.img-con img{
.img-con image{
width: 100%;
}
......@@ -135,6 +134,10 @@ page {
}
.pd30{
padding: 30rpx;
}
.category-item .more{
width: 100%;
height: auto;
......
......@@ -22,12 +22,12 @@
"disablePlugins": [],
"outputPath": ""
},
"useCompilerModule": true,
"useCompilerModule": false,
"userConfirmedUseCompilerModuleSwitch": false
},
"compileType": "miniprogram",
"libVersion": "2.11.0",
"appid": "wxc3b64b09b1d3dfc2",
"appid": "wxac09792264c49b5c",
"projectname": "%E5%BE%AE%E5%95%86%E5%9F%8E",
"debugOptions": {
"hidedInDevtools": []
......@@ -731,10 +731,10 @@
"scene": null
},
{
"id": -1,
"id": 99,
"name": "活动预约",
"pathName": "subPackageMarketing/page/pages/activityOrder/activityOrder",
"query": "id=717451838479273984",
"query": "id=717762562237927424",
"scene": null
}
]
......
......@@ -27,6 +27,9 @@ wxService.page({
*/
onLoad: function (options) {
if(options.id){
wx.showLoading({
title: '加载中..',
});
this.data.id = options.id;
wx.showLoading({
title: '数据加载中..',
......@@ -38,7 +41,6 @@ wxService.page({
//获取活动详情
getActivityInfo(){
wxService.post(`/marketing/bookingActivitySet/findById?id=${this.data.id}`).then(res => {
console.log(res)
if(res){
let obj = res.data.data ? res.data.data : null;
if(obj){
......@@ -96,22 +98,34 @@ wxService.page({
//立即预约
onTapOrderNow(){
//先判断是否已经预约过
if(this.data.userOrderStatus){
wx.showModal({
title : '预约成功',
showCancel: false,
confirmText : '确定',
content : '您已订阅消息通知~',
confirmColor : app.globalData.themeColor,
success(){},
})
}
else{
if(this.data.activityInfo.templateId){
this.getOrderActivityInfo(this.data.activityInfo,this.data.activityInfo);
wxService.post(`/marketing/bookingActivitySet/checkActivityTakeeffect?id=${this.data.activityInfo.id}`).then(res => {
if(res){
if(res.data.data){
//先判断是否已经预约过
if(this.data.userOrderStatus){
wx.showModal({
title : '预约成功',
showCancel: false,
confirmText : '确定',
content : '您已订阅消息通知~',
confirmColor : app.globalData.themeColor,
success(){},
})
}
else{
if(this.data.activityInfo.templateId){
this.getOrderActivityInfo(this.data.activityInfo.templateId,this.data.activityInfo);
}
}
}
else{
wx.showToast({
title: '不在活动预约时间范围内',
icon : 'none'
});
}
}
}
});
},
//获取预约信息
......@@ -137,7 +151,7 @@ wxService.page({
orderActivity(activityId,templateId,info){
let self = this;
let baseUserInfo = wx.getStorageSync('_baseUserInfo');
wxService.post(`/merchant/message/wxSubMsgSubscride/member/subscribe`, {
wxService.post(`${'/merchant/message/wxSubMsgSubscride/member/subscribe'}`, {
businessId: activityId,
memberId: baseUserInfo.memberId,
templateId : templateId,
......@@ -191,7 +205,7 @@ wxService.page({
let tentacleId = res.id;
let inner_id = Integer.digit(this.data.activityInfo.id, 10, 64);
let inner_tentacleId = Integer.digit(tentacleId, 10, 64);
var path = 'subPackage/page/pages/scanCoupon/scanCoupon' + '?i=' + inner_id + '&t=' + inner_tentacleId;
var path = 'subPackageMarketing/page/pages/activityOrder/activityOrder' + '?i=' + inner_id + '&t=' + inner_tentacleId;
this.data.shareObj = {
title: this.data.activityInfo.name,
......@@ -201,9 +215,29 @@ wxService.page({
this.setData({
shareObj : this.data.shareObj
});
//生成二维码
this.genteratorQrcode(inner_id,inner_tentacleId);
}
});
},
//生成带触点的二维码
genteratorQrcode(i,t){
let data = {
"autoColor": true,
// "page": 'subPackageMarketing/page/pages/activityOrder/activityOrder',
"page": 'pages/userCenter/userCenter',
"scene": `i=${i}&t=${t}`,
"width": 260
}
wxService.post(`/marketing/quickMark/getAppQrCodePicture`, data).then(res => {
const { result, data } = res.data
if (result == 0) {
let url = app.globalData.imageUrl + data;
this.data.activityInfo.qrcode = url;
}
});
},
//邀请好友
onTapInviteFriends(){
this.setData({
......@@ -215,5 +249,24 @@ wxService.page({
this.setData({
showInvite : false
});
}
})
\ No newline at end of file
},
//生成海报
onTapGeneratePoster(){
if(!this.data.activityInfo.imgUrl){
wx.showToast({
title: '该活动暂未设置分享封面,请商户配置后再生成海报~',
icon : 'none'
});
return ;
}
wx.setStorageSync('activityOrderInfo', this.data.activityInfo);
this.setData({
showInvite : false
});
wx.navigateTo({
url: '/subPackageMarketing/page/pages/activityPoster/activityPoster',
});
},
});
\ No newline at end of file
<!--subPackageMarketing/page/pages/activityOrder/activityOrder.wxml-->
<view class="page-container">
<image src="{{activityInfo.imgUrl}}" mode="aspectFit"></image>
<image src="{{activityInfo.imgUrl}}" mode="widthFix"></image>
</view>
<view class="bottom-order">
<view class="order-btns positionRe" >
......@@ -13,6 +13,7 @@
</view>
</view>
<!-- 底部 -->
<view class="invite-modal" wx:if="{{showInvite}}" bindtap="onTapCloseModal"></view>
<view class="invite-body {{showInvite ? 'show' : ''}}">
......@@ -23,8 +24,8 @@
</button>
</view>
<view class="items">
<button class="clear-btn">
<image src="/assets/imgs/7_1_0/wx-icon.png" mode="aspectFit"></image>
<button class="clear-btn" bindtap="onTapGeneratePoster">
<image src="https://img3.bigaka.com/test/1002/202006/20200603/1002fddc5530-17b9-4216-aff4-eea04c1765ef.png" mode="aspectFit"></image>
<text>生成海报</text>
</button>
</view>
......
......@@ -16,7 +16,6 @@ view{
.page-container image{
width: 100%;
height: 100%;
}
.bottom-order{
......@@ -123,4 +122,6 @@ view{
.invite-body .items:active{
opacity: 0.7;
}
\ No newline at end of file
}
// subPackageMarketing/page/pages/activityPoster/activityPoster.js
const wxService = require('../../../../utils/wxService')
const utils = require('../../../../utils/util')
const envInfo = require('../../../../config/index').envInfo
const app = getApp()
const deviceWidth = app.globalData.systemInfo.windowWidth;
const isIPX = app.globalData.systemInfo.model == 'iPhone X';
let deviceHeight = app.globalData.systemInfo.windowHeight;
const ratio = deviceWidth / deviceHeight;
// 单位转换
const rpx2px = rpx => deviceWidth / 750 * rpx
/**
* 设置文本行数,超出省略
* @param {object} ctx canvas实例
* @param {string} text 文本数据
* @param {number} lineNum 行数
* @param {number} width 文字宽度最宽默认 620rpx
* 返回 由每一行组成的数组
*/
const setTextLine = (ctx, text, lineNum = 1, width = 610) => {
const str_arr = String(text).split('')
width = rpx2px(width)
let temp = ''
// 分行
let row_arr = str_arr.reduce((arr, word) => {
const w = ctx.measureText(temp).width
if (w < width) {
temp += word;
} else {
arr.push(temp)
temp = word
}
return arr
}, [])
row_arr.push(temp)
temp = ''
// 判断需要的行数
row_arr = row_arr.slice(0, lineNum)
if (row_arr.length > 1) {
// 最后一行超出则省略号
row_arr[row_arr.length - 1].split().every(v => {
temp += v
if (ctx.measureText(temp).width > (width - 20)) {
temp += '...'
return false
}
return true
})
row_arr.splice(row_arr.length - 1, 1, temp)
}
return row_arr
}
wxService.page({
/**
* 页面的初始数据
*/
data: {
height : deviceHeight + 'px',
width : deviceWidth + 'px',
activityInfo : {},
posterImgInfo : null,
qrcodeImgInfo : null,
saveImgUrl : '',
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
wx.hideShareMenu();
let activityInfo = wx.getStorageSync('activityOrderInfo');
if(activityInfo){
wx.showLoading({
title: '海报制作中..',
});
//调用处理信息
this.data.activityInfo = activityInfo;
console.log(this.data.activityInfo)
this.downloadSharePosterImg();
}
},
//下载海报图
downloadSharePosterImg(){
var that = this;
let posterImgUrl = this.data.activityInfo.imgUrl;
wx.downloadFile({
url: posterImgUrl,
success: function (res) {
if (res.statusCode === 200) {
var sharePosterUrl = res.tempFilePath;
that.calculateImg(sharePosterUrl,res => {
that.data.posterImgInfo = res;
//下载二维码
that.downloadQrcode();
})
}
},
fail: function () {
wx.hideLoading();
wx.showToast({
title: '海报图下载失败!',
icon: 'none',
duration: 2000
});
},
})
},
//下载二维码
downloadQrcode(){
var that = this;
let imgUrl = this.data.activityInfo.qrcode;
wx.downloadFile({
url: imgUrl,
success: function (res) {
if (res.statusCode === 200) {
var sharePosterUrl = res.tempFilePath;
that.calculateImg(sharePosterUrl,res => {
that.data.qrcodeImgInfo = res;
that.drawCanvas();
})
}
},
fail: function () {
wx.hideLoading();
wx.showToast({
title: '二维码下载失败!',
icon: 'none',
duration: 2000
});
},
})
},
//获取图片规格
calculateImg(src, cb){
var that = this;
wx.getImageInfo({
src: src,
success(res) {
cb(res);
}
})
},
//画canvas
drawCanvas(){
let self = this;
console.log(this.data)
console.log(ratio,deviceWidth,deviceHeight)
const ctx = wx.createCanvasContext('myCanvas', this)
const canvasWidth = deviceWidth
const canvasHeight = deviceHeight
// 绘制背景,填充满整个canvas画布
ctx.setFillStyle('#fff')
ctx.fillRect(0, 0, canvasWidth, canvasHeight)
//计算海报宽高
//先把宽度撑满(默认海报的宽度是大于等于6splus宽度)
let posterShareImgWidth = this.data.posterImgInfo.width, posterShareImgHeight = this.data.posterImgInfo.height;
let ratioImgHeight = posterShareImgHeight*(deviceWidth/posterShareImgWidth);
ctx.drawImage(this.data.posterImgInfo.path, 0, 0, deviceWidth, ratioImgHeight);
//计算剩下的高度
let leftHeight = deviceHeight - ratioImgHeight;
console.log('leftHeight---',leftHeight)
//设置二维码的宽高
let qrcodeWidth = parseInt(leftHeight/3)*2 , qrcodeHeight = qrcodeWidth;
let qrcodeX = deviceWidth - qrcodeWidth - 25 , qrcodeY = ratioImgHeight + (qrcodeWidth/3);
console.log(qrcodeX,qrcodeY,qrcodeWidth,qrcodeHeight)
ctx.drawImage(this.data.qrcodeImgInfo.path, qrcodeX, qrcodeY, qrcodeWidth, qrcodeHeight);
//画文案
//第一行文案 邀请您参与
let firstLineTextX = 25, firstLineTextY = ratioImgHeight + (qrcodeWidth/3) + qrcodeHeight/4;
ctx.setFillStyle('#666')
ctx.setFontSize(14)
ctx.fillText('邀请您参与', firstLineTextX,firstLineTextY);
//第二行文案
let SecondLineTextX = 25, SecondLineTextY = firstLineTextY + 25;
ctx.setFillStyle('#000')
ctx.setFontSize(14)
ctx.fillText(`【${this.data.activityInfo.name}】`, SecondLineTextX,SecondLineTextY);
// ctx.fillText(`【测试一下最长能多上的测试】`, SecondLineTextX,SecondLineTextY);
//第三行文案
let thirdLineTextX = 25, thirdLineTextY = SecondLineTextY + 25;
ctx.setFillStyle('#666')
ctx.setFontSize(14)
ctx.fillText('长按扫码有惊喜', thirdLineTextX,thirdLineTextY);
// return ;
ctx.stroke()
ctx.draw(false , () => {
wx.canvasToTempFilePath({
canvasId: 'myCanvas',
quality: 1,
success: result => {
wx.hideLoading();
this.data.saveImgUrl = result.tempFilePath;
this.savePosterImg(this.data.saveImgUrl);
}
}, self);
});
},
//canvas点击
onTapSave(){
if(this.data.saveImgUrl){
this.savePosterImg(this.data.saveImgUrl);
}
else{
wx.showToast({
title: '请等待海报生成完成后保存',
icon : 'none'
});
}
},
//保存海报
savePosterImg(tempFilePath){
wx.showModal({
title : '保存海报',
confirmText : '确定',
content : '海报已生成,是否保存海报到相册?',
confirmColor : app.globalData.themeColor,
success(res){
if(res.confirm){
wx.saveImageToPhotosAlbum({
filePath: tempFilePath,
success(){
wx.showToast({
title: '保存成功,快去相册看看吧~',
icon : 'none'
});
}
});
}
},
})
}
})
\ No newline at end of file
{
"disableScroll": true,
"navigationBarTitleText": "生成海报(长按保存)",
"usingComponents": {}
}
\ No newline at end of file
<!--subPackageMarketing/page/pages/activityPoster/activityPoster.wxml-->
<view class="canvas-container">
<canvas canvas-id="myCanvas" style="height:{{height}};width:{{width}}" bindlongtap="onTapSave"></canvas>
</view>
/* subPackageMarketing/page/pages/activityPoster/activityPoster.wxss */
page{
box-sizing: border-box;
-webkit-box-sizing: border-box;
}
view{
box-sizing: border-box;
-webkit-box-sizing: border-box;
}
.canvas-container{
width: 100vw;
height: 100vh;
}
// subPackageMarketing/page/pages/liveSubscrib/liveSubscrib.js
const wxService = require('../../../../utils/wxService')
const utils = require('../../../../utils/util')
import { Integer } from '../../../../utils/integerDigitalConvertion'
const app = getApp();
// let livePlayer = requirePlugin('live-player-plugin')
wxService.page({
/**
* 页面的初始数据
*/
data: {
room_id : '',
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
console.log(options)
this.data.room_id = options.room_id;
this.setData({
room_id : this.data.room_id
});
},
//点击事件
onTapDoSubscrib(e){
console.log(e)
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
}
})
\ No newline at end of file
{
"disableScroll": true,
"navigationBarTitleText": "直播订阅",
"usingComponents": {
"subscribe": "plugin-private://wx2b03c6e691cd7370/components/subscribe/subscribe"
}
}
\ No newline at end of file
<!--subPackageMarketing/page/pages/liveSubscrib/liveSubscrib.wxml-->
<view catchtap="onTapDoSubscrib" id="parent" class="parent">
<subscribe room-id="{{room_id}}" id="child"></subscribe>
</view>
/* subPackageMarketing/page/pages/liveSubscrib/liveSubscrib.wxss */
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment