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.

124 lines
3.3 KiB

3 years ago
// index.js
// 获取应用实例
const app = getApp()
3 years ago
var QQMapWX = require('../../utils/qqmap-wx-jssdk.min.js');
var qqmapsdk;
3 years ago
Page({
data: {
3 years ago
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,
3 years ago
active: 1,
demandList: [],
resourcesList: [],
province: '',
city: '',
3 years ago
},
onLoad() {
3 years ago
app.editTabbar()
this.getCagetoryList()
qqmapsdk = new QQMapWX({
key: 'UVEBZ-M3VRS-CO4OH-6F5QZ-X7FB7-SVFOX' //这里自己的key秘钥进行填充
});
this.getLocation()
3 years ago
},
3 years ago
tabClick(e){
this.setData({
active: e.currentTarget.dataset.i
3 years ago
})
},
3 years ago
toTab2(){
wx.switchTab({
url: '/pages/demandHall/index',
3 years ago
})
3 years ago
},
3 years ago
getCagetoryList(){
app.http('get','index').then((res)=>{
if(res.data.success){
this.setData({
demandList: res.data.data.demandList,
resourcesList: res.data.data.resourcesDtos,
cagetoryList: res.data.data.cagetoryDtos
})
}
})
},
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);
}
});
},
3 years ago
})