Commit d4b8fd3d by 高淑倩

图片导航授权页面

parent 3b72bd32
......@@ -9,55 +9,90 @@ Component({
/**
* 组件的属性列表
*/
properties: {
currentHasUserInfo:{
type: Boolean,
type: false
},
picNav: {
type: Array,
value: [],
},
},
attached() {
this.setData({
baseImgUrl: app.globalData.imageUrl
})
},
properties: {
currentHasUserInfo: {
type: Boolean,
type: false
},
picNav: {
type: Array,
value: [],
},
},
attached() {
this.setData({
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: {
imagewidth: 0,//缩放后的宽
imageheight: 0,//缩放后的高
isAuthorization: false,
isAuthorizationActiveText: '',
isAuthorizationType: 2,
baseImgUrl: ''
},
data: {
imagewidth: 0,//缩放后的宽
imageheight: 0,//缩放后的高
isAuthorization: false,
isAuthorizationActiveText: '',
isAuthorizationType: 2,
baseImgUrl: ''
},
/**
* 组件的方法列表
*/
methods: {
methods: {
_getUserInfo(res = {}) {
wxService.nextTick(() => {
this.triggerEvent('getAuth', res);
})
},
imageLoad(e) {
let imageSize = utils.imageUtil(e)
this.setData({
imagewidth: imageSize.imageWidth,
imageheight: imageSize.imageHeight
})
},
preview(event) {
const ev = event.currentTarget.dataset;
imageLoad(e) {
let imageSize = utils.imageUtil(e)
this.setData({
imagewidth: imageSize.imageWidth,
imageheight: imageSize.imageHeight
})
},
preview(event) {
const ev = event.currentTarget.dataset;
let curItemType = ev.item
// 获取当前帐号信息
// 获取当前帐号信息
const userInfo = wx.getStorageSync('_baseUserInfo')
// link row
// link row
if (curItemType.link) {
let currentClickType = app.globalData.commonFunc.getLink(curItemType.link.type, curItemType)
if (curItemType.link.type == 1) {
......@@ -85,10 +120,11 @@ Component({
wxService.router(`/${currentClickType}`)
} else if (curItemType.link.type == 7) {
// 集点详情
wxService.router(`${currentClickType}`)
wxService.router(`${currentClickType}`)
}
} 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)
if (rowObj.type == 1) { }
......@@ -102,16 +138,16 @@ Component({
// 商品
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}`)
}
}
},
activeTocard(e) {
if (e.detail) {
wxService.openCard()
}
}
}
},
activeTocard(e) {
if (e.detail) {
wxService.openCard()
}
}
}
})
......@@ -7,29 +7,31 @@
wx:for-item="item"
class="nav-block"
>
<image
wx:if="{{currentHasUserInfo}}"
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 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
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
wx:if="{{currentHasUserInfo}}"
class="pic-img"
style="width: {{100}}%;height: {{100}}px;"
src="{{utils.formateUrl(item.imageUrl,baseImgUrl)}}"
......@@ -40,8 +42,20 @@
bindload="imageLoad"
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>
......@@ -14,8 +14,11 @@
overflow: hidden;
box-sizing: border-box;
flex-direction: row;
align-items: center;
/* align-items: center; */
}
.nav-block {
flex: 1
}
.btn-vip-code {
display: flex;
}
\ No newline at end of file
......@@ -30,15 +30,16 @@ function formateUrl(url, BASE_IMG_URL){
// 授权路径 我的/购物车/我的奖励/邀请好友/推广商品/我的地址/我的订单
function hanlerLinkNeedAuth(link){
var flag = false
if(link.indexOf('pages/my/my') > -1 ||
link.indexOf('pages/cart/cart') > -1 ||
link.indexOf('subPackage/page/pages/orderBenefit/orderBenefit') > -1 ||
link.indexOf('subPackage/page/pages/myInvite/myInvite') > -1 ||
link.indexOf('pages/extendProduct/extendProduct') > -1 ||
link.indexOf('pages/myAddress/myAddress') > -1 ||
link.indexOf('pages/order/order') > -1)
{
flag = true
if(typeof(link) != undefined && link) {
if(link.indexOf('pages/my/my') > -1 ||
link.indexOf('pages/cart/cart') > -1 ||
link.indexOf('subPackage/page/pages/orderBenefit/orderBenefit') > -1 ||
link.indexOf('subPackage/page/pages/myInvite/myInvite') > -1 ||
link.indexOf('pages/extendProduct/extendProduct') > -1 ||
link.indexOf('pages/myAddress/myAddress') > -1 ||
link.indexOf('pages/order/order') > -1) {
flag = true
}
}
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