|
|
@ -20,7 +20,9 @@ Page({ |
|
|
retailId: "", |
|
|
retailId: "", |
|
|
retailSkuId: "", |
|
|
retailSkuId: "", |
|
|
shareImg: null, |
|
|
shareImg: null, |
|
|
showShareFlag: false |
|
|
showShareFlag: false, |
|
|
|
|
|
showQrCode: false, |
|
|
|
|
|
wxqrcode: null |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
@ -85,16 +87,15 @@ Page({ |
|
|
source_id: this.data.info.id, |
|
|
source_id: this.data.info.id, |
|
|
url: "/pages/info/cardInfo/index?id=" + this.data.info.id, |
|
|
url: "/pages/info/cardInfo/index?id=" + this.data.info.id, |
|
|
uuid: app.globalData.uuid |
|
|
uuid: app.globalData.uuid |
|
|
}).then(res => { |
|
|
}).then(res => {}) |
|
|
}) |
|
|
} else { |
|
|
} |
|
|
|
|
|
else { |
|
|
|
|
|
this.BroswerRecord(); |
|
|
this.BroswerRecord(); |
|
|
} |
|
|
} |
|
|
}, 500) |
|
|
}, 500) |
|
|
}, |
|
|
}, |
|
|
changeMenu: function (e) { |
|
|
changeMenu: function (e) { |
|
|
let index = e.currentTarget.dataset.index, that = this; |
|
|
let index = e.currentTarget.dataset.index, |
|
|
|
|
|
that = this; |
|
|
const query = wx.createSelectorQuery(); //创建节点查询器
|
|
|
const query = wx.createSelectorQuery(); //创建节点查询器
|
|
|
query.select("#box" + index).boundingClientRect() //选择toViewid获取位置信息
|
|
|
query.select("#box" + index).boundingClientRect() //选择toViewid获取位置信息
|
|
|
query.selectViewport().scrollOffset() //获取页面查询位置的
|
|
|
query.selectViewport().scrollOffset() //获取页面查询位置的
|
|
|
@ -110,7 +111,8 @@ Page({ |
|
|
}) |
|
|
}) |
|
|
}, |
|
|
}, |
|
|
onPageScroll: function (e) { |
|
|
onPageScroll: function (e) { |
|
|
let that = this, height = this.data.top; |
|
|
let that = this, |
|
|
|
|
|
height = this.data.top; |
|
|
let topHeight = height; |
|
|
let topHeight = height; |
|
|
wx.createSelectorQuery().select('#menus').boundingClientRect(function (rect) { |
|
|
wx.createSelectorQuery().select('#menus').boundingClientRect(function (rect) { |
|
|
console.log(rect.top, topHeight) |
|
|
console.log(rect.top, topHeight) |
|
|
@ -119,8 +121,7 @@ Page({ |
|
|
that.setData({ |
|
|
that.setData({ |
|
|
fixed: true |
|
|
fixed: true |
|
|
}) |
|
|
}) |
|
|
} |
|
|
} else { |
|
|
else { |
|
|
|
|
|
that.setData({ |
|
|
that.setData({ |
|
|
fixed: false |
|
|
fixed: false |
|
|
}) |
|
|
}) |
|
|
@ -137,18 +138,15 @@ Page({ |
|
|
that.setData({ |
|
|
that.setData({ |
|
|
type: 4 |
|
|
type: 4 |
|
|
}) |
|
|
}) |
|
|
} |
|
|
} else if (res[2].top < minHeight) { |
|
|
else if (res[2].top < minHeight) { |
|
|
|
|
|
that.setData({ |
|
|
that.setData({ |
|
|
type: 3 |
|
|
type: 3 |
|
|
}) |
|
|
}) |
|
|
} |
|
|
} else if (res[1].top < minHeight) { |
|
|
else if (res[1].top < minHeight) { |
|
|
|
|
|
that.setData({ |
|
|
that.setData({ |
|
|
type: 2 |
|
|
type: 2 |
|
|
}) |
|
|
}) |
|
|
} |
|
|
} else { |
|
|
else { |
|
|
|
|
|
that.setData({ |
|
|
that.setData({ |
|
|
type: 1 |
|
|
type: 1 |
|
|
}) |
|
|
}) |
|
|
@ -158,6 +156,17 @@ Page({ |
|
|
|
|
|
|
|
|
}, |
|
|
}, |
|
|
order: function () { |
|
|
order: function () { |
|
|
|
|
|
commonApi.user_post('wx/get_user_keep', { |
|
|
|
|
|
jumpurl: '/pages/info/roadInfo/index?id=' + this.data.id, |
|
|
|
|
|
title: this.data.info.title, |
|
|
|
|
|
type: 'mini' |
|
|
|
|
|
}).then(res => { |
|
|
|
|
|
if (res.data.subscribe == 0) { |
|
|
|
|
|
this.setData({ |
|
|
|
|
|
wxqrcode: res.data.qrcode, |
|
|
|
|
|
showQrCode: true |
|
|
|
|
|
}) |
|
|
|
|
|
} else { |
|
|
app.globalData.couponInfo = null; |
|
|
app.globalData.couponInfo = null; |
|
|
app.globalData.product = { |
|
|
app.globalData.product = { |
|
|
product: this.data.info |
|
|
product: this.data.info |
|
|
@ -175,6 +184,11 @@ Page({ |
|
|
wx.navigateTo({ |
|
|
wx.navigateTo({ |
|
|
url: '/pages/order/road/index?id=' + this.data.info.id + (this.data.retailSkuId ? ('&skuid=' + this.data.retailSkuId) : '') |
|
|
url: '/pages/order/road/index?id=' + this.data.info.id + (this.data.retailSkuId ? ('&skuid=' + this.data.retailSkuId) : '') |
|
|
}) |
|
|
}) |
|
|
|
|
|
} |
|
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}, |
|
|
}, |
|
|
pagePoint: function (e) { |
|
|
pagePoint: function (e) { |
|
|
util.pagePoint(e) |
|
|
util.pagePoint(e) |
|
|
@ -207,7 +221,8 @@ Page({ |
|
|
}, |
|
|
}, |
|
|
// 保存
|
|
|
// 保存
|
|
|
save() { |
|
|
save() { |
|
|
let url = this.data.shareImg, that = this; |
|
|
let url = this.data.shareImg, |
|
|
|
|
|
that = this; |
|
|
wx.authorize({ |
|
|
wx.authorize({ |
|
|
/* 这个就是保存相册的 */ |
|
|
/* 这个就是保存相册的 */ |
|
|
scope: 'scope.writePhotosAlbum', |
|
|
scope: 'scope.writePhotosAlbum', |
|
|
@ -259,7 +274,8 @@ Page({ |
|
|
}, |
|
|
}, |
|
|
// 绘制海报
|
|
|
// 绘制海报
|
|
|
drawImg: function () { |
|
|
drawImg: function () { |
|
|
var that = this, userinfo = wx.getStorageSync('jstrip_userInfo'); |
|
|
var that = this, |
|
|
|
|
|
userinfo = wx.getStorageSync('jstrip_userInfo'); |
|
|
if (!userinfo) { |
|
|
if (!userinfo) { |
|
|
// 去登录
|
|
|
// 去登录
|
|
|
return false; |
|
|
return false; |
|
|
@ -408,12 +424,13 @@ Page({ |
|
|
}, |
|
|
}, |
|
|
// 绘制两行文字
|
|
|
// 绘制两行文字
|
|
|
drawText: function (ctx, str, x, y, canvasWidth, ratio) { |
|
|
drawText: function (ctx, str, x, y, canvasWidth, ratio) { |
|
|
let row = [], temp = "", chr = str.split(""); |
|
|
let row = [], |
|
|
|
|
|
temp = "", |
|
|
|
|
|
chr = str.split(""); |
|
|
for (var a = 0; a < chr.length; a++) { |
|
|
for (var a = 0; a < chr.length; a++) { |
|
|
if (ctx.measureText(temp).width < canvasWidth) { |
|
|
if (ctx.measureText(temp).width < canvasWidth) { |
|
|
temp += chr[a]; |
|
|
temp += chr[a]; |
|
|
} |
|
|
} else { |
|
|
else { |
|
|
|
|
|
a--; //这里添加了a-- 是为了防止字符丢失,效果图中有对比
|
|
|
a--; //这里添加了a-- 是为了防止字符丢失,效果图中有对比
|
|
|
row.push(temp); |
|
|
row.push(temp); |
|
|
temp = ""; |
|
|
temp = ""; |
|
|
@ -430,8 +447,7 @@ Page({ |
|
|
for (var a = 0; a < rowPart.length; a++) { |
|
|
for (var a = 0; a < rowPart.length; a++) { |
|
|
if (ctx.measureText(test).width < canvasWidth - 30 * ratio) { |
|
|
if (ctx.measureText(test).width < canvasWidth - 30 * ratio) { |
|
|
test += rowPart[a]; |
|
|
test += rowPart[a]; |
|
|
} |
|
|
} else { |
|
|
else { |
|
|
|
|
|
break; |
|
|
break; |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
@ -461,8 +477,7 @@ Page({ |
|
|
} |
|
|
} |
|
|
if (this.data.info && this.data.info.id) { |
|
|
if (this.data.info && this.data.info.id) { |
|
|
this.drawImg() |
|
|
this.drawImg() |
|
|
} |
|
|
} else { |
|
|
else { |
|
|
|
|
|
setTimeout(() => { |
|
|
setTimeout(() => { |
|
|
this.onShow() |
|
|
this.onShow() |
|
|
}, 200) |
|
|
}, 200) |
|
|
|