mirror of
https://github.com/jumpserver/lina.git
synced 2026-01-13 11:24:17 +00:00
perf: 用户个人信息页面添加开启消息接受方式
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<IBox fa="fa-edit" :title="title" v-bind="$attrs">
|
||||
<IBox :fa="fa" :title="title" v-bind="$attrs">
|
||||
<div v-for="action of actions" :key="action.title" class="quick-actions">
|
||||
<table>
|
||||
<ActionItem v-if="action.has === undefined || action.has" :action="action" />
|
||||
@@ -20,6 +20,10 @@ export default {
|
||||
ActionItem
|
||||
},
|
||||
props: {
|
||||
fa: {
|
||||
type: String,
|
||||
default: () => 'fa-edit'
|
||||
},
|
||||
title: {
|
||||
type: String,
|
||||
default() {
|
||||
|
||||
@@ -1011,6 +1011,8 @@
|
||||
"UpdateNodeAssetHardwareInfo": "更新节点资产硬件信息"
|
||||
},
|
||||
"users": {
|
||||
"MessageSubscription": "消息订阅",
|
||||
"AuthSettings": "认证配置",
|
||||
"UserName": "姓名",
|
||||
"Account": "账户",
|
||||
"Authentication": "认证",
|
||||
@@ -1127,7 +1129,8 @@
|
||||
"Sender": "发送人",
|
||||
"MarkAsRead": "标记已读",
|
||||
"NoUnreadMsg": "暂无未读消息",
|
||||
"SiteMessage": "站内信"
|
||||
"SiteMessage": "站内信",
|
||||
"SMS": "短信"
|
||||
},
|
||||
"xpack": {
|
||||
"Admin": "管理员",
|
||||
|
||||
@@ -981,6 +981,8 @@
|
||||
"UpdateNodeAssetHardwareInfo": "Update node asset hardware information"
|
||||
},
|
||||
"users": {
|
||||
"MessageSubscription": "Message Subscription",
|
||||
"AuthSettings": "Auth settings",
|
||||
"UserName": "Name",
|
||||
"Account": "Account",
|
||||
"Existing":"Existing",
|
||||
@@ -1095,7 +1097,8 @@
|
||||
"Sender": "Sender",
|
||||
"MarkAsRead": "Mark as read",
|
||||
"NoUnreadMsg": "No unread messages",
|
||||
"SiteMessage": "Site messages"
|
||||
"SiteMessage": "Site messages",
|
||||
"SMS": "SMS"
|
||||
},
|
||||
"xpack": {
|
||||
"Admin": "Admin",
|
||||
|
||||
@@ -5,7 +5,18 @@
|
||||
<DetailCard :items="detailCardItems" />
|
||||
</el-col>
|
||||
<el-col :span="10">
|
||||
<QuickActions type="primary" :actions="quickActions" />
|
||||
<QuickActions
|
||||
type="primary"
|
||||
:title="this.$t('users.AuthSettings')"
|
||||
:actions="authQuickActions"
|
||||
/>
|
||||
<QuickActions
|
||||
type="info"
|
||||
style="margin-top: 15px"
|
||||
:title="this.$t('users.MessageSubscription')"
|
||||
fa="fa-info-circle"
|
||||
:actions="messageSubscriptionQuickActions"
|
||||
/>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<Dialog
|
||||
@@ -57,7 +68,7 @@ export default {
|
||||
showPasswordDialog: false,
|
||||
passwordInput: '',
|
||||
currentEdit: '',
|
||||
quickActions: [
|
||||
authQuickActions: [
|
||||
{
|
||||
title: this.$t('users.setWeCom'),
|
||||
attrs: {
|
||||
@@ -174,6 +185,79 @@ export default {
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
messageSubscriptionQuickActions: [
|
||||
{
|
||||
title: this.$t('notifications.SiteMessage'),
|
||||
type: 'switcher',
|
||||
attrs: {
|
||||
disabled: true,
|
||||
name: 'site_msg',
|
||||
model: this.object.receive_backends.indexOf('site_msg') !== -1
|
||||
},
|
||||
callbacks: {
|
||||
change: this.updateUserReceiveBackends
|
||||
}
|
||||
},
|
||||
{
|
||||
title: this.$t('setting.Email'),
|
||||
type: 'switcher',
|
||||
attrs: {
|
||||
name: 'email',
|
||||
model: this.object.receive_backends.indexOf('email') !== -1
|
||||
},
|
||||
callbacks: {
|
||||
change: this.updateUserReceiveBackends
|
||||
}
|
||||
},
|
||||
{
|
||||
title: this.$t('notifications.SMS'),
|
||||
type: 'switcher',
|
||||
has: this.$store.getters.publicSettings,
|
||||
attrs: {
|
||||
name: 'sms',
|
||||
model: this.object.receive_backends.indexOf('sms') !== -1
|
||||
},
|
||||
callbacks: {
|
||||
change: this.updateUserReceiveBackends
|
||||
}
|
||||
},
|
||||
{
|
||||
title: this.$t('setting.WeCom'),
|
||||
type: 'switcher',
|
||||
attrs: {
|
||||
name: 'wecom',
|
||||
model: this.object.receive_backends.indexOf('wecom') !== -1
|
||||
},
|
||||
has: this.$store.getters.publicSettings.AUTH_WECOM,
|
||||
callbacks: {
|
||||
change: this.updateUserReceiveBackends
|
||||
}
|
||||
},
|
||||
{
|
||||
title: this.$t('setting.DingTalk'),
|
||||
type: 'switcher',
|
||||
attrs: {
|
||||
name: 'dingtalk',
|
||||
model: this.object.receive_backends.indexOf('dingtalk') !== -1
|
||||
},
|
||||
has: this.$store.getters.publicSettings.AUTH_DINGTALK,
|
||||
callbacks: {
|
||||
change: this.updateUserReceiveBackends
|
||||
}
|
||||
},
|
||||
{
|
||||
title: this.$t('setting.FeiShu'),
|
||||
type: 'switcher',
|
||||
attrs: {
|
||||
name: 'feishu',
|
||||
model: this.object.receive_backends.indexOf('feishu') !== -1
|
||||
},
|
||||
has: this.$store.getters.publicSettings.AUTH_FEISHU,
|
||||
callbacks: {
|
||||
change: this.updateUserReceiveBackends
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
@@ -245,6 +329,28 @@ export default {
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
updateUserReceiveBackends(val) {
|
||||
this.$axios.patch(
|
||||
`/api/v1/notifications/user-msg-subscription/${this.object.id}/`,
|
||||
{ 'receive_backends': this.getReceiveBackendList() }
|
||||
).then(res => {
|
||||
this.$message.success(this.$t('common.updateSuccessMsg'))
|
||||
}).catch(err => {
|
||||
this.$message.error(this.$t('common.updateErrorMsg' + ' ' + err))
|
||||
})
|
||||
},
|
||||
getReceiveBackendList() {
|
||||
const backendList = []
|
||||
for (const backend of this.messageSubscriptionQuickActions) {
|
||||
const name = backend.attrs.name
|
||||
const enabled = backend.attrs.model
|
||||
if (enabled) {
|
||||
backendList.push(name)
|
||||
}
|
||||
}
|
||||
console.log(backendList)
|
||||
return backendList
|
||||
},
|
||||
passConfirm() {
|
||||
this.$axios.post(
|
||||
`/api/v1/authentication/password/verify/`, {
|
||||
|
||||
Reference in New Issue
Block a user