Authored by TaoHuang

Merge remote-tracking branch 'origin/develop' into develop

<template>
<div class="scroll-app">
<div class="scroll-flex">
<div class="scroll-list-wrap">
<Scroll
ref="scroll"
:scroll-events="scrollEvents"
@scroll="scrollHandler"
:options="options"
@pulling-up="onPullingUp"
:data="channelList.productlist">
<div class="body" ref="body">
<div class="channel-top"></div>
<!-- <div class="html">qwdwqdwq、</div> -->
<div v-for="(item, index) in channelList.list" :key="index">
<Swiper :list="item.data" v-if="item.template_name == 'threePicture'"/>
<Hot :list="item.data.list" v-if="item.template_name == 'image_list'" />
<Banner :list="item.data" v-if="item.template_name == 'single_image'" />
<TwoBanner :list="item.data" v-if="item.template_name == 'twoPicture'" />
<ScrollNav :list="item.data.list" v-if="item.template_name == 'guessLike'"></ScrollNav>
<LayoutApp :show-back="true">
<div class="scroll-list-wrap">
<template v-if="isShow">
<div v-for="(item, index) in channelList.list" v-if="item.template_name == 'guessLike'">
<ScrollNav :list="item.data.list"></ScrollNav>
</div>
<ProductList :list="channelList.productlist"></ProductList>
</div>
</Scroll>
</div>
</div>
</div>
</template>
<Scroll
ref="scroll"
:scroll-events="scrollEvents"
@scroll="scrollHandler"
:options="options"
@pulling-up="onPullingUp"
:data="productList.list">
<div class="body" ref="body">
<div class="channel-top"></div>
<div class="marginTop">
<div v-for="(item, index) in channelList.list" :key="index" class="space-between">
<Swiper :list="item.data" v-if="item.template_name == 'threePicture'"/>
<Hot :list="item.data.list" v-if="item.template_name == 'image_list'" />
<Banner :list="item.data" v-if="item.template_name == 'single_image'" />
<TwoBanner :list="item.data" v-if="item.template_name == 'twoPicture'" />
<template v-if="!isShow">
<div ref="sss" v-if="item.template_name == 'guessLike'">
<ScrollNav :list="item.data.list"></ScrollNav>
</div>
</template>
</div>
</div>
<div :style="{minHeight: total + 'px'}">
<ProductList :list="productList.list" v-if="productList.list.length > 0" class="bgColor"></ProductList>
<UfoNoItem :tip="`暂无数据`" v-else></UfoNoItem>
</div>
</div>
</Scroll>
</div>
</LayoutApp>
</template>
<script>
... ... @@ -36,8 +47,11 @@ import TwoBanner from './components/twoBanner';
import Hot from './components/hot';
import ScrollNav from './components/scrollNav';
import ProductList from '../../list/components/productList';
import { setTimeout } from 'timers';
import UfoNoItem from '../../../components/ufo-no-item';
const { mapState, mapActions } = createNamespacedHelpers('home/channel');
const { mapState: mapStateList, mapActions: mapActionsList } = createNamespacedHelpers('list');
export default {
data() {
... ... @@ -50,32 +64,58 @@ export default {
},
scrollEvents: ['scroll'],
scrollY: 0,
navTop: 0,
navHeight: 0,
isShow: false,
total: 0,
marginTop: 0,
}
},
computed: {
...mapState(['channelList']),
...mapStateList(['productList']),
},
mounted() {
const params = {
isPage: true
isPage: true,
isHome: true,
}
this.fetchChannelList();
this.fetchChannelList().then((res)=>{
this.navTop = this.$refs.sss[0].offsetTop;
this.navHeight = this.$refs.sss[0].offsetHeight;
let windowH = document.documentElement.clientHeight || document.body.clientHeight;
this.total = windowH - this.navHeight;
console.log(windowH);
console.log(this.navHeight);
console.log(this.total);
console.log("______");
});
this.fetchProductList(params);
console.log(this.$refs.elememt);
console.log("elememt");
},
created() {
},
methods: {
scrollHandler({ y }) {
// console.log(y);
let scrollY = Math.abs(parseInt(y));
if(scrollY >= this.navTop) {
this.isShow = true;
this.marginTop = 0;
} else {
this.isShow = false;
this.marginTop = '30px';
}
// this.scrollY = -y
},
...mapActions(['fetchChannelList','fetchProductList']),
...mapActions(['fetchChannelList']),
...mapActionsList(['fetchProductList']),
async onPullingUp() {
const params = {
isReset: false
isReset: false,
isHome: true,
}
await this.fetchProductList(params);
this.$refs.scroll.forceUpdate()
... ... @@ -92,7 +132,8 @@ export default {
Sticky,
cubeSticky: Sticky,
cubeStickyEle: Sticky.Ele,
ProductList
ProductList,
UfoNoItem
}
};
</script>
... ... @@ -103,6 +144,9 @@ export default {
height: 310px;
background: #08304B;
}
.marginTop {
margin-top: -150px;
}
.scroll-app {
position: absolute;
top: 0;
... ... @@ -133,11 +177,18 @@ export default {
.body {
height: 100%;
overflow-y: auto;
// padding: 0 40px;
}
.html {
margin-top: -250px;
margin-bottom: 20px;
.space-between {
padding: 0 20px;
}
.bgColor {
background: #f5f5f5;
}
.navFixed {
width: 100%;
position: fixed;
top: 0;
left: 0;
z-index: 999;
}
</style>
... ...
<template>
<div class="ScrollNav" v-if="labels.length > 0">
<div class="ScrollNav" ref="scrollNavtop" v-if="labels.length > 0">
<ScrollNavBar :current="current" :labels="labels" @change="changeHandler">
<span slot-scope="props">
{{props.txt}}
... ... @@ -13,7 +13,8 @@
import Vue from 'vue'
import { Style, ScrollNavBar } from 'cube-ui';
import { createNamespacedHelpers } from 'vuex';
const { mapState, mapActions } = createNamespacedHelpers('home/channel');
// const { mapState, mapActions } = createNamespacedHelpers('list/channel');
const {mapState, mapActions} = createNamespacedHelpers('list');
export default {
name: 'slide',
... ... @@ -35,27 +36,24 @@ export default {
ScrollNavBar
},
computed: {
...mapState(['scrollnavidList']),
...mapState(['productList']),
},
mounted() {
// this.fetchProductList();
// 遍历ScrollNavBar的key值,组装到labels中;
this.list.map((res) => { this.labels.push(res.tab_name) });
console.log(this.$refs.scrollNavtop);
console.log("this.$refs.xxx.offsetTop2");
},
created() {
},
methods: {
...mapActions(['fetchProductList']),
changeHandler(cur) {
let index = this.$refs[`getindex${cur}`].innerText;
const params = {
isReset: true,
}
let query = this.list[index].query
let params = Object.assign({},...query);
params.isReset = true; delete params.method;
this.fetchProductList(params);
console.log(this.list[index].tab_name);
// console.log(index);
}
}
};
... ...
... ... @@ -2,15 +2,15 @@
<div class="swiper">
<div class="swiper-item swiper-item-left">
<a :href="list[0].url">
<ImageFormat @click="clickHandler(item, index)" :lazy="false" class="item-imge" :src="list[0].src" :width="302" :height="402"></ImageFormat>
<ImageFormat @click="clickHandler(item, index)" :lazy="false" class="item-imge" :src="list[0].src" :width="310" :height="402"></ImageFormat>
</a>
</div>
<div class="swiper-item swiper-item-right">
<a :href="list[1].url">
<ImageFormat @click="clickHandler(item, index)" :lazy="false" class="item-imge" :src="list[1].src" :width="374" :height="196"></ImageFormat>
<ImageFormat @click="clickHandler(item, index)" :lazy="false" class="item-imge" :src="list[1].src" :width="380" :height="196"></ImageFormat>
</a>
<a :href="list[2].url">
<ImageFormat style="margin-top: 4px" @click="clickHandler(item, index)" :lazy="false" class="item-imge" :src="list[2].src" :width="374" :height="196"></ImageFormat>
<ImageFormat style="margin-top: 4px" @click="clickHandler(item, index)" :lazy="false" class="item-imge" :src="list[2].src" :width="380" :height="196"></ImageFormat>
</a>
</div>
</div>
... ... @@ -38,18 +38,18 @@ export default {
<style lang="scss" scoped>
.swiper {
// margin-top: -250px;
padding: 0 32px;
// padding: 0 32px;
overflow: hidden;
.swiper-item {
&.swiper-item-left {
width: 301px;
width: 310px;
float: left;
img {
height: 402px;
}
}
&.swiper-item-right {
width: 374px;
width: 380px;
float: right;
img {
height: 196px;
... ... @@ -58,7 +58,7 @@ export default {
img {
width: 100%;
display: block;
border-radius: 4px;
border-radius: 8px;
}
}
}
... ...
export default [
{
name: 'Coupon',
path: '/xianyu/home/coupon.html',
component: () => import(/* webpackChunkName: "home.coupon" */ './list'),
},
];
... ...
<template>
</template>
<script>
export default {
name: "list"
}
</script>
<style scoped>
</style>
... ...
... ... @@ -77,10 +77,8 @@ export default {
params.type = 6;
}
!params.order && (params.order = 'sale_desc');
params.listPage = true
this.fetchProductList({...params, isReset: true});
this.fetchFilterData(params);
},
methods: {
...mapActions(['fetchProductList', 'fetchFilterData', 'initData']),
... ...
... ... @@ -48,7 +48,7 @@ export default {
return {
name:
owner === ownType.SELL
? detailRouteNames.SELL_ORDER_DETIAL
? detailRouteNames.SELL_ORDER_DETAIL
: detailRouteNames.BUY_ORDER_DETAIL,
params: { code: this.order.orderCode, owner }
};
... ...
... ... @@ -70,7 +70,7 @@ export default {
if (!!code) {
this.$nextTick(() => {
this.$router.push({
name: routeNames.SELL_ORDER_DETIAL,
name: routeNames.SELL_ORDER_DETAIL,
params: {
owner: ownType.SELL,
code
... ...
... ... @@ -24,27 +24,24 @@ export default function() {
if (res.template_name === 'hotSeries') {
for (let i = 0; i < res.data.length; i++) {
state.channelList.scrollnavList.push(res.data[i].series_name);
// state.channelList.scrollnavidList.push(res.data[i].series_id);
}
}
});
},
[Types.FETCH_PRODUCT](state, { productlist }) {
// state.channelList.productlist = productlist;
console.log(state.channelList.productlist);
Vue.set(state.channelList, 'productlist', state.channelList.productlist.concat(productlist.product_list));
Vue.set(state.channelList, 'page', productlist.page);
},
},
actions: {
async fetchProductList({ commit, state }, obj) {
console.log(obj);
let page = obj && obj.isReset ? state.channelList.page = 1 : state.channelList.page + 1;
let size = state.channelList.page_size;
const result = await this.$api.get('/api/ufo/list/productList', {
order: obj && obj.isReset ? 'sale_desc' : 'st_desc',
type: 6,
page,
pageSize: size,
...obj,
});
if (result.code === 200) {
... ... @@ -53,7 +50,7 @@ export default function() {
},
async fetchChannelList({ commit }) {
const result = await this.$api.get('/api/ufo/channel/channelList', {
content_code: 'c07b807110b342a09bd65d13aeb118f6',
content_code: 'b4c2aa846b56ad7e51e7255c2ee4c1f9',
// uid: '64668089',
uid: '500031170',
});
... ...
const uid = '500031170';
export default function() {
return {
namespaced: true,
state: {
unused: {
type: 'unused',
isFetching: false,
reachedEnd: false,
list: [],
filter: 0,
page: 0,
limit: 10,
total: 0
},
used: {
type: 'used',
isFetching: false,
reachedEnd: false,
list: [],
filter: 0,
page: 0,
limit: 10,
total: 0
},
overtime: {
type: 'overtime',
isFetching: false,
reachedEnd: false,
list: [],
filter: 0,
page: 0,
limit: 10,
total: 0
},
},
mutations: {
addList(state, { data }) {
state[data.type] = data;
}
},
actions: {
async fetchCouponList({ commit, state }, param) {
if (!param.type) {
return;
}
let couponData = {...state[param.type]};
if (!param.isReset && couponData.reachedEnd) {
return;
}
let params = {
page: couponData.page,
limit: couponData.limit,
type: couponData.limit,
};
if (param.isReset) {
params.page = 1;
} else {
params.page += 1;
}
params.uid = uid;
let result = await this.$api.get('api/ufo/coupon/list', {...params});
if (result.code === 200) {
let data = result.data;
if (typeof data === 'object' && Object.keys(data).length) {
for (let key in data) {
if (key === 'coupons') {
couponData.list = data.page > 1 ? couponData.list.concat(data.coupons) : data.coupons;
} else {
couponData[key] = data[key];
}
}
if (couponData.list.length === couponData.total) {
couponData.reachedEnd = true;
}
commit('addList', { data: couponData });
}
}
return result.data || [];
},
},
};
}
... ...
... ... @@ -2,25 +2,28 @@ import mine from './mine';
import channel from './channel';
import favorite from './favorite';
import news from './news';
import coupon from './coupon';
export default function() {
return {
namespaced: true,
state: {
fetchNoticeList:false,
noticeList:[],
fetchNoticeList: false,
noticeList: [],
fetchNoticePage: 1,
fetchNoticeLastedTime: 0,
},
mutations: {
},
actions: {
},
modules: {
mine: mine(),
channel: channel(),
favorite: favorite(),
news: news(),
coupon: coupon()
}
};
}
\ No newline at end of file
}
... ...
... ... @@ -107,4 +107,16 @@ module.exports = {
uid: { type: Number },
},
},
'api/ufo/coupon/list': {
ufo: true,
// auth: true,
api: 'ufo.coupons.list',
param: {
uid: { type: Number },
page: {type: Number},
limit: {type: Number},
type: {type: Number}
}
},
};
... ...