actions.js
2.57 KB
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
import axios from 'axios'
import router from '../router'
export default {
// 获取用户信息
ON_GET_ME(context){
var pathname = location.pathname
axios.get('/admin/me')
.then(response => {
context.commit("onIsLogin", true)
context.commit("onChangeAdminInfo", response.data.data)
if(location.pathname == '/login' || location.hash.indexOf("#/login") != -1){
router.push({ path: '/index'})
}
})
.catch(error => {
console.log(error.response)
context.commit("onIsLogin", false)
if(pathname != '/login'){
router.push({ path: '/login'})
}
});
},
// 获取配置信息
ON_GET_CONFIGS(context){
axios.get('/public/configs')
.then(response => {
context.commit('onChangeConfigs', response.data.data)
})
},
// 获取平台配置数据
ON_GET_PLATFORM_CONFIG(context){
axios.get('/platform/list')
.then(response => {
context.commit('onChangePlatformConfig', response.data.data)
})
},
// 获取systemInfo
ON_GET_SYSTEM(context){
axios.get('/system')
.then(response => {
context.commit('onChangeSystemInfo', response.data.data)
document.title = response.data.data.title
})
},
// 获取companyInfo
ON_GET_COMPANY(context){
axios.get('/public/company')
.then(response => {
context.commit('onChangeCompanyInfo', response.data.data)
})
},
// 获取uploads/config
ON_GET_UPLOADS_CONFIG(context){
axios.get('/uploads/config')
.then(response => {
context.commit('onChangeUploadsConfigs', response.data.data)
})
},
// 获取会话列表
ON_GET_CONTACTS(context){
axios.get('/contact/list')
.then(response => {
context.commit('onChangeContacts', response.data.data)
})
},
// 一分钟上报一次我的活动
ON_RUN_LAST_ACTiIVITY(){
axios.get('/public/activity/')
},
// 获取机器人列表
ON_GET_ROBOTS(context){
axios.get('/robot/list')
.then(response => {
context.commit('onChangeRobos', response.data.data)
})
.catch(() => {
this.loading = false
});
},
// 获取工单系统counts
ON_GET_WORKORDER_COUNTS(context){
axios.get('/workorder/counts')
.then(response => {
context.commit('onChangeWorkOrderCounts', response.data.data)
})
}
}