Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
7
7-Eleven
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
高淑倩
7-Eleven
Commits
27e00ab0
Commit
27e00ab0
authored
Sep 23, 2019
by
高淑倩
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
集点
parent
ce33a9e5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
172 additions
and
42 deletions
+172
-42
pointDetail.js
src/pages/pointDetail/pointDetail.js
+87
-39
pointList.js
src/pages/pointList/pointList.js
+12
-3
currentAccessiblePath.js
src/utils/currentAccessiblePath.js
+9
-0
helper.js
src/utils/helper.js
+6
-0
wxService.js
src/utils/wxService.js
+58
-0
No files found.
src/pages/pointDetail/pointDetail.js
View file @
27e00ab0
...
...
@@ -56,6 +56,54 @@ wxService.page({
this
.
generatePointObject
(
tentacleInfo
);
}
},
watch
:
{
experAccessible
(
newVal
,
oldVal
)
{
if
(
newVal
)
{
// 登录接口返回err
const
reLoginErrFlag
=
wx
.
getStorageSync
(
'reLoginErr'
)
const
baseUserInfo
=
wx
.
getStorageSync
(
'_baseUserInfo'
)
let
id
if
(
baseUserInfo
&&
!
reLoginErrFlag
)
{
this
.
setData
({
isAuthorization
:
false
},
()
=>
{
const
option
=
this
.
options
||
{}
const
{
scene
}
=
option
if
(
scene
)
{
let
idParam
=
decodeURIComponent
(
scene
).
split
(
'&'
)[
0
]
let
shareId
=
idParam
&&
idParam
.
split
(
'='
)[
1
]
||
0
id
=
shareId
}
else
{
id
=
option
.
id
}
if
(
id
)
{
this
.
setData
({
id
},
()
=>
{
this
.
getPointDetail
(
id
)
})
}
// 隐藏 dialog
this
.
isShowDialog
(
false
)
})
}
else
if
(
!
baseUserInfo
&&
reLoginErrFlag
)
{
this
.
setData
({
isAuthorization
:
true
})
}
else
{
this
.
setData
({
isAuthorization
:
true
})
}
}
else
{
// 去别的页面
wxService
.
router
(
`/subPackage/page/pages/goToHome/goToHome`
).
replace
()
}
}
},
// 集点详情
getPointDetail
(
id
)
{
wx
.
showLoading
({
...
...
@@ -248,46 +296,46 @@ wxService.page({
* 生命周期函数--监听页面显示
*/
onShow
:
function
()
{
const
{
memberId
,
member
}
=
wx
.
getStorageSync
(
'_baseUserInfo'
)
// 登录接口返回err
const
reLoginErrFlag
=
wx
.
getStorageSync
(
'reLoginErr'
)
const
baseUserInfo
=
wx
.
getStorageSync
(
'_baseUserInfo'
)
let
id
if
(
baseUserInfo
&&
!
reLoginErrFlag
){
this
.
setData
({
isAuthorization
:
false
},()
=>
{
const
option
=
this
.
options
||
{}
const
{
scene
}
=
option
if
(
scene
)
{
let
idParam
=
decodeURIComponent
(
scene
).
split
(
'&'
)[
0
]
let
shareId
=
idParam
&&
idParam
.
split
(
'='
)[
1
]
||
0
id
=
shareId
}
else
{
id
=
option
.
id
}
//
const { memberId, member } = wx.getStorageSync('_baseUserInfo')
//
//
登录接口返回err
//
const reLoginErrFlag = wx.getStorageSync('reLoginErr')
//
const baseUserInfo = wx.getStorageSync('_baseUserInfo')
//
let id
//
if (baseUserInfo && !reLoginErrFlag){
//
this.setData({
//
isAuthorization: false
//
},()=>{
//
const option = this.options || {}
//
const { scene } = option
//
if (scene) {
//
let idParam = decodeURIComponent(scene).split('&')[0]
//
let shareId = idParam && idParam.split('=')[1] || 0
//
id = shareId
//
} else {
//
id = option.id
//
}
if
(
id
)
{
this
.
setData
({
id
},
()
=>
{
this
.
getPointDetail
(
id
)
})
}
// 隐藏 dialog
this
.
isShowDialog
(
false
)
})
}
else
if
(
!
baseUserInfo
&&
reLoginErrFlag
){
this
.
setData
({
isAuthorization
:
true
})
}
else
{
this
.
setData
({
isAuthorization
:
true
})
}
//
if (id) {
//
this.setData({
//
id
//
}, () => {
//
this.getPointDetail(id)
//
})
//
}
//
// 隐藏 dialog
//
this.isShowDialog(false)
//
})
//
}
//
else if(!baseUserInfo && reLoginErrFlag){
//
this.setData({
//
isAuthorization: true
//
})
//
}
//
else {
//
this.setData({
//
isAuthorization: true
//
})
//
}
},
/**
...
...
src/pages/pointList/pointList.js
View file @
27e00ab0
...
...
@@ -14,7 +14,16 @@ wxService.page({
currentStatus
:
2
,
// 活动状态 1 未生效 2 生效中 3 已失效 0 已删除
currentTimeStatus
:
1
,
// 1 进行中 2 已结束 3 未开始
},
watch
:
{
experAccessible
(
newVal
,
oldVal
)
{
if
(
newVal
)
{
this
.
getPointList
()
}
else
{
// 去别的页面
wxService
.
router
(
`/subPackage/page/pages/goToHome/goToHome`
).
replace
()
}
}
},
/**
* 生命周期函数--监听页面加载
*/
...
...
@@ -41,8 +50,8 @@ wxService.page({
* 生命周期函数--监听页面显示
*/
onShow
()
{
const
{
memberId
,
member
}
=
wx
.
getStorageSync
(
'_baseUserInfo'
)
this
.
getPointList
()
//
const { memberId, member } = wx.getStorageSync('_baseUserInfo')
//
this.getPointList()
},
getPointList
()
{
wx
.
showLoading
({
...
...
src/utils/currentAccessiblePath.js
0 → 100644
View file @
27e00ab0
var
pathJson
=
{
'7.1'
:
[
// 版本对应路径
'pages/pointList/pointList'
,
'pages/pointDetail/pointDetail'
]
}
module
.
exports
=
pathJson
\ No newline at end of file
src/utils/helper.js
View file @
27e00ab0
...
...
@@ -79,6 +79,12 @@ export function getC3 (c2Name) {
})
}
export
function
getCurrentRouter
()
{
var
pages
=
getCurrentPages
()
// 获取加载的页面
var
currentPage
=
pages
[
pages
.
length
-
1
]
// 获取当前页面的对象
return
currentPage
}
export
function
getAppUserInfo
()
{
const
userInfo
=
wx
.
getStorageSync
(
'_userInfo'
)
if
(
userInfo
)
{
...
...
src/utils/wxService.js
View file @
27e00ab0
...
...
@@ -19,6 +19,7 @@ import utils from './util'
const
citysData
=
require
(
'./city.js'
)
import
{
Integer
}
from
'./integerDigitalConvertion'
import
*
as
watch
from
"./watch.js"
;
const
pathData
=
require
(
'./currentAccessiblePath.js'
)
let
openCardLister
=
null
/**
...
...
@@ -368,6 +369,44 @@ class WXService extends Http {
})
}
getAssPath
()
{
const
paths
=
pathData
let
pathArr
=
[]
for
(
const
key
in
paths
)
{
if
(
paths
.
hasOwnProperty
(
key
))
{
let
pathObj
=
{}
pathObj
[
key
]
=
paths
[
key
]
pathArr
.
push
(
pathObj
)
}
}
return
pathArr
}
trialList
()
{
let
localPath
=
this
.
getAssPath
()
wx
.
showLoading
({
title
:
'加载中'
})
return
this
.
get
(
`/member/trial/list`
).
then
(
res
=>
{
if
(
res
)
{
const
{
result
,
data
}
=
res
.
data
if
(
result
==
0
)
{
wx
.
hideLoading
()
// 对应的path
let
currentPaths
=
[];
localPath
.
forEach
(
item
=>
{
if
(
item
.
hasOwnProperty
(
data
))
{
currentPaths
=
item
[
data
]
}
else
{
console
.
log
(
222
);
}
})
return
Promise
.
resolve
({
currentPaths
})
}
}
})
}
getSystemInfo
()
{
return
new
Promise
((
resolve
,
reject
)
=>
{
wx
.
getSystemInfo
({
...
...
@@ -500,6 +539,9 @@ class WXService extends Http {
config
.
data
.
currentPageRequireAuth
=
false
;
// vip
config
.
data
.
isVip
=
''
// 集点体验者
config
.
data
.
experAccessible
;
const
CONFIG_PAPGE
=
{
onLoad
:
function
(...
args
)
{
...
...
@@ -536,6 +578,8 @@ class WXService extends Http {
_self
.
currentPage
=
page
config
.
onShow
&&
config
.
onShow
.
apply
(
page
,
args
)
wx
.
removeStorageSync
(
'_premiumExpireTime'
)
// 获取当前页
let
router
=
getCurrentRouter
()
const
baseUserInfo
=
wx
.
getStorageSync
(
'_baseUserInfo'
)
const
premiumExpireTime
=
baseUserInfo
&&
baseUserInfo
.
member
&&
baseUserInfo
.
member
.
premiumExpireTime
||
''
...
...
@@ -553,6 +597,20 @@ class WXService extends Http {
page
.
setData
({
currentHasUserInfo
:
true
,
isVip
:
vipFlag
},()
=>
{
_self
.
trialList
().
then
(
res
=>
{
if
(
!
res
)
return
false
const
{
currentPaths
}
=
res
if
(
currentPaths
.
indexOf
(
router
.
route
)
>
-
1
&&
isExperiencer
)
{
this
.
setData
({
experAccessible
:
true
})
}
else
{
this
.
setData
({
experAccessible
:
false
})
}
})
});
}
else
{
page
.
setData
({
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment