Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
N
nyx
概览
Overview
Details
Activity
Cycle Analytics
版本库
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
问题
0
Issues
0
列表
Board
标记
里程碑
合并请求
0
Merge Requests
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
Snippets
成员
Collapse sidebar
Close sidebar
活动
图像
聊天
创建新问题
作业
提交
Issue Boards
Open sidebar
发现
nyx
Commits
c33dc349
Commit
c33dc349
authored
Aug 27, 2020
by
jscat
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
nyx weapp, 功能更新
1. 添加城市选择功能 2. 添加最近选择城市
parent
643946e9
隐藏空白字符变更
内嵌
并排
正在显示
8 个修改的文件
包含
113 行增加
和
31 行删除
+113
-31
增值产品-小程序及app/nyx-master/pages/activity/activity-info/activity-info.wxml
+2
-2
增值产品-小程序及app/nyx-master/pages/activity/activity-list/activity-list.js
+42
-11
增值产品-小程序及app/nyx-master/pages/activity/activity-list/activity-list.wxml
+7
-2
增值产品-小程序及app/nyx-master/pages/activity/activity.js
+19
-6
增值产品-小程序及app/nyx-master/pages/activity/activity.wxml
+2
-2
增值产品-小程序及app/nyx-master/pages/switchcity/switchcity.js
+35
-6
增值产品-小程序及app/nyx-master/utils/date.wxs
+3
-1
增值产品-小程序及app/nyx-master/utils/utils.js
+3
-1
没有找到文件。
增值产品-小程序及app/nyx-master/pages/activity/activity-info/activity-info.wxml
查看文件 @
c33dc349
<wxs
module="tutil" src="./../../../utils/date.wxs"></wxs>
<wxs
module="tutil" src="./../../../utils/date.wxs"></wxs>
...
...
@@ -49,7 +49,7 @@
<span>日期: {{tutil.formatDate_ymdw_today_interval(activityInfo.start_datetime, activityInfo.end_datetime)}}</span>
<!-- 时间 -->
<span>时间:
19:30 - 22:00
</span>
<span>时间:
{{tutil.formatDate_hm_interval(activityInfo.start_datetime, activityInfo.end_datetime)}}
</span>
<span>地点: {{activityInfo.address_name}}</span>
</view>
...
...
增值产品-小程序及app/nyx-master/pages/activity/activity-list/activity-list.js
查看文件 @
c33dc349
// pa
ges/member/activity-post/activity-edit/activity-edit.js
// pa
ges/member/activity-post/activity-edit/activity-edit.js
...
...
@@ -15,7 +15,12 @@ Page({
userInfo
:
{},
memberId
:
""
,
header_infoData
:
{},
header_infoData
:
{
date
:
'日期'
,
info
:
[
{
member_name
:
"商家"
,
title
:
"活动"
,
unit_price
:
"价格"
}
]
},
product_listData
:
[],
// 城市模块
...
...
@@ -25,6 +30,9 @@ Page({
stride
:
0
,
isHideLoadMore
:
false
,
// 活动场次
num_activities
:
0
,
},
...
...
@@ -66,13 +74,10 @@ Page({
})
}
var
city
=
""
if
(
options
.
city
!=
""
)
var
city
=
app
.
globalData
.
defaultCity
if
(
options
.
city
!=
""
&&
options
.
city
!=
undefined
)
{
city
=
options
.
city
;
_this
.
setData
({
city
:
city
})
}
wx
.
setNavigationBarTitle
({
...
...
@@ -84,13 +89,13 @@ Page({
{
var
curDate
=
getCurDate
()
var
endDate
=
getWeekEndDate
()
var
header_infoData
=
_this
.
__data__
.
header_infoData
var
stride
=
20
// 每20条记录做为一个page
this
.
setData
({
stride
:
stride
,
curDate
:
curDate
,
endDate
:
endDate
,
header_infoData
:
header_infoData
,
product_listData
:
product_listData
,
city
:
city
,
});
_this
.
getActivitiesByPeriod
(
0
,
1
,
stride
,
city
,
curDate
,
endDate
);
...
...
@@ -105,6 +110,27 @@ Page({
onReady
:
function
(
e
)
{
},
// 功能: 监听页面卸载 (如果是多个页面, 则需要多次销毁)
// 操作: 点击左上角'返回'时销毁当前页面
// 当通过左上角离开activity-list页面时,强制更新activity页面
onUnload
:
function
(){
let
pages
=
getCurrentPages
().
length
-
1
;
// console.log('需要销毁的页面:'+pages);
// console.log('onUnload page===', getCurrentPages())
// 当最后一个activity-list的数据被销毁之前,同步强制更新activity页面的数据
// ['/activity', '/activity-list']
if
(
getCurrentPages
().
length
==
2
)
{
// 刷新第一个页面栈元素, 也就是首页的数据, 其实是activity.wxml页面的数据
getCurrentPages
()[
getCurrentPages
().
length
-
2
].
onUpdateData
()
}
// 将创建的activity-list页面依次进行销毁
wx
.
navigateBack
({
delta
:
pages
})
},
// Date Flow
// 输入该组图片的标签
bindKeyInput
(
e
)
{
...
...
@@ -228,10 +254,16 @@ Page({
{
list
.
unshift
(
_this
.
__data__
.
header_infoData
)
}
var
num_activities
=
0
for
(
var
i
=
0
;
i
<
list
.
length
;
i
++
)
{
num_activities
+=
list
[
i
][
'info'
].
length
}
_this
.
setData
({
product_listData
:
list
,
pageIndex
:
pageNum
+
1
,
num_activities
:
num_activities
,
isHideLoadMore
:
bisHideLoadMoreType
,
})
}
...
...
@@ -273,8 +305,7 @@ Page({
startTime
.
setDate
(
startTime
.
getDate
()
+
1
);
i
+=
1
;
}
}
},
})
...
...
增值产品-小程序及app/nyx-master/pages/activity/activity-list/activity-list.wxml
查看文件 @
c33dc349
<!--
/page/post/edit/edit 添加分类的标签,以及自定义标签 -->
<!--
/page/post/edit/edit 添加分类的标签,以及自定义标签 -->
...
...
@@ -4,11 +4,16 @@
<view class="page" style="height:100%;width:100%">
<view class="weui-search-bar">
<!-- <text>{{city}}</text>
<image src='../../../icon/down.png' style='width: 32rpx;height: 32rpx;' class='selecrtImg'></image> -->
<navigator url="../../switchcity/switchcity?city={{city}}&type=list">
<text>{{city}}</text>
<image src='../../../icon/down.png' style='width: 32rpx;height: 32rpx;' class='selecrtImg'></image>
</navigator>
<view class="list-activity-number">
<label>
本周活动: {{
product_listData.length
-1}}场
本周活动: {{
num_activities
-1}}场
</label>
</view>
</view>
...
...
增值产品-小程序及app/nyx-master/pages/activity/activity.js
查看文件 @
c33dc349
// pa
ges/activity/activity.js
// pa
ges/activity/activity.js
...
...
@@ -4,7 +4,7 @@ var config = wx.getStorageSync("config");
var
util
=
require
(
'./../../utils/util.js'
)
var
event
=
require
(
'./../../utils/event.js'
)
const
{
globalData
:
{
defaultCity
,
defaultCounty
}
}
=
app
//
const { globalData: { defaultCity, defaultCounty } } = app
Page
({
...
...
@@ -13,8 +13,8 @@ Page({
*/
data
:
{
city
:
defaultCity
,
county
:
defaultCounty
,
city
:
""
,
county
:
""
,
category
:
[
// 导航栏内容数据
{
name
:
'点赞'
,
order
:
'like'
},
...
...
@@ -82,6 +82,20 @@ Page({
//入口页面,先确定nyxCode
/*step1 先确定用户信息 */
var
nyxCode
=
wx
.
getStorageSync
(
'nyxCode'
);
//step2 确定城市信息
var
LatestCityList
=
wx
.
getStorageSync
(
'LatestCityList'
)
||
[]
if
(
LatestCityList
.
length
>
0
)
{
var
city
=
LatestCityList
[
0
][
"city"
]
app
.
globalData
.
defaultCity
=
city
_this
.
setData
({
city
})
}
else
{
var
city
=
app
.
globalData
.
defaultCity
_this
.
setData
({
city
})
}
//不存在
if
(
!
nyxCode
)
{
...
...
@@ -195,8 +209,6 @@ Page({
var
_this
=
this
;
const
{
globalData
:
{
defaultCity
,
defaultCounty
}
}
=
app
console
.
log
(
"===city, "
+
defaultCity
)
console
.
log
(
"===county, "
+
defaultCounty
)
this
.
setData
({
city
:
defaultCity
,
county
:
defaultCounty
...
...
@@ -548,6 +560,7 @@ Page({
},
// 刷新页面数据
// used by switchcity.js
onUpdateData
:
function
(){
var
_this
=
this
;
...
...
增值产品-小程序及app/nyx-master/pages/activity/activity.wxml
查看文件 @
c33dc349
<wxs
module="tutil" src="./../../utils/date.wxs"></wxs>
<wxs
module="tutil" src="./../../utils/date.wxs"></wxs>
...
...
@@ -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}}">
<navigator url="../switchcity/switchcity?city={{city}}
&type=index
">
<text>{{city}}</text>
<image src='../../icon/down.png' style='width: 32rpx;height: 32rpx;' class='selecrtImg'></image>
</navigator>
...
...
增值产品-小程序及app/nyx-master/pages/switchcity/switchcity.js
查看文件 @
c33dc349
impor
t
{
LETTERS
,
HOT_CITY_LIST
}
from
'../../locale/citydata'
impor
t
{
LETTERS
,
HOT_CITY_LIST
}
from
'../../locale/citydata'
...
...
@@ -10,6 +10,7 @@ const {
getLocationUrl
,
getCountyListUrl
,
getIndexUrl
,
getListUrl
,
onFail
,
}
=
utils
;
const
appInstance
=
getApp
();
...
...
@@ -33,6 +34,9 @@ Page({
auto
:
true
,
// 自动手动定位开关
LatestCityList
:
[{
cityCode
:
310000
,
city
:
'上海'
},
{
cityCode
:
110000
,
city
:
'北京'
}],
// 数据更新的页面
update_type
:
""
,
},
onLoad
:
function
(
options
)
{
...
...
@@ -42,15 +46,18 @@ Page({
const
winHeight
=
sysInfo
.
windowHeight
;
const
sideBarLetterList
=
LETTERS
.
map
(
letter
=>
({
name
:
letter
}));
var
city
=
""
if
(
options
.
city
!=
""
)
var
update_type
=
""
if
(
options
.
city
!=
""
&&
options
.
city
!=
undefined
)
{
city
=
options
.
city
;
update_type
=
options
.
type
;
}
this
.
setData
({
winHeight
,
sideBarLetterList
,
cityList
:
cityListSortedByInitialLetter
,
city
:
city
,
update_type
:
update_type
,
});
// 定位
// this.getLocation();
...
...
@@ -76,8 +83,9 @@ Page({
},
//选择城市
chooseCity
:
function
(
e
)
{
var
_this
=
this
;
const
{
city
,
code
}
=
safeGet
([
'currentTarget'
,
'dataset'
],
e
)
this
.
setData
({
_
this
.
setData
({
auto
:
false
,
showCountyPicker
:
false
,
city
,
...
...
@@ -89,9 +97,11 @@ Page({
//无须再选择county
//this.getCountyList()
//直接更新app.globalData
appInstance
.
globalData
.
defaultCity
=
city
appInstance
.
globalData
.
defaultCounty
=
''
// 同步更新storage记录
// start 记录最近访问
let
LatestCityList
=
wx
.
getStorageSync
(
'LatestCityList'
)
||
[];
var
item
=
{
cityCode
:
code
,
city
:
city
}
...
...
@@ -112,15 +122,34 @@ Page({
// end of 最近访问 去重
// 返回首页
var
update_type
=
_this
.
__data__
.
update_type
update_type
==
"index"
?
_this
.
updateIndex
()
:
_this
.
updateList
()
},
updateIndex
:
function
(
e
){
var
url
=
getIndexUrl
()
wx
.
switchTab
({
url
:
getIndexUrl
()
,
success
:
function
(
e
)
{
url
:
url
,
success
:
function
(
e
)
{
var
page
=
getCurrentPages
().
pop
();
if
(
page
==
undefined
||
page
==
null
)
return
;
// 更新首页的数据
page
.
onUpdateData
();
}
})
})
},
updateList
:
function
(
e
)
{
var
url
=
getListUrl
()
wx
.
redirectTo
({
url
:
url
,
success
:
function
(
e
)
{
// jscat 20200827 在activity-list页面的onload里更新
// page.onLoad();
}
})
},
chooseCounty
:
function
(
e
)
{
...
...
增值产品-小程序及app/nyx-master/utils/date.wxs
查看文件 @
c33dc349
var f
ormatTime = function (date) {
var f
ormatTime = function (date) {
...
...
@@ -106,6 +106,8 @@ var formatDate_ymdw_today_interval = function(date1, date2){
var formatDate_hm_interval = function (date_start, date_end) {
// 输入 2020-02-04 19:30:00, 2020-02-04 22:00:00
// 返回 19:30 - 22:00
date_start = date_start +""
date_end = date_end +""
var date1 = getDate(date_start.split('-').join('/'));
var date2 = getDate(date_end.split('-').join('/'));
var hm1 = formatNumber(date1.getHours()) + ":" +formatNumber(date1.getMinutes())
...
...
增值产品-小程序及app/nyx-master/utils/utils.js
查看文件 @
c33dc349
impor
t
{
LETTERS
,
CITY_LIST
}
from
'../locale/citydata'
impor
t
{
LETTERS
,
CITY_LIST
}
from
'../locale/citydata'
...
...
@@ -5,6 +5,7 @@ import config from 'config'
const
getLocationUrl
=
(
latitude
,
longitude
)
=>
(
`https://apis.map.qq.com/ws/geocoder/v1/?location=
${
latitude
}
,
${
longitude
}
&key=
${
config
.
key
}
`
)
const
getCountyListUrl
=
code
=>
(
`https://apis.map.qq.com/ws/district/v1/getchildren?&id=
${
code
}
&key=
${
config
.
key
}
`
)
const
getIndexUrl
=
()
=>
(
'../activity/activity'
)
const
getListUrl
=
()
=>
(
'../activity/activity-list/activity-list'
)
/**
* 安全地在深层嵌套对象中取值
...
...
@@ -36,6 +37,7 @@ export default {
getLocationUrl
,
getCountyListUrl
,
getIndexUrl
,
getListUrl
,
safeGet
,
isNotEmpty
,
isChinese
,
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论