Blame view

src/main.js 1.14 KB
a42b3256   wuxw   HC小区管理系统前段vue版正在开发中
1
2
3
4
5
6
7
  import Vue from 'vue'
  import App from './App.vue'
  import router from './router'
  import ElementUI from 'element-ui'
  import 'element-ui/lib/theme-chalk/index.css'
  import i18n from './i18n'
  
ebc1053d   wuxw   加入运营员工详情功能
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
  Vue.prototype.hasPrivilege = function(_privaleges) {
    // 确保 _privaleges 是数组,如果不是则转换为数组
    const privilegesToCheck = Array.isArray(_privaleges) ? _privaleges : [_privaleges];
    
    // 从本地存储获取用户权限
    let userPrivileges = localStorage.getItem('hc_staff_privilege');
    
    // 如果存在用户权限,则转换为数组
    if (userPrivileges) {
      userPrivileges = userPrivileges.split(',');
    } else {
      // 如果没有权限数据,直接返回 false
      return false;
    }
    
    // 检查用户是否有任一所需权限
    return privilegesToCheck.some(item => userPrivileges.includes(item));
a42b3256   wuxw   HC小区管理系统前段vue版正在开发中
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
  }
  Vue.prototype.toDoc = function(url) {
    window.open('http://www.homecommunity.cn/'+url, '_blank')
  }
  
  Vue.prototype.$getUser = function() {
    let user = JSON.parse(localStorage.getItem('user'))
    return user
  }
  
  
  Vue.use(ElementUI)
  Vue.config.productionTip = false
  
  new Vue({
    router,
    i18n,
    render: h => h(App)
  }).$mount('#app')