You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 

268 lines
7.7 KiB

var Api = require('../../../utils/common.js');
var re = require('../../../utils/request.js');
// const QQMapWX = require('../../utils/qqmap-wx-jssdk.min.js');
var QQMapWX=require('../../../utils/qqmap-wx-jssdk.min')
let qqmapsdk
Page({
/**
* 页面的初始数据
*/
data: {
activeId:'',
detail:{},
content:[],
user:[{img:'../../../images/ava.png',name:'长岛加冰'},{img:'../../../images/ava.png',name:'长岛加冰'},
{img:'../../../images/ava.png',name:'长岛加冰'},{img:'../../../images/ava.png',name:'长岛加冰'},
{img:'../../../images/ava.png',name:'长岛加冰'}],
company:{img:'../../../images/logo.jpg',name:'众兴天下户外',status:'1',active:'15',group:'23',intro:'个性签名个性签名个性签名个性签名个性签名个性签名个性签名个性签名个性签名个性签名个性签名个性签名个性签名个...'},
messages:[
{ava:'../../../images/ava.png',nickName:'耳机分你一瓣',content:'这个地方看起来特别好玩的样子,个地方看起来特别好玩的样子,我们计划下个月也全家去玩我们计划下个月也全家去玩。',time:'2020-10-10 20:00'},
{ava:'../../../images/ava.png',nickName:'耳机分你一瓣',content:'这个地方看起来特别好玩的样子,我们计划下个月也全家去玩。',time:'2020-10-10 20:00'},
{ava:'../../../images/ava.png',nickName:'耳机分你一瓣',content:'这个地方看起来特别好玩的样子,我们计划下个月也全家去玩。',time:'2020-10-10 20:00'}
],
otheractive:[
{img:'../../../images/logo.jpg',intro:'欢乐游园亲子活动,全家人一起畅游欢乐谷,享受天...',time:'2020-10-13 07:00',people:'2'},
{img:'../../../images/logo.jpg',intro:'欢乐游园亲子活动,全家人一起畅游欢乐谷,享受天...',time:'2020-10-13 07:00',people:'2'},
{img:'../../../images/logo.jpg',intro:'欢乐游园亲子活动,全家人一起畅游欢乐谷,享受天...',time:'2020-10-13 07:00',people:'2'}
]
},
seeJoin:function(){
var that = this;
wx.navigateTo({
url: '../join/join?acId=' + that.data.detail.activityId
})
},
tojion:function(){
var that = this;
console.log(that.data.detail);
wx.navigateTo({
url: '../myjoin/myjoin?acId='+that.data.detail.activityId+'&clubId='+that.data.detail.clubId+'&price='+that.data.detail.lowestPrice+''
})
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
var that = this;
that.setData({
activeId:options.id,
});
that.getActiveDetail();
that.addviews(options.id);
},
getActiveDetail:function(){
var that = this;
const imgUrl = wx.getStorageSync('imgUrl');
var postData = {
activityId:that.data.activeId
};
var header = {
token:wx.getStorageSync('token'),
"Content-Type": "application/x-www-form-urlencoded"
};
re.request(Api.getActiveDetail(), postData, header).then((res) => {
let datas = res.data.data;
that.setData({
user: datas.registerList
})
datas.activityLogo = imgUrl + datas.activityLogo;
datas.coverFirstImage = imgUrl + datas.coverFirstImage;
let content = JSON.parse(datas.activityContent);
for(var i=0;i<content.length;i++){
if(content[i].slice(0,1)=='/'){
content[i] = {image:imgUrl + content[i]};
}
}
that.setData({
detail:datas,
content
})
this.getclubInfo(datas.clubId);
this.getOtherActive();
})
},
Tomap:function(e){
var that = this;
qqmapsdk = new QQMapWX({
key: '5LUBZ-EIXCU-4D4VL-433ZJ-TZDAH-YABL6'
});
qqmapsdk.geocoder({
address: this.data.detail.activityAddr,
sig: 'FvbPshzJis7X9P4A5wbkLVnnOuYdtv',
success: res => {
//成功后的回调
// console.log(res,'地址');
// this.latitude = res.result.location.lat;
// this.longitude = res.result.location.lng;
wx.openLocation({
latitude:Number(res.result.location.lat),
longitude:Number(res.result.location.lng),
name:that.data.activityAddr,
scale: 28
})
},
fail: function(error) {
console.error(error);
}
});
// wx.openLocation({
// latitude:Number(that.data.addrLat),
// longitude:Number(that.data.addrLon),
// name:that.data.activityAddr,
// scale: 28
// })
},
tiaozhuan(e){
// pages/club/clubDetail/clubDetail
wx.navigateTo({
url: '../../club/clubDetail/clubDetail?id='+this.data.company.clubId,
})
},
otherJump: function(e){
wx.navigateTo({
url: 'activeDetail?id='+e.currentTarget.dataset.id
})
},
getclubInfo:function(id){
var that = this;
const imgUrl = wx.getStorageSync('imgUrl');
var postData = {
clubId:id
};
var header = {
token:wx.getStorageSync('token'),
"Content-Type": "application/x-www-form-urlencoded"
};
re.request(Api.getclubInfo(), postData, header).then((res) => {
let datas = res.data.data;
// console.log(datas);
// datas.clubLogo = imgUrl + datas.clubLogo;
that.setData({
company:datas
})
})
},
addviews:function(id){
var that = this;
var postData = {
activityId:id,
};
var header = {
token:wx.getStorageSync('token'),
"Content-Type": "application/x-www-form-urlencoded"
};
re.request(Api.addviews(), postData, header).then((res) => {
let datas = res.data.data;
console.log(datas);
})
},
//打电话
phone: function(e){
wx.makePhoneCall({
phoneNumber: e.target.dataset.phonenumber,
success(){},
fail(){}
})
},
getOtherActive:function(){
var that = this;
const imgUrl = wx.getStorageSync('imgUrl');
var postData = {
activityId:that.data.activeId,
clubId:that.data.detail.clubId
};
var header = {
token:wx.getStorageSync('token'),
"Content-Type": "application/x-www-form-urlencoded"
};
re.request(Api.getOtherActive(), postData, header).then((res) => {
let datas = res.data.data;
for(let i=0;i<datas.length;i++){
if(datas[i].activityLogo){
datas[i].activityLogo = imgUrl + datas[i].activityLogo
datas[i].coverFirstImage = imgUrl + datas[i].coverFirstImage
}
}
that.setData({
otheractive:datas
})
})
},
toJoin:function(){
var that = this;
var header = {
token:wx.getStorageSync('token'),
"Content-Type": "application/x-www-form-urlencoded"
};
var postData={
clubId:that.data.detail.clubId,
memberType:4,
};
re.request(Api.addClub(), postData, header).then((res) => {
wx.showToast({
title: '加入成功',
icon: 'none',
duration: 1000
})
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},
handleContact(e){
console.log(e);
},
onShareAppMessage: function () {
return {
title: '报名了',
path: 'pages/index/activeDetail/activeDetail?id='+this.data.detail.activityId,
success: (res) => {
// 分享成功
console.log(this.data.detail.activityId,'this.data.detail.activityId');
console.log(res);
},
fail: (res) => {
// 分享失败
}
}
}
})