Commit 3b48ed94 by jscat

nyx weapp: 功能更新

1. 添加园区和园区活动query功能
parent a80d7bba
//app.js //app.js
...@@ -77,6 +77,7 @@ App({ ...@@ -77,6 +77,7 @@ App({
defaultCity: '上海', defaultCity: '上海',
defaultCounty: '静安区', defaultCounty: '静安区',
citySwitched: 0,
}, },
......
{ {
...@@ -43,7 +43,7 @@ ...@@ -43,7 +43,7 @@
}, },
{ {
"pagePath": "pages/fair/fair", "pagePath": "pages/fair/fair",
"text": "市", "text": "市",
"iconPath": "./icon/fair/fair.png", "iconPath": "./icon/fair/fair.png",
"selectedIconPath": "./icon/fair/fair.png" "selectedIconPath": "./icon/fair/fair.png"
}, },
......
//config.js API全局域名配置 //config.js API全局域名配置
...@@ -51,6 +51,7 @@ var config={ ...@@ -51,6 +51,7 @@ var config={
notes_query_url: host_key + "/api/nyx/post/query", notes_query_url: host_key + "/api/nyx/post/query",
activity_query_url: host_key + "/api/nyx/activity/query", activity_query_url: host_key + "/api/nyx/activity/query",
activity_period_query_url: host_key + "/api/nyx/activity/query/period", activity_period_query_url: host_key + "/api/nyx/activity/query/period",
activity_stat_query_url: host_key + "/api/nyx/activity/stat/query",
order_detail_query_url: host_key + "/api/nyx/order/detail/query", order_detail_query_url: host_key + "/api/nyx/order/detail/query",
order_add_url: host_key + "/api/nyx/add/order", order_add_url: host_key + "/api/nyx/add/order",
match_query_url: host_key + "/api/nyx/match/query", match_query_url: host_key + "/api/nyx/match/query",
......
// pages/activity/activity.js // pages/activity/activity.js
...@@ -51,24 +51,34 @@ Page({ ...@@ -51,24 +51,34 @@ Page({
//搜索模块 //搜索模块
inputShowed: false, //初始文本框不显示内容 inputShowed: false, //初始文本框不显示内容
strSearch : "", //搜索的字串 strSearch : "", //搜索的title字串
strAddress : "思南公馆", //搜索的address字串
inputVal : "", //输入字符串,主要用于页面显示 inputVal : "", //输入字符串,主要用于页面显示
//二维码信息 //二维码信息
qRCodeMsg: "", qRCodeMsg: "",
//园区
communities: [
'思南公馆',
'永平里',
],
curCommunity: 0,
}, },
switchCategory(e) { switchCategory(e) {
var _this = this; var _this = this;
var curIndex = e.currentTarget.dataset.index ? e.currentTarget.dataset.index : 0 var curIndex = e.currentTarget.dataset.index ? e.currentTarget.dataset.index : 0
var strCity = _this.__data__.city var curCommunity = _this.__data__.curCommunity
var strAddress = _this.__data__.communities[curCommunity]
var strCategory = _this.__data__.category[curIndex].order var strCategory = _this.__data__.category[curIndex].order
var strSearch = _this.__data__.strSearch var strSearch = _this.__data__.strSearch
this.setData({ this.setData({
curIndex: curIndex, curIndex: curIndex,
}) })
_this.getActivities(0, 1, 4, strCity, strCategory, strSearch); _this.getActivities(0, 1, 4, strAddress, strCategory, strSearch);
}, },
// 搜索点击事件 // 搜索点击事件
entrySearch(e) { entrySearch(e) {
...@@ -180,13 +190,13 @@ Page({ ...@@ -180,13 +190,13 @@ Page({
} }
) )
// step5 初始载入四个推荐的活动 - local page // step5 初始载入四个推荐的活动 - local page
if(_this.__data__.activities.length == 0) if(_this.__data__.activities.length == 0)
{ {
var switchId = app.globalData.switchId var switchId = app.globalData.switchId
var curIndex = switchId != ""? switchId : _this.__data__.curIndex var curIndex = switchId != ""? switchId : _this.__data__.curIndex
var strCity = _this.__data__.city var curCommunity = _this.__data__.curCommunity
var strAddress = _this.__data__.communities[curCommunity]
var strCategory = _this.__data__.category[curIndex].order var strCategory = _this.__data__.category[curIndex].order
var strSearch = _this.__data__.strSearch var strSearch = _this.__data__.strSearch
this.setData({ this.setData({
...@@ -194,7 +204,7 @@ Page({ ...@@ -194,7 +204,7 @@ Page({
}); });
app.globalData.switchId = "" app.globalData.switchId = ""
_this.getActivities(0, 1, 4, strCity, strCategory, strSearch); _this.getActivities(0, 1, 4, strAddress, strCategory, strSearch);
} }
...@@ -288,7 +298,8 @@ Page({ ...@@ -288,7 +298,8 @@ Page({
console.log('页面上拉触底') console.log('页面上拉触底')
var _this = this; var _this = this;
var curIndex = _this.__data__.curIndex var curIndex = _this.__data__.curIndex
var strCity = _this.__data__.city var curCommunity = _this.__data__.curCommunity
var strAddress = _this.__data__.communities[curCommunity]
var strCategory = _this.__data__.category[curIndex].order var strCategory = _this.__data__.category[curIndex].order
var strSearch = _this.__data__.strSearch var strSearch = _this.__data__.strSearch
var isHideLoadMore = _this.__data__.isHideLoadMore; var isHideLoadMore = _this.__data__.isHideLoadMore;
...@@ -301,7 +312,7 @@ Page({ ...@@ -301,7 +312,7 @@ Page({
console.log('加载更多') console.log('加载更多')
setTimeout(() => { setTimeout(() => {
_this.getActivities(1, pageIndex, 4, strCity, strCategory, strSearch); _this.getActivities(1, pageIndex, 4, strAddress, strCategory, strSearch);
}, 1000) }, 1000)
} }
else { else {
...@@ -328,12 +339,12 @@ Page({ ...@@ -328,12 +339,12 @@ Page({
2. tab, tag=strSearch 2. tab, tag=strSearch
3. 新增的search tab, '搜索'tab的时候,需要转换为搜索的关键词(_this.__data__.strSearch) 3. 新增的search tab, '搜索'tab的时候,需要转换为搜索的关键词(_this.__data__.strSearch)
*/ */
getActivities: function (scrollType, pageNum, pageCount, strCity, strCategory, strSearch) { getActivities: function (scrollType, pageNum, pageCount, strAddress, strCategory, strSearch) {
var _this = this; var _this = this;
// 如果是"推荐"和"搜索",需要单独处理 // 如果是"推荐"和"搜索",需要单独处理
// '搜索'tab的时候, 需要转换为搜索的关键词(_this.__data__.strSearch) // '搜索'tab的时候, 需要转换为搜索的关键词(_this.__data__.strSearch)
var query_url = '&title=' + strSearch + '&orderType=' + strCategory + '&city=' + strCity var query_url = '&title=' + strSearch + '&orderType=' + strCategory + '&city=' + strAddress
var strUrl = config.activity_query_url + "?pageCount=" + pageCount var strUrl = config.activity_query_url + "?pageCount=" + pageCount
+ "&pageNum=" + pageNum + query_url + "&pageNum=" + pageNum + query_url
...@@ -436,7 +447,8 @@ Page({ ...@@ -436,7 +447,8 @@ Page({
hideInput: function () { hideInput: function () {
var _this = this; var _this = this;
var curIndex = _this.__data__.curIndex var curIndex = _this.__data__.curIndex
var strCity = _this.__data__.city var curCommunity = _this.__data__.curCommunity
var strAddress = _this.__data__.communities[curCommunity]
var strCategory = _this.__data__.category[curIndex].order var strCategory = _this.__data__.category[curIndex].order
var strSearch = "" var strSearch = ""
...@@ -445,7 +457,7 @@ Page({ ...@@ -445,7 +457,7 @@ Page({
inputShowed: false, inputShowed: false,
}); });
_this.getActivities(0, 1, 4, strCity, strCategory, strSearch); _this.getActivities(0, 1, 4, strAddress, strCategory, strSearch);
}, },
// * 删除输入字符串 // * 删除输入字符串
...@@ -460,10 +472,11 @@ Page({ ...@@ -460,10 +472,11 @@ Page({
var _this = this; var _this = this;
var strSearch = e.detail.value var strSearch = e.detail.value
var curIndex = _this.__data__.curIndex var curIndex = _this.__data__.curIndex
var strCity = _this.__data__.city var curCommunity = _this.__data__.curCommunity
var strAddress = _this.__data__.communities[curCommunity]
var strCategory = _this.__data__.category[curIndex].order var strCategory = _this.__data__.category[curIndex].order
console.log("===input search text_" + strSearch) console.log("===input search text_" + strSearch)
_this.getActivities(0, 1, 4, strCity, strCategory, strSearch); _this.getActivities(0, 1, 4, strAddress, strCategory, strSearch);
_this.setData({ _this.setData({
strSearch: strSearch, strSearch: strSearch,
...@@ -593,14 +606,37 @@ Page({ ...@@ -593,14 +606,37 @@ Page({
onUpdateData: function(){ onUpdateData: function(){
var _this = this; var _this = this;
var strCity = app.globalData.defaultCity
var curIndex = _this.__data__.curIndex var curIndex = _this.__data__.curIndex
var curCommunity = _this.__data__.curCommunity
var strAddress = _this.__data__.communities[curCommunity]
var strCategory = _this.__data__.category[curIndex].order var strCategory = _this.__data__.category[curIndex].order
var strSearch = _this.__data__.strSearch var strSearch = _this.__data__.strSearch
_this.getActivities(0, 1, 4, strCity, strCategory, strSearch); _this.getActivities(0, 1, 4, strAddress, strCategory, strSearch);
}, },
/*
* 更换某一个memberInfo的地址信息
*/
onCommunityPicker: function (e) {
var _this = this;
var curCommunity = e.detail.value
var switchId = app.globalData.switchId
var curIndex = switchId != ""? switchId : _this.__data__.curIndex
var strAddress = _this.__data__.communities[curCommunity]
var strCategory = _this.__data__.category[curIndex].order
var strSearch = ""
this.setData({
curIndex, curCommunity, strSearch
});
app.globalData.switchId = ""
_this.getActivities(0, 1, 4, strAddress, strCategory, strSearch);
},
}) })
//通过Promise方式为wx.request添加同步操作 //通过Promise方式为wx.request添加同步操作
......
<wxs module="tutil" src="./../../utils/date.wxs"></wxs> <wxs module="tutil" src="./../../utils/date.wxs"></wxs>
...@@ -7,21 +7,21 @@ ...@@ -7,21 +7,21 @@
<!-- refer https://www.jb51.net/article/158292.htm --> <!-- refer https://www.jb51.net/article/158292.htm -->
<!-- refer https://github.com/cinoliu/-selectCity --> <!-- refer https://github.com/cinoliu/-selectCity -->
<view class="weui-search-bar"> <view class="weui-search-bar">
<navigator url="../switchcity/switchcity?city={{city}}&type=index"> <picker mode="selector" range="{{communities}}" value="{{curCommunity}}" bindchange="onCommunityPicker" class='address_member'>
<text>{{city}}</text> <text>{{communities[curCommunity]}}</text>
<image src='../../icon/down.png' style='width: 32rpx;height: 32rpx;' class='selecrtImg'></image> <image src='../../icon/down.png' style='width: 40rpx;height: 40rpx;' class='selecrtImg'></image>
</navigator> </picker>
<view class="weui-search-bar__form"> <view class="weui-search-bar__form">
<view class="weui-search-bar__box"> <view class="weui-search-bar__box">
<icon class="weui-icon-search_in-box" type="search" size="16"></icon> <icon class="weui-icon-search_in-box" type="search" size="16"></icon>
<input type="text" class="weui-search-bar__input" placeholder="发现感兴趣的活动" value="{{inputVal}}" focus="{{inputShowed}}" bindconfirm="startSearch" /> <input type="text" class="weui-search-bar__input" placeholder="发现{{communities[curCommunity]}}" value="{{inputVal}}" focus="{{inputShowed}}" bindconfirm="startSearch" />
<view class="weui-icon-clear" wx:if="{{inputVal.length > 0}}" bindtap="clearInput"> <view class="weui-icon-clear" wx:if="{{inputVal.length > 0}}" bindtap="clearInput">
<icon type="clear" size="16"></icon> <icon type="clear" size="16"></icon>
</view> </view>
</view> </view>
<label class="weui-search-bar__label" hidden="{{inputShowed}}" bindtap="showInput"> <label class="weui-search-bar__label" hidden="{{inputShowed}}" bindtap="showInput">
<icon class="weui-icon-search" type="search" size="16"></icon> <icon class="weui-icon-search" type="search" size="16"></icon>
<view class="weui-search-bar__text">发现感兴趣的夜市活动</view> <view class="weui-search-bar__text">发现{{communities[curCommunity]}}·感兴趣的活动</view>
</label> </label>
</view> </view>
<view class="weui-search-bar__cancel-btn" hidden="{{!inputShowed}}" bindtap="hideInput">取消 <view class="weui-search-bar__cancel-btn" hidden="{{!inputShowed}}" bindtap="hideInput">取消
...@@ -48,26 +48,19 @@ ...@@ -48,26 +48,19 @@
<!-- jscat20200816 添加活动日历 for convinience --> <!-- jscat20200816 添加活动日历 for convinience -->
<block> <block>
<view class="items"> <view class="items">
<navigator url="/pages/activity/activity-list/activity-list?city={{city}}"> <navigator url="/pages/activity/activity-list/activity-list?strAddress={{communities[curCommunity]}}">
<image src="../../icon/member/schedule.png" style="margin-top:10rpx; margin-bottom:-10rpx"></image> <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;">本周活动</text>
</navigator> </navigator>
</view> </view>
</block> </block>
<view class="items">
<navigator url="/pages/my/my-collects/my-collects">
<image src="../../icon/my/fav.png" style="margin-top:10rpx; margin-bottom:-10rpx"></image>
<text style="font-size:28rpx;">我的收藏</text>
</navigator>
</view>
<!-- todo 0828 我的活动暂时也不实现 --> <!-- todo 0828 我的活动暂时也不实现 -->
<view class="items"> <view class="items">
<navigator url="/pages/my/my-orders/my-orders"> <navigator url="/pages/community/introduction/introduction?strAddress={{communities[curCommunity]}}">
<image src="../../icon/activity/order.png" style="margin-top:10rpx; margin-bottom:-10rpx"></image> <image src="../../icon/activity/order.png" style="margin-top:10rpx; margin-bottom:-10rpx"></image>
</navigator> </navigator>
<text>我的预订</text> <text>{{communities[curCommunity]}}介绍</text>
</view> </view>
</view> </view>
...@@ -102,7 +95,7 @@ ...@@ -102,7 +95,7 @@
<view class="note-column"> <view class="note-column">
<navigator url='{{item.url}}&num_like={{item.num_like}}' > <navigator url='{{item.url}}&num_like={{item.num_like}}' >
<!-- 商家信息 --> <!-- 商家信息 -->
{{item.title}} <text>{{item.title}}</text>
<!-- 商品价格 --> <!-- 商品价格 -->
<span> <span>
<view class="price-row"> <view class="price-row">
......
/* /*
...@@ -335,6 +335,16 @@ ...@@ -335,6 +335,16 @@
width: 55%; width: 55%;
} }
.note-column text{
/* 多行溢出省略 */
display: -webkit-box;
word-break: break-all;
-webkit-box-orient: vertical;
-webkit-line-clamp:2;
overflow: hidden;
text-overflow:ellipsis;
}
.writer-image{ .writer-image{
width: 240rpx; width: 240rpx;
height: 240rpx; height: 240rpx;
......
import { LETTERS, HOT_CITY_LIST } from '../../locale/citydata' import { LETTERS, HOT_CITY_LIST } from '../../locale/citydata'
...@@ -100,6 +100,7 @@ Page({ ...@@ -100,6 +100,7 @@ Page({
//直接更新app.globalData //直接更新app.globalData
appInstance.globalData.defaultCity = city appInstance.globalData.defaultCity = city
appInstance.globalData.defaultCounty = '' appInstance.globalData.defaultCounty = ''
appInstance.globalData.citySwitched = 1
// 同步更新storage记录 // 同步更新storage记录
// start 记录最近访问 // start 记录最近访问
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论