Commit 3f7ab116 by jscat

nyx update:

1. /live/live.wxml 更新sortType的bindtap
2. /switchcity.js 城市switch之后,更新updateTab函数
3. 城市switch之后, 通过onshow()函数同步/live/live和/activity/activity的数据显示问题
parent aefe14be
......@@ -57,7 +57,7 @@ Page({
//二维码信息
qRCodeMsg: "",
//活动类型
//活动类型 @by default "00-饮事" 20210308 00-饮事::01-集市::02-园区
activityType: "00-饮事",
},
......@@ -253,13 +253,21 @@ Page({
* 生命周期函数--监听页面显示
*/
onShow: function () {
var _this = this;
var _this = this;
var city = _this.data.city
const { globalData: { defaultCity, defaultCounty } } = app
this.setData({
city: defaultCity,
county: defaultCounty
})
if( city != defaultCity)
{
_this.setData({
city: defaultCity,
county: defaultCounty
})
console.log("onshowing")
    //调用数据初始化方法
_this.onGetActivities();
}
},
......@@ -602,15 +610,23 @@ Page({
// used by switchcity.js
onUpdateData: function(){
var _this = this;
var strCity = app.globalData.defaultCity
_this.onGetActivities();
},
// 开始搜索
onGetActivities: function () {
var _this = this;
var strCity = _this.__data__.city
var curIndex = _this.__data__.curIndex
var strCategory = _this.__data__.category[curIndex].order
var strSearch = _this.__data__.strSearch
var activityType = _this.__data__.activityType
_this.getActivities(0, 1, 4, strCity, activityType, strCategory, strSearch);
},
},
})
......
......@@ -7,7 +7,7 @@
<!-- refer https://www.jb51.net/article/158292.htm -->
<!-- refer https://github.com/cinoliu/-selectCity -->
<view class="weui-search-bar">
<navigator url="../switchcity/switchcity?city={{city}}&type=index">
<navigator url="../switchcity/switchcity?city={{city}}&type=tab">
<text>{{city}}</text>
<image src='../../icon/down.png' style='width: 32rpx;height: 32rpx;' class='selecrtImg'></image>
</navigator>
......
......@@ -3,8 +3,8 @@
<!-- start key view -->
<view class="page__hd" style="position:fixed; top:0;width: 100%;">
<view class="tab-title">
<view class="{{selected=='@'?'border-tottom':'default'}}" id="@" bindtap="selected">话题榜</view>
<view class="{{selected=='#'?'border-tottom':'default'}}" id="#" bindtap="selected">活跃榜</view>
<view class="{{selected=='@'?'border-tottom':'default'}}" id="@" bindtap="selected">@热门话题</view>
<view class="{{selected=='#'?'border-tottom':'default'}}" id="#" bindtap="selected">活跃用户榜</view>
</view>
<!-- start_of_tab-content -->
<scroll-view scroll-y="true" scroll-top="0">
......
......@@ -42,8 +42,10 @@ Page({
//二维码信息
qRCodeMsg: "",
//现场类型
//现场类型 @NotUsed 20210308
liveType: "",
//排序类型 new added 20210308, 人气: "01", 热度: "02", 关注: "03"
sortType: "01",
lives: [
// {
......@@ -68,6 +70,9 @@ Page({
// },
],
//避免安卓手机的onShow()被触发两次(ios不会), jscat 20210308
hadOnShow: false,
},
// 搜索点击事件
......@@ -183,13 +188,8 @@ Page({
// step5 初始载入四个直播的活动 - local page
if(_this.__data__.lives.length == 0)
{
var strCity = _this.__data__.city
var strSearch = _this.__data__.strSearch
var liveType = _this.__data__.liveType
_this.getLives(0, 1, 4, strCity, liveType, strSearch);
{
_this.onGetLives();
}
// step6 窗口初始化
......@@ -225,12 +225,19 @@ Page({
*/
onShow: function () {
var _this = this;
var city = _this.data.city
const { globalData: { defaultCity, defaultCounty } } = app
this.setData({
city: defaultCity,
county: defaultCounty
})
if( city != defaultCity)
{
_this.setData({
city: defaultCity,
county: defaultCounty
})
console.log("onshowing")
    //调用数据初始化方法
_this.onGetLives();
}
},
......@@ -533,13 +540,25 @@ Page({
// used by switchcity.js
onUpdateData: function(){
var _this = this;
_this.onGetLives();
var strCity = _this.__data__.city
},
// 开始搜索
onGetLives: function (e) {
var _this = this;
var sortType = e == undefined ? _this.__data__.sortType : e.currentTarget.dataset.id
var strSearch = _this.__data__.strSearch
var strCity = _this.__data__.city
var liveType = _this.__data__.liveType
_this.getLives(0, 1, 4, strCity, liveType, strSearch);
},
_this.setData({
strSearch: strSearch,
sortType: sortType,
})
},
})
......
......@@ -18,7 +18,7 @@
<!-- refer https://www.jb51.net/article/158292.htm -->
<!-- refer https://github.com/cinoliu/-selectCity -->
<view class="weui-search-bar">
<navigator url="../switchcity/switchcity?city={{city}}&type=index">
<navigator url="../switchcity/switchcity?city={{city}}&type=tab">
<text>{{city}}</text>
<image src='../../icon/down.png' style='width: 32rpx;height: 32rpx;' class='selecrtImg'></image>
</navigator>
......@@ -42,27 +42,21 @@
<view class="workbench">
<view class="list">
<block>
<view class="items">
<navigator url="/pages/activity/activity-list/activity-list?city={{city}}">
<image src="../../icon/member/schedule.png" style="margin-top:10rpx; margin-bottom:-10rpx"></image>
<text style="font-size:28rpx;">人气: 100</text>
</navigator>
<view class="items" bindtap="onGetLives" data-id="01">
<image src="../../icon/member/schedule.png" style="margin-top:10rpx; margin-bottom:-10rpx"></image>
<text style="font-size:28rpx;">人气: 100</text>
</view>
</block>
<!-- todo 0828 我的活动暂时也不实现 -->
<view class="items">
<navigator url="/pages/my/my-orders/my-orders">
<image src="../../icon/activity/order.png" style="margin-top:10rpx; margin-bottom:-10rpx"></image>
<text style="font-size:28rpx;">热度: 1.2k</text>
</navigator>
<view class="items" bindtap="onGetLives" data-id="02">
<image src="../../icon/activity/order.png" style="margin-top:10rpx; margin-bottom:-10rpx"></image>
<text style="font-size:28rpx;">热度: 1.2k</text>
</view>
<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;">关注: 12.5k</text>
</navigator>
<view class="items" bindtap="onGetLives" data-id="03">
<image src="../../icon/my/fav.png" style="margin-top:10rpx; margin-bottom:-10rpx"></image>
<text style="font-size:28rpx;">关注: 12.5k</text>
</view>
</view>
......
......@@ -3,7 +3,7 @@
<!-- start key view -->
<view class="page__hd" style="position:fixed; top:0;width: 100%;">
<view class="tab-title">
<view class="{{selected=='@'?'border-tottom':'default'}}" id="@" bindtap="selected">热度话题榜</view>
<view class="{{selected=='@'?'border-tottom':'default'}}" id="@" bindtap="selected">@热门话题</view>
<view class="{{selected=='#'?'border-tottom':'default'}}" id="#" bindtap="selected">活跃聊天室</view>
</view>
<!-- start_of_tab-content -->
......
import { LETTERS, HOT_CITY_LIST } from '../../locale/citydata'
import { commonMessage } from '../../locale/commonMessageZhCn'
import { AutoPredictor } from '../../utils/autoPredictor'
import utils from '../../utils/utils'
import utils from '../../utils/util_switchcity'
const {
isNotEmpty,
......@@ -124,31 +124,35 @@ Page({
// 返回首页
var update_type = _this.__data__.update_type
update_type == "index" ? _this.updateIndex() : _this.updateList()
update_type == "tab" ? _this.updateTab() : _this.updateTo()
},
updateIndex: function(e){
var url = getIndexUrl()
//tab页面; jscat 20210308
updateTab: function(e){
//var urlCurrent = "../live/live" //pass
var urlCurrent = "../../" + getCurrentPages()[0].route
wx.switchTab({
url: url,
url: urlCurrent,
success: function (e) {
var page = getCurrentPages().pop();
var page = getCurrentPages()[0]
if (page == undefined || page == null) return;
// 更新页的数据
// 更新tab页的数据
page.onUpdateData();
}
})
},
updateList: function(e)
//子页面; 非Tab页面 not used and not tested, jscat 20210308
//因为子页面不应该直接设置city参数; 在/live/live 或者 /activity/activity设置
updateTo: function(e)
{
var url = getListUrl()
var urlCurrent = getCurrentPages()[0].route
wx.redirectTo({
url: url,
url: urlCurrent,
success: function (e) {
// jscat 20200827 在activity-list页面的onload里更新
// page.onLoad();
//jscat 20200827 在activity-list页面的onload里更新
page.onLoad();
}
})
},
......
import { CITY_LIST, CITY_NOT_FOUND } from '../locale/citydata'
import utils from 'utils'
import utils from 'util_switchcity'
const { isNotEmpty, isChinese, getSlicedName } = utils;
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论