Commit d4b8fd3d by 高淑倩

图片导航授权页面

parent 3b72bd32
...@@ -10,7 +10,7 @@ Component({ ...@@ -10,7 +10,7 @@ Component({
* 组件的属性列表 * 组件的属性列表
*/ */
properties: { properties: {
currentHasUserInfo:{ currentHasUserInfo: {
type: Boolean, type: Boolean,
type: false type: false
}, },
...@@ -23,6 +23,41 @@ Component({ ...@@ -23,6 +23,41 @@ Component({
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() {
}, },
/** /**
* 组件的初始数据 * 组件的初始数据
...@@ -88,7 +123,8 @@ Component({ ...@@ -88,7 +123,8 @@ Component({
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) { }
......
...@@ -7,8 +7,17 @@ ...@@ -7,8 +7,17 @@
wx:for-item="item" wx:for-item="item"
class="nav-block" class="nav-block"
> >
<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)}}">
<button
wx:if="{{!currentHasUserInfo}}"
bindgetuserinfo="_getUserInfo"
data-jflag="false"
open-type='getUserInfo'
class='btn btn-primary btn-vip-code'
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)}}"
...@@ -19,17 +28,10 @@ ...@@ -19,17 +28,10 @@
bindload="imageLoad" bindload="imageLoad"
bindtap='preview' 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>
...@@ -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
...@@ -30,16 +30,17 @@ function formateUrl(url, BASE_IMG_URL){ ...@@ -30,16 +30,17 @@ function formateUrl(url, BASE_IMG_URL){
// 授权路径 我的/购物车/我的奖励/邀请好友/推广商品/我的地址/我的订单 // 授权路径 我的/购物车/我的奖励/邀请好友/推广商品/我的地址/我的订单
function hanlerLinkNeedAuth(link){ function hanlerLinkNeedAuth(link){
var flag = false var flag = false
if(typeof(link) != undefined && link) {
if(link.indexOf('pages/my/my') > -1 || if(link.indexOf('pages/my/my') > -1 ||
link.indexOf('pages/cart/cart') > -1 || link.indexOf('pages/cart/cart') > -1 ||
link.indexOf('subPackage/page/pages/orderBenefit/orderBenefit') > -1 || link.indexOf('subPackage/page/pages/orderBenefit/orderBenefit') > -1 ||
link.indexOf('subPackage/page/pages/myInvite/myInvite') > -1 || link.indexOf('subPackage/page/pages/myInvite/myInvite') > -1 ||
link.indexOf('pages/extendProduct/extendProduct') > -1 || link.indexOf('pages/extendProduct/extendProduct') > -1 ||
link.indexOf('pages/myAddress/myAddress') > -1 || link.indexOf('pages/myAddress/myAddress') > -1 ||
link.indexOf('pages/order/order') > -1) link.indexOf('pages/order/order') > -1) {
{
flag = true flag = true
} }
}
return flag return flag
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment