This commit is contained in:
wans 2020-08-12 11:24:30 +08:00
commit 9b5f913489
23 changed files with 447 additions and 79 deletions

3
app.js
View File

@ -10,6 +10,9 @@ App({
venueUrl: 'https://www.wgink.ink/venuebooking', venueUrl: 'https://www.wgink.ink/venuebooking',
activityUrl: 'https://www.wgink.ink/culturalactivity', activityUrl: 'https://www.wgink.ink/culturalactivity',
volunteerUrl: 'https://www.wgink.ink/volunteer', volunteerUrl: 'https://www.wgink.ink/volunteer',
venueUrl: 'https://www.wgink.ink/venuebooking',
activityUrl: 'https://www.wgink.ink/culturalactivity',
volunteerUrl: 'https://www.wgink.ink/volunteer',
liveUrl: 'https://www.wgink.ink/live', liveUrl: 'https://www.wgink.ink/live',
liveRecordUrl: 'https://www.wgink.ink', liveRecordUrl: 'https://www.wgink.ink',
socialUrl: 'https://www.wgink.ink/social', socialUrl: 'https://www.wgink.ink/social',

BIN
images/marker_yellow.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

View File

@ -7,11 +7,38 @@ Page({
*/ */
data: { data: {
dataList: [], dataList: [],
areaList: [],
pages: { pages: {
page: 1, page: 1,
rows: 5 rows: 5,
county: ''
} }
}, },
getAreaList: function () {
var self = this;
app.restAjax.get(app.restAjax.path(app.usercenterUrl + '/app/dataarea/listareabyparentidrelease/640675', []),
self.data.pages, null, function (code, data) {
if (code == '200') {
self.setData({
areaList: data
})
}
}
)
},
changeArea: function (e) {
app.dialog.loading('正在加载');
this.setData({
'pages.county': e.currentTarget.dataset.area
})
this.getActivityList()
},
loadAll: function () {
this.setData({
'pages.county': ''
})
this.getActivityList()
},
goDetail: function (e) { goDetail: function (e) {
var id = e.currentTarget.dataset.id; var id = e.currentTarget.dataset.id;
wx.navigateTo({ wx.navigateTo({
@ -50,6 +77,7 @@ Page({
}, function() { }, function() {
wx.hideNavigationBarLoading(); //完成停止加载图标 wx.hideNavigationBarLoading(); //完成停止加载图标
wx.stopPullDownRefresh(); wx.stopPullDownRefresh();
wx.hideLoading();
}) })
}, },
/** /**
@ -57,6 +85,7 @@ Page({
*/ */
onLoad: function (options) { onLoad: function (options) {
this.getActivityList(); this.getActivityList();
this.getAreaList()
}, },
/** /**

View File

@ -1,3 +1,7 @@
<view class="area">
<view class="area-box {{'' == pages.county?'active': ''}}" bindtap="loadAll">全部</view>
<view class="area-box {{item.areaId == pages.county?'active': ''}}" wx:for="{{areaList}}" wx:key="index" data-area="{{item.areaId}}" bindtap="changeArea">{{item.areaName}}</view>
</view>
<view class="activity"> <view class="activity">
<view class="activity-box" bindtap="goDetail" data-id="{{item.activityLibraryId}}" wx:for="{{dataList}}" wx:key="index"> <view class="activity-box" bindtap="goDetail" data-id="{{item.activityLibraryId}}" wx:for="{{dataList}}" wx:key="index">
<view class="activity-img"> <view class="activity-img">

View File

@ -1,5 +1,6 @@
.activity{ .activity{
padding: 20rpx 30rpx 0; padding: 20rpx 30rpx 0;
margin-top: 80rpx;
} }
.activity-box{ .activity-box{
margin-bottom: 20rpx; margin-bottom: 20rpx;
@ -66,4 +67,23 @@
margin-top: 10rpx; margin-top: 10rpx;
font-size: 24rpx; font-size: 24rpx;
color: #242424; color: #242424;
}
.area{
position: fixed;
top: 0;
left: 0;
right: 0;
height: 80rpx;
white-space: nowrap;
overflow-x: auto;
}
.area-box{
display: inline-block;
width: 25%;
line-height: 80rpx;
text-align: center;
font-size: 30rpx;
}
.area-box.active{
color: #9F1512;
} }

View File

@ -12,7 +12,8 @@ Page({
page: 1, page: 1,
rows: 5 rows: 5
}, },
dataList: {} dataList: {},
status: ''
}, },
getToken: function() { getToken: function() {
var self = this; var self = this;
@ -61,6 +62,7 @@ Page({
self.setData({ self.setData({
dataList: data.rows dataList: data.rows
}) })
console.log(self.data.dataList)
}else { }else {
if(data.rows.length == 0) { if(data.rows.length == 0) {
self.setData({ self.setData({
@ -88,7 +90,8 @@ Page({
onLoad: function (options) { onLoad: function (options) {
var self = this; var self = this;
self.setData({ self.setData({
serviceId: options.serviceId serviceId: options.serviceId,
status: options.status
}) })
this.getToken().then(result => { this.getToken().then(result => {
this.getActivityHis() this.getActivityHis()

View File

@ -1,4 +1,7 @@
<view class="dialog"> <view class="dialog">
<view class="dialog-box" wx:if="{{dataList < 1}}">
暂无评论
</view>
<view class="dialog-box" wx:for="{{dataList}}"> <view class="dialog-box" wx:for="{{dataList}}">
<view class="avatar"> <view class="avatar">
<image wx:if="{{item.photo}}" src="{{item.photo}}"></image> <image wx:if="{{item.photo}}" src="{{item.photo}}"></image>
@ -15,9 +18,6 @@
</view> </view>
<view class="public-time"> <view class="public-time">
<view class="time">{{item.uploadTime}}</view> <view class="time">{{item.uploadTime}}</view>
<!--<view class="delete">
<image src="../../images/delete.png"></image>
</view>-->
</view> </view>
</view> </view>
</view> </view>

View File

@ -14,7 +14,10 @@ Page({
name: '', name: '',
idCard: '', idCard: '',
trueCode: '', trueCode: '',
activityId: '' activityId: '',
restTime: 120,
timer: '',
gotCode: false
}, },
getToken: function() { getToken: function() {
var self = this; var self = this;
@ -40,7 +43,23 @@ Page({
{}, null, function(code, data) { {}, null, function(code, data) {
console.log(data) console.log(data)
if('200' == code) { if('200' == code) {
self.setData({
gotCode: true
})
self.data.timer = setInterval(function () {
var cur = self.data.restTime - 1
if (cur == 0) {
clearInterval(self.data.timer)
self.setData({
restTime: 120,
gotCode: false
})
} else {
self.setData({
restTime: cur
})
}
}, 1000)
} }
}, function(code, data) { }, function(code, data) {
app.dialog.msg(data.msg) app.dialog.msg(data.msg)

View File

@ -41,7 +41,8 @@
<view class="info-box"> <view class="info-box">
验证码: 验证码:
<input placeholder="请输入验证码" model:value="{{code}}"></input> <input placeholder="请输入验证码" model:value="{{code}}"></input>
<view class="get-code" bindtap="getCode">获取验证码</view> <view class="get-code" bindtap="getCode" wx:if="{{!gotCode}}">获取验证码</view>
<view class="got-code" wx:if="{{gotCode}}">{{restTime}}</view>
</view> </view>
<view class="info-box"> <view class="info-box">
姓 名: 姓 名:

View File

@ -63,7 +63,7 @@
height: 40rpx; height: 40rpx;
margin-top: -5rpx; margin-top: -5rpx;
} }
.get-code{ .get-code, .got-code{
position: absolute; position: absolute;
top: 15rpx; top: 15rpx;
right: 0; right: 0;
@ -73,6 +73,13 @@
color: #9F1512; color: #9F1512;
font-size: 26rpx; font-size: 26rpx;
} }
.got-code{
width: 120rpx;
background: #eee;
color: #4a4d52;
border: 1px solid #eaeaea;
text-align: center;
}
.sign-box{ .sign-box{
position: fixed; position: fixed;
bottom: 0; bottom: 0;

View File

@ -45,7 +45,7 @@ Page({
if(page <= 1) { if(page <= 1) {
libraryArray = data.rows; libraryArray = data.rows;
} else { } else {
libraryArray = self.data.news.newsList; libraryArray = self.data.libraryList;
libraryArray = libraryArray.concat(data.rows); libraryArray = libraryArray.concat(data.rows);
} }
self.setData({ self.setData({

View File

@ -7,7 +7,7 @@ Page({
randomName: '', randomName: '',
showPhone: true, showPhone: true,
gotCode: false, gotCode: false,
restTime: 10, restTime: 120,
timer: '', timer: '',
indicatorDots: true, indicatorDots: true,
autoplay: true, autoplay: true,
@ -29,7 +29,8 @@ Page({
liveUrl: app.liveUrl, liveUrl: app.liveUrl,
liveList: [] liveList: []
}, },
usercenterUrl: app.usercenterUrl usercenterUrl: app.usercenterUrl,
isConfirm: false
}, },
doLogin: function () { doLogin: function () {
var self = this; var self = this;
@ -189,7 +190,6 @@ Page({
this.setData({ this.setData({
phone: res.detail.value phone: res.detail.value
}) })
console.log(this.data.phone)
}, },
// 校验手机号 // 校验手机号
testPhone: function () { testPhone: function () {
@ -214,43 +214,40 @@ Page({
}, },
// 获取验证码 // 获取验证码
getCode: function () { getCode: function () {
var self = this var self = this;
self.setData({
gotCode: true
})
self.data.timer = setInterval(function () {
var cur = self.data.restTime - 1
if (cur == 0) {
clearInterval(self.data.timer)
self.setData({
restTime: 120,
gotCode: false
})
} else {
self.setData({
restTime: cur
})
}
}, 1000)
app.restAjax.get(app.restAjax.path('{usercenterUrl}/api/sms/getverificationcode/' + self.data.phone, [app.usercenterUrl]), {}, null, app.restAjax.get(app.restAjax.path('{usercenterUrl}/api/sms/getverificationcode/' + self.data.phone, [app.usercenterUrl]), {}, null,
function (code, data) {},
function (code, data) { function (code, data) {
if (code == 200) {
console.log(data)
self.setData({
gotCode: true
})
self.data.timer = setInterval(function () {
var cur = self.data.restTime - 1
console.log(cur)
if (cur == 0) {
clearInterval(self.data.timer)
self.setData({
restTime: 120,
gotCode: false
})
} else {
self.setData({
restTime: cur
})
}
}, 1000)
}
},
function (code, data) {
console.log(data)
wx.showToast({ wx.showToast({
title: data.msg, title: data.msg,
icon: 'none', icon: 'none',
duration: 1500 duration: 1500
}) })
} ) })
}, },
// 提交绑定手机 // 提交绑定手机
submitPhone: function () { submitPhone: function () {
var self = this var self = this;
self.setData({
isConfirm: true
})
app.restAjax.put(app.restAjax.path('{usercenterUrl}/app/user/updateminiappdefaultusername', [app.usercenterUrl]), { app.restAjax.put(app.restAjax.path('{usercenterUrl}/app/user/updateminiappdefaultusername', [app.usercenterUrl]), {
phone: self.data.phone, phone: self.data.phone,
verificationCode: self.data.code verificationCode: self.data.code
@ -259,17 +256,19 @@ Page({
token: self.data.token token: self.data.token
} }
}, function (code, data) { }, function (code, data) {
console.log(data)
wx.setStorageSync('token', data.data); wx.setStorageSync('token', data.data);
wx.setStorageSync('isRandomUsername', 0) wx.setStorageSync('isRandomUsername', 0)
clearInterval(self.data.timer) clearInterval(self.data.timer)
self.setData({ self.setData({
showPhone: false, showPhone: false
restTime: 120
}) })
wx.showTabBar();
self.getUserInfo() self.getUserInfo()
}, function (code, data) { }, function (code, data) {
console.log(data) app.dialog.msg(data.msg);
self.setData({
isConfirm: false
})
}) })
}, },
// 验证码 // 验证码
@ -305,7 +304,7 @@ Page({
userInfo: data userInfo: data
}) })
}, function (code, data) { }, function (code, data) {
console.log(data) app.dialog.msg(data.msg);
}) })
}, },
/** /**

View File

@ -134,19 +134,19 @@
</view> </view>
</view> </view>
</view> </view>
<view class="set-phone" wx:if="{{randomName && showPhone}}"> <!-- <view class="set-phone" wx:if="{{randomName && showPhone}}">
<view class="set-phone-box"> <view class="set-phone-box">
<view class="tips">您还没有绑定手机号,请先绑定手机号</view> <view class="tips">您还没有绑定手机号,请先绑定手机号</view>
<view class="phone-input"> <view class="phone-input">
<input placeholder="请输入手机号" bindinput="phoneNum" class="phone-input"></input> <input placeholder="请输入手机号" bindinput="phoneNum" class="phone-input" type="number"></input>
</view> </view>
<view class="code-input"> <view class="code-input">
<input placeholder="请输入验证码" bindinput="inputCode"></input> <input placeholder="请输入验证码" bindinput="inputCode" type="number"></input>
<view class="get-code" bindtap="testPhone" wx:if="{{!gotCode}}">获取验证码</view> <view class="get-code" bindtap="testPhone" wx:if="{{!gotCode}}">获取验证码</view>
<view class="got-code" wx:else>{{restTime}}</view> <view class="got-code" wx:else>{{restTime}}</view>
</view> </view>
<view class="set-phone-btn-box"> <view class="set-phone-btn-box">
<view class="set-phone-btn" bindtap="submitPhone">确认</view> <view class="set-phone-btn" bindtap="submitPhone" wx:if="{{!isConfirm}}">确认</view>
</view> </view>
</view> </view>
</view> </view> -->

View File

@ -96,7 +96,7 @@ Page({
teamAreaArray: [] teamAreaArray: []
}) })
this.getDataFromDict(self.data.teamCity[self.data.teamCityIndex].dictionaryId, 2).then(result => { this.getDataFromArea(self.data.teamCity[self.data.teamCityIndex].areaId, 2).then(result => {
if(self.data.tempObj.length > 0) { if(self.data.tempObj.length > 0) {
self.setData({ self.setData({
teamCounty: self.data.tempObj, teamCounty: self.data.tempObj,
@ -122,7 +122,7 @@ Page({
teamCountyIndex: e.detail.value teamCountyIndex: e.detail.value
}) })
this.getDataFromDict(self.data.teamCounty[self.data.teamCountyIndex].dictionaryId, 2).then(result => { this.getDataFromArea(self.data.teamCounty[self.data.teamCountyIndex].areaId, 2).then(result => {
if(self.data.tempObj.length > 0) { if(self.data.tempObj.length > 0) {
self.setData({ self.setData({
teamArea: self.data.tempObj, teamArea: self.data.tempObj,
@ -256,13 +256,62 @@ Page({
}) })
}) })
}, },
/**
*从区域表拉取数据
*/
getDataFromArea: function(dictId, type) {
var self = this;
return new Promise(resolve => {
app.restAjax.get(app.restAjax.path(app.volunteerUrl + '/app/dataarea/listareabyparentidrelease/' + dictId, []),
{}, {
headers: {
'token': self.data.token
}
}, function(code, data) {
if('200' == code) {
if(data || type === 2) {
var array = [];
for(var item of data) {
delete item.areaParentId;
delete item.areaParentName;
delete item.areaCode;
delete item.areaCityCode;
delete item.areaMergerName;
delete item.areaShortName;
delete item.areaZipCode;
delete item.areaLevel;
delete item.areaLng;
delete item.areaLat;
delete item.areaPinyin;
delete item.areaFirst;
delete item.subArea;
delete item.parent;
array.push(item.areaName);
}
self.setData({
tempArray: array
})
}
self.setData({
tempObj: data
})
}
return resolve();
}, function() {
}, function() {
})
})
},
/** /**
* 生命周期函数--监听页面加载 * 生命周期函数--监听页面加载
*/ */
onLoad: function (options) { onLoad: function (options) {
var self = this; var self = this;
this.getToken().then(result => { this.getToken().then(result => {
this.getDataFromDict('4a03e904-81e2-48e9-9006-e15ea4a6bc69', 2).then(result => { this.getDataFromArea('640332', 2).then(result => {
self.setData({ self.setData({
teamCity: self.data.tempObj, teamCity: self.data.tempObj,
teamCityArray: self.data.tempArray, teamCityArray: self.data.tempArray,

View File

@ -13,7 +13,8 @@ Page({
directoriesParentId: 'f497904b-7727-4832-891c-604c36ae4167', directoriesParentId: 'f497904b-7727-4832-891c-604c36ae4167',
currentNewsDictionariesId: '', currentNewsDictionariesId: '',
currentPage: 1, currentPage: 1,
rows: 10 rows: 10,
areaId: ''
}, },
doGetNewsDictionariesList: function() { doGetNewsDictionariesList: function() {
var self = this; var self = this;
@ -43,15 +44,21 @@ Page({
}); });
self.doGetNewsList(1); self.doGetNewsList(1);
}, },
doGetNewsList: function(page) { doGetNewsList: function(page, lv) {
var self = this; var self = this;
app.dialog.loading('正在加载'); app.dialog.loading('正在加载');
app.restAjax.get(app.restAjax.path('{newsUrl}/app/newscontent/listpagenewscontentrelease', [self.data.news.newsUrl]), { var info = {
newsDirectoriesParentId: self.data.directoriesParentId, newsDirectoriesParentId: self.data.directoriesParentId,
newsDirectoriesId: self.data.currentNewsDictionariesId ? self.data.currentNewsDictionariesId : '', newsDirectoriesId: self.data.currentNewsDictionariesId ? self.data.currentNewsDictionariesId : '',
page: page, page: page,
rows: self.data.rows rows: self.data.rows
}, null, function(code, data) { }
if (lv) {
lv = 'area' + lv
info[lv] = self.data.areaId
}
console.log(info)
app.restAjax.get(app.restAjax.path('{newsUrl}/app/newscontent/listpagenewscontentrelease', [self.data.news.newsUrl]), info, null, function(code, data) {
var newsArray; var newsArray;
if(page <= 1) { if(page <= 1) {
newsArray = data.rows; newsArray = data.rows;
@ -79,6 +86,32 @@ Page({
url: '../newsDetail/newsDetail?templateRecordUrl='+ event.currentTarget.dataset.templateRecordUrl, url: '../newsDetail/newsDetail?templateRecordUrl='+ event.currentTarget.dataset.templateRecordUrl,
}) })
}, },
getAreaList: function () {
var self = this;
app.restAjax.get(app.restAjax.path(app.usercenterUrl + '/app/dataarea/listareabyparentidrelease/640675', []),
self.data.pages, null, function (code, data) {
if (code == '200') {
self.setData({
areaList: data
})
}
}
)
},
changeArea: function (e) {
app.dialog.loading('正在加载');
var lv = parseInt(e.currentTarget.dataset.level) + 1
this.setData({
areaId: e.currentTarget.dataset.area
})
this.doGetNewsList(1, lv)
},
loadAll: function () {
this.setData({
areaId: ''
})
this.doGetNewsList(1)
},
/** /**
* 生命周期函数--监听页面加载 * 生命周期函数--监听页面加载
*/ */
@ -94,6 +127,7 @@ Page({
}); });
} }
self.doGetNewsDictionariesList(); self.doGetNewsDictionariesList();
self.getAreaList();
}, },
/** /**

View File

@ -1,13 +1,27 @@
<view class="top-tab"> <view class="top-tab">
<view class="tab-box {{!currentNewsDictionariesId ? 'active' : ''}}" bindtap="doClearCurrentNewsDictionariesId"> <view class="type">
<image src="../../images/selected-l.png" class="selected-l"></image> <view class="tab-box {{!currentNewsDictionariesId ? 'active' : ''}}" bindtap="doClearCurrentNewsDictionariesId">
全部 <image src="../../images/selected-l.png" class="selected-l"></image>
<image src="../../images/selected-r.png" class="selected-r"></image> 全部
<image src="../../images/selected-r.png" class="selected-r"></image>
</view>
<view class="tab-box {{ item.newsDirectoriesId == currentNewsDictionariesId ? 'active' : ''}}" wx:for="{{news.newsDictionaries}}" wx:for-index="index" wx:for-item="item" wx:key="newsDictionaries" bindtap="doClickDictionaries" data-news-directories-id="{{item.newsDirectoriesId}}">
<image src="../../images/selected-l.png" class="selected-l"></image>
{{item.directoriesName}}
<image src="../../images/selected-r.png" class="selected-r"></image>
</view>
</view> </view>
<view class="tab-box {{ item.newsDirectoriesId == currentNewsDictionariesId ? 'active' : ''}}" wx:for="{{news.newsDictionaries}}" wx:for-index="index" wx:for-item="item" wx:key="newsDictionaries" bindtap="doClickDictionaries" data-news-directories-id="{{item.newsDirectoriesId}}"> <view class="area">
<image src="../../images/selected-l.png" class="selected-l"></image> <view class="area-box {{'' == areaId?'active': ''}}" bindtap="loadAll">
{{item.directoriesName}} <image src="../../images/selected-l.png" class="selected-l"></image>
<image src="../../images/selected-r.png" class="selected-r"></image> 全部
<image src="../../images/selected-r.png" class="selected-r"></image>
</view>
<view class="area-box {{item.areaId == areaId?'active': ''}}" wx:for="{{areaList}}" wx:key="index" data-area="{{item.areaId}}" data-level="{{item.areaLevel}}" bindtap="changeArea">
<image src="../../images/selected-l.png" class="selected-l"></image>
{{item.areaName}}
<image src="../../images/selected-r.png" class="selected-r"></image>
</view>
</view> </view>
</view> </view>
<view class="news"> <view class="news">

View File

@ -3,12 +3,14 @@
top: 0; top: 0;
left: 0; left: 0;
right: 0; right: 0;
display: flex;
box-shadow:0 0 17rpx 0 rgba(0,0,0,0.1); box-shadow:0 0 17rpx 0 rgba(0,0,0,0.1);
border-radius:0 0 31rpx 31rpx; border-radius:0 0 31rpx 31rpx;
background: #fff; background: #fff;
overflow-x: auto; overflow-x: auto;
} }
.type{
display: flex;
}
.tab-box{ .tab-box{
display: inline-flex; display: inline-flex;
justify-content: center; justify-content: center;
@ -35,15 +37,52 @@
display: block; display: block;
} }
.tab-box image.selected-l{ .tab-box image.selected-l{
left: 40rpx; left: 20rpx;
} }
.tab-box image.selected-r{ .tab-box image.selected-r{
right: 40rpx; right: 20rpx;
}
.area{
overflow-x: auto;
white-space: nowrap;
}
.area-box{
display: inline-block;
width: 30%;
height: 90rpx;
line-height: 90rpx;
text-align: center;
padding: 0 20px;
box-sizing: border-box;
position: relative;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.area-box.active{
color: #9F1512;
}
.area-box image{
position: absolute;
width: 15rpx;
height: 40rpx;
top: 50%;
margin-top: -20rpx;
display: none;
}
.area-box.active image{
display: block;
}
.area-box image.selected-l{
left: 20rpx;
}
.area-box image.selected-r{
right: 20rpx;
} }
.news{ .news{
padding: 30rpx; padding: 30rpx;
border-bottom: 5px solid #FBFBFB; border-bottom: 5px solid #FBFBFB;
margin-top: 90rpx; margin-top: 180rpx;
} }
.news-box{ .news-box{
padding: 30rpx 0; padding: 30rpx 0;

View File

@ -224,10 +224,11 @@ Page({
}) })
}, },
toActivityHis: function() { toActivityHis: function(e) {
var self = this; var self = this;
const status = e.currentTarget.dataset.status;
wx.navigateTo({ wx.navigateTo({
url: '../activityDialog/activityDialog?serviceId=' + self.data.serviceId, url: '../activityDialog/activityDialog?serviceId=' + self.data.serviceId + '&status=' + status,
}) })
}, },
/** /**

View File

@ -24,7 +24,7 @@
<view class="part"> <view class="part">
<view class="part-title"> <view class="part-title">
活动详情 活动详情
<view class="comment-btn" bindtap="toActivityHis">评论列表</view> <view class="comment-btn" bindtap="toActivityHis" data-status="{{dataMap.status}}">评论列表</view>
</view> </view>
<rich-text class="part-content" nodes="{{dataMap.introduce}}"></rich-text> <rich-text class="part-content" nodes="{{dataMap.introduce}}"></rich-text>
</view> </view>

View File

@ -16,7 +16,11 @@ Page({
orderKey : '', orderKey : '',
venueType : '', venueType : '',
latitude: '', latitude: '',
longitude: '' longitude: '',
selectingArea: false, // 显示隐藏选择区域
areaList: [],
venueArea: '',
areaName: ''
}, },
//获取定位 //获取定位
@ -63,6 +67,7 @@ Page({
latitude: self.data.latitude, latitude: self.data.latitude,
longitude: self.data.longitude, longitude: self.data.longitude,
selfLocation: 'TX', selfLocation: 'TX',
venueArea: self.data.venueArea
}, null, }, null,
function(code, data){ function(code, data){
data.rows.forEach(element => { data.rows.forEach(element => {
@ -77,11 +82,15 @@ Page({
venuesList : data.rows, venuesList : data.rows,
page : data.page page : data.page
}); });
if (data.rows.length == 0) {
app.dialog.msg('暂无数据');
}
}, function(code,data){ }, function(code,data){
app.dialog.msg(data.msg); app.dialog.msg(data.msg);
},function(){ },function(){
wx.hideNavigationBarLoading(); wx.hideNavigationBarLoading();
wx.stopPullDownRefresh(); wx.stopPullDownRefresh();
wx.hideLoading();
} }
); );
}, },
@ -115,12 +124,51 @@ Page({
}) })
}, },
//选择区域
selectArea: function () {
this.setData({
selectingArea: true
})
},
// 获取地区列表
getAreaList: function () {
var self = this;
app.restAjax.get(app.restAjax.path(app.usercenterUrl + '/app/dataarea/listareabyparentidrelease/640675', []),
self.data.pages, null, function (code, data) {
if (code == '200') {
self.setData({
areaList: data
})
}
})
},
// 切换地区
changeArea: function (e) {
app.dialog.loading('正在加载');
this.setData({
venueArea: e.currentTarget.dataset.area,
selectingArea: false,
areaName: e.currentTarget.dataset.areaname
})
this.listPageVenuesInfo()
},
// 全部地区
loadAll: function () {
this.setData({
venueArea: '',
selectingArea: false
})
this.listPageVenuesInfo()
},
/** /**
* 生命周期函数--监听页面加载 * 生命周期函数--监听页面加载
*/ */
onLoad: function (options) { onLoad: function (options) {
this.listVenueType(); this.listVenueType();
this.getLocation(); this.getLocation();
this.getAreaList();
}, },
/** /**

View File

@ -19,6 +19,12 @@
<view class="select-box {{orderKey == 'timeDesc' ? 'active' : ''}}" bindtap="changeVenuesOrderBy" data-becheck="timeDesc"> <view class="select-box {{orderKey == 'timeDesc' ? 'active' : ''}}" bindtap="changeVenuesOrderBy" data-becheck="timeDesc">
最新发布 最新发布
</view> </view>
<view class="select-box" bindtap="selectArea" wx:if="{{venueArea == ''}}">
选择区域
</view>
<view class="select-box" bindtap="selectArea" wx:if="{{venueArea != ''}}">
{{areaName}}
</view>
</view> </view>
</view> </view>
<view class="venue"> <view class="venue">
@ -35,3 +41,9 @@
</view> </view>
</view> </view>
</view> </view>
<view class="select-area" wx:if="{{selectingArea}}">
<view class="area-container">
<view class="area-box {{'' == venueArea?'active': ''}}" bindtap="loadAll">全部</view>
<view class="area-box {{item.areaId == venueArea?'active': ''}}" wx:for="{{areaList}}" wx:key="index" data-area="{{item.areaId}}" data-areaName="{{item.areaName}}" bindtap="changeArea">{{item.areaName}}</view>
</view>
</view>

View File

@ -3,7 +3,7 @@
top: 0; top: 0;
left: 0; left: 0;
right: 0; right: 0;
padding: 0 30rpx; padding: 0 30rpx 10rpx;
background: #fff; background: #fff;
} }
.fixed-tab{ .fixed-tab{
@ -44,7 +44,7 @@
} }
.venue{ .venue{
height: 400rpx; height: 400rpx;
margin-top: 240rpx; margin-top: 250rpx;
padding: 0 30rpx; padding: 0 30rpx;
} }
@ -85,4 +85,41 @@
font-size: 28rpx; font-size: 28rpx;
color: #242424; color: #242424;
margin-top: 10rpx; margin-top: 10rpx;
}
.select-area{
position: fixed;
top: 0;
bottom: 0;
right: 0;
left: 0;
background: rgba(0,0,0,0.6);
}
.area-container{
background: #fff;
padding: 15rpx 15rpx 0;
font-size: 0;
}
.area-box{
display: inline-block;
width: 32%;
height: 60rpx;
line-height: 60rpx;
margin-bottom: 15rpx;
margin-right: 2%;
text-align: center;
font-size: 30rpx;
border: 1px solid #DDD;
border-radius: 10rpx;
box-sizing: border-box;
padding: 0 10rpx;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.area-box.active{
border: #9F1512 1px solid;
color: #9F1512;
}
.area-box:nth-child(3n){
margin-right: 0;
} }

View File

@ -58,7 +58,7 @@ Page({
teamAreaArray: [] teamAreaArray: []
}) })
this.getDataFromDict(self.data.teamCity[self.data.teamCityIndex].dictionaryId, 2).then(result => { this.getDataFromArea(self.data.teamCity[self.data.teamCityIndex].areaId, 2).then(result => {
if(self.data.tempObj.length > 0) { if(self.data.tempObj.length > 0) {
self.setData({ self.setData({
teamCounty: self.data.tempObj, teamCounty: self.data.tempObj,
@ -84,7 +84,7 @@ Page({
teamCountyIndex: e.detail.value teamCountyIndex: e.detail.value
}) })
this.getDataFromDict(self.data.teamCounty[self.data.teamCountyIndex].dictionaryId, 2).then(result => { this.getDataFromArea(self.data.teamCounty[self.data.teamCountyIndex].areaId, 2).then(result => {
if(self.data.tempObj.length > 0) { if(self.data.tempObj.length > 0) {
self.setData({ self.setData({
teamArea: self.data.tempObj, teamArea: self.data.tempObj,
@ -280,6 +280,55 @@ Page({
}) })
}) })
}, },
/**
*从区域表拉取数据
*/
getDataFromArea: function(dictId, type) {
var self = this;
return new Promise(resolve => {
app.restAjax.get(app.restAjax.path(app.volunteerUrl + '/app/dataarea/listareabyparentidrelease/' + dictId, []),
{}, {
headers: {
'token': self.data.token
}
}, function(code, data) {
if('200' == code) {
if(data || type === 2) {
var array = [];
for(var item of data) {
delete item.areaParentId;
delete item.areaParentName;
delete item.areaCode;
delete item.areaCityCode;
delete item.areaMergerName;
delete item.areaShortName;
delete item.areaZipCode;
delete item.areaLevel;
delete item.areaLng;
delete item.areaLat;
delete item.areaPinyin;
delete item.areaFirst;
delete item.subArea;
delete item.parent;
array.push(item.areaName);
}
self.setData({
tempArray: array
})
}
self.setData({
tempObj: data
})
}
return resolve();
}, function() {
}, function() {
})
})
},
getVolunteerMsg() { getVolunteerMsg() {
var self = this; var self = this;
return new Promise(resolve => { return new Promise(resolve => {
@ -323,7 +372,7 @@ Page({
}) })
}) })
}).then(result => { }).then(result => {
this.getDataFromDict('4a03e904-81e2-48e9-9006-e15ea4a6bc69', 2).then(result => { this.getDataFromArea('640332', 2).then(result => {
self.setData({ self.setData({
teamCity: self.data.tempObj, teamCity: self.data.tempObj,
teamCityArray: self.data.tempArray, teamCityArray: self.data.tempArray,