...
|
...
|
@@ -31,14 +31,14 @@ Page({ |
|
|
img_height = e.detail.height,
|
|
|
//宽高比
|
|
|
ratio = img_width / img_height;
|
|
|
console.log(img_width, img_height);
|
|
|
// console.log(img_width, img_height);
|
|
|
//计算的高度值
|
|
|
var viewHeight = 750 / ratio;
|
|
|
var img_height = viewHeight;
|
|
|
var img_heights = this.data.img_heights;
|
|
|
//把每一张图片的对应的高度记录到数组里
|
|
|
img_heights[e.target.dataset.id] = img_height;
|
|
|
console.log('img_heights',img_heights);
|
|
|
// console.log('img_heights',img_heights);
|
|
|
this.setData({
|
|
|
img_heights: img_heights
|
|
|
})
|
...
|
...
|
@@ -59,14 +59,14 @@ Page({ |
|
|
},
|
|
|
// 问一问
|
|
|
ask(e) {
|
|
|
console.log('前问一问-display', this.data.display);
|
|
|
// console.log('前问一问-display', this.data.display);
|
|
|
this.setData({
|
|
|
display: !this.data.display,
|
|
|
is_ask:true,is_reply:false,
|
|
|
content:'' ,
|
|
|
placeholder:'输入您的留言',
|
|
|
});
|
|
|
console.log('后问一问-display', this.data.display);
|
|
|
// console.log('后问一问-display', this.data.display);
|
|
|
// wx.navigateTo({
|
|
|
// url: '/pages/comment/comment?activity_id=' + this.data.detail_id
|
|
|
// + '&common_id=' + 0
|
...
|
...
|
@@ -80,7 +80,7 @@ Page({ |
|
|
},
|
|
|
//发送评论/回复
|
|
|
clickComment(e) {
|
|
|
console.log('评论', e);
|
|
|
// console.log('评论', e);
|
|
|
this.setData({ display: false });
|
|
|
if(this.data.content === '' ) {
|
|
|
wx.showToast({title:'请输入内容',icon:'none'})
|
...
|
...
|
@@ -94,7 +94,7 @@ Page({ |
|
|
formId:e.detail.formId,
|
|
|
};
|
|
|
app.post(url,params,{}).then((res)=>{
|
|
|
console.log('提交评论',res);
|
|
|
// console.log('提交评论',res);
|
|
|
if(+res.code === 1) {
|
|
|
wx.showToast({title:this.data.is_ask?'留言成功':'回复成功',icon:'none',});
|
|
|
this.getDetail();
|
...
|
...
|
@@ -127,7 +127,7 @@ Page({ |
|
|
},
|
|
|
//收藏/取消收藏
|
|
|
collect() {
|
|
|
console.log('收藏');
|
|
|
// console.log('收藏');
|
|
|
let self = this;
|
|
|
let url = '/portal/Active/collection';
|
|
|
let url_del = '/portal/Active/delCollection';
|
...
|
...
|
@@ -140,7 +140,7 @@ Page({ |
|
|
};
|
|
|
if(self.data.is_collect) {
|
|
|
app.post(url_del, params, header).then((res) => {
|
|
|
console.log('取消收藏',res);
|
|
|
// console.log('取消收藏',res);
|
|
|
if(+res.code === 1) {
|
|
|
wx.showToast({title:res.message,icon:'none'});
|
|
|
self.setData({
|
...
|
...
|
@@ -150,7 +150,7 @@ Page({ |
|
|
})
|
|
|
}else {
|
|
|
app.post(url, params, header).then((res) => {
|
|
|
console.log('收藏',res);
|
|
|
// console.log('收藏',res);
|
|
|
if(+res.code === 1) {
|
|
|
wx.showToast({title:res.message,icon:'none'});
|
|
|
self.setData({
|
...
|
...
|
@@ -175,7 +175,7 @@ Page({ |
|
|
commonId: id,
|
|
|
};
|
|
|
app.post(url, params, {}).then((res) => {
|
|
|
console.log('点赞', res);
|
|
|
// console.log('点赞', res);
|
|
|
if (+res.code === 1) { //
|
|
|
wx.showToast({title:res.message,icon:'none'});
|
|
|
self.setData({
|
...
|
...
|
@@ -225,7 +225,7 @@ Page({ |
|
|
//获取详情
|
|
|
getDetail() {
|
|
|
const self = this;
|
|
|
console.log('city',self.data.city);
|
|
|
// console.log('city',self.data.city);
|
|
|
let url = '/portal/Active/mealDetail';
|
|
|
let params = {
|
|
|
token:wx.getStorageSync('token'),
|
...
|
...
|
@@ -235,7 +235,7 @@ Page({ |
|
|
"token": wx.getStorageSync('token')
|
|
|
};
|
|
|
app.post(url, params, {}).then((res) => {
|
|
|
console.log('获取详情', res);
|
|
|
// console.log('获取详情', res);
|
|
|
if (+res.code === 1) {
|
|
|
self.setData({
|
|
|
detail: res.data.active,
|
...
|
...
|
@@ -259,10 +259,10 @@ Page({ |
|
|
// (0全部,2待拼成,3人数不足未拼成,4已拼成,5已取消,6已完成,7已评价,8已拼成(活动未结束),9删除
|
|
|
const status = res.data.active.status;
|
|
|
if(status === 2 || status === 6 || status === 7 || status === 8) {
|
|
|
console.log('调用倒计时');
|
|
|
// console.log('调用倒计时');
|
|
|
self.countDown();
|
|
|
}else {
|
|
|
console.log('不调用倒计时');
|
|
|
// console.log('不调用倒计时');
|
|
|
let countDownArr = [];
|
|
|
let obj = null;
|
|
|
obj = {
|
...
|
...
|
@@ -297,7 +297,7 @@ Page({ |
|
|
"token": wx.getStorageSync('token')
|
|
|
};
|
|
|
app.post(url, params, {}).then((res) => {
|
|
|
console.log('确认拼餐', res);
|
|
|
// console.log('确认拼餐', res);
|
|
|
if (+res.code === 1) {
|
|
|
// wx.showToast({title:'拼餐成功',icon:'success'});
|
|
|
self.setData({is_showRelease_modal:true,order_id:+res.data.orderId,is_join:true});
|
...
|
...
|
@@ -366,7 +366,7 @@ Page({ |
|
|
"token": wx.getStorageSync('token')
|
|
|
};
|
|
|
app.post(url, params, {}).then((res) => {
|
|
|
console.log('倒计时结束', res);
|
|
|
// console.log('倒计时结束', res);
|
|
|
if (+res.code === 1) {
|
|
|
// wx.showToast({title:'拼活动结束',icon:'success'})
|
|
|
}
|
...
|
...
|
@@ -376,7 +376,7 @@ Page({ |
|
|
getNavigate() {
|
|
|
const self = this;
|
|
|
const arr = self.data.detail.latng.split(',');
|
|
|
console.log('arr',arr,arr[0],arr[1]);
|
|
|
// console.log('arr',arr,arr[0],arr[1]);
|
|
|
|
|
|
wx.openLocation({//使用微信内置地图查看位置。
|
|
|
latitude: +arr[0],//要去的纬度-地址
|
...
|
...
|
@@ -391,7 +391,7 @@ Page({ |
|
|
* 生命周期函数--监听页面加载
|
|
|
*/
|
|
|
onLoad: function (options) {
|
|
|
console.log('详情options', options);
|
|
|
// console.log('详情options', options);
|
|
|
this.setData({detail_id:+options.id?+options.id:''});
|
|
|
},
|
|
|
//获取活动二维码
|
...
|
...
|
@@ -404,7 +404,7 @@ Page({ |
|
|
type:2,//1拼活动,2拼餐
|
|
|
};
|
|
|
app.post(url, params, {}).then((res) => {
|
|
|
console.log('获取活动二维码', res);
|
|
|
// console.log('获取活动二维码', res);
|
|
|
if (+res.code === 1) {
|
|
|
self.setData({qr_code:res.data},() => {
|
|
|
// console.log('二维码',self.data.qr_code);
|
...
|
...
|
@@ -513,7 +513,7 @@ Page({ |
|
|
ctx.clip()
|
|
|
},
|
|
|
drawCard() {
|
|
|
console.log('开始画');
|
|
|
// console.log('开始画');
|
|
|
const self = this;
|
|
|
//先创建一个画布
|
|
|
const ctx = wx.createCanvasContext("canvas");
|
...
|
...
|
@@ -527,18 +527,18 @@ Page({ |
|
|
//填充背景色
|
|
|
ctx.fillStyle = '#fff';
|
|
|
ctx.fillRect(0, 0, 280, 400);
|
|
|
console.log(self.data.local_img);
|
|
|
console.log(self.data.qr_code);
|
|
|
// console.log(self.data.local_img);
|
|
|
// console.log(self.data.qr_code);
|
|
|
//将图片转化为画布
|
|
|
ctx.drawImage(self.data.local_img, 0, 0, 280, 280);//详情图
|
|
|
console.log(111);
|
|
|
// console.log(111);
|
|
|
// ctx.drawImage(self.data.local_qr_code, 220, 209, 60, 60);//二维码
|
|
|
ctx.drawImage('../../../images/qr_code.jpg', 180, 320, 60, 60);//小程序码
|
|
|
//标题
|
|
|
ctx.setFontSize(12);
|
|
|
ctx.setFillStyle('#000');
|
|
|
ctx.textAlign = "left";
|
|
|
console.log(111);
|
|
|
// console.log(111);
|
|
|
ctx.fillText(self.data.detail.title, 16, 306.5);
|
|
|
ctx.fillText(self.data.detail.title, 15.5, 307);
|
|
|
ctx.restore();
|
...
|
...
|
@@ -599,7 +599,7 @@ Page({ |
|
|
// wx.hideLoading();
|
|
|
console.log("draw callback success");
|
|
|
self.setData({can_save: true,show_canvas: true});
|
|
|
console.log(self.data.can_save);
|
|
|
// console.log(self.data.can_save);
|
|
|
})
|
|
|
},
|
|
|
//获取保存到相册的权限
|
...
|
...
|
@@ -666,7 +666,7 @@ Page({ |
|
|
|
|
|
},
|
|
|
savePic() {
|
|
|
console.log('是否能保存',this.data.can_save);
|
|
|
// console.log('是否能保存',this.data.can_save);
|
|
|
if(this.data.can_save) {
|
|
|
wx.canvasToTempFilePath({
|
|
|
x: 0,
|
...
|
...
|
@@ -679,7 +679,7 @@ Page({ |
|
|
fileType: 'jpg',
|
|
|
quality:1,
|
|
|
success: function (res) {
|
|
|
console.log("get tempfilepath(success) is:", res.tempFilePath);
|
|
|
// console.log("get tempfilepath(success) is:", res.tempFilePath);
|
|
|
//将图片保存在系统相册中(应先获取权限,)
|
|
|
wx.saveImageToPhotosAlbum({
|
|
|
filePath: res.tempFilePath,
|
...
|
...
|
@@ -703,7 +703,7 @@ Page({ |
|
|
|
|
|
},
|
|
|
onShareAppMessage: function(res) {
|
|
|
console.log('转发res',res);
|
|
|
// console.log('转发res',res);
|
|
|
let self = this;
|
|
|
self.setData({show_canvas:false,});
|
|
|
if(res.from === 'button') {
|
...
|
...
|
|