Merge commit 'e770cfc39fd992e1822774ae15de3812be158f7f'
This commit is contained in:
@@ -133,8 +133,10 @@ public class SysRoleServiceImpl extends ServiceImpl<SysRoleMapper, SysRole> impl
|
||||
public List<String> getPermissionList(JSONObject userDto) {
|
||||
List<String> permission = new LinkedList<>();
|
||||
// 查看是否为管理员
|
||||
permission.add("admin");
|
||||
permission.addAll(sysMenuMapper.getPermissionByUserId(userDto.getString("userId")));
|
||||
if (userDto.getBoolean("is_admin")) {
|
||||
permission.add("admin");
|
||||
}
|
||||
permission.addAll(sysMenuMapper.getPermissionByUserId(userDto.getString("user_id")));
|
||||
return permission;
|
||||
}
|
||||
|
||||
|
||||
@@ -73,6 +73,7 @@ import Search from '@/components/HeaderSearch'
|
||||
import Avatar from '@/assets/images/avatar.png'
|
||||
import NoticeIcon from '@/views/system/notice/NoticeIcon.vue'
|
||||
import NoticeIconReader from '@/views/system/notice/NoticeIconReader.vue'
|
||||
import i18n from '@/i18n'
|
||||
|
||||
export default {
|
||||
components: {
|
||||
@@ -95,6 +96,7 @@ export default {
|
||||
},
|
||||
created() {
|
||||
this.initLang()
|
||||
this.initWebSocket()
|
||||
},
|
||||
computed: {
|
||||
...mapGetters([
|
||||
@@ -162,6 +164,35 @@ export default {
|
||||
this.$store.dispatch('LogOut').then(() => {
|
||||
location.reload()
|
||||
})
|
||||
},
|
||||
initWebSocket() {
|
||||
// const wsUri = (process.env.VUE_APP_WS_API === '/' ? '/' : (process.env.VUE_APP_WS_API + '/')) + 'messageInfo'
|
||||
const wsUri = process.env.VUE_APP_WS_API + '/webSocket/' + 'messageInfo'
|
||||
this.websock = new WebSocket(wsUri)
|
||||
this.websock.onerror = this.webSocketOnError
|
||||
this.websock.onmessage = this.webSocketOnMessage
|
||||
},
|
||||
webSocketOnError(e) {
|
||||
this.$notify({
|
||||
title: i18n.t('common.Tip14'),
|
||||
type: 'error',
|
||||
duration: 0
|
||||
})
|
||||
},
|
||||
webSocketOnMessage(e) {
|
||||
const data = JSON.parse(e.data)
|
||||
if (data.msgType === 'INFO') {
|
||||
// console.log('data', data)
|
||||
this.$bus.emit(data.msg.data, data.msg.msgType)
|
||||
} else if (data.msgType === 'ERROR') {
|
||||
this.$notify({
|
||||
title: '',
|
||||
message: data.msg,
|
||||
dangerouslyUseHTMLString: true,
|
||||
type: 'error',
|
||||
duration: 0
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user