Authored by TaoHuang

fix notice

... ... @@ -16,17 +16,9 @@ export default {
return;
}
// TODO url解析
if (this.$yoho.isAliApp && window.WindVane) {
window.WindVane.call('Base', 'openWindow', params, data => {
console.log('open new window success: ' + this.href);
}, e => {
window.open(this.href);
});
} else {
window.open(this.href);
}
this.$xianyu.goXianyuNewPage({
url: this.href
});
}
}
};
... ...
... ... @@ -7,7 +7,6 @@
@pulling-up="onPullingUp"
:data="newsList.list">
<div class="news-content">
<Title :title="msg"></Title>
<Tab :list="newsList.tabList"></Tab>
<List :list="newsList && newsList.list || []"></List>
</div>
... ... @@ -19,7 +18,6 @@
<script>
import { Style, Scroll } from 'cube-ui';
import { createNamespacedHelpers } from 'vuex';
import Title from './components/title';
import List from './components/list';
import Tab from './components/tab';
... ... @@ -62,7 +60,6 @@ export default {
components: {
Style,
Scroll,
Title,
List,
Tab
}
... ...
<template>
<div>
<Scroll ref="recyclelist" class="list" :on-fetch="onFetch">
<div >
<NoticeItem v-for="(item, index) in noticeList" :key="index" :data="item"></NoticeItem>
</div>
</Scroll>
</div>
</template>
<script>
import { createNamespacedHelpers } from 'vuex';
const { mapState, mapActions } = createNamespacedHelpers('gain');
import NoticeItem from './noticeItem';
import {
Style,
Scroll,
RecycleList
} from 'cube-ui';
// import { resolve } from 'dns';
export default {
components: {
NoticeItem,
Scroll,
RecycleList,
Style
},
data(){
return {
scrollOptions: {
bounce: {
top: false
},
pullUpLoad: true
},
fixed: false
};
},
mounted(){
// this.fetchList
},
methods:{
// async onPullingUp() {
// const result = await this.fetchList();
// if (!result) {
// this.$refs.scroll.$forceUpdate();
// }
// },
onFetch(){
let items = []
return new Promise((resolve) => {
setTimeout(() => {
for(let i = 0; i < 50; i++){
items.push({
id:i,
contents:'【税率调整】您的商品AIR JORDAN 4 RESET PUSH NONEKJG 2017已经被用户下单,请及时发货'+i,
time:'2018.08.08 17:20'
})
}
resolve(items)
}, 1000)
})
}
},
// async fetchList({ commit, state }) {
// let page = state.page;
// const result = await this.$api.get('/api/union/inviteList', {
// page: page,
// size: state.size
// });
// if (result.code === 200) {
// commit('addList', { list: result.data.list });
// commit('changePage', { page: ++page });
// }
// return result.data ? result.data.length : 0;
// }
}
</script>
\ No newline at end of file
<template>
<div class="notice-root" >
<p class="notice-content">【税率调整】您的商品AIR JORDAN 4 RESET PUSH NONEKJG 2017已经被用户下单,请及时发货</p>
<div class="time">
<time> 2018.08.08 17:20</time>
</div>
</div>
</template>
<script>
// export default {
// data(){
// },
// props:[
// ]
// };
// methods: {
// onGo()
// };
</script>
<style>
.notice-root{
margin-left: 40px;
margin-right: 40px;
}
.notice-content{
font-family: 'PingFang-SC-Regular';
font-size: 28px;
color: #000000;
}
.time {
font-size: 28px;
color: #999999;
}
</style>
\ No newline at end of file
<template>
<LayoutApp :show-back="true">
<div class="body" ref="body">
<List>
</List>
</div>
</LayoutApp>
</template>
<script>
import List from './components/list';
export default {
components: {
List
}
};
</script>
<style>
.body {
height: 100%;
overflow-y: auto;
}
</style>
\ No newline at end of file
<template>
<div>
<Scroll
ref="scroll"
class="list"
:data="noticeList"
:options="scrollOption"
@pulling-up="onPullingUp">
<Scroll
ref="scroll"
class="list"
:data="noticeList"
:options="scrollOption"
@pulling-up="onPullingUp">
<div class="content-root">
<NoticeItem v-for="(item, index) in noticeList" :key="index" :data="item"></NoticeItem>
</div>
... ... @@ -15,18 +15,14 @@
<script>
import { createNamespacedHelpers } from 'vuex';
const { mapState, mapActions} = createNamespacedHelpers('notice');
const { mapState, mapActions } = createNamespacedHelpers('notice');
import NoticeItem from './noticeItem';
import {
Style,
Scroll,
RecycleList
Style,
Scroll,
RecycleList
} from 'cube-ui';
// import { resolve } from 'dns';
export default {
components: {
... ... @@ -36,93 +32,58 @@ export default {
Style
},
name: 'NoticeListPage',
data(){
data() {
return {
data: {},
noMore: false,
scrolling: false,
scrollOption: {
// bounce: false,
pullUpLoad:true,
pullUpLoad: true,
},
};
},
created(){
// console.log(this.noticeList)
created() {
this.fetchNoticeList();
},
// activated(){
// this.fetchList();
// },
// async serverPrefetch(){
// this.fetchNoticeList();
// },
mounted(){
// this.fetchNoticeList();
mounted() {
},
computed: {
...mapState(['noticeList','fetchNoticePage']),
...mapState(['noticeList', 'fetchNoticePage']),
},
methods:{
methods: {
...mapActions(['fetchNoticeList']),
onScroll(){
console.log('onScroll')
onScroll() {
this.scrolling = true;
this._scTimer && clearTimeout(this._scTimer);
this._scTimer = setTimeout(() => {
this.scrolling = false;
}, 400);
},
onPullingUp(){
console.log('onPullingUp:'+this.noMore)
onPullingUp() {
console.log('onPullingUp:' + this.noMore);
},
onPullingDown() {
console.log('onPullingDown:'+this.noMore)
console.log('onPullingDown:' + this.noMore);
},
onFetch() {
// console.log('fetchList:'+this.noticeList)
// let items = []
// return new Promise((resolve) => {
// // 模拟请求 50 条数据,因为 size 设置为 50
// setTimeout(() => {
// for (let i = 0; i < 50; i++) {
// items.push({
// id: i,
// avatar: 'https://s3.amazonaws.com/uifaces/faces/twitter/danpliego/128.jpg',
// msg: '123',
// time: 'Thu Oct 25 2018 15:02:12 GMT+0800 (中国标准时间)'
// })
// }
// resolve(items)
// }, 1000)
// })
if (this.noMore) {
return;
}
this.fetchNoticeList();
// this.fetchNoticeList({}).then(res => {
// if (+this.fetchNoticePage > +get(res, 'data.totalPage')) {
// this.noMore = true;
// }
// this.$nextTick(() => {
// this.$refs.scroll.forceUpdate(true);
// });
// });
}
},
}
};
</script>
<style>
.list{
.list {
/* height: 400px; */
width: 100%;
}
.content-root{
.content-root {
/* height: 400px; */
width: 100%;
}
</style>
\ No newline at end of file
</style>
... ...
<template>
<div class="notice-root">
<a :href="data.url">
<LayoutLink :href="data.url">
<p class="notice-content">{{data.name}}</p>
<div class="time">
<time> {{data.createTime}}</time>
</div>
<div class="item-split-line"/>
</a>
</LayoutLink>
</div>
</template>
<script>
import {
Style,
Scroll,
RecycleList
Style,
Scroll,
RecycleList
} from 'cube-ui';
export default {
data(){
data() {
return {};
},
props: {
data: {
type: Object,
default() {
return {};
},
props:{
data: {
type: Object,
default() {
return {};
}
}
},
created() {
console.log(this.data)
},
methods: {
onFetch: Function,
goDetail(){
this.$router.push({
name: 'notice',
params: {
url: this.data.url,
}
});
}
},
components: {
Scroll,
RecycleList,
Style
}
}
},
created() {
},
methods: {
},
components: {
},
};
</script>
<style>
.notice-root{
margin-left: 40px;
margin-right: 40px;
padding-top: 32px;
.notice-root {
margin-left: 40px;
margin-right: 40px;
padding-top: 32px;
}
.notice-content{
font-family: 'PingFang-SC-Regular';
font-size: 28px;
color: #000000;
line-height: 1.5;
text-overflow: ellipsis;
-webkit-line-clamp: 2;
display: -webkit-box;
-webkit-box-orient: vertical;
overflow: hidden;
.notice-content {
font-family: 'PingFang-SC-Regular';
font-size: 28px;
color: #000000;
line-height: 1.5;
text-overflow: ellipsis;
-webkit-line-clamp: 2;
display: -webkit-box;
-webkit-box-orient: vertical;
overflow: hidden;
}
.time {
font-size: 28px;
color: #999999;
margin-top: 12px;
font-size: 28px;
color: #999999;
margin-top: 12px;
}
.item-split-line {
height: 1px;
width: 100%;
background-color: #EEEEEE;
margin-top: 32px;
height: 1px;
width: 100%;
background-color: #EEEEEE;
margin-top: 32px;
}
</style>
\ No newline at end of file
</style>
... ...
<template>
<template>
<LayoutApp :show-back="true" :title="title">
<Scroll
ref="scroll"
v-if="noticeList.length"
:scroll-events="['scroll-end','scroll']"
@scroll-end="fetchList"
<Scroll
ref="scroll"
v-if="noticeList.length"
:scroll-events="['scroll-end','scroll']"
@scroll-end="fetchList"
>
<NoticeItem v-for="(item, index) in noticeList" :key="index" :data="item"></NoticeItem>
</Scroll>
... ... @@ -15,15 +15,16 @@
<script>
import { createNamespacedHelpers } from 'vuex';
const { mapState, mapActions} = createNamespacedHelpers('notice');
const { mapState, mapActions } = createNamespacedHelpers('notice');
import NoticeItem from './components/noticeItem';
import UfoNoItem from '../../../components/ufo-no-item'
import UfoNoItem from '../../../components/ufo-no-item';
import {
Style,
Scroll,
RecycleList
Style,
Scroll,
RecycleList
} from 'cube-ui';
export default {
components: {
NoticeItem,
... ... @@ -32,35 +33,33 @@ export default {
UfoNoItem,
RecycleList
},
data(){
data() {
return {
title: '公告',
data: {},
scrolling: false,
scrollOption: {
pullUpLoad:true,
pullUpLoad: true,
},
};
},
created(){
created() {
this.fetchList();
// this.fetchNoticeList();
},
computed: {
...mapState(['noticeList','fetchNoticePage','isMore','isShowEmpty']),
...mapState(['noticeList', 'fetchNoticePage', 'isMore', 'isShowEmpty']),
},
methods:{
methods: {
...mapActions(['fetchNoticeList']),
onScroll(){
console.log('onScroll')
onScroll() {
this.scrolling = true;
this._scTimer && clearTimeout(this._scTimer);
this._scTimer = setTimeout(() => {
this.scrolling = false;
}, 400);
},
scroll({ y }) {
scroll({ y }) {
const height = this.$refs.banner.$el.offsetHeight + this.$refs.header.offsetHeight;
if (-y >= height) {
... ... @@ -69,20 +68,20 @@ export default {
this.fixed = false;
}
},
fetchList(){
console.log('fetchList:'+this.isMore)
if (!this.isMore) {
return;
}
console.log('fetchList:'+this.noMore)
this.fetchNoticeList().then(res => {
this.$nextTick(() => {
this.$refs.scroll.forceUpdate(true);
});
fetchList() {
console.log('fetchList:' + this.isMore);
if (!this.isMore) {
return;
}
console.log('fetchList:' + this.noMore);
this.fetchNoticeList().then(res => {
this.$nextTick(() => {
this.$refs.scroll.forceUpdate(true);
});
});
},
async onPullingUp(){
console.log('onPullingUp:'+this.isMore)
async onPullingUp() {
console.log('onPullingUp:' + this.isMore);
await this.fetchList();
},
... ... @@ -95,6 +94,6 @@ export default {
<style scoped>
.scroll-content {
height: 500px;
height: 500px;
}
</style>
\ No newline at end of file
</style>
... ...