Commit d1aa535f by 谢中龙

动态界面组件不支持企业微信兼容处理,KPI页面js时间格式转化不支持IOS出错的问题修复

parent 6a32dddc
...@@ -24,7 +24,7 @@ Component({ ...@@ -24,7 +24,7 @@ Component({
this.setData({ this.setData({
baseImgUrl: app.globalData.imageUrl baseImgUrl: app.globalData.imageUrl
}) })
const { imageData } = this.data const { imageData } = this.data;
let currentTab = imageData let currentTab = imageData
currentTab.forEach(item => { currentTab.forEach(item => {
// 存在 row 处理数据 8 商品 9 分类 // 存在 row 处理数据 8 商品 9 分类
...@@ -123,8 +123,33 @@ Component({ ...@@ -123,8 +123,33 @@ Component({
imageHeights: imageHeights, imageHeights: imageHeights,
windowWidth: sysRes.windowWidth, windowWidth: sysRes.windowWidth,
heights heights
}) });
//如果是在企业微信中 由于不支持observers属性方法,因此需要手动调用
const currentEnv = wx.getStorageSync('_qyWeChat');
if (currentEnv){
// console.log('its in qiye weixin')
this.calMaxHeight(heights);
}
}, },
//计算最大高度
calMaxHeight(heights){
let imageData = this.data.imageData
if (heights.length === imageData.length) {
let maxHeight = Math.max.apply(null, heights)
this.setData({
maxHeight,
})
wxService.nextTick(() => {
this.triggerEvent(
'imageLoad',
{ maxHeight, windowWidth: this.data.windowWidth },
{ bubbles: true, composed: true }
)
})
}
},
//预览
preview(event) { preview(event) {
utilLink.currentLinkRouter(event, this) utilLink.currentLinkRouter(event, this)
} }
......
<!--component/imageSwiper/imageSwiper.wxml--> <!--component/imageSwiper/imageSwiper.wxml-->
<wxs src="../../wxs/utils.wxs" module="utils" /> <wxs src="../../wxs/utils.wxs" module="utils" />
<swiper <swiper
class="image-swiper" class="image-swiper"
indicator-dots="{{indicatorDots}}" indicator-dots="{{indicatorDots}}"
...@@ -10,9 +9,8 @@ ...@@ -10,9 +9,8 @@
duration="{{duration}}" duration="{{duration}}"
style="height: {{maxHeight}}px;" style="height: {{maxHeight}}px;"
> >
<block wx:for="{{imageList}}" wx:key="swiper{{index}}" wx:for-item="item">
<block wx:for="{{imageList}}" wx:key="{{index}}" wx:for-item="item"> <swiper-item class="swiper-item" >
<swiper-item class="swiper-item">
<view wx:if="{{item.needAuth}}"> <view wx:if="{{item.needAuth}}">
<view wx:if="{{!currentHasUserInfo}}"> <view wx:if="{{!currentHasUserInfo}}">
<image <image
......
...@@ -23,8 +23,13 @@ Component({ ...@@ -23,8 +23,13 @@ Component({
attached() { attached() {
this.setData({ this.setData({
baseImgUrl: app.globalData.imageUrl baseImgUrl: app.globalData.imageUrl
}) });
//兼容企业微信中不能使用 observers 属性方法 , 手动调用
const currentEnv = wx.getStorageSync('_qyWeChat');
if(currentEnv){
this.handlePicNav();
}
}, },
observers: { observers: {
picNav() { picNav() {
...@@ -67,6 +72,7 @@ Component({ ...@@ -67,6 +72,7 @@ Component({
}) })
} }
}, },
/** /**
* 组件的初始数据 * 组件的初始数据
*/ */
...@@ -102,6 +108,45 @@ Component({ ...@@ -102,6 +108,45 @@ Component({
if (e.detail) { if (e.detail) {
wxService.openCard() wxService.openCard()
} }
} },
//处理PicNav
handlePicNav() {
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'
}
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 => {
if (checkUrl) item.needAuth = res.needAuth
this.setData({ newPicNav: picNav })
})
})
},
} }
}) })
...@@ -3,13 +3,21 @@ ...@@ -3,13 +3,21 @@
<!-- 1 轮播 2 个人中心 3 图片导航 4 底部左划 5 底部 Tab 6 公告 7 分类 8 关注公众号 9 plus(9/5-权重高)--> <!-- 1 轮播 2 个人中心 3 图片导航 4 底部左划 5 底部 Tab 6 公告 7 分类 8 关注公众号 9 plus(9/5-权重高)-->
<block wx:for="{{pages}}" wx:key="{{index}}" wx:for-item="pItem"> <block wx:for="{{pages}}" wx:key="{{index}}" wx:for-item="pItem">
<view wx:if="{{pItem.type == 1}}"> <view wx:if="{{pItem.type == 1}}">
<image-swiper image-data="{{pItem.rotationchart.images}}" bind:updatePage="updatePage" bind:getAuth="_getUserInfo" currentHasUserInfo="{{currentHasUserInfo}}"/> <image-swiper
image-data="{{pItem.rotationchart.images}}"
bind:updatePage="updatePage"
bind:getAuth="_getUserInfo"
currentHasUserInfo="{{currentHasUserInfo}}"/>
</view> </view>
<view class="" wx:if="{{pItem.type == 2}}"> <view class="" wx:if="{{pItem.type == 2}}">
<person-center isVip="{{isVip}}" bind:getAuth="_getUserInfo" currentHasUserInfo="{{currentHasUserInfo}}" base-user-info="{{baseUserInfo}}" person-data="{{pItem.customer}}" integral-num="{{integralNum}}" coupon-num="{{couponNum}}" token="{{token}}"/> <person-center isVip="{{isVip}}" bind:getAuth="_getUserInfo" currentHasUserInfo="{{currentHasUserInfo}}" base-user-info="{{baseUserInfo}}" person-data="{{pItem.customer}}" integral-num="{{integralNum}}" coupon-num="{{couponNum}}" token="{{token}}"/>
</view> </view>
<view class="" wx:if="{{pItem.type == 3}}"> <view class="" wx:if="{{pItem.type == 3}}">
<pic-nav pic-nav="{{pItem.navigation.images}}" bind:getAuth="_getUserInfo" currentHasUserInfo="{{currentHasUserInfo}}" bind:updatePage="updatePage"/> <pic-nav
pic-nav="{{pItem.navigation.images}}"
bind:getAuth="_getUserInfo"
currentHasUserInfo="{{currentHasUserInfo}}"
bind:updatePage="updatePage"/>
</view> </view>
<view class="" wx:if="{{pItem.type == 4}}"> <view class="" wx:if="{{pItem.type == 4}}">
<bottom bottom="{{pItem.bottom}}" /> <bottom bottom="{{pItem.bottom}}" />
......
...@@ -27,11 +27,11 @@ wxService.page({ ...@@ -27,11 +27,11 @@ wxService.page({
* 生命周期函数--监听页面显示 * 生命周期函数--监听页面显示
*/ */
onShow: function () { onShow: function () {
console.log('招募', this.options)
let taskId = this.options && this.options.id || 0 let taskId = this.options && this.options.id || 0
let orderType = this.options && this.options.type || 2 let orderType = this.options && this.options.type || 2
this.getTaskDetail(orderType, taskId) this.getTaskDetail(orderType, taskId)
}, },
//获取任务详情
getTaskDetail(orderType, taskId) { getTaskDetail(orderType, taskId) {
wx.showLoading({ wx.showLoading({
title: '加载中' title: '加载中'
...@@ -41,6 +41,13 @@ wxService.page({ ...@@ -41,6 +41,13 @@ wxService.page({
const { result, data } = res.data const { result, data } = res.data
if (result == 0) { if (result == 0) {
wx.hideLoading() wx.hideLoading()
if (data.task.startTime) {
data.task.startTime = data.task.startTime.replace(/\-/g, '/');
}
if (data.task.endTime) {
data.task.endTime = data.task.endTime.replace(/\-/g, '/');
}
let curStart = new Date(data.task.startTime) let curStart = new Date(data.task.startTime)
let curEnd = new Date(data.task.endTime) let curEnd = new Date(data.task.endTime)
data.task.startTime = `${curStart.getMonth()}${curStart.getDay()}日` data.task.startTime = `${curStart.getMonth()}${curStart.getDay()}日`
...@@ -52,39 +59,5 @@ wxService.page({ ...@@ -52,39 +59,5 @@ wxService.page({
} }
} }
}) })
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
} }
}) })
\ No newline at end of file
...@@ -51,8 +51,17 @@ wxService.page({ ...@@ -51,8 +51,17 @@ wxService.page({
if (result == 0) { if (result == 0) {
wx.hideLoading() wx.hideLoading()
data.content.forEach(item=>{ data.content.forEach(item=>{
//兼容ios
if(item.task.startTime){
item.task.startTime = item.task.startTime.replace(/\-/g, '/');
}
if (item.task.endTime) {
item.task.endTime = item.task.endTime.replace(/\-/g, '/');
}
let curStart = new Date(item.task.startTime) let curStart = new Date(item.task.startTime)
let curEnd = new Date(item.task.endTime) let curEnd = new Date(item.task.endTime)
item.task.startTime = `${curStart.getMonth()}${curStart.getDay()}日` item.task.startTime = `${curStart.getMonth()}${curStart.getDay()}日`
item.task.endTime = `${curEnd.getMonth()}${curEnd.getDay()}日` item.task.endTime = `${curEnd.getMonth()}${curEnd.getDay()}日`
}) })
...@@ -125,7 +134,6 @@ wxService.page({ ...@@ -125,7 +134,6 @@ wxService.page({
* 页面上拉触底事件的处理函数 * 页面上拉触底事件的处理函数
*/ */
onReachBottom: function () { onReachBottom: function () {
console.log('-------------')
if(pageNo < totalPages) { if(pageNo < totalPages) {
this.setData({ this.setData({
pageNo: this.data.pageNo + 1, pageNo: this.data.pageNo + 1,
......
...@@ -21,11 +21,11 @@ wxService.page({ ...@@ -21,11 +21,11 @@ wxService.page({
* 生命周期函数--监听页面显示 * 生命周期函数--监听页面显示
*/ */
onShow: function () { onShow: function () {
console.log('ddddd', this.options)
let taskId = this.options && this.options.id || 0 let taskId = this.options && this.options.id || 0
let orderType = this.options && this.options.type || 1 let orderType = this.options && this.options.type || 1
this.getTaskDetail(orderType, taskId) this.getTaskDetail(orderType, taskId)
}, },
//获取任务详情
getTaskDetail(orderType,taskId) { getTaskDetail(orderType,taskId) {
wx.showLoading({ wx.showLoading({
title: '加载中' title: '加载中'
...@@ -35,6 +35,13 @@ wxService.page({ ...@@ -35,6 +35,13 @@ wxService.page({
const { result, data } = res.data const { result, data } = res.data
if (result == 0) { if (result == 0) {
wx.hideLoading() wx.hideLoading()
if (data.task.startTime) {
data.task.startTime = data.task.startTime.replace(/\-/g, '/');
}
if (data.task.endTime) {
data.task.endTime = data.task.endTime.replace(/\-/g, '/');
}
let curStart = new Date(data.task.startTime) let curStart = new Date(data.task.startTime)
let curEnd = new Date(data.task.endTime) let curEnd = new Date(data.task.endTime)
data.task.startTime = `${curStart.getMonth()}${curStart.getDay()}日` data.task.startTime = `${curStart.getMonth()}${curStart.getDay()}日`
...@@ -63,25 +70,4 @@ wxService.page({ ...@@ -63,25 +70,4 @@ wxService.page({
}); });
}, },
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
}
}) })
\ No newline at end of file
...@@ -9,13 +9,28 @@ wxService.page({ ...@@ -9,13 +9,28 @@ wxService.page({
data: { data: {
code : null, code : null,
jsCodeSession : {}, jsCodeSession : {},
btnIsDisabled : true btnIsDisabled : true,
show : false,
}, },
/** /**
* 生命周期函数--监听页面加载 * 生命周期函数--监听页面加载
*/ */
onLoad: function (options) { onLoad: function (options) {
const currentEnv = wx.getStorageSync('_qyWeChat');
console.log(currentEnv)
if(!currentEnv){
wx.showToast({
title: '请在企业微信中使用导购!',
icon : 'none',
duration : 2000
});
this.setData({
show : true,
});
return ;
}
wx.showLoading({ wx.showLoading({
title: '检查登录状态..', title: '检查登录状态..',
}); });
...@@ -52,9 +67,6 @@ wxService.page({ ...@@ -52,9 +67,6 @@ wxService.page({
this.setData({ this.setData({
code: res.code code: res.code
}); });
console.log('企业登录ok,code -------', res.code);
this.jscode2session(res.code); this.jscode2session(res.code);
}, },
fail: res => { fail: res => {
......
<!--shoppingGuid/page/pages/welcomGuider/welcomGuider.wxml--> <!--shoppingGuid/page/pages/welcomGuider/welcomGuider.wxml-->
<view class='login'> <view class='login'>
<image src='https://bigaka-xie.oss-cn-shanghai.aliyuncs.com/welcom.png' mode='widthFix'></image> <image src='https://bigaka-xie.oss-cn-shanghai.aliyuncs.com/welcom.png' mode='widthFix'></image>
<view class='tips' wx:if="{{show}}">对不起,请在企业微信中使用导购功能!</view>
<button type='primary' bindtap='onTapGetEnterpriseUserInfo' disabled='{{btnIsDisabled}}'>立即进入</button> <button type='primary' bindtap='onTapGetEnterpriseUserInfo' disabled='{{btnIsDisabled}}'>立即进入</button>
<button class='enter-mall' bindtap='onTapToMall'>进入商城</button> <button class='enter-mall' bindtap='onTapToMall'>进入商城</button>
</view> </view>
...@@ -21,4 +21,14 @@ ...@@ -21,4 +21,14 @@
background: #ffffff; background: #ffffff;
color: #333333; color: #333333;
margin-top: 30rpx; margin-top: 30rpx;
}
.tips{
font-size: 24rpx;
color: #999999;
width: 100%;
height: auto;
margin-bottom: 30rpx;
display: flex;
justify-content: center;
} }
\ No newline at end of file
<!--subPackage/page/pages/subPage/subPage.wxml--> <!--subPackage/page/pages/subPage/subPage.wxml-->
<view class='user-center' style="background: {{pageBackgroundColor == 1? '#eee': '#fff'}};min-height: {{outoHeigth}}px"> <view class='user-center' style="background: {{pageBackgroundColor == 1? '#eee': '#fff'}};min-height: {{outoHeigth}}px">
<!-- 1 轮播 2 个人中心 3 图片导航 4 底部左划 5 底部 Tab 6 公告 7 分类 8 关注公众号 9 plus(9/5-权重高)--> <!-- 1 轮播 2 个人中心 3 图片导航 4 底部左划 5 底部 Tab 6 公告 7 分类 8 关注公众号 9 plus(9/5-权重高)-->
<!-- {{pages}} -->
<block wx:for="{{pages}}" wx:key="{{index}}" wx:for-item="pItem"> <block wx:for="{{pages}}" wx:key="{{index}}" wx:for-item="pItem">
<view wx:if="{{pItem.type == 1}}"> <view wx:if="{{pItem.type == 1}}">
<image-swiper image-data="{{pItem.rotationchart.images}}" bind:updatePage="updatePage" bind:getAuth="_getUserInfo" currentHasUserInfo="{{currentHasUserInfo}}"/> <image-swiper image-data="{{pItem.rotationchart.images}}" bind:updatePage="updatePage" bind:getAuth="_getUserInfo" currentHasUserInfo="{{currentHasUserInfo}}"/>
......
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