You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
94 lines
2.3 KiB
94 lines
2.3 KiB
|
3 months ago
|
import Vue from 'vue'
|
||
|
|
import Vuex from 'vuex'
|
||
|
|
Vue.use(Vuex)
|
||
|
|
import tabBar from "@/utils/tabbar.js"; // 引入刚刚创建的tabBar.js
|
||
|
|
|
||
|
|
const store = new Vuex.Store({
|
||
|
|
state: {
|
||
|
|
dynamicTabbar: [], // 动态tabbar
|
||
|
|
tabBarList: [],
|
||
|
|
dataType: null,//数据标识权限
|
||
|
|
},
|
||
|
|
getters: {},
|
||
|
|
actions: {
|
||
|
|
changeTabbar({ commit }, res) {
|
||
|
|
/*
|
||
|
|
admin 超管 1123598816738675201
|
||
|
|
客户 1846419477876510721
|
||
|
|
客服 1839536982874193922
|
||
|
|
维修负责人 1839537055389515777
|
||
|
|
维修人员 1839552581620793346
|
||
|
|
*/
|
||
|
|
if (res.detail.status == 90) {
|
||
|
|
commit('updateTabbar', tabBar.oathTab)
|
||
|
|
uni.reLaunch({
|
||
|
|
url: "/pages/login/authInfo",
|
||
|
|
});
|
||
|
|
} else {
|
||
|
|
// console.log(66666666666,role_id)
|
||
|
|
if (res.role_id == "1123598816738675201" || res.role_id == "1846419477876510721"||res.role_id =='1846486905193041922') {
|
||
|
|
commit('updateDatatype', 1) //客户
|
||
|
|
commit('updateTabbar', tabBar.member)
|
||
|
|
|
||
|
|
uni.reLaunch({
|
||
|
|
url: "/pages/home/index",
|
||
|
|
});
|
||
|
|
|
||
|
|
|
||
|
|
}
|
||
|
|
if (res.role_id == "1839536982874193922") {
|
||
|
|
commit('updateDatatype', 2) //客服
|
||
|
|
commit('updateTabbar', tabBar.ordinary)
|
||
|
|
|
||
|
|
uni.reLaunch({
|
||
|
|
url: "/pages/submission/records",
|
||
|
|
});
|
||
|
|
|
||
|
|
|
||
|
|
}
|
||
|
|
if (res.role_id == "1839537055389515777") {
|
||
|
|
commit('updateDatatype', 3) //维修负责人
|
||
|
|
commit('updateTabbar', tabBar.manage)
|
||
|
|
|
||
|
|
uni.reLaunch({
|
||
|
|
url: "/pages/submission/records",
|
||
|
|
});
|
||
|
|
// this.$u.api.updateCoordinate().then(res=>{
|
||
|
|
|
||
|
|
// })
|
||
|
|
|
||
|
|
}
|
||
|
|
if (res.role_id == "1839552581620793346") {
|
||
|
|
commit('updateDatatype', 4) //维修人员
|
||
|
|
commit('updateTabbar', tabBar.repair)
|
||
|
|
|
||
|
|
uni.reLaunch({
|
||
|
|
url: "/pages/submission/records",
|
||
|
|
});
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
// 如果是维修人员登录 则实时更新当前维修人员的位置
|
||
|
|
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
|
||
|
|
},
|
||
|
|
changeDatatype({ commit }, type) {
|
||
|
|
commit('updateTabbar', payload)
|
||
|
|
}
|
||
|
|
},
|
||
|
|
mutations: {
|
||
|
|
updateTabbar(state, list) {
|
||
|
|
uni.setStorageSync('tabBarList', list) // 根据登录时传过来的值,存储对应的tabbarlist
|
||
|
|
state.dynamicTabbar = list
|
||
|
|
},
|
||
|
|
updateDatatype(state, data) {
|
||
|
|
state.dataType = data
|
||
|
|
}
|
||
|
|
|
||
|
|
}
|
||
|
|
})
|
||
|
|
|
||
|
|
export default store
|