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
ddc0b8c2
Commit
ddc0b8c2
authored
Sep 18, 2019
by
高淑倩
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
link
parent
25b4f037
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
149 additions
and
257 deletions
+149
-257
bottomTabs.js
src/component/bottomTabs/bottomTabs.js
+54
-109
imageSwiper.js
src/component/imageSwiper/imageSwiper.js
+26
-92
picNav.js
src/component/picNav/picNav.js
+2
-56
currentLinkRouter.js
src/utils/currentLinkRouter.js
+67
-0
No files found.
src/component/bottomTabs/bottomTabs.js
View file @
ddc0b8c2
...
@@ -2,6 +2,7 @@
...
@@ -2,6 +2,7 @@
var
app
=
getApp
()
var
app
=
getApp
()
const
wxService
=
require
(
'../../utils/wxService'
)
const
wxService
=
require
(
'../../utils/wxService'
)
const
utils
=
require
(
'../../utils/util'
)
const
utils
=
require
(
'../../utils/util'
)
const
utilLink
=
require
(
'../../utils/currentLinkRouter'
)
const
envInfo
=
require
(
'../../config/index'
).
envInfo
const
envInfo
=
require
(
'../../config/index'
).
envInfo
Component
({
Component
({
...
@@ -9,13 +10,13 @@ Component({
...
@@ -9,13 +10,13 @@ Component({
* 组件的属性列表
* 组件的属性列表
*/
*/
properties
:
{
properties
:
{
currentHasUserInfo
:{
currentHasUserInfo
:
{
type
:
Boolean
,
type
:
Boolean
,
type
:
false
type
:
false
},
},
tabBar
:
{
tabBar
:
{
type
:
Object
,
type
:
Object
,
value
:
null
value
:
null
},
},
currHomePageId
:
{
currHomePageId
:
{
type
:
String
,
type
:
String
,
...
@@ -23,50 +24,50 @@ Component({
...
@@ -23,50 +24,50 @@ Component({
}
}
},
},
attached
()
{
attached
()
{
this
.
setData
({
this
.
setData
({
baseImgUrl
:
app
.
globalData
.
imageUrl
baseImgUrl
:
app
.
globalData
.
imageUrl
})
})
const
{
tabBar
}
=
this
.
data
const
{
tabBar
}
=
this
.
data
let
currentTab
=
tabBar
.
images
let
currentTab
=
tabBar
.
images
currentTab
.
forEach
(
item
=>
{
currentTab
.
forEach
(
item
=>
{
// 存在 row 处理数据 8 商品 9 分类
// 存在 row 处理数据 8 商品 9 分类
let
newRow
=
null
let
newRow
=
null
if
(
item
.
link
)
{
if
(
item
.
link
)
{
if
(
item
.
link
.
type
==
2
)
{
if
(
item
.
link
.
type
==
2
)
{
// 父组件 更新
// 父组件 更新
const
urls
=
getCurrentPages
()
const
urls
=
getCurrentPages
()
const
currentPath
=
urls
[
0
]
const
currentPath
=
urls
[
0
]
const
pageId
=
item
.
link
.
url
const
pageId
=
item
.
link
.
url
item
.
link
.
newPath
=
`/
${
currentPath
.
route
}
`
item
.
link
.
newPath
=
`/
${
currentPath
.
route
}
`
}
}
return
return
}
else
if
(
item
.
row
)
{
}
else
if
(
item
.
row
)
{
newRow
=
JSON
.
parse
(
item
.
row
)
newRow
=
JSON
.
parse
(
item
.
row
)
if
(
newRow
.
type
==
8
)
{
if
(
newRow
.
type
==
8
)
{
newRow
.
newPath
=
'/pages/productDetail/productDetail'
newRow
.
newPath
=
'/pages/productDetail/productDetail'
}
else
if
(
newRow
.
type
==
9
)
{
}
else
if
(
newRow
.
type
==
9
)
{
newRow
.
newPath
=
'/subPackage/page/pages/categoryPro/categoryPro'
newRow
.
newPath
=
'/subPackage/page/pages/categoryPro/categoryPro'
}
else
{
}
else
{
newRow
.
newPath
=
''
newRow
.
newPath
=
''
}
item
.
row
=
newRow
}
}
})
item
.
row
=
newRow
}
})
// 当前匹配路径是否需要授权 true 需要 false 不需要
// 当前匹配路径是否需要授权 true 需要 false 不需要
tabBar
.
images
.
forEach
(
item
=>
{
tabBar
.
images
.
forEach
(
item
=>
{
let
checkUrl
=
''
let
checkUrl
=
''
if
(
item
.
link
)
{
if
(
item
.
link
)
{
checkUrl
=
item
.
link
.
newPath
?
item
.
link
.
newPath
:
item
.
link
.
url
checkUrl
=
item
.
link
.
newPath
?
item
.
link
.
newPath
:
item
.
link
.
url
}
else
if
(
item
.
row
)
{
}
else
if
(
item
.
row
)
{
checkUrl
=
item
.
row
.
newPath
?
item
.
row
.
newPath
:
item
.
row
.
url
checkUrl
=
item
.
row
.
newPath
?
item
.
row
.
newPath
:
item
.
row
.
url
}
}
wxService
.
NoLoginPage
(
checkUrl
).
then
(
res
=>
{
wxService
.
NoLoginPage
(
checkUrl
).
then
(
res
=>
{
item
.
needAuth
=
res
.
needAuth
item
.
needAuth
=
res
.
needAuth
this
.
setData
({
tabBarList
:
tabBar
.
images
})
this
.
setData
({
tabBarList
:
tabBar
.
images
})
})
})
})
})
},
},
ready
()
{
ready
()
{
this
.
setData
({
this
.
setData
({
...
@@ -80,73 +81,17 @@ Component({
...
@@ -80,73 +81,17 @@ Component({
currentRoute
:
''
,
currentRoute
:
''
,
type
:
1
,
type
:
1
,
baseImgUrl
:
''
,
baseImgUrl
:
''
,
tabBarList
:[]
tabBarList
:
[]
},
},
/**
/**
* 组件的方法列表
* 组件的方法列表
*/
*/
methods
:
{
methods
:
{
_getUserInfo
(
res
=
{})
{
_getUserInfo
(
res
=
{})
{
this
.
triggerEvent
(
'getAuth'
,
res
);
this
.
triggerEvent
(
'getAuth'
,
res
);
},
},
handelToPage
(
event
){
handelToPage
(
event
)
{
const
ev
=
event
.
currentTarget
.
dataset
;
utilLink
.
currentLinkRouter
(
event
)
let
curItemType
=
ev
.
item
}
const
userInfo
=
wx
.
getStorageSync
(
'_baseUserInfo'
)
}
// link row
if
(
curItemType
.
link
)
{
let
currentClickType
=
app
.
globalData
.
commonFunc
.
getLink
(
curItemType
.
link
.
type
,
curItemType
)
if
(
curItemType
.
link
.
type
==
1
)
{
// 触发父组件更新页面 外部小程序
}
else
if
(
curItemType
.
link
.
type
==
2
)
{
// 触发父组件更新页面
wxService
.
nextTick
(()
=>
{
this
.
triggerEvent
(
'updatePage'
,
{
pageId
:
currentClickType
.
url
})
})
}
else
if
(
curItemType
.
link
.
type
==
3
)
{
// 预览
wx
.
previewImage
({
current
:
`
${
app
.
globalData
.
imageUrl
}
/
${
currentClickType
.
imageUrl
}
`
,
// 当前显示图片的http链接
urls
:
[
`
${
app
.
globalData
.
imageUrl
}
/
${
currentClickType
.
link
.
url
}
`
]
// 需要预览的图片http链接列表
})
}
else
if
(
curItemType
.
link
.
type
==
4
)
{
wxService
.
router
(
`
${
currentClickType
}
`
)
}
else
if
(
curItemType
.
link
.
type
==
5
)
{
if
(
currentClickType
==
1
)
{
wxService
.
openCard
()
}
else
if
(
currentClickType
==
2
)
{
wxService
.
openCard
()
}
}
else
if
(
curItemType
.
link
.
type
==
6
)
{
wxService
.
router
(
`
${
currentClickType
}
`
)
}
else
if
(
curItemType
.
link
.
type
==
7
)
{
// 集点详情
wxService
.
router
(
`
${
currentClickType
}
`
)
}
}
else
if
(
curItemType
.
row
)
{
// let rowObj = JSON.parse(curItemType.row)
let
rowObj
=
curItemType
.
row
let
currentClickRow
=
app
.
globalData
.
commonFunc
.
getLinkRow
(
rowObj
.
type
,
rowObj
)
if
(
rowObj
.
type
==
1
)
{
}
else
if
(
rowObj
.
type
==
2
)
{
}
else
if
(
rowObj
.
type
==
3
)
{
}
else
if
(
rowObj
.
type
==
4
)
{
}
else
if
(
rowObj
.
type
==
5
)
{
}
else
if
(
rowObj
.
type
==
6
)
{
}
else
if
(
rowObj
.
type
==
7
)
{
}
else
if
(
rowObj
.
type
==
8
)
{
// 商品
wxService
.
router
(
`/pages/productDetail/productDetail?id=
${
currentClickRow
}
`
)
}
else
if
(
rowObj
.
type
==
9
)
{
// 分类
wxService
.
router
(
`/subPackage/page/pages/categoryPro/categoryPro?
${
currentClickRow
}
`
)
}
}
}
}
})
})
src/component/imageSwiper/imageSwiper.js
View file @
ddc0b8c2
...
@@ -3,33 +3,34 @@
...
@@ -3,33 +3,34 @@
var
app
=
getApp
()
var
app
=
getApp
()
const
wxService
=
require
(
'../../utils/wxService'
)
const
wxService
=
require
(
'../../utils/wxService'
)
const
utils
=
require
(
'../../utils/util'
)
const
utils
=
require
(
'../../utils/util'
)
const
utilLink
=
require
(
'../../utils/currentLinkRouter'
)
const
envInfo
=
require
(
'../../config/index'
).
envInfo
const
envInfo
=
require
(
'../../config/index'
).
envInfo
Component
({
Component
({
/**
/**
* 组件的属性列表
* 组件的属性列表
*/
*/
properties
:
{
properties
:
{
imageData
:
{
imageData
:
{
type
:
Array
,
type
:
Array
,
value
:
[],
value
:
[],
},
},
},
},
attached
()
{
attached
()
{
this
.
setData
({
this
.
setData
({
baseImgUrl
:
app
.
globalData
.
imageUrl
baseImgUrl
:
app
.
globalData
.
imageUrl
})
})
},
},
/**
/**
* 组件的初始数据
* 组件的初始数据
*/
*/
data
:
{
data
:
{
indicatorDots
:
true
,
indicatorDots
:
true
,
autoplay
:
true
,
autoplay
:
true
,
circular
:
true
,
circular
:
true
,
interval
:
5000
,
interval
:
5000
,
duration
:
1000
,
duration
:
1000
,
isAuthorization
:
false
,
// false 不显示 true 显示
isAuthorization
:
false
,
// false 不显示 true 显示
baseImgUrl
:
''
,
baseImgUrl
:
''
,
maxHeight
:
0
,
maxHeight
:
0
,
padding
:
0
,
padding
:
0
,
...
@@ -37,7 +38,7 @@ Component({
...
@@ -37,7 +38,7 @@ Component({
imageHeights
:
{},
// 记录所有图片的实际高度
imageHeights
:
{},
// 记录所有图片的实际高度
},
},
observers
:
{
observers
:
{
heights
:
function
(
heights
)
{
heights
:
function
(
heights
)
{
let
imageData
=
this
.
data
.
imageData
let
imageData
=
this
.
data
.
imageData
if
(
heights
.
length
===
imageData
.
length
)
{
if
(
heights
.
length
===
imageData
.
length
)
{
let
maxHeight
=
Math
.
max
.
apply
(
null
,
heights
)
let
maxHeight
=
Math
.
max
.
apply
(
null
,
heights
)
...
@@ -57,8 +58,8 @@ Component({
...
@@ -57,8 +58,8 @@ Component({
/**
/**
* 组件的方法列表
* 组件的方法列表
*/
*/
methods
:
{
methods
:
{
imageLoad
:
function
(
e
)
{
imageLoad
:
function
(
e
)
{
// 图片加载完成回调
// 图片加载完成回调
let
heights
=
this
.
data
.
heights
let
heights
=
this
.
data
.
heights
let
id
=
e
.
target
.
id
let
id
=
e
.
target
.
id
...
@@ -76,75 +77,8 @@ Component({
...
@@ -76,75 +77,8 @@ Component({
heights
heights
})
})
},
},
preview
(
event
)
{
preview
(
event
)
{
const
ev
=
event
.
currentTarget
.
dataset
;
utilLink
.
currentLinkRouter
(
event
)
let
curItemType
=
ev
.
item
}
// 获取当前帐号信息
}
const
userInfo
=
wx
.
getStorageSync
(
'_baseUserInfo'
)
// link row
if
(
curItemType
.
link
)
{
let
currentClickType
=
app
.
globalData
.
commonFunc
.
getLink
(
curItemType
.
link
.
type
,
curItemType
)
if
(
curItemType
.
link
.
type
==
1
)
{
// 触发父组件更新页面 外部小程序
this
.
setData
({
isAuthorization
:
false
})
return
false
}
else
if
(
!
userInfo
)
{
this
.
setData
({
isAuthorization
:
true
})
return
false
}
else
if
(
userInfo
&&
userInfo
.
member
&&
!
userInfo
.
member
.
mobile
)
{
wxService
.
openCard
()
return
false
}
if
(
curItemType
.
link
.
type
==
2
)
{
// 触发父组件更新页面
wxService
.
nextTick
(()
=>
{
this
.
triggerEvent
(
'updatePage'
,
{
pageId
:
currentClickType
.
url
})
})
}
else
if
(
curItemType
.
link
.
type
==
3
)
{
// 预览
wx
.
previewImage
({
current
:
`
${
app
.
globalData
.
imageUrl
}
/
${
currentClickType
.
imageUrl
}
`
,
// 当前显示图片的http链接
urls
:
[
`
${
app
.
globalData
.
imageUrl
}
/
${
currentClickType
.
link
.
url
}
`
]
// 需要预览的图片http链接列表
})
}
else
if
(
curItemType
.
link
.
type
==
4
)
{
wxService
.
router
(
`
${
currentClickType
}
`
)
}
else
if
(
curItemType
.
link
.
type
==
5
)
{
if
(
currentClickType
==
1
)
{
wxService
.
openCard
()
}
else
if
(
currentClickType
==
2
)
{
wxService
.
openCard
()
}
}
else
if
(
curItemType
.
link
.
type
==
6
)
{
wxService
.
router
(
`/
${
currentClickType
}
`
)
}
else
if
(
curItemType
.
link
.
type
==
7
)
{
// 集点详情
wxService
.
router
(
`
${
currentClickType
}
`
)
}
}
else
if
(
curItemType
.
row
)
{
let
rowObj
=
JSON
.
parse
(
curItemType
.
row
)
let
currentClickRow
=
app
.
globalData
.
commonFunc
.
getLinkRow
(
rowObj
.
type
,
rowObj
)
if
(
rowObj
.
type
==
1
)
{
}
else
if
(
rowObj
.
type
==
2
)
{
}
else
if
(
rowObj
.
type
==
3
)
{
}
else
if
(
rowObj
.
type
==
4
)
{
}
else
if
(
rowObj
.
type
==
5
)
{
}
else
if
(
rowObj
.
type
==
6
)
{
}
else
if
(
rowObj
.
type
==
7
)
{
}
else
if
(
rowObj
.
type
==
8
)
{
// 商品
wxService
.
router
(
`/pages/productDetail/productDetail?id=
${
currentClickRow
}
`
)
}
else
if
(
rowObj
.
type
==
9
)
{
// 分类
wxService
.
router
(
`/subPackage/page/pages/categoryPro/categoryPro?
${
currentClickRow
}
`
)
}
}
}
}
})
})
src/component/picNav/picNav.js
View file @
ddc0b8c2
...
@@ -3,6 +3,7 @@
...
@@ -3,6 +3,7 @@
var
app
=
getApp
()
var
app
=
getApp
()
const
wxService
=
require
(
'../../utils/wxService'
)
const
wxService
=
require
(
'../../utils/wxService'
)
const
utils
=
require
(
'../../utils/util'
)
const
utils
=
require
(
'../../utils/util'
)
const
utilLink
=
require
(
'../../utils/currentLinkRouter'
)
const
envInfo
=
require
(
'../../config/index'
).
envInfo
const
envInfo
=
require
(
'../../config/index'
).
envInfo
Component
({
Component
({
...
@@ -97,62 +98,7 @@ Component({
...
@@ -97,62 +98,7 @@ Component({
})
})
},
},
preview
(
event
)
{
preview
(
event
)
{
const
ev
=
event
.
currentTarget
.
dataset
;
utilLink
.
currentLinkRouter
(
event
)
let
curItemType
=
ev
.
item
// 获取当前帐号信息
const
userInfo
=
wx
.
getStorageSync
(
'_baseUserInfo'
)
// link row
if
(
curItemType
.
link
)
{
let
currentClickType
=
app
.
globalData
.
commonFunc
.
getLink
(
curItemType
.
link
.
type
,
curItemType
)
if
(
curItemType
.
link
.
type
==
1
)
{
}
else
if
(
curItemType
.
link
.
type
==
2
)
{
// 触发父组件更新页面
wxService
.
nextTick
(()
=>
{
this
.
triggerEvent
(
'updatePage'
,
{
pageId
:
currentClickType
.
url
})
})
}
else
if
(
curItemType
.
link
.
type
==
3
)
{
// 预览
wx
.
previewImage
({
current
:
`
${
app
.
globalData
.
imageUrl
}
/
${
currentClickType
.
imageUrl
}
`
,
// 当前显示图片的http链接
urls
:
[
`
${
app
.
globalData
.
imageUrl
}
/
${
currentClickType
.
link
.
url
}
`
]
// 需要预览的图片http链接列表
})
}
else
if
(
curItemType
.
link
.
type
==
4
)
{
wxService
.
router
(
`
${
currentClickType
}
`
)
}
else
if
(
curItemType
.
link
.
type
==
5
)
{
if
(
currentClickType
==
1
)
{
wxService
.
openCard
()
}
else
if
(
currentClickType
==
2
)
{
wxService
.
openCard
()
}
}
else
if
(
curItemType
.
link
.
type
==
6
)
{
wxService
.
router
(
`/
${
currentClickType
}
`
)
}
else
if
(
curItemType
.
link
.
type
==
7
)
{
// 集点详情
wxService
.
router
(
`
${
currentClickType
}
`
)
}
}
else
if
(
curItemType
.
row
)
{
// let rowObj = JSON.parse(curItemType.row)
let
rowObj
=
curItemType
.
row
let
currentClickRow
=
app
.
globalData
.
commonFunc
.
getLinkRow
(
rowObj
.
type
,
rowObj
)
if
(
rowObj
.
type
==
1
)
{
}
else
if
(
rowObj
.
type
==
2
)
{
}
else
if
(
rowObj
.
type
==
3
)
{
}
else
if
(
rowObj
.
type
==
4
)
{
}
else
if
(
rowObj
.
type
==
5
)
{
}
else
if
(
rowObj
.
type
==
6
)
{
}
else
if
(
rowObj
.
type
==
7
)
{
}
else
if
(
rowObj
.
type
==
8
)
{
// 商品
wxService
.
router
(
`/pages/productDetail/productDetail?id=
${
currentClickRow
}
`
)
}
else
if
(
rowObj
.
type
==
9
)
{
// 分类
wxService
.
router
(
`/subPackage/page/pages/categoryPro/categoryPro?
${
currentClickRow
}
`
)
}
}
},
},
activeTocard
(
e
)
{
activeTocard
(
e
)
{
if
(
e
.
detail
)
{
if
(
e
.
detail
)
{
...
...
src/utils/currentLinkRouter.js
0 → 100644
View file @
ddc0b8c2
const
wxService
=
require
(
'./wxService'
)
const
app
=
getApp
()
function
currentLinkRouter
(
event
)
{
const
ev
=
event
.
currentTarget
.
dataset
;
let
curItemType
=
ev
.
item
const
userInfo
=
wx
.
getStorageSync
(
'_baseUserInfo'
)
// link row
if
(
curItemType
.
link
)
{
let
currentClickType
=
app
.
globalData
.
commonFunc
.
getLink
(
curItemType
.
link
.
type
,
curItemType
)
if
(
curItemType
.
link
.
type
==
1
)
{
// 触发父组件更新页面 外部小程序
}
else
if
(
curItemType
.
link
.
type
==
2
)
{
// 触发父组件更新页面
wxService
.
nextTick
(()
=>
{
this
.
triggerEvent
(
'updatePage'
,
{
pageId
:
currentClickType
.
url
})
})
}
else
if
(
curItemType
.
link
.
type
==
3
)
{
// 预览
wx
.
previewImage
({
current
:
`
${
app
.
globalData
.
imageUrl
}
/
${
currentClickType
.
imageUrl
}
`
,
// 当前显示图片的http链接
urls
:
[
`
${
app
.
globalData
.
imageUrl
}
/
${
currentClickType
.
link
.
url
}
`
]
// 需要预览的图片http链接列表
})
}
else
if
(
curItemType
.
link
.
type
==
4
)
{
wxService
.
router
(
`
${
currentClickType
}
`
)
}
else
if
(
curItemType
.
link
.
type
==
5
)
{
if
(
currentClickType
==
1
)
{
wxService
.
openCard
()
}
else
if
(
currentClickType
==
2
)
{
wxService
.
openCard
()
}
}
else
if
(
curItemType
.
link
.
type
==
6
)
{
wxService
.
router
(
`
${
currentClickType
}
`
)
}
else
if
(
curItemType
.
link
.
type
==
7
)
{
// 集点详情
wxService
.
router
(
`
${
currentClickType
}
`
)
}
}
else
if
(
curItemType
.
row
)
{
// let rowObj = JSON.parse(curItemType.row)
let
rowObj
=
curItemType
.
row
let
currentClickRow
=
app
.
globalData
.
commonFunc
.
getLinkRow
(
rowObj
.
type
,
rowObj
)
if
(
rowObj
.
type
==
1
)
{
}
else
if
(
rowObj
.
type
==
2
)
{
}
else
if
(
rowObj
.
type
==
3
)
{
}
else
if
(
rowObj
.
type
==
4
)
{
}
else
if
(
rowObj
.
type
==
5
)
{
}
else
if
(
rowObj
.
type
==
6
)
{
}
else
if
(
rowObj
.
type
==
7
)
{
}
else
if
(
rowObj
.
type
==
8
)
{
// 商品
wxService
.
router
(
`/pages/productDetail/productDetail?id=
${
currentClickRow
}
`
)
}
else
if
(
rowObj
.
type
==
9
)
{
// 分类
wxService
.
router
(
`/subPackage/page/pages/categoryPro/categoryPro?
${
currentClickRow
}
`
)
}
}
}
module
.
exports
=
{
currentLinkRouter
:
currentLinkRouter
}
\ No newline at end of file
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