Commit aca9f2f7 by jscat

nyx weapp: 页面优化

1. 统一community/fair的变量为entity
parent ace48180
// pages/activity/activity.js
// pages/activity/activity.js
......@@ -60,22 +60,22 @@ Page({
//园区
activityType: "02-园区",
communities: [],
entities: [], //包括fair和community
/*
园区所在的信息
community_name, num_activity, num_like
集市/园区所在的信息
fair_name, community_name, num_activity, num_like
*/
communityInfos: {},
curCommunity: 0,
entityInfos: {},
curEntity: 0,
},
switchCategory(e) {
var _this = this;
var curIndex = e.currentTarget.dataset.index ? e.currentTarget.dataset.index : 0
var curCommunity = _this.__data__.curCommunity
var curEntity = _this.__data__.curEntity
var strAddress = app.globalData.defaultCity
var strEntity = _this.__data__.communities[curCommunity]
var strEntity = _this.__data__.entities[curEntity]
var strCategory = _this.__data__.category[curIndex].order
var strSearch = _this.__data__.strSearch
this.setData({
......@@ -196,18 +196,18 @@ Page({
// step5 new add jscat 20201008 载入园区列表 - local page
var strCity = app.globalData.defaultCity
var activityType = _this.__data__.activityType
let promise_community = new Promise(function (resolve, reject) {
_this.getCommunities(strCity, activityType, resolve, reject);
let promise_entity = new Promise(function (resolve, reject) {
_this.getEntities(strCity, activityType, resolve, reject);
})
// step6 初始载入四个推荐的活动 - local page
promise_community.then(
promise_entity.then(
function (value){
console.log("===enter promise_community then_passed_" + value)
console.log("===enter promise_entity then_passed_" + value)
_this.onGetActivities()
},
function (value){
console.log("===enter promise_community then_failed_" + value)
console.log("===enter promise_entity then_failed_" + value)
}
)
......@@ -273,18 +273,18 @@ Page({
{
var strCity = app.globalData.defaultCity
var activityType = _this.__data__.activityType
let promise_community = new Promise(function (resolve, reject) {
_this.getCommunities(strCity, activityType, resolve, reject);
let promise_entity = new Promise(function (resolve, reject) {
_this.getEntities(strCity, activityType, resolve, reject);
})
// step6 初始载入四个推荐的活动 - local page
promise_community.then(
promise_entity.then(
function (value){
console.log("===enter promise_community then_passed_" + value)
console.log("===enter promise_entity then_passed_" + value)
_this.onGetActivities()
},
function (value){
console.log("===enter promise_community then_failed_" + value)
console.log("===enter promise_entity then_failed_" + value)
}
)
......@@ -323,15 +323,15 @@ Page({
console.log('页面上拉触底')
var _this = this;
var curIndex = _this.__data__.curIndex
var curCommunity = _this.__data__.curCommunity
var curEntity = _this.__data__.curEntity
var strAddress = app.globalData.defaultCity
var strEntity = _this.__data__.communities[curCommunity]
var strEntity = _this.__data__.entities[curEntity]
var strCategory = _this.__data__.category[curIndex].order
var strSearch = _this.__data__.strSearch
var isHideLoadMore = _this.__data__.isHideLoadMore;
var pageIndex = _this.__data__.pageIndex;
//控制逻辑, 在onClick之后或者onGetComment事件之后再允许下拉更新操作
//控制逻辑, 下拉更新操作
//判断是否已经全部加载完毕
//没有则加载更多
if (!isHideLoadMore) {
......@@ -476,9 +476,9 @@ Page({
hideInput: function () {
var _this = this;
var curIndex = _this.__data__.curIndex
var curCommunity = _this.__data__.curCommunity
var curEntity = _this.__data__.curEntity
var strAddress = app.globalData.defaultCity
var strEntity = _this.__data__.communities[curCommunity]
var strEntity = _this.__data__.entities[curEntity]
var strCategory = _this.__data__.category[curIndex].order
var strSearch = ""
......@@ -502,9 +502,9 @@ Page({
var _this = this;
var strSearch = e.detail.value
var curIndex = _this.__data__.curIndex
var curCommunity = _this.__data__.curCommunity
var curEntity = _this.__data__.curEntity
var strAddress = app.globalData.defaultCity
var strEntity = _this.__data__.communities[curCommunity]
var strEntity = _this.__data__.entities[curEntity]
var strCategory = _this.__data__.category[curIndex].order
console.log("===input search text_" + strSearch)
......@@ -639,10 +639,10 @@ Page({
var _this = this;
var curIndex = _this.__data__.curIndex
var curCommunity = _this.__data__.curCommunity
var curEntity = _this.__data__.curEntity
var strAddress = app.globalData.defaultCity
var strEntity = _this.__data__.communities[curCommunity]
var strEntity = _this.__data__.entities[curEntity]
var strCategory = _this.__data__.category[curIndex].order
var strSearch = _this.__data__.strSearch
......@@ -654,18 +654,18 @@ Page({
/*
* 更换某一个memberInfo的地址信息
*/
onCommunityPicker: function (e) {
onEntityPicker: function (e) {
var _this = this;
var curCommunity = e.detail.value
var curEntity = e.detail.value
var switchId = app.globalData.switchId
var curIndex = switchId != ""? switchId : _this.__data__.curIndex
var strAddress = app.globalData.defaultCity
var strEntity = _this.__data__.communities[curCommunity]
var strEntity = _this.__data__.entities[curEntity]
var strCategory = _this.__data__.category[curIndex].order
var strSearch = ""
this.setData({
curIndex, curCommunity, strSearch
curIndex, curEntity, strSearch
});
app.globalData.switchId = ""
......@@ -674,8 +674,8 @@ Page({
},
// 获取Communities数据 limit 10 by cityName && activityType
getCommunities: function (cityName, activityType, resolve, reject) {
// 获取entities数据 limit 10 by cityName && activityType
getEntities: function (cityName, activityType, resolve, reject) {
var _this = this;
var query_url = '?activityType=' + activityType + '&cityName=' + cityName
......@@ -693,32 +693,41 @@ Page({
//表示HTTP请求成功
console.log(res.data);
var list = []
var communities = []
var entities = []
for (var i = 0; i < res.data.data.length; i++) {
var result = {}
result["activity_type"] = res.data.data[i].activityType
result["city_name"] = res.data.data[i].cityName
result["fair_name"] = res.data.data[i].fairName
result["community_name"] = res.data.data[i].communityName
result["num_entity"] = res.data.data[i].numEntity
result["num_activity"] = res.data.data[i].numActivity
result["num_like"] = res.data.data[i].numLike
communities.push(res.data.data[i].communityName)
if(_this.data.activityType == "01-集市")
{
entities.push(res.data.data[i].fairName)
}
else if(_this.data.activityType == "02-园区")
{
entities.push(res.data.data[i].communityName)
}
list.push(result)
}
_this.setData({
communities: communities,
communityInfos: list,
curCommunity: 0,
entities: entities,
entityInfos: list,
curEntity: 0,
})
resolve("===getCommunities success")
resolve("===getEntities success")
}
},
fail: function (err) {
console.log("fail to getCommunities", err.errMsg)
reject(new Error('failed to getCommunities'));
console.log("fail to getEntities", err.errMsg)
reject(new Error('failed to getEntities'));
},
})
},
......@@ -728,13 +737,13 @@ Page({
var _this = this;
// 如果强制更新, 则不考虑_this.data.activities length是否为0
if( _this.__data__.communities.length > 0 )
if( _this.__data__.entities.length > 0 )
{
var switchId = app.globalData.switchId
var curIndex = switchId != ""? switchId : _this.__data__.curIndex
var curCommunity = _this.__data__.curCommunity
var curEntity = _this.__data__.curEntity
var strAddress = app.globalData.defaultCity
var strEntity = _this.__data__.communities[curCommunity]
var strEntity = _this.__data__.entities[curEntity]
var strCategory = _this.__data__.category[curIndex].order
var strSearch = _this.__data__.strSearch
this.setData({ curIndex });
......
<wxs module="tutil" src="./../../utils/date.wxs"></wxs>
<wxs module="tutil" src="./../../utils/date.wxs"></wxs>
......@@ -7,21 +7,21 @@
<!-- refer https://www.jb51.net/article/158292.htm -->
<!-- refer https://github.com/cinoliu/-selectCity -->
<view class="weui-search-bar">
<picker mode="selector" range="{{communities}}" value="{{curCommunity}}" bindchange="onCommunityPicker" class='address_member'>
<text>{{communities[curCommunity]}}</text>
<picker mode="selector" range="{{entities}}" value="{{curEntity}}" bindchange="onEntityPicker" class='address_member'>
<text>{{entities[curEntity]}}</text>
<image src='../../icon/down.png' style='width: 40rpx;height: 40rpx;' class='selecrtImg'></image>
</picker>
<view class="weui-search-bar__form">
<view class="weui-search-bar__box">
<icon class="weui-icon-search_in-box" type="search" size="16"></icon>
<input type="text" class="weui-search-bar__input" placeholder="发现{{communities[curCommunity]}}" value="{{inputVal}}" focus="{{inputShowed}}" bindconfirm="startSearch" />
<input type="text" class="weui-search-bar__input" placeholder="发现{{entities[curEntity]}}" value="{{inputVal}}" focus="{{inputShowed}}" bindconfirm="startSearch" />
<view class="weui-icon-clear" wx:if="{{inputVal.length > 0}}" bindtap="clearInput">
<icon type="clear" size="16"></icon>
</view>
</view>
<label class="weui-search-bar__label" hidden="{{inputShowed}}" bindtap="showInput">
<icon class="weui-icon-search" type="search" size="16"></icon>
<view class="weui-search-bar__text">发现{{communities[curCommunity]}}·感兴趣的活动</view>
<view class="weui-search-bar__text">发现{{entities[curEntity]}}·感兴趣的活动</view>
</label>
</view>
<view class="weui-search-bar__cancel-btn" hidden="{{!inputShowed}}" bindtap="hideInput">取消
......@@ -48,23 +48,23 @@
<!-- jscat20200816 添加活动日历 for convinience -->
<block>
<view class="items">
<navigator url="/pages/activity/activity-list/activity-list?entityName={{communities[curCommunity]}}&activityType={{activityType}}">
<navigator url="/pages/activity/activity-list/activity-list?entityName={{entities[curEntity]}}&activityType={{activityType}}">
<image src="../../icon/member/schedule.png" style="margin-top:10rpx; margin-bottom:-10rpx"></image>
<text style="font-size:28rpx;">本周活动: {{communityInfos[curCommunity].num_activity}}场</text>
<text style="font-size:28rpx;">本周活动: {{entityInfos[curEntity].num_activity}}场</text>
</navigator>
</view>
</block>
<block wx:if="{{communityInfos[curCommunity].num_entity > 1}}">
<block wx:if="{{entityInfos[curEntity].num_entity > 1}}">
<view class="items">
<image src="../../icon/community/community.png" style="margin-top:10rpx; margin-bottom:-10rpx"></image>
<text style="font-size:28rpx;">园区: {{communityInfos[curCommunity].num_entity}}个</text>
<text style="font-size:28rpx;">园区: {{entityInfos[curEntity].num_entity}}个</text>
</view>
</block>
<view class="items">
<image src="../../icon/activity/like.png" style="margin-top:10rpx; margin-bottom:-10rpx"></image>
<text style="font-size:28rpx;">热度: {{communityInfos[curCommunity].num_like}}点</text>
<text style="font-size:28rpx;">热度: {{entityInfos[curEntity].num_like}}点</text>
</view>
</view>
......
// pages/user/user.js
// pages/user/user.js
Page({
/**
* 页面的初始数据
*/
data: {
strAddress: "",
strIntro: {},
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
var _this = this;
var strAddress = ""
if(options.strAddress != "" && options.strAddress != undefined)
{
strAddress = options.strAddress
}
var strIntro = {
"思南公馆": "思南公馆是中国上海市中心唯一一个以成片花园洋房的保留保护为宗旨的项目,坐拥51栋历史悠久的花园洋房,同时汇聚了独立式花园洋房、联立式花园洋房、带内院独立式花园洋房、联排式建筑、外廊式建筑、新式里弄、花园里弄、现代公寓等多种建筑样式 ,是上海近代居住类建筑的集中地。\n占地面积约5万平方米,总建筑面积近8万平方米,内设有精品酒店、酒店式公寓、企业公馆和商业区,与淮海路沿线的百年经典建筑、名人故居交相辉映,成为上海市中心集人文、历史和时尚底蕴于一身,最具特色的风景。",
"永平里":"永平里 (上海衡复历史文化风貌区之一)\n永平里,北临衡山路、南接永嘉路。内部建筑错落于其中,相互由道路和庭院形成整体贯通,成为连接衡山路和永嘉路的特别区域兼具历史风貌和现代欧式风格的步行街道。"
}
_this.setData({ strAddress, strIntro })
wx.setNavigationBarTitle({
title: '园区介绍',
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
}
})
\ No newline at end of file
<view class="page">
<view class="page">
<view class="userInfo">
<view class="userDesc">
<span>{{strIntro[strAddress]}}</span>
</view>
</view>
</view>
.page{
.page{
height: 100vh;
background: #f5f8fa;
}
.userinfo{
width: 100%;
height: 450rpx;
background: rgb(185, 172, 155);
}
.head-img{
width: 100%;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
overflow: hidden;
padding-top: 30px;
}
.thumb{
width: 120rpx;
height: 120rpx;
border: 1px solid #ffffff;
border-radius: 50%;
overflow: hidden;
}
.name{
margin: 30rpx;
color: #ffffff;
}
.userMessage{
display: flex;
justify-content: center; /*子元素水平居中*/
align-items: center; /*子元素垂直居中*/
}
.messageBox{
width: 650rpx;
height: 150rpx;
}
.focus, .fans, .praise-collect{
width: 200rpx;
color: #ffffff;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
overflow: hidden;
float: left;
}
.border{
color: #ffffff;
width: 20rpx;
height: 150rpx;
float: left;
}
.grade{
height: 70rpx;
color: #6d6d6d;
background: #ffffff;
display: flex;
justify-content: center; /*子元素水平居中*/
align-items: center; /*子元素垂直居中*/
}
.grade-icon{
width: 50rpx;
height: 50rpx;
margin-right: 10rpx;
}
.userDesc{
height: 120rpx;
color: #6d6d6d;
background: #ffffff;
}
.userDesc span{
margin-left: 30rpx;
}
// pages/activity/activity.js
// pages/activity/activity.js
......@@ -59,26 +59,29 @@ Page({
qRCodeMsg: "",
//园区
communities: [
'思南公馆',
'永平里',
],
curCommunity: 0,
activityType: "01-集市",
entities: [], //包括fair和community
/*
集市/园区所在的信息
fair_name, community_name, num_activity, num_like
*/
entityInfos: {},
curEntity: 0,
},
switchCategory(e) {
var _this = this;
var curIndex = e.currentTarget.dataset.index ? e.currentTarget.dataset.index : 0
var curCommunity = _this.__data__.curCommunity
var strAddress = _this.__data__.communities[curCommunity]
var curEntity = _this.__data__.curEntity
var strAddress = app.globalData.defaultCity
var strEntity = _this.__data__.entities[curEntity]
var strCategory = _this.__data__.category[curIndex].order
var strSearch = _this.__data__.strSearch
this.setData({
curIndex: curIndex,
})
_this.getActivities(0, 1, 4, strAddress, strCategory, strSearch);
_this.getActivities(0, 1, 4, strAddress, strEntity, strCategory, strSearch);
},
// 搜索点击事件
entrySearch(e) {
......@@ -190,25 +193,25 @@ Page({
}
)
// step5 初始载入四个推荐的活动 - local page
if(_this.__data__.activities.length == 0)
{
var switchId = app.globalData.switchId
var curIndex = switchId != ""? switchId : _this.__data__.curIndex
var curCommunity = _this.__data__.curCommunity
var strAddress = _this.__data__.communities[curCommunity]
var strCategory = _this.__data__.category[curIndex].order
var strSearch = _this.__data__.strSearch
this.setData({
curIndex: curIndex,
});
app.globalData.switchId = ""
_this.getActivities(0, 1, 4, strAddress, strCategory, strSearch);
// step5 new add jscat 20201008 载入园区列表 - local page
var strCity = app.globalData.defaultCity
var activityType = _this.__data__.activityType
let promise_entity = new Promise(function (resolve, reject) {
_this.getEntities(strCity, activityType, resolve, reject);
})
// step6 初始载入四个推荐的活动 - local page
promise_entity.then(
function (value){
console.log("===enter promise_entity then_passed_" + value)
_this.onGetActivities()
},
function (value){
console.log("===enter promise_entity then_failed_" + value)
}
)
// step6 event 订阅, 主要接受activity-info.js里 emit 发送的消息 local page
// step7 event 订阅, 主要接受activity-info.js里 emit 发送的消息 local page
event.on('LikeChanged', this, function(data) {
var activity_id = data['activity_id']
var num_like = data['num_like']
......@@ -226,7 +229,7 @@ Page({
})
})
// step7 窗口初始化
// step8 窗口初始化
var device = wx.getSystemInfoSync()
//self.device = app.globalData.myDevice
// jscat miniprogram default width is 750rpx
......@@ -242,7 +245,7 @@ Page({
})
wx.setNavigationBarTitle({
title: '园区活动',
title: '集市活动',
})
},
......@@ -266,6 +269,28 @@ Page({
county: defaultCounty
})
if(app.globalData.citySwitched == 1)
{
var strCity = app.globalData.defaultCity
var activityType = _this.__data__.activityType
let promise_entity = new Promise(function (resolve, reject) {
_this.getEntities(strCity, activityType, resolve, reject);
})
// step6 初始载入四个推荐的活动 - local page
promise_entity.then(
function (value){
console.log("===enter promise_entity then_passed_" + value)
_this.onGetActivities()
},
function (value){
console.log("===enter promise_entity then_failed_" + value)
}
)
app.globalData.citySwitched = 0
}
},
/**
......@@ -298,21 +323,22 @@ Page({
console.log('页面上拉触底')
var _this = this;
var curIndex = _this.__data__.curIndex
var curCommunity = _this.__data__.curCommunity
var strAddress = _this.__data__.communities[curCommunity]
var curEntity = _this.__data__.curEntity
var strAddress = app.globalData.defaultCity
var strEntity = _this.__data__.entities[curEntity]
var strCategory = _this.__data__.category[curIndex].order
var strSearch = _this.__data__.strSearch
var isHideLoadMore = _this.__data__.isHideLoadMore;
var pageIndex = _this.__data__.pageIndex;
//控制逻辑, 在onClick之后或者onGetComment事件之后再允许下拉更新操作
//控制逻辑, 下拉更新操作
//判断是否已经全部加载完毕
//没有则加载更多
if (!isHideLoadMore) {
console.log('加载更多')
setTimeout(() => {
_this.getActivities(1, pageIndex, 4, strAddress, strCategory, strSearch);
_this.getActivities(1, pageIndex, 4, strAddress, strEntity, strCategory, strSearch);
}, 1000)
}
else {
......@@ -338,13 +364,16 @@ Page({
1. 搜索框, tag=strSearch + title=strSearch
2. tab, tag=strSearch
3. 新增的search tab, '搜索'tab的时候,需要转换为搜索的关键词(_this.__data__.strSearch)
4. jscat 20201008 新增按照entity搜索(fair/community)
*/
getActivities: function (scrollType, pageNum, pageCount, strAddress, strCategory, strSearch) {
getActivities: function (scrollType, pageNum, pageCount, strAddress, strEntity, strCategory, strSearch) {
var _this = this;
var activityType = _this.__data__.activityType
// 如果是"推荐"和"搜索",需要单独处理
// '搜索'tab的时候, 需要转换为搜索的关键词(_this.__data__.strSearch)
var query_url = '&title=' + strSearch + '&orderType=' + strCategory + '&city=' + strAddress
+ '&activityType=' + activityType + '&entityName=' + strEntity
var strUrl = config.activity_query_url + "?pageCount=" + pageCount
+ "&pageNum=" + pageNum + query_url
......@@ -447,8 +476,9 @@ Page({
hideInput: function () {
var _this = this;
var curIndex = _this.__data__.curIndex
var curCommunity = _this.__data__.curCommunity
var strAddress = _this.__data__.communities[curCommunity]
var curEntity = _this.__data__.curEntity
var strAddress = app.globalData.defaultCity
var strEntity = _this.__data__.entities[curEntity]
var strCategory = _this.__data__.category[curIndex].order
var strSearch = ""
......@@ -457,7 +487,7 @@ Page({
inputShowed: false,
});
_this.getActivities(0, 1, 4, strAddress, strCategory, strSearch);
_this.getActivities(0, 1, 4, strAddress, strEntity, strCategory, strSearch);
},
// * 删除输入字符串
......@@ -472,11 +502,13 @@ Page({
var _this = this;
var strSearch = e.detail.value
var curIndex = _this.__data__.curIndex
var curCommunity = _this.__data__.curCommunity
var strAddress = _this.__data__.communities[curCommunity]
var curEntity = _this.__data__.curEntity
var strAddress = app.globalData.defaultCity
var strEntity = _this.__data__.entities[curEntity]
var strCategory = _this.__data__.category[curIndex].order
console.log("===input search text_" + strSearch)
_this.getActivities(0, 1, 4, strAddress, strCategory, strSearch);
_this.getActivities(0, 1, 4, strAddress, strEntity, strCategory, strSearch);
_this.setData({
strSearch: strSearch,
......@@ -607,35 +639,120 @@ Page({
var _this = this;
var curIndex = _this.__data__.curIndex
var curCommunity = _this.__data__.curCommunity
var strAddress = _this.__data__.communities[curCommunity]
var curEntity = _this.__data__.curEntity
var strAddress = app.globalData.defaultCity
var strEntity = _this.__data__.entities[curEntity]
var strCategory = _this.__data__.category[curIndex].order
var strSearch = _this.__data__.strSearch
_this.getActivities(0, 1, 4, strAddress, strCategory, strSearch);
console.log("===input search text_" + strSearch)
_this.getActivities(0, 1, 4, strAddress, strEntity, strCategory, strSearch);
},
/*
* 更换某一个memberInfo的地址信息
*/
onCommunityPicker: function (e) {
onEntityPicker: function (e) {
var _this = this;
var curCommunity = e.detail.value
var curEntity = e.detail.value
var switchId = app.globalData.switchId
var curIndex = switchId != ""? switchId : _this.__data__.curIndex
var strAddress = _this.__data__.communities[curCommunity]
var strAddress = app.globalData.defaultCity
var strEntity = _this.__data__.entities[curEntity]
var strCategory = _this.__data__.category[curIndex].order
var strSearch = ""
this.setData({
curIndex, curCommunity, strSearch
curIndex, curEntity, strSearch
});
app.globalData.switchId = ""
_this.getActivities(0, 1, 4, strAddress, strCategory, strSearch);
console.log("===input search text_" + strSearch)
_this.getActivities(0, 1, 4, strAddress, strEntity, strCategory, strSearch);
},
// 获取entities数据 limit 10 by cityName && activityType
getEntities: function (cityName, activityType, resolve, reject) {
var _this = this;
var query_url = '?activityType=' + activityType + '&cityName=' + cityName
var strUrl = config.activity_stat_query_url + query_url
config.debug == 1 ? console.log("===strUrl is: \"" + strUrl + "\"") : ""
wx.request({
url: strUrl,
method: 'GET',
header: {
'Cookie': wx.getStorageSync('cookieKey'),
},
success: function (res) {
if (res.data.resultCode == 200) {
//表示HTTP请求成功
console.log(res.data);
var list = []
var entities = []
for (var i = 0; i < res.data.data.length; i++) {
var result = {}
result["activity_type"] = res.data.data[i].activityType
result["city_name"] = res.data.data[i].cityName
result["fair_name"] = res.data.data[i].fairName
result["community_name"] = res.data.data[i].communityName
result["num_entity"] = res.data.data[i].numEntity
result["num_activity"] = res.data.data[i].numActivity
result["num_like"] = res.data.data[i].numLike
if(_this.data.activityType == "01-集市")
{
entities.push(res.data.data[i].fairName)
}
else if(_this.data.activityType == "02-园区")
{
entities.push(res.data.data[i].communityName)
}
list.push(result)
}
_this.setData({
entities: entities,
entityInfos: list,
curEntity: 0,
})
resolve("===getEntities success")
}
},
fail: function (err) {
console.log("fail to getEntities", err.errMsg)
reject(new Error('failed to getEntities'));
},
})
},
// getActivities入口函数
onGetActivities: function(){
var _this = this;
// 如果强制更新, 则不考虑_this.data.activities length是否为0
if( _this.__data__.entities.length > 0 )
{
var switchId = app.globalData.switchId
var curIndex = switchId != ""? switchId : _this.__data__.curIndex
var curEntity = _this.__data__.curEntity
var strAddress = app.globalData.defaultCity
var strEntity = _this.__data__.entities[curEntity]
var strCategory = _this.__data__.category[curIndex].order
var strSearch = _this.__data__.strSearch
this.setData({ curIndex });
app.globalData.switchId = ""
_this.getActivities(0, 1, 4, strAddress, strEntity, strCategory, strSearch);
}
},
})
......
<wxs module="tutil" src="./../../utils/date.wxs"></wxs>
<wxs module="tutil" src="./../../utils/date.wxs"></wxs>
......@@ -7,21 +7,21 @@
<!-- refer https://www.jb51.net/article/158292.htm -->
<!-- refer https://github.com/cinoliu/-selectCity -->
<view class="weui-search-bar">
<picker mode="selector" range="{{communities}}" value="{{curCommunity}}" bindchange="onCommunityPicker" class='address_member'>
<text>{{communities[curCommunity]}}</text>
<picker mode="selector" range="{{entities}}" value="{{curEntity}}" bindchange="onEntityPicker" class='address_member'>
<text>{{entities[curEntity]}}</text>
<image src='../../icon/down.png' style='width: 40rpx;height: 40rpx;' class='selecrtImg'></image>
</picker>
<view class="weui-search-bar__form">
<view class="weui-search-bar__box">
<icon class="weui-icon-search_in-box" type="search" size="16"></icon>
<input type="text" class="weui-search-bar__input" placeholder="发现{{communities[curCommunity]}}" value="{{inputVal}}" focus="{{inputShowed}}" bindconfirm="startSearch" />
<input type="text" class="weui-search-bar__input" placeholder="发现{{entities[curEntity]}}" value="{{inputVal}}" focus="{{inputShowed}}" bindconfirm="startSearch" />
<view class="weui-icon-clear" wx:if="{{inputVal.length > 0}}" bindtap="clearInput">
<icon type="clear" size="16"></icon>
</view>
</view>
<label class="weui-search-bar__label" hidden="{{inputShowed}}" bindtap="showInput">
<icon class="weui-icon-search" type="search" size="16"></icon>
<view class="weui-search-bar__text">发现{{communities[curCommunity]}}·感兴趣的活动</view>
<view class="weui-search-bar__text">发现{{entities[curEntity]}}·感兴趣的活动</view>
</label>
</view>
<view class="weui-search-bar__cancel-btn" hidden="{{!inputShowed}}" bindtap="hideInput">取消
......@@ -48,19 +48,23 @@
<!-- jscat20200816 添加活动日历 for convinience -->
<block>
<view class="items">
<navigator url="/pages/activity/activity-list/activity-list?strAddress={{communities[curCommunity]}}">
<navigator url="/pages/activity/activity-list/activity-list?entityName={{entities[curEntity]}}&activityType={{activityType}}">
<image src="../../icon/member/schedule.png" style="margin-top:10rpx; margin-bottom:-10rpx"></image>
<text style="font-size:28rpx;">本周活动</text>
<text style="font-size:28rpx;">本周活动: {{entityInfos[curEntity].num_activity}}场</text>
</navigator>
</view>
</block>
<!-- todo 0828 我的活动暂时也不实现 -->
<block wx:if="{{entityInfos[curEntity].num_entity > 1}}">
<view class="items">
<navigator url="/pages/community/introduction/introduction?strAddress={{communities[curCommunity]}}">
<image src="../../icon/activity/order.png" style="margin-top:10rpx; margin-bottom:-10rpx"></image>
</navigator>
<text>{{communities[curCommunity]}}介绍</text>
<image src="../../icon/fair/fair.png" style="margin-top:10rpx; margin-bottom:-10rpx"></image>
<text style="font-size:28rpx;">集市: {{entityInfos[curEntity].num_entity}}个</text>
</view>
</block>
<view class="items">
<image src="../../icon/activity/like.png" style="margin-top:10rpx; margin-bottom:-10rpx"></image>
<text style="font-size:28rpx;">热度: {{entityInfos[curEntity].num_like}}点</text>
</view>
</view>
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论