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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
<template>
  <!--
          作者:yj
      -->
  <div>
    <DemandApply v-if="activeName == 'demandapply'"></DemandApply>
    <DemandUser v-if="activeName == 'demanduser'"></DemandUser>
    <SupplyApply v-if="activeName == 'supplyapply'"></SupplyApply>
    <SupplyUser v-if="activeName == 'supplyuser'"></SupplyUser>
    <DemandProject v-if="activeName == 'demandproject'"></DemandProject>
    <SupplyProject v-if="activeName == 'supplyproject'"></SupplyProject>
    <Order v-if="activeName == 'order'"></Order>
    <Category v-if="activeName == 'category'"></Category>
    <Tag v-if="activeName == 'tag'"></Tag>
    <Cash v-if="activeName == 'cash'"></Cash>
    <Setting v-if="activeName == 'setting'"></Setting>
    <Grade v-if="activeName == 'grade'"></Grade>
  </div>
</template>
<script>
import bus from '@/utils/eventBus.js';
import PlusApi from '@/api/plus.js';
import DemandApply from './demand/apply/Apply';
import DemandUser from './demand/user/User';
import SupplyApply from './supply/apply/Apply';
import SupplyUser from './supply/user/User';
import DemandProject from './demandproject/index';
import SupplyProject from './supplyproject/index';
import Order from './order/Order';
import Category from './releasecategory/index';
import Tag from './tag/index';
import Cash from './cash/Cash';
import Setting from './setting/Setting';
import Grade from './grade/index';
 
 
export default {
  components: {
    DemandApply,
    DemandUser,
    SupplyApply,
    SupplyUser,
    DemandProject,
    SupplyProject,
    Order,
    Category,
    Tag,
    Cash,
    Setting,
    Grade,
  },
  data() {
    return {
      formInline: {
        nick_name: ''
      },
      /*参数*/
      param: {},
      /*当前选中*/
      activeName: 'demandapply',
      /*切换数组*/
      sourceList: [
        {
          key: 'demandapply',
          value: '需求方申请',
          path:'/plus/release/demand/apply/index'
        },
        {
          key: 'demanduser',
          value: '需求方用户',
          path:'/plus/release/demand/user/index'
        },{
          key: 'supplyapply',
          value: '供应方申请',
          path:'/plus/release/supply/apply/index'
        },
        {
          key: 'supplyuser',
          value: '供应方用户',
          path:'/plus/release/supply/user/index'
        },
        {
          key: 'demandproject',
          value: '需求发布',
          path:'/plus/release/demandproject/index'
        },
        {
          key: 'supplyproject',
          value: '供应发布',
          path:'/plus/release/supplyproject/index'
        },
        // {
        //   key: 'order',
        //   value: '用户订单',
        //   path:'/plus/release/order/Order'
        // },
        {
          key: 'grade',
          value: '信誉等级',
          path:'/plus/release/grade/index'
        },
        {
          key: 'category',
          value: '分类列表',
          path:'/plus/release/releasecategory/index'
        },
        {
          key: 'tag',
          value: '标签列表',
          path:'/plus/release/tag/index'
        },
        // {
        //   key: 'cash',
        //   value: '提现列表',
        //   path:'/plus/release/cash/Cash'
        // },
        {
          key: 'setting',
          value: '发布设置',
          path:'/plus/release/setting/Setting'
        }
 
      ],
      /*权限筛选后的数据*/
      tabList:[],
      /*判断third是否有参数*/
      is_third_param: false
    };
  },
  watch:{
 
    //监听路由
    $route(to, from) {
      this.init();
    }
  },
  created() {
 
    this.init();
 
  },
  beforeDestroy() {
    //发送类别切换
    bus.$emit('tabData', { active: null, tab_type:'release',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 => {
        if (this.is_third_param) {
          this.param.user_id = '';
          this.is_third_param = false;
        }
        this.activeName = res;
      });
 
      //发送类别切换
      let params = {
        active: this.activeName,
        list: this.tabList,
        tab_type:'release'
      };
      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>