Commit 68217022 by 高淑倩

add: 首页跳转路径

parent afe1774e
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
// component/picNav/picNav.js // component/picNav/picNav.js
var app = getApp() var app = getApp()
const wxService = require('../../utils/wxService') const wxService = require('../../utils/wxService')
const utils = require('../../utils/util')
const envInfo = require('../../config/index').envInfo const envInfo = require('../../config/index').envInfo
Component({ Component({
...@@ -25,6 +26,30 @@ Component({ ...@@ -25,6 +26,30 @@ Component({
* 组件的方法列表 * 组件的方法列表
*/ */
methods: { methods: {
preview(e) {
const {appid, path} = e.currentTarget.dataset
// 获取当前帐号信息
const accountInfo = utils.getAccountInfo()
// 是当前小程序 直接跳转
if(accountInfo.miniProgram.appId == appid){
wxService.router(`${path}`)
} else {
// 跳转其他小程序
wx.navigateToMiniProgram({
appId: appid,
path: `${path}`,
success: e => {
console.log(e)
},
fail: e => {
console.log(e)
},
complete: e => {
console.log(e)
},
})
}
}
} }
}) })
<!--component/picNav/picNav.wxml--> <!--component/picNav/picNav.wxml-->
<view class="pic-nav"> <view class="pic-nav">
<block wx:for="{{picNav}}" wx:key="{{index}}" wx:for-item="item" class="pic-content"> <block wx:for="{{picNav}}" wx:key="{{index}}" wx:for-item="item" class="pic-content">
<view class="pic-item"><image class="pic-img" src="http://testimg3.bigaka.com{{item.imageUrl}}" mode="scaleToFill"/></view> <view class="pic-item"><image class="pic-img" src="http://testimg3.bigaka.com{{item.imageUrl}}" data-appid="{{item.link.appid}}" data-path="{{item.link.url}}" bindtap='preview' mode="scaleToFill"/></view>
</block> </block>
</view> </view>
...@@ -68,8 +68,30 @@ wxService.page({ ...@@ -68,8 +68,30 @@ wxService.page({
// endX, endY, startX, startY // endX, endY, startX, startY
const {startX, startY} = this.data const {startX, startY} = this.data
let isTouchLeft = utils.getTouchData(x, y, startX, startY) let isTouchLeft = utils.getTouchData(x, y, startX, startY)
if( isTouchLeft == left) { // 触发左划事件
if(isTouchLeft == 'left') {
const {appid, path} = e.currentTarget.dataset
// 获取当前帐号信息
const accountInfo = utils.getAccountInfo()
// 是当前小程序 直接跳转
if(accountInfo.miniProgram.appId == appid){
wxService.router(`${path}`)
} else {
// 跳转其他小程序
wx.navigateToMiniProgram({
appId: appid,
path: `${path}`,
success: e => {
console.log(e)
},
fail: e => {
console.log(e)
},
complete: e => {
console.log(e)
},
})
}
} }
}, },
// page 信息 // page 信息
......
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
</view> </view>
<!-- 底部 --> <!-- 底部 -->
<view class="images-tab" wx:if="{{pItem.type == 4}}"> <view class="images-tab" wx:if="{{pItem.type == 4}}">
<view class='footer-content' style="background:{{pItem.bottom.color}};color:{{pItem.bottom.color}}" catchtouchstart='touchStart' catchtouchend="touchEnd"> <view class='footer-content' style="background:{{pItem.bottom.color}};color:{{pItem.bottom.color}}" data-appid="{{pItem.bottom.link.appid}}" data-path="{{pItem.bottom.link.url}}" catchtouchstart='touchStart' catchtouchend="touchEnd">
<text class="footer-arrow" style="color:{{pItem.bottom.fontColor}}"><<</text> <text class="footer-arrow" style="color:{{pItem.bottom.fontColor}}"><<</text>
<text class='footer-text' style="color:{{pItem.bottom.fontColor}}">{{pItem.bottom.title}}</text> <text class='footer-text' style="color:{{pItem.bottom.fontColor}}">{{pItem.bottom.title}}</text>
</view> </view>
......
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