修改请求方法, app.json添加获取定位时的默认提示框

This commit is contained in:
wans 2020-06-26 15:28:31 +08:00
parent 5eb282a80f
commit 29c6690080
6 changed files with 59 additions and 54 deletions

2
app.js
View File

@ -7,7 +7,7 @@ App({
newsUrl: 'http://192.168.0.113:8082/news',
libraryUrl: 'http://192.168.0.113:8081/library',
activityUrl: '',
venueUrl: '',
venueUrl: 'http://192.168.0.109:8082/venuebooking',
restAjax: restAjax,
dialog: dialog,
onLaunch: function () {

View File

@ -64,6 +64,11 @@
}
]
},
"permission": {
"scope.userLocation": {
"desc": "你的位置信息将用于您当前所在位置"
}
},
"style": "v2",
"sitemapLocation": "sitemap.json"
}

View File

@ -1,3 +1,4 @@
var app = getApp();
// pages/venue/venue.js
Page({
@ -5,8 +6,8 @@ Page({
* 页面的初始数据
*/
data: {
baseUrl : 'http://192.168.0.109:8082/venuebooking/',
imgRoute : 'route/file/downloadfile/true/',
venueUrl : app.venueUrl,
imgRoute : '/route/file/downloadfile/true/',
venueTypeParentId : 'df8b758c-f6d8-465a-9aa8-c451fde47076',
page : '1',
rows : '10',
@ -38,23 +39,23 @@ Page({
//获取场馆分类
listVenueType : function(){
var self = this;
wx.request({
url: self.data.baseUrl + 'app/venuedictionary/listvenuedictionarybyparentidrelease/' + self.data.venueTypeParentId,
success : function(res){
var data = res.data;
app.restAjax.get(app.restAjax.path('{venueUrl}/app/venuedictionary/listvenuedictionarybyparentidrelease/{venueTypeParentId}',
[app.venueUrl, self.data.venueTypeParentId]), {}, null,
function(code,data){
self.setData({
venueTypeList : data.data
})
venueTypeList: data.data
});
},function(code, data){
app.dialog.msg(data.msg);
}
})
);
},
//获取场馆列表
listPageVenuesInfo : function(){
var self = this;
wx.request({
url: self.data.baseUrl + 'app/venuesinfo/listpagevenuesinforelease',
data : {
app.restAjax.get(app.restAjax.path('{venueUrl}/app/venuesinfo/listpagevenuesinforelease', [app.venueUrl]),
{
page : self.data.page,
rows : self.data.rows,
orderKey : self.data.orderKey,
@ -62,9 +63,8 @@ Page({
latitude: self.data.latitude,
longitude: self.data.longitude,
selfLocation: 'TX',
},
success : function(res){
var data = res.data;
}, null,
function(code, data){
data.rows.forEach(element => {
element.venuePanorama = element.venuePanorama.split(',')[0];
if(element.apart >= 1000){
@ -76,10 +76,11 @@ Page({
self.setData({
venuesList : data.rows,
page : data.page
})
});
}, function(code,data){
app.dialog.msg(data.msg);
}
})
);
},
//切换场馆类型
@ -97,7 +98,6 @@ Page({
//切换场馆排序
changeVenuesOrderBy: function(options){
var beCheck = options.currentTarget.dataset.becheck;
console.log(options);
this.setData({
orderKey : beCheck
})

View File

@ -1,7 +1,7 @@
<view class="fixed-top">
<view class="fixed-tab">
<view class="tab-box {{item.dictionaryId == venueType ? 'active' : ''}}" wx:for="{{venueTypeList}}" bindtap="changeVenueType" data-id="{{item.dictionaryId}}">
<image src="{{baseUrl}}{{imgRoute}}{{item.dictionaryIcon}}"></image>
<view class="tab-box {{item.dictionaryId == venueType ? 'active' : ''}}" wx:for="{{venueTypeList}}" wx:key="index" bindtap="changeVenueType" data-id="{{item.dictionaryId}}">
<image src="{{venueUrl}}{{imgRoute}}{{item.dictionaryIcon}}"></image>
<view class="tab-title">{{item.dictionaryName}}</view>
</view>
</view>
@ -18,9 +18,9 @@
</view>
</view>
<view class="venue">
<view class="venue-box" wx:for="{{venuesList}}" bindtap="goDetail" data-id="{{item.venuesInfoId}}">
<view class="venue-box" wx:for="{{venuesList}}" wx:key="index" bindtap="goDetail" data-id="{{item.venuesInfoId}}">
<view class="venue-img">
<image src="{{baseUrl}}{{imgRoute}}{{item.venuePanorama}}"></image>
<image src="{{venueUrl}}{{imgRoute}}{{item.venuePanorama}}"></image>
</view>
<view class="venue-info">
<view class="name-distance">

View File

@ -1,15 +1,14 @@
var app = getApp();
// pages/venueDetail/venueDetail.js
Page({
/**
* 页面的初始数据
*/
data: {
baseUrl: 'http://192.168.0.109:8082/venuebooking/',
imgRoute : 'route/file/downloadfile/true/',
venueUrl: app.venueUrl,
imgRoute : '/route/file/downloadfile/true/',
indicatorDots: true,
autoplay: true,
venuesInfoId: '',
venuesDetail:{},
venuesProjectList: [],
@ -22,37 +21,35 @@ Page({
//场馆详情接口
getVenuesDetail: function(){
var self = this;
wx.request({
url: self.data.baseUrl + 'app/venuesinfo/getvenuesinfobyidrelease/' + self.data.venuesInfoId,
data: {
app.restAjax.get(app.restAjax.path('{venueUrl}/app/venuesinfo/getvenuesinfobyidrelease/{venuesInfoId}',[app.venueUrl, self.data.venuesInfoId]),
{
resultLocation: 'TX'
},
success:(res) => {
var swiperImg = res.data.venuePanorama.split(',');
}, null, function(code, data){
var swiperImg = data.venuePanorama.split(',');
if(swiperImg.length <= 1){
self.setData({
indicatorDots: false,
autoplay: false
})
}
};
self.setData({
venuesDetail: res.data,
venuesDetail: data,
swiperImg: swiperImg,
venueCharge: res.data.venueCharge
venueCharge: data.venueCharge
});
console.log(self.data.venuesDetail);
}, function(code,data){
app.dialog.msg(data.msg);
}
})
);
},
//获取项目列表
listVenuesProject: function(){
var self = this;
wx.request({
url: self.data.baseUrl + 'app/venuesproject/listprojectinforelease/' + self.data.venuesInfoId,
success: (res) => {
app.restAjax.get(app.restAjax.path('{venueUrl}/app/venuesproject/listprojectinforelease/{venuesInfoId}', [app.venueUrl, self.data.venuesInfoId]), {}, null ,
function(code,data){
self.setData({
venuesProjectList: res.data
venuesProjectList: data
});
if(self.data.venuesProjectList.length > 0){
self.setData({
@ -60,8 +57,10 @@ Page({
});
self.getVenuesProjectDetail();
};
}, function(code, data){
app.dialog.msg(data.msg);
}
})
);
},
//切换当前选择项目
@ -79,21 +78,22 @@ Page({
//获取项目详情信息
getVenuesProjectDetail: function(){
var self = this;
wx.request({
url: self.data.baseUrl + 'app/venuesproject/getvenuesprojectdetailrelease/' + self.data.selectVenuesProject,
success: function(res){
app.restAjax.get(app.restAjax.path('{venueUrl}/app/venuesproject/getvenuesprojectdetailrelease/{selectVenuesProject}',
[app.venueUrl, self.data.selectVenuesProject]), {}, null,
function(code,data){
console.log(data);
self.setData({
selectVenuesProjectDetail: res.data.data
selectVenuesProjectDetail: data.data
});
}, function(code,data){
app.dialog.msg(data.msg);
}
});
);
},
//场馆地图导航
showMap: function(options){
console.log(options);
var dataObj = options.currentTarget.dataset
console.log(dataObj.latitude + 0)
wx.openLocation({//​使用微信内置地图查看位置。
latitude: Number(dataObj.latitude),//要去的纬度-地址
longitude: Number(dataObj.longitude),//要去的经度-地址

View File

@ -1,7 +1,7 @@
<view class="swiper-box">
<swiper indicator-dots="{{indicatorDots}}" autoplay="{{autoplay}}" >
<swiper-item class="swiper-item" wx:for="{{swiperImg}}">
<image src="{{baseUrl}}{{imgRoute}}{{item}}"></image>
<swiper-item class="swiper-item" wx:for="{{swiperImg}}" wx:key="index">
<image src="{{venueUrl}}{{imgRoute}}{{item}}"></image>
</swiper-item>
</swiper>
</view>
@ -28,7 +28,7 @@
<view wx:if="{{venuesProjectList.length > 0}}">
<view class="selecet-tab">
<view class="tab-btn {{selectVenuesProject == item.venuesProjectId ? 'active' : ''}}"
wx:for="{{venuesProjectList}}" bindtap="changeVenuesProject" data-id="{{item.venuesProjectId}}">{{item.projectName}}</view>
wx:for="{{venuesProjectList}}" wx:key="index" bindtap="changeVenuesProject" data-id="{{item.venuesProjectId}}">{{item.projectName}}</view>
</view>
<view class="tab-info">
<view class="tab-content">