Toggle navigation
Toggle navigation
This project
Loading...
Sign in
fe
/
yoho-limited-sell-miniapp
·
Commits
Go to a project
GitLab
Go to group
Project
Activity
Files
Commits
Pipelines
0
Builds
0
Graphs
Milestones
Issues
0
Merge Requests
0
Members
Labels
Wiki
Forks
Network
Create a new issue
Download as
Email Patches
Plain Diff
Browse Files
Authored by
邱骏
7 years ago
Commit
c6c1371e3d275e87fcb7b13f8810125df04ad8fd
1 parent
0ff4b884
助力排队
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
134 additions
and
133 deletions
app/pages/index/index.js
app/pages/product/detail/detail.js
app/pages/queue/index.js
app/pages/index/index.js
View file @
c6c1371
...
...
@@ -9,148 +9,148 @@ let yas;
let
router
=
global
.
router
;
Page
({
data
:
{
tabSelected
:
0
,
refreshText
:
'下拉刷新'
,
footText
:
'内容加载中...'
,
userInfo
:
{},
tabBarArr
:
[
{
icon
:
'../../static/images/limit/icon_rmfs_n@3x.png'
,
iconSelected
:
'../../static/images/limit/icon_rmfs_p@3x.png'
,
name
:
'热门发售'
,
method
:
'app.limitProduct.hotLimitProduct'
},
{
icon
:
'../../static/images/limit/icon_jjfs_n@3x.png'
,
iconSelected
:
'../../static/images/limit/icon_jjfs_p@3x.png'
,
name
:
'即将发售'
,
method
:
'app.limitProduct.soonToSaleLimitProduct'
},
{
icon
:
'../../static/images/limit/icon_yjfs_n@3x.png'
,
iconSelected
:
'../../static/images/limit/icon_yjfs_p@3x.png'
,
name
:
'已经发售'
,
method
:
'app.limitProduct.alreadySaleLimitProduct'
}
],
listData
:
[
{},
{},
{}
],
icon
:
{
clock
:
'../../static/images/limit/clock_left.png'
}
},
onLoad
:
function
()
{
yas
=
new
Yas
(
app
);
data
:
{
tabSelected
:
0
,
refreshText
:
'下拉刷新'
,
footText
:
'内容加载中...'
,
userInfo
:
{},
tabBarArr
:
[
{
icon
:
'../../static/images/limit/icon_rmfs_n@3x.png'
,
iconSelected
:
'../../static/images/limit/icon_rmfs_p@3x.png'
,
name
:
'热门发售'
,
method
:
'app.limitProduct.hotLimitProduct'
},
{
icon
:
'../../static/images/limit/icon_jjfs_n@3x.png'
,
iconSelected
:
'../../static/images/limit/icon_jjfs_p@3x.png'
,
name
:
'即将发售'
,
method
:
'app.limitProduct.soonToSaleLimitProduct'
},
{
icon
:
'../../static/images/limit/icon_yjfs_n@3x.png'
,
iconSelected
:
'../../static/images/limit/icon_yjfs_p@3x.png'
,
name
:
'已经发售'
,
method
:
'app.limitProduct.alreadySaleLimitProduct'
}
],
listData
:
[
{},
{},
{}
],
icon
:
{
clock
:
'../../static/images/limit/clock_left.png'
}
},
onLoad
:
function
()
{
yas
=
new
Yas
(
app
);
this
.
getList
(
0
,
1
,
20
,
false
);
},
onShow
:
function
()
{
yas
.
pageOpenReport
();
},
onPullDownRefresh
:
function
()
{
this
.
setData
({
refreshText
:
'加载中...'
});
this
.
getList
(
0
,
1
,
20
,
false
);
},
onShow
:
function
()
{
yas
.
pageOpenReport
();
},
onPullDownRefresh
:
function
()
{
this
.
setData
({
refreshText
:
'加载中...'
});
this
.
getList
(
this
.
data
.
tabSelected
,
1
,
20
,
false
).
then
(()
=>
{
wx
.
stopPullDownRefresh
();
this
.
setData
({
refreshText
:
'下拉刷新'
});
});
this
.
getList
(
this
.
data
.
tabSelected
,
1
,
20
,
false
).
then
(()
=>
{
wx
.
stopPullDownRefresh
();
this
.
setData
({
refreshText
:
'下拉刷新'
});
});
},
onReachBottom
:
function
()
{
let
page
=
this
.
data
.
listData
[
this
.
data
.
tabSelected
].
page
;
let
page_total
=
this
.
data
.
listData
[
this
.
data
.
tabSelected
].
page_total
;
},
onReachBottom
:
function
()
{
let
page
=
this
.
data
.
listData
[
this
.
data
.
tabSelected
].
page
;
let
page_total
=
this
.
data
.
listData
[
this
.
data
.
tabSelected
].
page_total
;
if
(
page
<
page_total
)
{
page
+=
1
;
this
.
getList
(
this
.
data
.
tabSelected
,
page
,
20
,
true
);
}
},
getUserInfo
:
function
(
e
)
{
console
.
log
(
e
);
if
(
e
.
detail
.
errMsg
===
'getUserInfo:ok'
)
{
// AccountModel.decodeUserInfo();
}
app
.
setUserInfo
(
e
.
detail
.
userInfo
);
this
.
setData
({
userInfo
:
e
.
detail
.
userInfo
,
hasUserInfo
:
true
});
},
tabChange
:
function
(
e
)
{
// 切换TAB
let
index
=
e
.
currentTarget
.
dataset
.
index
;
if
(
page
<
page_total
)
{
page
+=
1
;
this
.
getList
(
this
.
data
.
tabSelected
,
page
,
20
,
true
);
}
},
getUserInfo
:
function
(
e
)
{
console
.
log
(
e
);
if
(
e
.
detail
.
errMsg
===
'getUserInfo:ok'
)
{
// AccountModel.decodeUserInfo();
}
app
.
setUserInfo
(
e
.
detail
.
userInfo
);
this
.
setData
({
userInfo
:
e
.
detail
.
userInfo
,
hasUserInfo
:
true
});
},
tabChange
:
function
(
e
)
{
// 切换TAB
let
index
=
e
.
currentTarget
.
dataset
.
index
;
if
(
index
!==
this
.
data
.
tabSelected
)
{
this
.
setData
({
tabSelected
:
index
});
if
(
index
!==
this
.
data
.
tabSelected
)
{
this
.
setData
({
tabSelected
:
index
});
// 如果listData没有数据,或者数据为空,则调用接口
if
(
!
this
.
data
.
listData
[
index
].
limitProductVoList
||
this
.
data
.
listData
[
index
].
limitProductVoList
.
length
===
0
)
{
this
.
getList
(
index
,
1
,
20
,
false
);
}
}
},
// 如果listData没有数据,或者数据为空,则调用接口
if
(
!
this
.
data
.
listData
[
index
].
limitProductVoList
||
this
.
data
.
listData
[
index
].
limitProductVoList
.
length
===
0
)
{
this
.
getList
(
index
,
1
,
20
,
false
);
}
}
},
/**
/**
* 获取限定发售列表
* index: tab的index,
* page:分页,
* limit: 每页数量,
* isBottom:是否是到达底部后触发
*/
getList
:
function
(
index
,
page
,
limit
,
isBottom
)
{
let
method
=
this
.
data
.
tabBarArr
[
index
].
method
;
let
that
=
this
;
getList
:
function
(
index
,
page
,
limit
,
isBottom
)
{
let
method
=
this
.
data
.
tabBarArr
[
index
].
method
;
let
that
=
this
;
this
.
setData
({
footText
:
'内容加载中...'
});
this
.
setData
({
footText
:
'内容加载中...'
});
return
LimitModel
.
getLimitSaleList
({
method
:
method
,
page
:
page
,
limit
:
limit
}).
then
(
res
=>
{
console
.
log
(
res
.
data
);
if
(
res
.
data
&&
res
.
data
.
limitProductVoList
)
{
// 获取到已有的data数据,对某部分数据进行赋值后再setData
let
list
=
that
.
data
.
listData
;
return
LimitModel
.
getLimitSaleList
({
method
:
method
,
page
:
page
,
limit
:
limit
}).
then
(
res
=>
{
console
.
log
(
res
.
data
);
if
(
res
.
data
&&
res
.
data
.
limitProductVoList
)
{
// 获取到已有的data数据,对某部分数据进行赋值后再setData
let
list
=
that
.
data
.
listData
;
if
(
isBottom
)
{
list
[
index
].
page
=
page
;
list
[
index
].
limitProductVoList
=
if
(
isBottom
)
{
list
[
index
].
page
=
page
;
list
[
index
].
limitProductVoList
=
list
[
index
].
limitProductVoList
.
concat
(
res
.
data
.
limitProductVoList
);
}
else
{
list
[
index
]
=
res
.
data
;
}
that
.
setData
({
listData
:
list
,
footText
:
'暂无更多内容'
});
}
}
else
{
list
[
index
]
=
res
.
data
;
}
that
.
setData
({
listData
:
list
,
footText
:
'暂无更多内容'
});
},
navigateToDetail
:
function
(
e
)
{
// 跳转到详情页
console
.
log
(
e
);
let
id
=
e
.
currentTarget
.
dataset
.
id
;
let
limitProductCode
=
e
.
currentTarget
.
dataset
.
code
;
}
});
},
navigateToDetail
:
function
(
e
)
{
// 跳转到详情页
console
.
log
(
e
);
let
id
=
e
.
currentTarget
.
dataset
.
id
;
let
limitProductCode
=
e
.
currentTarget
.
dataset
.
code
;
if
(
app
.
getUid
()
&&
app
.
getUserInfo
().
wechat
)
{
router
.
go
(
'productDetail'
,
{
limitProductCode
});
}
else
{
let
pages
=
getCurrentPages
();
let
referer
=
pages
[
pages
.
length
-
1
].
route
;
if
(
app
.
getUid
()
&&
app
.
getUserInfo
().
wechat
)
{
router
.
go
(
'productDetail'
,
{
limitProductCode
});
}
else
{
let
pages
=
getCurrentPages
();
let
referer
=
pages
[
pages
.
length
-
1
].
route
;
router
.
go
(
'userCenter'
,
{
referer
});
}
},
navigateToHome
:
function
(
e
)
{
// 跳转到我的限购码
router
.
go
(
'userCenter'
);
router
.
go
(
'userCenter'
,
{
referer
});
}
},
navigateToHome
:
function
(
e
)
{
// 跳转到我的限购码
router
.
go
(
'userCenter'
);
}
});
...
...
app/pages/product/detail/detail.js
View file @
c6c1371
...
...
@@ -160,7 +160,7 @@ Page(Object.assign({
};
}
else
if
(
res
.
from
===
'button'
)
{
// 用户点击分享按钮
console
.
log
(
`
/
pages
/
product
/
detail
/
detail
?
limitProductCode
=
$
{
this
.
data
.
limitProductCode
}
&
originUid
=
$
{
app
.
getUid
()}
&
originUnionID
=
$
{
app
.
getUnionID
()}
`
)
console
.
log
(
`
/
pages
/
product
/
detail
/
detail
?
limitProductCode
=
$
{
this
.
data
.
limitProductCode
}
&
originUid
=
$
{
app
.
getUid
()}
&
originUnionID
=
$
{
app
.
getUnionID
()}
`
);
return
{
title
:
params
.
TITLE
,
// 分享标题
desc
:
params
.
DESC
,
// 分享描述
...
...
@@ -196,7 +196,7 @@ Page(Object.assign({
});
let
uid
=
this
.
data
.
originUid
||
this
.
data
.
uid
;
if
(
index
===
0
)
{
if
(
this
.
data
.
showAssisList
)
{
return
;
...
...
@@ -515,4 +515,4 @@ Page(Object.assign({
});
});
}
},
Actionsheet
));
\ No newline at end of file
},
Actionsheet
));
...
...
app/pages/queue/index.js
View file @
c6c1371
...
...
@@ -164,9 +164,9 @@ Page(Object.assign({
onShow
:
function
(
options
)
{
setTimeout
(
this
.
hidePopup
,
4000
);
if
(
app
.
getUid
())
{
this
.
setData
({
hideInviteButton
:
0
});
this
.
setData
({
hideInviteButton
:
0
});
}
},
...
...
@@ -359,10 +359,11 @@ Page(Object.assign({
this
.
setData
({
showMsg
:
1
});
}
else
if
(
!
uid
)
{
let
pages
=
getCurrentPages
();
let
referer
=
pages
[
pages
.
length
-
1
].
route
+
'?'
+
stringify
(
this
.
data
.
shareInfo
);
router
.
go
(
'userCenter'
,
{
referer
});
}
else
if
(
!
uid
)
{
let
pages
=
getCurrentPages
();
let
referer
=
pages
[
pages
.
length
-
1
].
route
+
'?'
+
stringify
(
this
.
data
.
shareInfo
);
router
.
go
(
'userCenter'
,
{
referer
});
}
},
...
...
Please
register
or
login
to post a comment