Authored by bevishuang

fix merge

@@ -20,7 +20,7 @@ export default { @@ -20,7 +20,7 @@ export default {
20 }, 20 },
21 data() { 21 data() {
22 return { 22 return {
23 - animate:false, 23 +
24 // lists:[ 24 // lists:[
25 // {name:'公告1'}, 25 // {name:'公告1'},
26 // {name:'公告2'} 26 // {name:'公告2'}
@@ -29,6 +29,7 @@ export default { @@ -29,6 +29,7 @@ export default {
29 }, 29 },
30 computed: { 30 computed: {
31 ...mapState({ 31 ...mapState({
  32 + animate: state => state.animate,
32 lists: state => state.rollNoticeList 33 lists: state => state.rollNoticeList
33 }) 34 })
34 }, 35 },
@@ -41,16 +42,7 @@ export default { @@ -41,16 +42,7 @@ export default {
41 } 42 }
42 }, 43 },
43 methods: { 44 methods: {
44 - ...mapActions(['fetchRollBoardList']),  
45 -  showMarquee() {  
46 - let that = this  
47 - that.animate = true;  
48 - setTimeout(()=>{  
49 - that.lists.push(that.lists[0]);  
50 - that.lists.shift();  
51 - that.animate = false;  
52 - },800)  
53 - }, 45 + ...mapActions(['fetchRollBoardList',' showMarquee']),
54 } 46 }
55 } 47 }
56 </script> 48 </script>
@@ -2,21 +2,37 @@ export default function() { @@ -2,21 +2,37 @@ export default function() {
2 return { 2 return {
3 namespaced: true, 3 namespaced: true,
4 state: { 4 state: {
  5 + animate: false,
5 rollNoticeList: [], 6 rollNoticeList: [],
6 }, 7 },
7 mutations: { 8 mutations: {
8 addList(state, { list }) { 9 addList(state, { list }) {
9 state.rollNoticeList = state.rollNoticeList.concat(list); 10 state.rollNoticeList = state.rollNoticeList.concat(list);
10 }, 11 },
  12 + startAnimate(state) {
  13 + state.animate = true;
  14 + },
  15 + animateHandler(state) {
  16 + state.rollNoticeList.push(state.rollNoticeList[0]);
  17 + state.rollNoticeList.shift();
  18 + state.animate = false;
  19 + }
11 }, 20 },
12 actions: { 21 actions: {
13 async fetchRollBoardList({ commit }) { 22 async fetchRollBoardList({ commit }) {
14 const result = await this.$api.get('/api/ufo/mine/rollBoardList', {}); 23 const result = await this.$api.get('/api/ufo/mine/rollBoardList', {});
15 24
16 if (result.code === 200) { 25 if (result.code === 200) {
17 - commit('addList', { list: result.data.list });  
18 - } 26 + commit('addList', { list: result.data });
19 } 27 }
20 }, 28 },
  29 + showMarquee({ commit }) {
  30 + console.log('fff');
  31 + commit('startAnimate');
  32 + setTimeout(() => {
  33 + commit('animateHandler');
  34 + }, 800);
  35 + },
  36 + },
21 }; 37 };
22 } 38 }