|
|
|
// index.js
|
|
|
|
// 获取应用实例
|
|
|
|
const app = getApp()
|
|
|
|
import util from '../../utils/util'
|
|
|
|
var QQMapWX = require('../../utils/qqmap-wx-jssdk.min.js');
|
|
|
|
var qqmapsdk;
|
|
|
|
Page({
|
|
|
|
data: {
|
|
|
|
tabbar: {},
|
|
|
|
menuList:[
|
|
|
|
{ icon:'../../images/home/menu1.png',text: 'IT制作'},
|
|
|
|
{ icon:'../../images/home/menu2.png', text: 'logo设计' },
|
|
|
|
{ icon:'../../images/home/menu3.png', text: '文案策划' },
|
|
|
|
{ icon:'../../images/home/menu4.png', text: 'app开发' },
|
|
|
|
{ icon:'../../images/home/menu5.png', text: '装修服务' },
|
|
|
|
{ icon:'../../images/home/menu6.png', text: '软件定制' },
|
|
|
|
{ icon:'../../images/home/menu7.png', text: '法律服务' },
|
|
|
|
{ icon:'../../images/home/menu8.png', text: '小程序' },
|
|
|
|
{ icon:'../../images/home/menu9.png', text: '网络营销' },
|
|
|
|
{ icon:'../../images/home/menu10.png', text: '全部分类' }
|
|
|
|
],
|
|
|
|
CustomBar: app.globalData.CustomBar,
|
|
|
|
menuHeight: app.globalData.menuHeight,
|
|
|
|
navHeight: app.globalData.navHeight,
|
|
|
|
menuTop: app.globalData.menuTop,
|
|
|
|
active: 1,
|
|
|
|
recommendActivity: [],
|
|
|
|
demandList: [],
|
|
|
|
resourcesList: [],
|
|
|
|
province: '',
|
|
|
|
city: '',
|
|
|
|
},
|
|
|
|
onLoad() {
|
|
|
|
app.editTabbar()
|
|
|
|
this.getCagetoryList()
|
|
|
|
qqmapsdk = new QQMapWX({
|
|
|
|
key: 'UVEBZ-M3VRS-CO4OH-6F5QZ-X7FB7-SVFOX' //这里自己的key秘钥进行填充
|
|
|
|
});
|
|
|
|
this.getLocation()
|
|
|
|
},
|
|
|
|
toActiveDetail(e){
|
|
|
|
let id = e.currentTarget.dataset.id;
|
|
|
|
wx.navigateTo({
|
|
|
|
url: '/pages/activity/detail/index?id=' + id,
|
|
|
|
})
|
|
|
|
},
|
|
|
|
tabClick(e){
|
|
|
|
this.setData({
|
|
|
|
active: e.currentTarget.dataset.i
|
|
|
|
})
|
|
|
|
},
|
|
|
|
toTab2(){
|
|
|
|
wx.switchTab({
|
|
|
|
url: '/pages/demandHall/index',
|
|
|
|
})
|
|
|
|
},
|
|
|
|
getCagetoryList(){
|
|
|
|
app.http('get','index').then((res)=>{
|
|
|
|
if(res.data.success){
|
|
|
|
res.data.data.recommendActivity.content.forEach((item)=>{
|
|
|
|
item.activityStartTime = util.getWeek(item.activityStartTime)
|
|
|
|
})
|
|
|
|
this.setData({
|
|
|
|
demandList: res.data.data.demandList,
|
|
|
|
resourcesList: res.data.data.resourcesDtos,
|
|
|
|
cagetoryList: res.data.data.cagetoryDtos,
|
|
|
|
recommendActivity: res.data.data.recommendActivity.content
|
|
|
|
})
|
|
|
|
}
|
|
|
|
})
|
|
|
|
},
|
|
|
|
toResourcesDetail(e){
|
|
|
|
let id = e.currentTarget.dataset.id
|
|
|
|
wx.navigateTo({
|
|
|
|
url: '/pages/demandHall/resourcesDetail/index?id='+id,
|
|
|
|
})
|
|
|
|
},
|
|
|
|
toCompanyDetail(e){
|
|
|
|
let id = e.currentTarget.dataset.id
|
|
|
|
wx.navigateTo({
|
|
|
|
url: '/pages/demandHall/companyDetail/index?id='+id,
|
|
|
|
})
|
|
|
|
},
|
|
|
|
toNeedDetail(e){
|
|
|
|
let id = e.currentTarget.dataset.id
|
|
|
|
wx.navigateTo({
|
|
|
|
url: '/pages/demandHall/needsDetail/index?id='+id,
|
|
|
|
})
|
|
|
|
},
|
|
|
|
getLocation(){
|
|
|
|
let vm = this;
|
|
|
|
wx.getLocation({
|
|
|
|
type: 'wgs84',
|
|
|
|
success: function (res) {
|
|
|
|
// console.log(JSON.stringify(res))
|
|
|
|
var latitude = res.latitude
|
|
|
|
var longitude = res.longitude
|
|
|
|
var speed = res.speed
|
|
|
|
var accuracy = res.accuracy;
|
|
|
|
vm.getLocal(latitude, longitude)
|
|
|
|
},
|
|
|
|
fail: function (res) {
|
|
|
|
console.log('fail' + JSON.stringify(res))
|
|
|
|
}
|
|
|
|
})
|
|
|
|
},
|
|
|
|
// 获取当前地理位置
|
|
|
|
getLocal: function (latitude, longitude) {
|
|
|
|
let vm = this;
|
|
|
|
qqmapsdk.reverseGeocoder({
|
|
|
|
location: {
|
|
|
|
latitude: latitude,
|
|
|
|
longitude: longitude
|
|
|
|
},
|
|
|
|
success: function (res) {
|
|
|
|
// console.log(JSON.stringify(res));
|
|
|
|
let province = res.result.ad_info.province
|
|
|
|
let city = res.result.ad_info.city
|
|
|
|
vm.setData({
|
|
|
|
province: province,
|
|
|
|
city: city,
|
|
|
|
latitude: latitude,
|
|
|
|
longitude: longitude
|
|
|
|
})
|
|
|
|
// console.log(city)
|
|
|
|
},
|
|
|
|
fail: function (res) {
|
|
|
|
console.log(res);
|
|
|
|
},
|
|
|
|
complete: function (res) {
|
|
|
|
// console.log(res);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
},
|
|
|
|
})
|