Authored by 肖亚东

活动详情页接口联调UI修改

... ... @@ -7,7 +7,9 @@ Component({
}
},
methods: {
jumpToDetail() {
jumpToDetail(e) {
let articleId = e.currentTarget.dataset.id;
this.triggerEvent('jumpActivityetail', { articleId:articleId });
},
... ...
// 逛文章详情
import { ACTIVITY_HOST, API_HOST, SERVICE_HOST } from '../../libs/config';
import { ACTIVITY_HOST, YOHOOD_HOST, API_HOST, SERVICE_HOST } from '../../libs/config';
import { GET, POST } from '../../libs/request';
import guangUtil from './util';
import Promise from '../../vendors/es6-promise';
... ... @@ -25,6 +25,7 @@ Page({
screenHeight: screenHeight - 60,
isShowIndicator: false,
isActivtyDetail: false,
replyTemArray: [],
articleInfo: {},
articleContent: {},
... ... @@ -47,9 +48,10 @@ Page({
},
loadElement: function(options) {
let isActivtyDetail = options.isActivtyDetail || false;
this.setData({
options,
isActivtyDetail,
yasParam: `&page_name=${this.data.current_page_name}&page_param=${options.id || ''}`,
current_page_param: options.id || '',
from_page_name: options.page_name || '',
... ... @@ -66,17 +68,13 @@ Page({
},
_init: function() {
return Promise.all([
this._getArticleExec(),
// this._getArticleContentExec(),
// this._getBrandExec(),
let isActivtyDetail = this.data.isActivtyDetail || false;
if (isActivtyDetail) { //活动详情
this._getActivityDetailExec();
} else { //资讯详情
this._getArticleExec();
}
]).then(result => {
// return Promise.all([
// this._recomandLi(result[1]),
// this._getOtherArticleExec(result[0].tag)
// ]);
});
},
_getArticleExec: function() {
let that = this;
... ... @@ -92,7 +90,7 @@ Page({
console.log(replyTemArray);
// debugger;
this.setData({
that.setData({
articleInfo: data,
replyTemArray,
});
... ... @@ -101,71 +99,39 @@ Page({
});
},
_getActivityDetailExec: function() {
let that = this;
let param = {
id: this.data.options.id
}
GET(YOHOOD_HOST + '/activity/detail', param)
.then(json => {
if (json && json.code == 200) {
let data = json.data;
console.log('====================================');
console.log(data);
console.log('====================================');
wx.setNavigationBarTitle({title: data.title || '文章详情'});
var article = data.content;
WxParse.wxParse('replyTemArray', 'html', article, that, 0);
let replyTemArray = this.data.replyTemArray;
console.log(replyTemArray);
// debugger;
that.setData({
articleInfo: data,
replyTemArray,
});
}
})
.catch(error => {
_getArticleContentExec: function() {
return guangUtil._getArticleContent({
article_id: this.data.options.id
}, GET, API_HOST).then(rdata => {
rdata = guangUtil._processArticleDetail(rdata);
rdata.replyTexts.map((text, tindex) => {
WxParse.wxParse('reply' + tindex, 'html', text, this, 0);
if (tindex === rdata.replyTexts.length - 1) {
WxParse.wxParseTemArray("replyTemArray", 'reply', rdata.replyTexts.length, this);
}
});
let replyTemArray = this.data.replyTemArray;
rdata.finalDetail.map(item => {
if (item.text) {
item.wxText = replyTemArray.shift();
}
});
this.setData({articleContent: rdata, replyTemArray: []});
return rdata;
});
},
_recomandLi: function(data) {
return guangUtil._recomandLi({skns: data.allGoods}, GET, API_HOST).then(rdata => {
data.finalDetail = guangUtil._pushGoodsInfo(data.finalDetail, rdata.product_list);
this.setData({articleContent: data});
});
})
},
_getBrandExec: function() {
return guangUtil._getBrand({
article_id: this.data.options.id
}, GET, API_HOST).then(rdata => {
rdata.map(item => {
if (item.thumb) {
item.thumb = util.formatImageUrl(item.thumb.replace(/\?(.*)/, ''), 160, 80, 1);
}
});
this.setData({brands: rdata});
return rdata;
});
},
_getOtherArticleExec: function(tag) {
return guangUtil._getOtherArticle({
article_id: this.data.options.id,
tags: tag || ''
}, GET, API_HOST).then(rdata => {
rdata.map(item => {
if (item.thumb) {
item.thumb = util.formatImageUrl(item.thumb, 240, 150, 1);
}
});
this.setData({otherArticles: rdata});
return rdata;
});
},
setGoodsMore: function(event) {
let data = event.currentTarget.dataset;
let findex = data.findex || 0;
... ... @@ -202,6 +168,11 @@ Page({
});
},
applyAction: function(event) {
let id = event.currentTarget.dataset.id;
},
//跳转到登录页面
loginAndRegisterTapped:function(needBind) {
let app = getApp()
... ...
<import src="../../vendors/wxParse/wxParse.wxml"/>
<view class="newsDetail-detail-page">
<view class="newsDetail-container">
<!-- <view class="newsDetail-container" style="padding-bottom:{{isActivtyDetail ? '136rpx;' : '0'}}"> -->
<view class="newsDetail-container">
<!-- 标题头部 -->
<view class="title-header">
<view class="newsDetail-title">{{articleInfo.title}}</view>
<view class="newsDetail-time">15:00-16:00 8.29.2019</view>
<view class="newsDetail-location">展位号:A4</view>
<view wx:if="{{isActivtyDetail}}" class="newsDetail-time">{{articleInfo.activityTime}}</view>
<view wx:if="{{isActivtyDetail}}" class="newsDetail-location">展位号:{{articleInfo.place}}</view>
</view>
<!-- 文章内容 -->
... ... @@ -103,67 +104,10 @@
<text>{{item.name}}</text>
</navigator>
</view>
<block wx:for="{{articleContent.finalDetail}}" wx:key="dindex" wx:for-item="ditem">
<view class="container-block" wx:if="{{ditem.recommendProducts.length}}">
<view class="title">为您优选</view>
<scroll-view class="nav-scroll" scroll-x scroll-with-animation>
<view class="products-box"
bindtap="productCellTapped"
data-skn="{{goods.product_skn}}"
wx:for="{{ditem.recommendProducts}}"
wx:key="goodsKey"
wx:for-item="goods">
<image class="img" src="{{goods.pic_url}}"></image>
<view class="footer">
<text class="price">¥{{goods.price}}</text>
</view>
</view>
</scroll-view>
</view><!--/container-block-->
</block>
<view class="container-block" wx:if="{{brands.length}}">
<view class="title block-brand">相关品牌</view>
<scroll-view class="nav-scroll" scroll-x
scroll-with-animation>
<navigator class="item brand-block"
open-type="navigate"
url="/pages/goodsList/brand?brandId={{item.id}}&brandName={{item.name}}{{yasParam}}"
hover-class="none"
wx:for="{{brands}}"
wx:key="index"
wx:for-item="item"
wx:if="{{item.isGlobal==='N'}}">
<view>
<view class="brand-box">
<image class="img" src="{{item.thumb}}"></image>
<view class="ellipsis title">{{item.name}}</view>
</view>
</view>
</navigator>
</scroll-view>
</view><!--/container-block-->
<view class="container-block" wx:if="{{otherArticles.length}}">
<view class="title">相关推荐</view>
<view class="related-container">
<navigator url="/page/subPackage/pages/newsDetail/detail?id={{item.id}}{{yasParam}}"
open-type="navigate"
hover-class="none"
wx:for="{{otherArticles}}" wx:key="index" wx:for-item="item">
<view class="item" >
<image class="img" src="{{item.thumb}}"></image>
<view class="info">
<view class="ellipsis title">{{item.title}}</view>
<view class="time">
<image src="/page/subPackage/pages/newsDetail/images/time@3x.png"></image>
<text>{{item.publishTime}}</text>
</view>
</view>
</view>
</navigator>
</view>
</view><!--/container-block-->
</view>
<!-- 活动详情报名按钮 -->
<!-- <view wx:if="{{isActivtyDetail}}" class="apply-button" bindtap="applyAction" data-id="{{articleInfo.id}}">
报名
</view> -->
</view>
... ...
... ... @@ -20,6 +20,7 @@
.title-header {
display: flex;
flex-direction: column;
margin-bottom: 60rpx;
}
.newsDetail-title {
font-family: PingFangSC-Medium;
... ... @@ -42,7 +43,7 @@
font-size: 24rpx;
color: #B0B0B0;
letter-spacing: 0;
margin: 20rpx 30rpx 60rpx 0;
margin: 20rpx 30rpx 0 0;
}
.newsDetail-content {
... ... @@ -351,3 +352,21 @@
max-width: 500rpx;
text-align: left;
}
.newsDetail-detail-page .apply-button {
width: 750rpx;
height: 96rpx;
background-color: #444444;
font-family: PingFang-SC-Medium;
font-weight: bold;
font-size: 32rpx;
color: #FFFFFF;
letter-spacing: 2px;
display: flex;
justify-content: center;
align-items: center;
position: fixed;
bottom: 0;
left: 0;
z-index: 99;
}
\ No newline at end of file
... ...
... ... @@ -65,15 +65,21 @@ Page({
})
},
jumpActivityetail(e) {
let articleId = e.detail.articleId || '';
wx.navigateTo({
url: '/pages/newsDetail/detail?id=' + articleId + '&isActivtyDetail=true'
});
},
applyAction(e) {
let activityId = e.detail.activityId;
let array = this.data.array;
// let activityId = e.detail.activityId;
// let array = this.data.array;
if (app.globalData.userInfo.uid) {//已登录
// if (app.globalData.userInfo.uid) {//已登录
} else {
loginAndRegisterTapped();
}
// } else {
// loginAndRegisterTapped();
// }
},
jumpMap() {
... ...
... ... @@ -5,7 +5,7 @@
<block wx:for="{{curScheduleList}}" wx:key="index" wx:for-item="schedule">
<view class="time-title">{{schedule.timeType}}</view>
<block wx:for="{{schedule.list}}" wx:key="index" wx:for-item="item">
<schedule-item data="{{item}}" bind:applyAction="applyAction"></schedule-item>
<schedule-item data="{{item}}" bind:applyAction="applyAction" bind:jumpActivityetail="jumpActivityetail"></schedule-item>
<view wx:if="{{index!=array.length-1}}" class="space-view40"></view>
</block>
</block>
... ...
... ... @@ -49,7 +49,7 @@
"list": []
},
"miniprogram": {
"current": 5,
"current": 6,
"list": [
{
"id": -1,
... ... @@ -92,6 +92,13 @@
"pathName": "pages/userCenter/userCenter",
"query": "",
"scene": null
},
{
"id": -1,
"name": "活动详情",
"pathName": "pages/newsDetail/detail",
"query": "id=2&isActivtyDetail=true",
"scene": null
}
]
}
... ...