Authored by bevishuang

fix merge

... ... @@ -20,7 +20,7 @@ export default {
},
data() {
return {
animate:false,
// lists:[
// {name:'公告1'},
// {name:'公告2'}
... ... @@ -29,6 +29,7 @@ export default {
},
computed: {
...mapState({
animate: state => state.animate,
lists: state => state.rollNoticeList
})
},
... ... @@ -41,16 +42,7 @@ export default {
}
},
methods: {
...mapActions(['fetchRollBoardList']),
 showMarquee() {
let that = this
that.animate = true;
setTimeout(()=>{
that.lists.push(that.lists[0]);
that.lists.shift();
that.animate = false;
},800)
},
...mapActions(['fetchRollBoardList',' showMarquee']),
}
}
</script>
... ...
... ... @@ -2,21 +2,37 @@ export default function() {
return {
namespaced: true,
state: {
animate: false,
rollNoticeList: [],
},
mutations: {
addList(state, { list }) {
state.rollNoticeList = state.rollNoticeList.concat(list);
},
startAnimate(state) {
state.animate = true;
},
animateHandler(state) {
state.rollNoticeList.push(state.rollNoticeList[0]);
state.rollNoticeList.shift();
state.animate = false;
}
},
actions: {
async fetchRollBoardList({ commit }) {
const result = await this.$api.get('/api/ufo/mine/rollBoardList', {});
if (result.code === 200) {
commit('addList', { list: result.data.list });
}
commit('addList', { list: result.data });
}
},
showMarquee({ commit }) {
console.log('fff');
commit('startAnimate');
setTimeout(() => {
commit('animateHandler');
}, 800);
},
},
};
}
... ...