huangsijun
2025-09-22 a78c011de350b188afb03beb2f26a73f35f71986
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
<template>
  <div>
    <!--秒杀活动列表-->
    <List v-if="activeName == 'list'"></List>
    <!--参与记录-->
    <My v-if="activeName == 'my'"></My>
  </div>
</template>
<script>
  import bus from '@/utils/eventBus.js';
  import List from './list';
  import My from './my';
  export default {
    components: {
      List,
      My
    },
    data() {
      return {
        /*是否加载完成*/
        loading: true,
        form: {},
        /*参数*/
        param: {},
        /*当前选中*/
        activeName: 'list',
        /*切换数组原始数据*/
        sourceList: [{
            key: 'list',
            value: '活动列表',
            path: '/activity/seckill/list'
          },
          {
            key: 'my',
            value: '参与记录',
            path: '/activity/seckill/my'
          }
        ],
        /*权限筛选后的数据*/
        tabList: [],
      };
    },
    mounted() {
      this.init();
    },
    beforeDestroy() {
      //发送类别切换
      bus.$emit('tabData', {active: null,tab_type:'seckill', list: []});
      bus.$off('activeValue');
    },
    methods: {
      init() {
        this.tabList = this.authFilter();
        if (this.tabList.length > 0) {
          this.activeName = this.tabList[0].key;
        }
 
        if (this.$route.query.type != null) {
          this.activeName = this.$route.query.type;
        }
        /*监听传插件的值*/
        bus.$on('activeValue', res => {
          this.activeName = res;
        });
 
        //发送类别切换
        let params = {
          active: this.activeName,
          list: this.tabList,
          tab_type: 'seckill'
        }
        bus.$emit('tabData', params);
      },
      /*权限过滤*/
      authFilter() {
        let list = [];
        for (let i = 0; i < this.sourceList.length; i++) {
          let item = this.sourceList[i];
          if (this.$filter.isAuth(item.path)) {
            list.push(item);
          }
        }
        return list;
      },
 
    }
  };
</script>
 
<style>
  .operation-wrap {
    height: 124px;
    border-radius: 8px;
    -webkit-box-pack: center;
    -ms-flex-pack: center;
    justify-content: center;
    padding: 30px 30px;
    -webkit-box-orient: vertical;
    -webkit-box-direction: normal;
    -ms-flex-direction: column;
    flex-direction: column;
    overflow: hidden;
    background: #909399;
    background-size: 100% 100%;
    color: #fff;
  }
</style>