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
d4b8fd3d
Commit
d4b8fd3d
authored
Sep 12, 2019
by
高淑倩
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
图片导航授权页面
parent
3b72bd32
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
134 additions
and
79 deletions
+134
-79
picNav.js
src/component/picNav/picNav.js
+82
-46
picNav.wxml
src/component/picNav/picNav.wxml
+37
-23
picNav.wxss
src/component/picNav/picNav.wxss
+5
-1
utils.wxs
src/wxs/utils.wxs
+10
-9
No files found.
src/component/picNav/picNav.js
View file @
d4b8fd3d
...
@@ -9,55 +9,90 @@ Component({
...
@@ -9,55 +9,90 @@ Component({
/**
/**
* 组件的属性列表
* 组件的属性列表
*/
*/
properties
:
{
properties
:
{
currentHasUserInfo
:{
currentHasUserInfo
:
{
type
:
Boolean
,
type
:
Boolean
,
type
:
false
type
:
false
},
},
picNav
:
{
picNav
:
{
type
:
Array
,
type
:
Array
,
value
:
[],
value
:
[],
},
},
},
},
attached
()
{
attached
()
{
this
.
setData
({
this
.
setData
({
baseImgUrl
:
app
.
globalData
.
imageUrl
baseImgUrl
:
app
.
globalData
.
imageUrl
})
})
},
const
{
picNav
}
=
this
.
data
picNav
.
forEach
(
item
=>
{
// 存在 row 处理数据 8 商品 9 分类
let
newRow
=
null
if
(
item
.
link
)
{
if
(
item
.
link
.
type
==
2
){
// 父组件 更新
const
urls
=
getCurrentPages
()
const
currentPath
=
urls
[
0
]
const
pageId
=
item
.
link
.
url
console
.
log
(
'currentPath'
,
currentPath
.
route
,
item
.
link
.
url
)
item
.
link
.
newPath
=
`/
${
currentPath
.
route
}
`
}
return
}
else
if
(
item
.
row
)
{
newRow
=
JSON
.
parse
(
item
.
row
)
if
(
newRow
.
type
==
8
)
{
newRow
.
newPath
=
'/pages/productDetail/productDetail'
}
else
if
(
newRow
.
type
==
9
)
{
newRow
.
newPath
=
'/subPackage/page/pages/categoryPro/categoryPro'
}
else
{
newRow
.
newPath
=
''
}
// item.row = JSON.stringify(newRow)
item
.
row
=
newRow
}
})
this
.
setData
({
picNav
},
()
=>
{
console
.
log
(
'wwwwpicNav'
,
this
.
data
.
picNav
)
})
},
ready
()
{
},
/**
/**
* 组件的初始数据
* 组件的初始数据
*/
*/
data
:
{
data
:
{
imagewidth
:
0
,
//缩放后的宽
imagewidth
:
0
,
//缩放后的宽
imageheight
:
0
,
//缩放后的高
imageheight
:
0
,
//缩放后的高
isAuthorization
:
false
,
isAuthorization
:
false
,
isAuthorizationActiveText
:
''
,
isAuthorizationActiveText
:
''
,
isAuthorizationType
:
2
,
isAuthorizationType
:
2
,
baseImgUrl
:
''
baseImgUrl
:
''
},
},
/**
/**
* 组件的方法列表
* 组件的方法列表
*/
*/
methods
:
{
methods
:
{
_getUserInfo
(
res
=
{})
{
_getUserInfo
(
res
=
{})
{
wxService
.
nextTick
(()
=>
{
wxService
.
nextTick
(()
=>
{
this
.
triggerEvent
(
'getAuth'
,
res
);
this
.
triggerEvent
(
'getAuth'
,
res
);
})
})
},
},
imageLoad
(
e
)
{
imageLoad
(
e
)
{
let
imageSize
=
utils
.
imageUtil
(
e
)
let
imageSize
=
utils
.
imageUtil
(
e
)
this
.
setData
({
this
.
setData
({
imagewidth
:
imageSize
.
imageWidth
,
imagewidth
:
imageSize
.
imageWidth
,
imageheight
:
imageSize
.
imageHeight
imageheight
:
imageSize
.
imageHeight
})
})
},
},
preview
(
event
)
{
preview
(
event
)
{
const
ev
=
event
.
currentTarget
.
dataset
;
const
ev
=
event
.
currentTarget
.
dataset
;
let
curItemType
=
ev
.
item
let
curItemType
=
ev
.
item
// 获取当前帐号信息
// 获取当前帐号信息
const
userInfo
=
wx
.
getStorageSync
(
'_baseUserInfo'
)
const
userInfo
=
wx
.
getStorageSync
(
'_baseUserInfo'
)
// link row
// link row
if
(
curItemType
.
link
)
{
if
(
curItemType
.
link
)
{
let
currentClickType
=
app
.
globalData
.
commonFunc
.
getLink
(
curItemType
.
link
.
type
,
curItemType
)
let
currentClickType
=
app
.
globalData
.
commonFunc
.
getLink
(
curItemType
.
link
.
type
,
curItemType
)
if
(
curItemType
.
link
.
type
==
1
)
{
if
(
curItemType
.
link
.
type
==
1
)
{
...
@@ -85,10 +120,11 @@ Component({
...
@@ -85,10 +120,11 @@ Component({
wxService
.
router
(
`/
${
currentClickType
}
`
)
wxService
.
router
(
`/
${
currentClickType
}
`
)
}
else
if
(
curItemType
.
link
.
type
==
7
)
{
}
else
if
(
curItemType
.
link
.
type
==
7
)
{
// 集点详情
// 集点详情
wxService
.
router
(
`
${
currentClickType
}
`
)
wxService
.
router
(
`
${
currentClickType
}
`
)
}
}
}
else
if
(
curItemType
.
row
)
{
}
else
if
(
curItemType
.
row
)
{
let
rowObj
=
JSON
.
parse
(
curItemType
.
row
)
// let rowObj = JSON.parse(curItemType.row)
let
rowObj
=
curItemType
.
row
let
currentClickRow
=
app
.
globalData
.
commonFunc
.
getLinkRow
(
rowObj
.
type
,
rowObj
)
let
currentClickRow
=
app
.
globalData
.
commonFunc
.
getLinkRow
(
rowObj
.
type
,
rowObj
)
if
(
rowObj
.
type
==
1
)
{
}
if
(
rowObj
.
type
==
1
)
{
}
...
@@ -102,16 +138,16 @@ Component({
...
@@ -102,16 +138,16 @@ Component({
// 商品
// 商品
wxService
.
router
(
`/pages/productDetail/productDetail?id=
${
currentClickRow
}
`
)
wxService
.
router
(
`/pages/productDetail/productDetail?id=
${
currentClickRow
}
`
)
}
}
else
if
(
rowObj
.
type
==
9
)
{
else
if
(
rowObj
.
type
==
9
)
{
// 分类
// 分类
wxService
.
router
(
`/subPackage/page/pages/categoryPro/categoryPro?
${
currentClickRow
}
`
)
wxService
.
router
(
`/subPackage/page/pages/categoryPro/categoryPro?
${
currentClickRow
}
`
)
}
}
}
}
},
},
activeTocard
(
e
)
{
activeTocard
(
e
)
{
if
(
e
.
detail
)
{
if
(
e
.
detail
)
{
wxService
.
openCard
()
wxService
.
openCard
()
}
}
}
}
}
}
})
})
src/component/picNav/picNav.wxml
View file @
d4b8fd3d
...
@@ -7,29 +7,31 @@
...
@@ -7,29 +7,31 @@
wx:for-item="item"
wx:for-item="item"
class="nav-block"
class="nav-block"
>
>
<image
<view wx:if="{{item.link ? utils.hanlerLinkNeedAuth(typeOf(item.link.newPath) != undefined ? item.link.newPath : item.link.url) : utils.hanlerLinkNeedAuth(item.row.newPath ? item.row.newPath : item.row.url)}}">
wx:if="{{currentHasUserInfo}}"
<button
class="pic-img"
wx:if="{{!currentHasUserInfo}}"
style="width: {{100}}%;height: {{100}}px;"
bindgetuserinfo="_getUserInfo"
src="{{utils.formateUrl(item.imageUrl,baseImgUrl)}}"
data-jflag="false"
data-appid="{{item.link.appid}}"
open-type='getUserInfo'
data-path="{{item.link.url}}"
class='btn btn-primary btn-vip-code'
data-link="{{item.link}}"
hover-class="btn-hover"
data-item="{{item}}"
style="height:100%"
bindload="imageLoad"
>
bindtap='preview'
<image
/>
class="pic-img"
style="width: {{100}}%;height: {{100}}px;"
src="{{utils.formateUrl(item.imageUrl,baseImgUrl)}}"
data-appid="{{item.link.appid}}"
data-path="{{item.link.url}}"
data-link="{{item.link}}"
data-item="{{item}}"
bindload="imageLoad"
bindtap='preview'
/>
</button>
<button
wx:if="{{!currentHasUserInfo}}"
bindgetuserinfo="_getUserInfo"
data-jflag="false"
open-type='getUserInfo'
class='btn btn-primary df'
hover-class="btn-hover"
style="height:100%"
>
<image
<image
wx:if="{{currentHasUserInfo}}"
class="pic-img"
class="pic-img"
style="width: {{100}}%;height: {{100}}px;"
style="width: {{100}}%;height: {{100}}px;"
src="{{utils.formateUrl(item.imageUrl,baseImgUrl)}}"
src="{{utils.formateUrl(item.imageUrl,baseImgUrl)}}"
...
@@ -40,8 +42,20 @@
...
@@ -40,8 +42,20 @@
bindload="imageLoad"
bindload="imageLoad"
bindtap='preview'
bindtap='preview'
/>
/>
</button>
</view>
<view wx:else>
<image
class="pic-img"
style="width: {{100}}%;height: {{100}}px;"
src="{{utils.formateUrl(item.imageUrl,baseImgUrl)}}"
data-appid="{{item.link.appid}}"
data-path="{{item.link.url}}"
data-link="{{item.link}}"
data-item="{{item}}"
bindload="imageLoad"
bindtap='preview'
/>
</view>
</view>
</view>
</view>
</view>
src/component/picNav/picNav.wxss
View file @
d4b8fd3d
...
@@ -14,8 +14,11 @@
...
@@ -14,8 +14,11 @@
overflow: hidden;
overflow: hidden;
box-sizing: border-box;
box-sizing: border-box;
flex-direction: row;
flex-direction: row;
align-items: center;
/* align-items: center; */
}
}
.nav-block {
.nav-block {
flex: 1
flex: 1
}
.btn-vip-code {
display: flex;
}
}
\ No newline at end of file
src/wxs/utils.wxs
View file @
d4b8fd3d
...
@@ -30,15 +30,16 @@ function formateUrl(url, BASE_IMG_URL){
...
@@ -30,15 +30,16 @@ function formateUrl(url, BASE_IMG_URL){
// 授权路径 我的/购物车/我的奖励/邀请好友/推广商品/我的地址/我的订单
// 授权路径 我的/购物车/我的奖励/邀请好友/推广商品/我的地址/我的订单
function hanlerLinkNeedAuth(link){
function hanlerLinkNeedAuth(link){
var flag = false
var flag = false
if(link.indexOf('pages/my/my') > -1 ||
if(typeof(link) != undefined && link) {
link.indexOf('pages/cart/cart') > -1 ||
if(link.indexOf('pages/my/my') > -1 ||
link.indexOf('subPackage/page/pages/orderBenefit/orderBenefit') > -1 ||
link.indexOf('pages/cart/cart') > -1 ||
link.indexOf('subPackage/page/pages/myInvite/myInvite') > -1 ||
link.indexOf('subPackage/page/pages/orderBenefit/orderBenefit') > -1 ||
link.indexOf('pages/extendProduct/extendProduct') > -1 ||
link.indexOf('subPackage/page/pages/myInvite/myInvite') > -1 ||
link.indexOf('pages/myAddress/myAddress') > -1 ||
link.indexOf('pages/extendProduct/extendProduct') > -1 ||
link.indexOf('pages/order/order') > -1)
link.indexOf('pages/myAddress/myAddress') > -1 ||
{
link.indexOf('pages/order/order') > -1) {
flag = true
flag = true
}
}
}
return flag
return flag
}
}
...
...
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