Commit e325defe by 赵雅纹

Merge branch 'dev_7.1.0' into fixbug-ZYW

parents f422f9cc 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,26 +24,25 @@ Component({ ...@@ -23,26 +24,25 @@ 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
console.log('currentPath', currentPath.route,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'
...@@ -51,15 +51,24 @@ Component({ ...@@ -51,15 +51,24 @@ Component({
} else { } else {
newRow.newPath = '' newRow.newPath = ''
} }
// item.row = JSON.stringify(newRow)
item.row = newRow item.row = newRow
} }
}) })
this.setData({ tabBar }, () => { // 当前匹配路径是否需要授权 true 需要 false 不需要
tabBar.images.forEach(item => {
let checkUrl = ''
if (item.link) {
checkUrl = item.link.newPath ? item.link.newPath : item.link.url
} else if (item.row) {
checkUrl = item.row.newPath ? item.row.newPath : item.row.url
}
wxService.NoLoginPage(checkUrl).then(res => {
item.needAuth = res.needAuth
this.setData({ tabBarList: tabBar.images })
})
}) })
}, },
ready() { ready() {
this.setData({ this.setData({
currentRoute: `/${utils.getCurrentPageUrl()}` currentRoute: `/${utils.getCurrentPageUrl()}`
...@@ -70,75 +79,19 @@ Component({ ...@@ -70,75 +79,19 @@ Component({
*/ */
data: { data: {
currentRoute: '', currentRoute: '',
tabs: [],
type: 1, type: 1,
baseImgUrl: '' baseImgUrl: '',
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}`)
}
}
}
}
}) })
...@@ -2,11 +2,10 @@ ...@@ -2,11 +2,10 @@
<wxs src="../../wxs/utils.wxs" module="utils" /> <wxs src="../../wxs/utils.wxs" module="utils" />
<!--<wxs src="./handlerData.wxs" module="tools" />--> <!--<wxs src="./handlerData.wxs" module="tools" />-->
<view class='bgc fixed-bottom0' style="background-image:url({{tabBar.num == 4 ? '': '/assets/imgs/7_1_0/bg.png'}});" wx:if="{{tabBar.num == 4}}"> <view class='bgc fixed-bottom0' style="background-image:url({{tabBar.num == 4 ? '': '/assets/imgs/7_1_0/bg.png'}});" wx:if="{{tabBar.num == 4}}">
<block wx:for="{{tabBar.images}}" wx:key="{{index}}" wx:for-item="tab"> <block wx:for="{{tabBarList}}" wx:key="{{index}}" wx:for-item="tab">
<view class="tab"> <view class="tab">
<!--当前页面需要授权 且未授权--> <!--当前页面需要授权 且未授权-->
<!--<view wx:if="{{utils.hanlerLinkNeedAuth(tab.link.url)}}" class="btn-tab">--> <view wx:if="{{tab.needAuth}}" class="btn-tab">
<view wx:if="{{tab.link ? utils.hanlerLinkNeedAuth(typeOf(tab.link.newPath) != undefined ? tab.link.newPath : tab.link.url) : utils.hanlerLinkNeedAuth(tab.row.newPath ? tab.row.newPath : tab.row.url)}}" class="btn-tab">
<view wx:if="{{!currentHasUserInfo}}" class="btn-tab"> <view wx:if="{{!currentHasUserInfo}}" class="btn-tab">
<button <button
bindgetuserinfo="_getUserInfo" bindgetuserinfo="_getUserInfo"
...@@ -44,7 +43,7 @@ ...@@ -44,7 +43,7 @@
</block> </block>
</view> </view>
<view class="bottom-tab fixed-bottom0" wx:if="{{tabBar.num == 5}}"> <view class="bottom-tab fixed-bottom0" wx:if="{{tabBar.num == 5}}">
<block wx:for="{{tabs}}" wx:key="{{index}}" wx:for-item="tab"> <block wx:for="{{tabBarList}}" wx:key="{{index}}" wx:for-item="tab">
<view class="tab" data-item="{{tab}}" bindtap="handelToPage"> <view class="tab" data-item="{{tab}}" bindtap="handelToPage">
<!--当前页面需要授权 且未授权--> <!--当前页面需要授权 且未授权-->
<view wx:if="{{utils.hanlerLinkNeedAuth(tab.link.url)}}" class="btn-tab"> <view wx:if="{{utils.hanlerLinkNeedAuth(tab.link.url)}}" class="btn-tab">
......
...@@ -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}`)
}
}
}
}
}) })
...@@ -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({
...@@ -23,38 +24,51 @@ Component({ ...@@ -23,38 +24,51 @@ 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 }, () => {
})
}, },
observers: {
picNav() {
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
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 = newRow
}
})
// 当前匹配路径是否需要授权 true 需要 false 不需要
picNav.forEach(item => {
let checkUrl = ''
if(item.link) {
checkUrl = item.link.newPath ? item.link.newPath : item.link.url
} else if(item.row) {
checkUrl = item.row.newPath ? item.row.newPath : item.row.url
}
wxService.NoLoginPage(checkUrl).then(res=>{
item.needAuth = res.needAuth
this.setData({ newPicNav: picNav })
})
})
}
},
/** /**
* 组件的初始数据 * 组件的初始数据
*/ */
...@@ -64,7 +78,8 @@ Component({ ...@@ -64,7 +78,8 @@ Component({
isAuthorization: false, isAuthorization: false,
isAuthorizationActiveText: '', isAuthorizationActiveText: '',
isAuthorizationType: 2, isAuthorizationType: 2,
baseImgUrl: '' baseImgUrl: '',
newPicNav: []
}, },
/** /**
* 组件的方法列表 * 组件的方法列表
...@@ -83,62 +98,7 @@ Component({ ...@@ -83,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) {
......
...@@ -2,13 +2,13 @@ ...@@ -2,13 +2,13 @@
<wxs src="../../wxs/utils.wxs" module="utils" /> <wxs src="../../wxs/utils.wxs" module="utils" />
<view class="pic-nav"> <view class="pic-nav">
<view <view
wx:for="{{picNav}}" wx:for="{{newPicNav}}"
wx:key="{{index}}" wx:key="{{index}}"
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)}}"> <view wx:if="{{item.needAuth}}">
<button <button
wx:if="{{!currentHasUserInfo}}" wx:if="{{!currentHasUserInfo}}"
bindgetuserinfo="_getUserInfo" bindgetuserinfo="_getUserInfo"
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
style="height:100%" style="height:100%"
> >
<image <image
class="pic-img" class="pic-img hhh"
style="width: {{100}}%;height: {{100}}px;" style="width: {{100}}%;height: {{100}}px;"
src="{{utils.formateUrl(item.imageUrl,baseImgUrl)}}" src="{{utils.formateUrl(item.imageUrl,baseImgUrl)}}"
data-appid="{{item.link.appid}}" data-appid="{{item.link.appid}}"
...@@ -33,7 +33,7 @@ ...@@ -33,7 +33,7 @@
<image <image
wx:if="{{currentHasUserInfo}}" wx:if="{{currentHasUserInfo}}"
class="pic-img" class="pic-img yyyy"
style="width: {{100}}%;height: {{100}}px;" style="width: {{100}}%;height: {{100}}px;"
src="{{utils.formateUrl(item.imageUrl,baseImgUrl)}}" src="{{utils.formateUrl(item.imageUrl,baseImgUrl)}}"
data-appid="{{item.link.appid}}" data-appid="{{item.link.appid}}"
...@@ -46,7 +46,7 @@ ...@@ -46,7 +46,7 @@
</view> </view>
<view wx:else> <view wx:else>
<image <image
class="pic-img" class="pic-img ttt"
style="width: {{100}}%;height: {{100}}px;" style="width: {{100}}%;height: {{100}}px;"
src="{{utils.formateUrl(item.imageUrl,baseImgUrl)}}" src="{{utils.formateUrl(item.imageUrl,baseImgUrl)}}"
data-appid="{{item.link.appid}}" data-appid="{{item.link.appid}}"
...@@ -56,7 +56,7 @@ ...@@ -56,7 +56,7 @@
bindload="imageLoad" bindload="imageLoad"
bindtap='preview' bindtap='preview'
/> />
</view> </view>
</view> </view>
</view> </view>
...@@ -79,29 +79,63 @@ class Http { ...@@ -79,29 +79,63 @@ class Http {
.catch(this.fail) .catch(this.fail)
} }
// header: {
// 'tunnel-token' : 'aa8a1bfb7f6c5031d172d94b6574293ef954a6f2d4e16657da008e0cc15588feD'
// },
get (url, parmas) { get (url, parmas) {
return this.request({ let baseUserInfo = wx.getStorageSync('_baseUserInfo')
url, console.log('baseUserInfo', baseUserInfo ? 'buyer-token' : 'tunnel-token')
method: 'GET', if(baseUserInfo){
header: { return this.request({
'buyer-token': this.getToken(), url,
'TENTACLE_CONTENT': this.getTentacle() method: 'GET',
}, header: {
data: parmas 'buyer-token': this.getToken(),
}) 'TENTACLE_CONTENT': this.getTentacle()
},
data: parmas
})
} else {
return this.request({
url,
method: 'GET',
header: {
'tunnel-token': this.getToken(),
'TENTACLE_CONTENT': this.getTentacle()
},
data: parmas
})
}
} }
post (url, parmas, channel) { post (url, parmas, channel) {
return this.request({ let baseUserInfo = wx.getStorageSync('_baseUserInfo')
url,
method: 'POST', if(baseUserInfo){
header: { return this.request({
'buyer-token': this.getToken(), url,
'TENTACLE_CONTENT': this.getTentacle() method: 'POST',
}, header: {
data: parmas, 'buyer-token': this.getToken(),
channel: channel 'TENTACLE_CONTENT': this.getTentacle()
}) },
data: parmas,
channel: channel
})
} else {
return this.request({
url,
method: 'POST',
header: {
'tunnel-token': this.getToken(),
'TENTACLE_CONTENT': this.getTentacle()
},
data: parmas,
channel: channel
})
}
} }
checkStatus (resp) { checkStatus (resp) {
......
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
...@@ -308,8 +308,9 @@ function _getUserInfo(ev) { ...@@ -308,8 +308,9 @@ function _getUserInfo(ev) {
setUserInfo() // 判断有无开卡 setUserInfo() // 判断有无开卡
}).catch(err => { }).catch(err => {
if (err) { if (err) {
console.log('err', err)
wx.showToast({ wx.showToast({
title: `会员系统异常请稍后重试!`, title: `您已拒绝授权!`,
icon: 'none' icon: 'none'
}) })
} }
......
...@@ -59,60 +59,30 @@ class WXService extends Http { ...@@ -59,60 +59,30 @@ class WXService extends Http {
this.setPageLoadStatus() this.setPageLoadStatus()
wx.hideLoading() wx.hideLoading()
}).catch(res => { }).catch(res => {
// if (res.msg && res.msg.indexOf('未登录') > -1) { if (res.msg && res.msg.indexOf('未登录') > -1) {
// // 判断是否登陆过 登陆过 重新登陆 未登陆 跳转首页 wx.removeStorageSync('_baseUserInfo')
// const baseUserInfo = this.getBaseUserInfo()
// if(!baseUserInfo) {
// wxService.router('/pages/userCenter/userCenter').replace()
// return false
// }
// // 条件限制 getUserInfoLimitCount:重试次数
// if (!this.getUserInfoLimitCount) { // if (!this.getUserInfoLimitCount) {
// this.getUserInfoLimitCount = 1 // this.getUserInfoLimitCount = 1
// } else { // } else {
// this.getUserInfoLimitCount++ // this.getUserInfoLimitCount++
// } // }
// console.log('count', this.getUserInfoLimitCount)
// if (this.getUserInfoLimitCount > 3) { // if (this.getUserInfoLimitCount > 3) {
// wx.showToast({ // wx.showToast({
// title: '登录超出重试次数!', // title: '会员系统异常,请联系管理员',
// icon: 'none' // icon: 'none',
// duration: 2000
// }) // })
// wxService.router(`/pages/userCenter/userCenter`).replace()
// return false
// } else { // } else {
// // 重新登陆 更新缓存 // // 重新登陆之前判断是否登陆过 重新登陆
// this.reLogin() // const baseUserInfo = this.getBaseUserInfo()
// if (baseUserInfo) {
// // this.reLogin()
// return false
// }
// } // }
} else
// setTimeout(()=>{ if (res.msg && res.msg.indexOf('请重新授权') > -1) {
// const pages = getCurrentPages()
// const perpage = pages[pages.length - 1]
// perpage.onShow()
// },2000)
// }
if (res.msg && res.msg.indexOf('未登录') > -1) {
if (!this.getUserInfoLimitCount) {
this.getUserInfoLimitCount = 1
} else {
this.getUserInfoLimitCount++
}
console.log('count', this.getUserInfoLimitCount)
if (this.getUserInfoLimitCount > 3) {
wx.showToast({
title: '会员系统异常,请联系管理员',
icon: 'none',
duration: 2000
})
} else {
// 重新登陆之前判断是否登陆过 重新登陆
const baseUserInfo = this.getBaseUserInfo()
if (baseUserInfo) {
// this.reLogin()
return false
}
}
} else if (res.msg && res.msg.indexOf('请重新授权') > -1) {
wx.setStorageSync('reLoginErr', true) wx.setStorageSync('reLoginErr', true)
wxService.router(`/pages/userCenter/userCenter`).back() wxService.router(`/pages/userCenter/userCenter`).back()
} }
...@@ -425,6 +395,30 @@ class WXService extends Http { ...@@ -425,6 +395,30 @@ class WXService extends Http {
}) })
} }
NoLoginPage(page) {
// 首页/商品详情页/内容列表/内容详情/分类/商品列表/集点列表/分享列表
const NoLoginAuthPage = [
'/pages/userCenter/userCenter',
'/pages/myShare/myShare',
'/subPackage/page/pages/myReleaseDetail/myReleaseDetail',
'/pages/productDetail/productDetail',
'/pages/category/category',
'/subPackage/page/pages/categoryPro/categoryPro',
'/pages/pointList/pointList',
'/subPackage/page/pages/friendShareList/friendShareList',
]
return new Promise((resolve,reject) => {
if(NoLoginAuthPage.indexOf(page) > -1) {
resolve({needAuth : false})
} else {
resolve({needAuth : true})
}
}).catch((err) => {
console.log('不需要登录err', err)
reject()
})
}
handlerPage(page) { handlerPage(page) {
const AccreditWhitePages = [ const AccreditWhitePages = [
'pages/welcome/welcome' 'pages/welcome/welcome'
...@@ -481,63 +475,6 @@ class WXService extends Http { ...@@ -481,63 +475,6 @@ class WXService extends Http {
}) })
} }
// handlerPage (page) {
// const AccreditWhitePages = [
// 'pages/welcome/welcome'
// ] // 免授权页面白名单
// const _self = this
// const app = _self.getApp()
// const baseUserInfo = wx.getStorageSync('_baseUserInfo')
// if (baseUserInfo && baseUserInfo.isMember === '1') {
// app.globalData.openCard = true
// }
// return new Promise((resolve, reject) => {
// let accreditUserInfo = wx.getStorageSync('_accreditUserInfo')
// if (app.globalData.openCard && accreditUserInfo) {
// resolve()
// return false
// }
// if (AccreditWhitePages.indexOf(page.route) > -1) {
// resolve()
// } else if (accreditUserInfo) {
// getAppUserInfo().then(() => {
// if (this.lock) {
// return false
// }
// if ((!baseUserInfo || baseUserInfo.isMember !== '1') && needOpenCard()) {
// reject({ state: 1 })
// _self.lock = false
// } else {
// _self.lock = false
// resolve()
// }
// }).catch((res) => {
// reject()
// })
// } else {
// reject({ state: 1 })
// }
// }).catch((err) => {
// if (err && err.state === 1) {
// const modifyMottoRoute = [
// "pos/express/pages/orderList/orderList",
// "pos/express/pages/confirm/confirm"
// ]
// let router = '/pages/welcome/welcome';
// if (modifyMottoRoute.indexOf(page.route) > -1) {
// page.options.motto = 'express';
// }
// wxService.router('/pages/welcome/welcome').search({
// route: `${page.route}`,
// options: JSON.stringify(page.options)
// }).replace()
// }
// return Promise.reject()
// })
// }
// 设置异步的全局变量值 // 设置异步的全局变量值
initAppGlobalDataSync() { initAppGlobalDataSync() {
const app = this.getApp() const app = this.getApp()
......
...@@ -44,6 +44,7 @@ function hanlerLinkNeedAuth(link){ ...@@ -44,6 +44,7 @@ function hanlerLinkNeedAuth(link){
return flag return flag
} }
module.exports = { module.exports = {
formateUrl:formateUrl, formateUrl:formateUrl,
numberFormat: numberFormat, numberFormat: numberFormat,
......
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