Authored by 肖亚东

首页接口联调等

... ... @@ -8,6 +8,7 @@
"pages/newsDetail/detail",
"pages/schedule/schedule",
"pages/community/community",
"pages/mars/mars",
"pages/brands/brands",
"pages/brands/brandDetail",
"pages/webview/webview",
... ... @@ -44,7 +45,7 @@
"selectedIconPath": "static/images/community_selected@3x.png"
},
{
"pagePath": "pages/community/community",
"pagePath": "pages/mars/mars",
"text": "mars",
"iconPath": "static/images/mars@3x.png",
"selectedIconPath": "static/images/mars_selected@3x.png"
... ...
Component({
properties: {
floorData: {
banner: {
type: Object
},
isGroup: {
type: Boolean,
value: false
},
floorIdx: {
type: Number
},
reportClick: {
type: Boolean,
value: true
}
},
data: {
swiperCurrent: 0
... ... @@ -23,6 +12,11 @@ Component({
this.setData({
swiperCurrent: e.detail.current
});
},
tapBanner(e) {
let href = e.target.dataset.href;
let articleId = e.target.dataset.articleId;
this.triggerEvent('tapBanner', { href:href, articleId:articleId });
}
}
});
... ...
{
"component": true,
"usingComponents": {
"anchor": "/components/common/anchor/anchor",
"format-img": "/components/common/format-image/index"
}
}
\ No newline at end of file
... ...
... ... @@ -2,26 +2,14 @@
<swiper
bindchange="swiperChange" vertical='true'
class='resource-swiper' indicator-dots='{{false}}' autoplay="true" interval="3500" circular='true'>
<block wx:for="{{floorData}}" wx:key="{{index}}">
<block wx:for="{{banner}}" wx:key="{{index}}">
<swiper-item>
<anchor
is-floor="{{reportClick}}"
floor-data="{{floorData}}"
floor-idx="{{floorIdx}}"
item-idx="{{index}}"
url="{{item.url}}">
<format-img
width="{{492}}"
height="{{232}}"
src="{{item.src}}"
default-width="true">
</format-img>
</anchor>
<image class="single-image" src="{{item.img}}" bindtap="tapBanner" data-href="{{item.href}}" data-article-id="{{item.articleId}}" mode="widthFix"></image>
</swiper-item>
</block>
</swiper>
<view class="dots">
<block wx:for="{{floorData}}" wx:key="unique">
<block wx:for="{{banner}}" wx:key="unique">
<view class="dot {{index == swiperCurrent ? ' active' : ''}}"></view>
</block>
</view>
... ...
Component({
properties: {
floorData: {
imageInfo: {
type: Object,
observer: '_dataChange'
},
floorIdx: {
type: Number
}
},
methods: {
_dataChange() {
}
tapImage(e) {
let productSkn = e.target.dataset.skn;
this.triggerEvent('jumpYohobuyGoodsDetail', { productSkn:productSkn });
},
}
});
... ...
{
"component": true,
"usingComponents": {
"anchor": "/components/common/anchor/anchor",
"format-img": "/components/common/format-image/index"
}
}
\ No newline at end of file
... ...
<view class="resource-single">
<view wx:if="{{!!floorData.data.title}}" class="title">
<view class='line'></view>
<view class='text'>{{floorData.data.title}}</view>
</view>
<anchor
is-floor="{{true}}"
floor-idx="{{floorIdx}}"
item-idx="1"
floor-data="{{floorData}}"
url="{{floorData.data.list[0].url}}">
<image class="resource-single-image" src="https://ss2.bdstatic.com/70cFvnSh_Q1YnxGkpoWK1HF6hhy/it/u=2700915385,2771074487&fm=26&gp=0.jpg" mode="aspectFill"></image>
</anchor>
<view class="resource-single" bindtap="tapImage">
<image class="single-image" src="{{imageInfo.img}}" data-skn="{{imageInfo.skn}}" mode="widthFix"></image>
</view>
\ No newline at end of file
... ...
... ... @@ -29,7 +29,7 @@
vertical-align: top;
}
.resource-single .resource-single-image {
.resource-single .single-image {
width: 100%;
height: 250rpx;
box-shadow: 0 0 10px 0 #E0E0E0;
... ...
... ... @@ -4,93 +4,95 @@ Component({
* 组件的属性列表
*/
properties: {
endTime: {//结束时间
type: Number
floorData: {
type: Object,
value: {},
observer: '_dataChange'
},
formatTime: {
type: Array
}
},
/**
* 组件的初始数据
*/
data: {
banner:[
{'src': "http://img11.static.yhbimg.com/yhb-img01/2019/07/08/16/01ebb6ff346dc35b904fd42a5118f2472c.jpg?imageView2/{mode}/w/{width}/h/{height}"},
{'src': "http://img10.static.yhbimg.com/yhb-img01/2019/07/08/16/015af7151eb026ebb776fac720eb227b0d.jpg?imageView2/{mode}/w/{width}/h/{height}"},
{'src': "http://img10.static.yhbimg.com/yhb-img01/2019/07/08/16/01055d8fc10a714574bf5cdcb57017abe0.jpg?imageView2/{mode}/w/{width}/h/{height}"}
],
formatTime: [],
},
ready: function() {
this.setData({
formatTime: this.formatCountDown(this.properties.endTime)
})
this.formatTime()
this.loadFontFace()
},
/**
* 组件的方法列表
*/
methods: {
formatTime:function() {
let self = this
setInterval(function() {
self.setData({
formatTime: self.formatCountDown(self.properties.endTime)
})
},1000)
},
formatCountDown:function formatCountDown(end) {
if (end === 0 || (end * 1000 - Date.now() < 0)) {
return '00000000'
}
var timeInSecond = (end * 1000 - Date.now()) / 1000
_dataChange(newValue, oldValue){
this._formatTime()
},
var day = 24 * 60 * 60
var numberOfDay = Math.floor(timeInSecond / day)
timeInSecond = timeInSecond - numberOfDay * day
numberOfDay = Math.min(numberOfDay, 99)
_formatTime:function() {
let that = this;
setInterval(function() {
that.setData({
formatTime: that.formatCountDown(that.properties.floorData.startTime),
})
},1000)
},
var hour = 60 * 60
var numberOfHour = Math.floor(timeInSecond / hour)
timeInSecond = timeInSecond - numberOfHour * hour
formatCountDown(end) {
if (end === 0 || (end * 1000 - Date.now() < 0)) {
return '00000000'
}
var timeInSecond = (end * 1000 - Date.now()) / 1000
var minute = 60
var numberOfMinute = Math.floor(timeInSecond / minute)
timeInSecond = timeInSecond - numberOfMinute * minute
var day = 24 * 60 * 60
var numberOfDay = Math.floor(timeInSecond / day)
timeInSecond = timeInSecond - numberOfDay * day
numberOfDay = Math.min(numberOfDay, 99)
var numberOfSecond = parseInt(timeInSecond)
var hour = 60 * 60
var numberOfHour = Math.floor(timeInSecond / hour)
timeInSecond = timeInSecond - numberOfHour * hour
var list = [numberOfDay, numberOfHour, numberOfMinute, numberOfSecond]
var newList = []
var minute = 60
var numberOfMinute = Math.floor(timeInSecond / minute)
timeInSecond = timeInSecond - numberOfMinute * minute
for (var i = 0; i < list.length; i++) {
var item = list[i]
if (item < 10) {
list[i] = '0' + item
} else {
list[i] = '' + item
}
var numberOfSecond = parseInt(timeInSecond)
//新增拆分
var array = list[i].split('')
do {
let number = array.shift()
newList.push(number)
var list = [numberOfDay, numberOfHour, numberOfMinute, numberOfSecond]
var newList = []
} while (array.length > 0);
for (var i = 0; i < list.length; i++) {
var item = list[i]
if (item < 10) {
list[i] = '0' + item
} else {
list[i] = '' + item
}
return newList
},
loadFontFace() {
const self = this
wx.loadFontFace({
family: 'CAI978',
source: 'url("https://cdn.yoho.cn/miniapp/yohood/statics/font/064-CAI978.ttf")',
});
},
//新增拆分
var array = list[i].split('')
do {
let number = array.shift()
newList.push(number)
} while (array.length > 0);
}
return newList
},
loadFontFace() {
const self = this
wx.loadFontFace({
family: 'CAI978',
source: 'url("https://cdn.yoho.cn/miniapp/yohood/statics/font/064-CAI978.ttf")',
});
},
tapBanner(e) {
let href = e.detail.href;
let articleId = e.detail.articleId;
this.triggerEvent('tapBanner', { href:href, articleId:articleId });
}
}
})
... ...
<!--pages/zeroSell/components/timeCountDown/time-countdown.wxml-->
<view>
<image class="background-image" src="https://cdn.yoho.cn/miniapp/yohood/statics/img/yohood_banner_bg@3x.png" mode="aspectFill">
<image class="background-image" src="{{floorData.topBackgroundImg}}" mode="aspectFill">
<!-- banner -->
<newFocus class="banner" floor-data="{{banner}}"></newFocus>
<newFocus class="banner" banner="{{floorData.topSlide}}" bind:tapBanner="tapBanner"></newFocus>
<view class="time-countdown">
<block wx:for="{{formatTime}}" wx:key="">
... ...
Component({
properties: {
floorData: Object,
floorIdx: {
type: Number
}
},
methods: {
tapItem(e) {
let data = e.currentTarget.dataset;
this.triggerEvent('jumpDetail', { index:data.index });
}
this.triggerEvent('jumpStarBrand', { index:data.index, href:data.href });
},
}
});
... ...
<view class="resource-two-image">
<block wx:for="{{floorData}}" wx:key="{{index}}">
<!-- <block wx:for="{{floorData}}" wx:key="{{index}}">
<image class="image-content" src="{{item}}" bindtap="tapItem" data-index="{{index}}" mode="aspectFill">
<image class="image-cover" src="{{index==0 ? '../../../static/images/star@3x.png' : '../../../static/images/brand@3x.png' }}" mode="widthFix"></image>
</image>
</block>
</block> -->
<view class="left-view">
<image class="image-content" src="{{floorData.starts.img}}" bindtap="tapItem" data-href="{{floorData.starts.href}}" data-index="0" mode="aspectFill">
<image class="image-cover" src="../../../static/images/star@3x.png" mode="widthFix"></image>
</image>
</view>
<view class="right-view">
<image class="image-content" src="{{floorData.brandsImg}}" bindtap="tapItem" data-index="1" mode="aspectFill">
<image class="image-cover" src="../../../static/images/brand@3x.png" mode="widthFix"></image>
</image>
</view>
</view>
\ No newline at end of file
... ...
<view class="container">
<view class="brand-detail">
<view class="brand-name-tips">店铺名:
<text class="brand-name">{{brandInfo.name}}</text>
</view>
<view class="brand-location-tips">展位号:
<text class="brand-location">{{brandInfo.booth_id}}</text>
</view>
<image class="brand-logo" src="{{brandInfo.logo}}" mode="aspectFill"></image>
<view class="brand-description">{{brandInfo.description}}</view>
<view class="content">
<view class="brand-detail">
<view class="brand-name-tips">店铺名:
<text class="brand-name">{{brandInfo.name}}</text>
</view>
<view class="brand-location-tips">展位号:
<text class="brand-location">{{brandInfo.booth_id}}</text>
</view>
<image class="brand-logo" src="{{brandInfo.logo}}" mode="aspectFill"></image>
<view class="brand-description">{{brandInfo.description}}</view>
</view>
<view class="product-list">
<block wx:for="{{productList.list}}" wx:key="{{index}}">
<productListCell item="{{item}}"></productListCell>
</block>
</view>
</view>
<view class="product-list">
<block wx:for="{{productList.list}}" wx:key="{{index}}">
<productListCell item="{{item}}"></productListCell>
</block>
</view>
<view class="enter-shop" bindtap="enterShop" data-shop-id="{{shopId}}">进入店铺</view>
</view>
\ No newline at end of file
... ...
.container {
position: relative;
}
.content {
padding-bottom: 130rpx;
}
.brand-detail {
margin: 40rpx 40rpx 0 40rpx;
box-shadow: 0 0 20px 0 rgba(176,176,176,0.50);
... ... @@ -52,7 +54,6 @@
flex-direction: row;
flex-wrap: wrap;
background-color: white;
margin-bottom: 130rpx;
}
.enter-shop {
... ...
import wx from "../../utils/wx";
Page({
data: {
url: 'https://m.yohobuy.com',
url: '',
},
onLoad: function(options) {
//Do some initialize when page load.
let that = this
wx.getStorage({
key: 'social',
success: function (res) {
if (res.data.length > 0) {
that.setData({ url : res.data});
}
}
})
},
onReady: function() {
//Do some when page ready.
... ...
<!-- <view class="container">
<image src="../../static/images/empty_view@3x.png" mode="widthFix" class="empty"></image>
</view> -->
<web-view src="{{url}}"></web-view>
\ No newline at end of file
... ...
.container {
width: 100%;
height: 100%;
}
.empty {
width: 750rpx;
}
\ No newline at end of file
import { ACTIVITY_HOST, API_HOST } from '../../libs/config';
import { ACTIVITY_HOST, YOHOOD_HOST, API_HOST } from '../../libs/config';
import { GET, POST } from '../../libs/request';
import jumpToMiniapp from '../../router/jump-to-miniapp';
Page({
data: {
imageArray: [ 'https://ss2.bdstatic.com/70cFvnSh_Q1YnxGkpoWK1HF6hhy/it/u=2700915385,2771074487&fm=26&gp=0.jpg', 'https://ss2.bdstatic.com/70cFvnSh_Q1YnxGkpoWK1HF6hhy/it/u=2700915385,2771074487&fm=26&gp=0.jpg'],
floorData: {},
newsList: {
page: 0,
limit: 20,
... ... @@ -13,6 +15,7 @@ Page({
},
onLoad: function(options) {
//Do some initialize when page load.
this.fetchHomedata();
this.fetchNewsList();
},
onReady: function() {
... ... @@ -24,6 +27,35 @@ Page({
},
fetchHomedata() {
let that = this;
GET(YOHOOD_HOST + '/activity/home', {})
.then(json => {
if (json && json.code == 200) {
let floorData = json.data;
console.log('====================================');
console.log(floorData);
console.log('====================================');
that.setData({
floorData
})
wx.setStorage({
key: "mars",
data: floorData.mars
});
wx.setStorage({
key: "social",
data: floorData.social
});
}
})
.catch(error => {
})
},
fetchNewsList(isLoadMore) {
let that = this;
let newsList = this.data.newsList;
... ... @@ -47,7 +79,6 @@ Page({
GET(ACTIVITY_HOST + '/api/yohood/getNewsList', param)
.then(json => {
console.log(json);
if (json) {
var list = [];
for(var i = 0; i< json.length; i++) {
... ... @@ -83,11 +114,31 @@ Page({
}
},
jumpDetail(e) {
tapBanner(e){
let href = e.detail.href || '';
let articleId = e.detail.articleId || '';
if (articleId) {//跳资讯详情
wx.navigateTo({
url: '/pages/newsDetail/detail?id=' + articleId
});
} else {
wx.navigateTo({
url: `../webview/webview?url=${href}`,
})
}
},
jumpYohobuyGoodsDetail(e) {
let productSkn = e.detail.productSkn || '';
jumpToMiniapp({ app: 'yohobuy', page: 'productDetail', data: {productSkn:productSkn} })
},
jumpStarBrand(e) {
let index = e.detail.index;
let href = e.detail.href || '';
if (index == 0) { //参展明星
wx.navigateTo({
url: `../webview/webview?url=https://activity.yoho.cn/feature/507.html?share_id=2647`,
url: `../webview/webview?url=${href}`,
})
} else if (index == 1) {// 参展品牌
... ... @@ -99,7 +150,7 @@ Page({
//跳资讯详情
jumpNewsDetail(e) {
let newsId = e.detail;
let newsId = e.detail || '';
wx.navigateTo({
url: '/pages/newsDetail/detail?id=' + newsId
});
... ...
<view class="container">
<!-- 倒计时 -->
<time-countdown endTime="2562644800"></time-countdown>
<time-countdown floor-data="{{floorData}}" bind:tapBanner="tapBanner"></time-countdown>
<view class="space-view20 middle30"></view>
<!-- 购票单图 -->
<newSingleImage></newSingleImage>
<view class="space-view20"></view>
<newSingleImage></newSingleImage>
<block wx:for="{{floorData.tickets}}" wx:key="unique">
<newSingleImage image-info="{{item}}" bind:jumpYohobuyGoodsDetail="jumpYohobuyGoodsDetail"></newSingleImage>
<view class="space-view20" wx:if="{{index != floorData.tickets.length-1}}"></view>
</block>
<!-- 参展明星、参展品牌 -->
<view class="space-view20 large40"></view>
<twoImage floor-data="{{imageArray}}" bind:jumpDetail="jumpDetail"></twoImage>
<twoImage floor-data="{{floorData}}" bind:jumpStarBrand="jumpStarBrand"></twoImage>
<view class="space-view20 gray"></view>
<!-- 资讯文章列表 -->
... ...
import wx from "../../utils/wx";
Page({
data: {
url: '',
},
onLoad: function(options) {
//Do some initialize when page load.
let that = this
wx.getStorage({
key: 'mars',
success: function (res) {
if (res.data.length > 0) {
that.setData({ url : res.data});
}
}
})
},
onReady: function() {
//Do some when page ready.
},
onShow: function() {
//Do some when page show.
},
onHide: function() {
//Do some when page hide.
},
onUnload: function() {
//Do some when page unload.
},
onPullDownRefresh: function() {
//Do some when page pull down.
}
})
\ No newline at end of file
... ...
{
"navigationBarTitleText": "社区",
"enablePullDownRefresh": true,
"usingComponents": {
}
}
\ No newline at end of file
... ...
<web-view src="{{url}}"></web-view>
\ No newline at end of file
... ...
... ... @@ -13,7 +13,7 @@
"nodeModules": false,
"autoAudits": false,
"checkInvalidKey": true,
"checkSiteMap": true,
"checkSiteMap": false,
"uploadWithSourceMap": true,
"babelSetting": {
"ignore": [],
... ...