Commit b3337d18 by 谢中龙

修改导航是分类时不能跳转的问题

parent 47d9e9b0
......@@ -25,7 +25,11 @@ Component({
*/
methods: {
handelGoHome() {
wxService.router('/pages/userCenter/userCenter').replace()
// wxService.router('/pages/userCenter/userCenter').replace()
//关闭小程序内所有已经打开的页面
wx.reLaunch({
url: '/pages/userCenter/userCenter',
});
}
}
})
......@@ -42,6 +42,7 @@ wxService.page({
this.setData({
pageNum: 1
})
this.getContentList(this.data.pageNum,current)
},
/**
......@@ -61,16 +62,47 @@ wxService.page({
this.generatePointObject(tentacleInfo);
}
//获取种草分类数据
this.getCategoryList()
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
this.getPageData();
this.updateFavoriteAndShareNumById();
},
//根据详情那边过来的点赞分享数据 更改列表中对应的数据
updateFavoriteAndShareNumById(){
console.log(wx.getStorageSync('articleInfo'))
let articleInfo = wx.getStorageSync('articleInfo');
if (articleInfo){
//更新数据
if (this.data.contentList.length != 0){
let obj = this.data.contentList.filter(item => item.id == articleInfo.id);
obj = obj.length != 0 ? obj[0] : null;
if(obj){
obj.enjoySum = articleInfo.enjoySum;
obj.transmitSum = articleInfo.transmitSum;
obj.type = articleInfo.type ? articleInfo.type : 0;
wx.removeStorageSync('articleInfo');
this.setData({
contentList : this.data.contentList
})
}
}
}
},
//获取界面数据信息
getPageData(){
// 原来放到onshow中的事件 现在放到这里
const { memberId, member } = wx.getStorageSync('_baseUserInfo')
const premiumExpireTime = member && member.premiumExpireTime || ''
// ios 兼容 是不是plus vip
let currentEndTime = (new Date(premiumExpireTime.replace(/-/g, '/'))).getTime(); // 到期时间
let time = (new Date()).getTime();
let time = (new Date()).getTime();
if (member && member.premiumExpireTime && currentEndTime > time) {
this.setData({
plus: 1
......@@ -81,7 +113,7 @@ wxService.page({
})
}
this.getValidContentSetExplain() // 获取有效的种草配置文案
this.getCategoryList()
this.getContentPermission()
this.data.currentShareContent = null;
},
......@@ -162,7 +194,7 @@ wxService.page({
totalPages: data.totalPages,
totalElements: data.totalElements
},()=>{
console.log('666666',this.data.contentList)
// console.log('666666',this.data.contentList)
})
}else{
this.setData({
......
......@@ -35,12 +35,19 @@ wxService.page({
skuVOList: [],
benefitData: '',
isQiye: false,
x : 0,
y : 0,
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
this.initPage();
// this.setData({
// x: utils.configSliderBlock(app).x,
// y: utils.configSliderBlock(app).y,
// })
// 判断环境是不是企业微信
let env = wx.getStorageSync('_qyWeChat');
......
<!--pages/userCenter.wxml-->
<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-权重高)-->
<block wx:for="{{pages}}" wx:key="{{index}}" wx:for-item="pItem">
......@@ -38,19 +39,6 @@
<plus sku-list="{{skuVOList}}" plus-bgi="{{pItem.plus}}" currentHasUserInfo="{{currentHasUserInfo}}" bind:updatePage="updatePage"/>
</view>
</block>
<view class="cell-me" wx:if="{{!isQiye}}">
<cell
bind:startmessage='startmessage'
isMask="0"
styleType="2"
blockStyle="bubble"
buttonStyle="light"
buttonText="0"
bubbleColor="cb3c3c"
bind:completemessage="completemessage"
plugid='766c50920993bf9c41c6c3d2761a2df5' />
</view>
</view>
<guide-page-modal show="{{guidePageModalShow}}" />
<share-benefit-modal show="{{shareBenefitModalShow}}" benefit-data="{{benefitData}}"/>
......@@ -58,3 +46,16 @@
<!-- 底部补充高度 防止被遮盖 -->
<view class="bottom-fixed" style="padding-bottom:{{paddingBottom}}"></view>
<!--联系我 客服ID-->
<!-- style='left:{{x}}px;top:{{y}}px' -->
<view class="cell-me" wx:if="{{!isQiye}}" >
<cell
bind:startmessage='startmessage'
isMask="0"
styleType="2"
blockStyle="bubble"
buttonStyle="light"
buttonText="0"
bubbleColor="cb3c3c"
bind:completemessage="completemessage"
plugid='766c50920993bf9c41c6c3d2761a2df5' />
</view>
......@@ -8,7 +8,6 @@ page{
right: 10rpx;
top: 76%;
z-index: 2;
}
.bottom-fixed{
padding-bottom: 40rpx;
......
......@@ -195,7 +195,7 @@ wxService.page({
},
// 获取内容详情
getContentDetail(){
getContentDetail(needStorage,type){
const { memberId, member } = wx.getStorageSync('_baseUserInfo')
wxService.post(`/merchant/contentMobileTerminal/getContentParticulars`,{
id: this.data.id,
......@@ -206,7 +206,17 @@ wxService.page({
if (result == 0) {
this.setData({
contentInfo: data
})
});
if(needStorage){
wx.setStorageSync('articleInfo',{
id : data.id,
enjoySum: data.enjoySum ,
type : type,
transmitSum: data.transmitSum
});
}
this.getProList()
}
......@@ -220,7 +230,8 @@ wxService.page({
productIds: this.data.contentInfo.productIds
}
if (this.data.contentInfo.productIds && this.data.contentInfo.productIds.length > 0){
wxService.post(`/sale/product/buyer/listPage?pageNo=${this.data.pageNo}&pageSize=${this.data.pageSize}`, params).then(res => {
wxService.post(`/sale/product/buyer/listPage?pageNo=${this.data.pageNo}&pageSize=${this.data.pageSize}`,
params).then(res => {
if (!res) return false
const { result, data } = res.data
if (result == 0 && data.content) {
......@@ -251,7 +262,7 @@ wxService.page({
title: '点赞成功',
icon: 'none'
})
this.getContentDetail()
this.getContentDetail(true,1);
}
}).finally(() => {
......@@ -269,7 +280,7 @@ wxService.page({
title: '取消点赞成功',
icon: 'none'
})
this.getContentDetail()
this.getContentDetail(true,0)
}
}).finally(() => {
......
......@@ -8,7 +8,7 @@
left: 0;
background: #ffffff;
display: flex;
z-index: 99999;
z-index: 99;
}
.bottom-tab-bar .tab-bar-item{
......
......@@ -33,6 +33,12 @@ wxService.page({
list: [],
currentPage: 1,
noData : false
},
showShareGoods : false,
shareGoodsObj : {
title: '',
path: '',
imageUrl: '',
}
},
......@@ -42,13 +48,16 @@ wxService.page({
onLoad: function (options) {
//首次进来先加载导购学院的列表
this.getGuidCollegeList();
wx.hideShareMenu();
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
this.setData({
showShareGoods : false,
})
},
//点击事件
......@@ -179,27 +188,51 @@ wxService.page({
}
});
// 先不管触点 测试调用企业微信接口
// let inner_id = Integer.digit(item.productId, 10, 64);
// var path = 'pages/productDetail/productDetail' + '?i=' + inner_id;
// wx.qy.shareToExternalContact({
// appid: app.globalData.appId,//小程序的appid
// title: item.productName, //小程序消息的title
// imgUrl: item.productImgUrl,//小程序消息的封面图
// page: path, //小程序消息打开后的路径
// success: function (res) {
// //todo:
// wx.showToast({
// title: '推荐成功!'
// });
// },
// fail: function (err) {
// console.log('error---------------', err);
// }
// });
},
//定向转发商品给用户 分享功能
onTapToShare(e){
let item = e.currentTarget.dataset.item;
// 生成触点对象
let content = {
title: item.productName,
id: item.productId,
url: item.productImgUrl
}
let tentacleInfo = {
content: JSON.stringify(content),
contentId: item.productId,
contentType: app.globalData.contants.SHARE_TYPE.PRODUCT_DETAIL, //内容类型
title: item.productName, //标题
type: 3// 1:门店,2:员工(暂时不做),3:会员,4:第三方外部渠道,5:智能营销
}
wxService.getTentacleContent(tentacleInfo).then(res => {
if (res && res.id) {
let tentacleId = res.id;
let inner_id = Integer.digit(item.productId, 10, 64);
let inner_tentacleId = Integer.digit(tentacleId, 10, 64);
var path = 'pages/productDetail/productDetail' + '?i=' + inner_id + '&t=' + inner_tentacleId;
this.data.shareGoodsObj.title = item.productName;
this.data.shareGoodsObj.imageUrl = item.productImgUrl;
this.data.shareGoodsObj.path = path;
this.setData({
shareGoodsObj: this.data.shareGoodsObj,
showShareGoods : true,
});
}
});
},
//取消分享
onTapCancelShare(){
this.setData({
showShareGoods: false,
});
},
//去商城
onTapToMall(){
wx.redirectTo({
......@@ -348,7 +381,13 @@ wxService.page({
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
onShareAppMessage: function (res) {
if (res.from == 'button'){
return {
title : this.data.shareGoodsObj.title,
path : this.data.shareGoodsObj.path,
imageUrl: this.data.shareGoodsObj.imageUrl
}
}
}
})
\ No newline at end of file
......@@ -55,7 +55,11 @@
</view> -->
</view>
<view class='rg-btn'>
<button class='theme-color' data-item="{{item}}" bindtap='onTapToRecommandProduct'>立即推荐</button>
<button class='theme-color' data-item="{{item}}"
bindtap='onTapToRecommandProduct'>立即群发</button>
<!-- style='background-color:#0091FF' -->
<button class='theme-color'
data-item="{{item}}" bindtap='onTapToShare'>定向发送</button>
</view>
</view>
<!-- 优惠券 -->
......@@ -108,4 +112,15 @@
</view>
</view>
<!-- tabbar -->
<tab-bar index="{{2}}"></tab-bar>
\ No newline at end of file
<tab-bar index="{{2}}"></tab-bar>
<!-- 分享好友 -->
<view class='bg' style='display:{{showShareGoods ? "block" : "none"}}' bindtap='onTapCancelShare'></view>
<view class='share-container {{showShareGoods ? "sliderUp" : ""}}'>
<button open-type="share">
<view class='share-item'>
<image src='/assets/imgs/7_1_0/wx-icon.png' mode='aspectFit'></image>
<text>微信好友</text>
</view>
</button>
</view>
\ No newline at end of file
......@@ -146,16 +146,14 @@ view{
.price-btn .rg-btn{
flex: 0;
min-width: 160rpx;
max-width: 160rpx;
height: 100%;
min-width: 300rpx;
max-width: 300rpx;
display: flex;
align-items: flex-end;
justify-content: flex-end;
}
.price-btn .rg-btn button{
font-size: 24rpx;
height: 50rpx;
......@@ -314,4 +312,57 @@ view{
align-items: center;
justify-content: center;
font-size: 24rpx;
}
.bg{
position: fixed;
left: 0;
top: 0;
width: 100%;
height: 100%;
background: rgba(0,0,0,0.5);
z-index: 1000;
display: none;
}
.share-container{
position: fixed;
width: 100%;
height: 200rpx;
background: #ffffff;
bottom: 0;
left: 0;
z-index: 1001;
display: flex;
align-items: center;
justify-content: space-around;
transition: all 0.3s;
transform: translateY(100%);
}
.share-container button{
appearance: none;
background: transparent;
border: none !important;
-webkit-appearance: none;
color:#333333;
}
.share-container button::after { border: none; }
.sliderUp{
transform: translateY(0) !important;
}
.share-container .share-item{
display: flex;
align-items: center;
flex-direction: column;
justify-content: center;
}
.share-container .share-item image{
width: 80rpx;
height: 80rpx;
margin-bottom: 5rpx;
}
\ No newline at end of file
......@@ -24,17 +24,26 @@
</view>
<view class="title-border-text">
<!--<input placeholder="这一刻想说什么..." name="article" value="{{params.article}}" />-->
<textarea bindblur="bindWordLimit" style="width: 100%;" class='textarea-text' name="article" value="{{params.article}}" auto-height placeholder="这一刻想说什么..." />
<textarea bindblur="bindWordLimit"
style="width: 100%;"
class='textarea-text' name="article"
value="{{params.article}}"
auto-height
placeholder="这一刻想说什么..." />
</view>
<view class="title-border" bindtap="selectTab">
<image class="tab-icon" src="/assets/imgs/7_1_0/tab.png"></image>
<input class="tab-input" placeholder="选择标签" value="{{tabName}}" disabled="true" />
<view class="tips-container" bindtap="selectTab">
<view class='tip-lf'>
<image class="tab-icon" src="/assets/imgs/7_1_0/relation.png" mode='aspectFit'></image>
<input class="tab-input" placeholder="选择标签" value="{{tabName}}" disabled="true" />
</view>
<view class='tip-rg'>
<image class="tab-icon" src="/assets/imgs/7_1_0/arrow-right-sku.png" mode='aspectFit'></image>
</view>
</view>
<view class="related-goods" bindtap="handleRelatedGoods">
<image class="relate-img" mode="widthFix" src="/assets/imgs/7_1_0/relation.png"></image>
<text class="relate-text">关联商品</text>
</view>
<text class="relate-text">关联商品</text></view>
<view class="gress-list">
<grass-item pro-goods="{{proGoods}}"/>
</view>
......
......@@ -2,6 +2,7 @@
@import './../../../../base/base.wxss';
page{
padding-bottom: 100rpx;
font-size: 26rpx;
}
.grass-community{
padding: 30rpx;
......@@ -9,6 +10,12 @@ page{
.upload-img {
margin: 0 20rpx 20rpx 0;
}
.textarea-text{
width: 100%;
min-height: 300rpx;
}
.upload-tip {
height: 28prx;
color: rgba(170, 170, 170, 1);
......@@ -50,6 +57,35 @@ page{
line-height: 66rpx;
border-bottom: 1px solid rgba(151, 151, 151, 0.3);
}
.tips-container{
display: flex;
align-items: center;
border-bottom: 1px solid rgba(151, 151, 151, 0.3);
height: 70rpx;
width: 100%;
}
.tips-container:active{
background: #f2f2f2;
}
.tips-container .tip-lf{
flex: 1;
display: flex;
align-items: center;
}
.tips-container .tip-rg{
flex: 0;
min-width: 60rpx;
max-width: 60rpx;
height: 100%;
display: flex;
align-items: center;
justify-content: flex-end;
}
.tab-icon{
width: 26rpx;
height: 26rpx;
......@@ -70,6 +106,9 @@ page{
background-color: rgba(216, 216, 216, 1);
margin-top: 97rpx;
display: flex;
align-items: center;
justify-content: center;
}
.gress-list {
margin: 0 auto;
......
......@@ -57,6 +57,7 @@ wxService.page({
handlerDataOnPage.init(this, 'pages')
if (this.options['scene']) {
let idParam = decodeURIComponent(this.options['scene']).split('&')[0];
// let hasPageId = idParam ? (idParam.indexOf('pageId') > -1 ? true : false) : false;
let shareId = idParam && idParam.split('=')[1] || 0;
this.options.pageId = shareId;
}
......
......@@ -116,7 +116,7 @@ class Http {
post (url, parmas, channel) {
let baseUserInfo = wx.getStorageSync('_baseUserInfo')
let guideUserInfo = wx.getStorageSync('guidBaseInfo');
console.log('getTentacle------',this.getTentacle())
// console.log('getTentacle------',this.getTentacle())
// console.log('--------------header-----------------', this.getTentacle())
// console.log('--------------token-----------------', this.getToken())
......
......@@ -5,43 +5,66 @@ function currentLinkRouter(event, _this) {
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 (Object.keys(curItemType.link).length > 0){
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.link.type == 8) {
wxService.router(`/pages/productDetail/productDetail?id=${currentClickType}`)
} else if (curItemType.link.type == 9) {
wxService.router(`/subPackage/page/pages/categoryPro/categoryPro?${currentClickType}`)
}
}
else{
let rowObj = typeof (curItemType.row) == "string" ? JSON.parse(curItemType.row) : curItemType.row
let currentClickRow = app.globalData.commonFunc.getLinkRow(rowObj.type, rowObj)
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()
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 (curItemType.link.type == 6) {
wxService.router(`${currentClickType}`)
} else if (curItemType.link.type == 7) {
// 集点详情
wxService.router(`${currentClickType}`)
} else if (curItemType.link.type == 8) {
wxService.router(`/pages/productDetail/productDetail?id=${currentClickType}`)
} else if (curItemType.link.type == 9) {
wxService.router(`/subPackage/page/pages/categoryPro/categoryPro?${currentClickType}`)
}
else if (rowObj.type == 9) {
// 分类
wxService.router(`/subPackage/page/pages/categoryPro/categoryPro?${currentClickRow}`)
}
}
} else if (curItemType.row) {
let rowObj = typeof(curItemType.row) == "string" ? JSON.parse(curItemType.row) : curItemType.row
let currentClickRow = app.globalData.commonFunc.getLinkRow(rowObj.type, rowObj)
......@@ -63,7 +86,7 @@ function currentLinkRouter(event, _this) {
}
}
}
//导出
module.exports = {
currentLinkRouter: currentLinkRouter
}
\ No newline at end of file
......@@ -266,7 +266,6 @@ class Logger {
tip += ',%o'
})
params[0] = tip
console.log.apply(console, params)
}
}
......@@ -294,7 +293,6 @@ function getUserInfoByBtn(userInfo) {
const currentEnv = wx.getStorageSync('_qyWeChat')
// let currentLoginUrl = currentEnv ? `/member/qiyeweixin/minaLogin` : `/member/minaLogin`
let currentLoginUrl = `/member/minaLogin`
console.log('登陆', currentLoginUrl)
return wxService.post(`${currentLoginUrl}`, {
code: res[1].code,
......@@ -304,7 +302,6 @@ function getUserInfoByBtn(userInfo) {
}, (err) => {
return Promise.reject(err)
}).then(response => {
console.log('登陆response', response)
logger.log('getCrmUserInfo response', response)
if (response.data.data.rspCode === -1) {
return Promise.reject(response.data.data)
......@@ -340,7 +337,6 @@ function _getUserInfo(ev) {
setUserInfo() // 判断有无开卡
}).catch(err => {
if (err) {
console.log('err', err)
wx.showToast({
title: `您已拒绝授权!`,
icon: 'none'
......@@ -352,11 +348,9 @@ function setUserInfo() {
const userInfo = wx.getStorageSync('_baseUserInfo')
// 新用户去激活领卡
if (userInfo && userInfo.member && !userInfo.member.mobile) {
console.log('去开')
wxService.openCard()
return false
} else {
console.log('已开')
}
// 跳转
const urls = getCurrentPages()
......@@ -377,6 +371,17 @@ function setUserInfo() {
}, 200)
}
//根据系统屏幕宽高设置联系我们滑块
function configSliderBlock(app){
let system = app.globalData.systemInfo;
let screenWidth = system.windowWidth,
screenHeight = system.windowHeight;
return {
x: screenWidth-70,
y: screenHeight-240
}
}
wxService.setGetAuthUserInfo(_getUserInfo);
module.exports = {
......@@ -403,5 +408,6 @@ module.exports = {
getAccountInfo,
aspectRatio,
imageUtil,
validateEmail
validateEmail,
configSliderBlock
}
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