perf: 支持自定义仪表盘欢迎词

This commit is contained in:
kuaifan 2025-02-05 01:33:32 +09:00
parent 0019c9ef41
commit 64262134c4
3 changed files with 20 additions and 2 deletions

View File

@ -41,7 +41,7 @@ class SystemController extends AbstractController
* @apiParam {String} type * @apiParam {String} type
* - get: 获取(默认) * - get: 获取(默认)
* - all: 获取所有(需要管理员权限) * - all: 获取所有(需要管理员权限)
* - save: 保存设置(参数:['reg', 'reg_identity', 'reg_invite', 'temp_account_alias', 'login_code', 'password_policy', 'project_invite', 'chat_information', 'anon_message', 'voice2text', 'translation', 'e2e_message', 'auto_archived', 'archived_day', 'task_visible', 'task_default_time', 'all_group_mute', 'all_group_autoin', 'user_private_chat_mute', 'user_group_chat_mute', 'system_alias', 'image_compress', 'image_quality', 'image_save_local', 'start_home'] * - save: 保存设置(参数:['reg', 'reg_identity', 'reg_invite', 'temp_account_alias', 'login_code', 'password_policy', 'project_invite', 'chat_information', 'anon_message', 'voice2text', 'translation', 'e2e_message', 'auto_archived', 'archived_day', 'task_visible', 'task_default_time', 'all_group_mute', 'all_group_autoin', 'user_private_chat_mute', 'user_group_chat_mute', 'system_alias', 'system_welcome', 'image_compress', 'image_quality', 'image_save_local', 'start_home']
* @apiSuccess {Number} ret 返回状态码1正确、0错误 * @apiSuccess {Number} ret 返回状态码1正确、0错误
* @apiSuccess {String} msg 返回信息(错误描述) * @apiSuccess {String} msg 返回信息(错误描述)
@ -80,6 +80,7 @@ class SystemController extends AbstractController
'user_private_chat_mute', 'user_private_chat_mute',
'user_group_chat_mute', 'user_group_chat_mute',
'system_alias', 'system_alias',
'system_welcome',
'image_compress', 'image_compress',
'image_quality', 'image_quality',
'image_save_local', 'image_save_local',
@ -108,6 +109,9 @@ class SystemController extends AbstractController
if ($all['system_alias'] == env('APP_NAME')) { if ($all['system_alias'] == env('APP_NAME')) {
$all['system_alias'] = ''; $all['system_alias'] = '';
} }
if ($all['system_welcome'] == '欢迎您,{username}') {
$all['system_welcome'] = '';
}
$setting = Base::setting('system', Base::newTrim($all)); $setting = Base::setting('system', Base::newTrim($all));
} else { } else {
$setting = Base::setting('system'); $setting = Base::setting('system');

View File

@ -5,7 +5,7 @@
<span @click="goForward({name: 'manage-setting-license'})">{{warningMsg}}</span> <span @click="goForward({name: 'manage-setting-license'})">{{warningMsg}}</span>
</Alert> </Alert>
<div class="dashboard-wrapper" :style="wrapperStyle"> <div class="dashboard-wrapper" :style="wrapperStyle">
<div class="dashboard-hello">{{$L('欢迎您,' + userInfo.nickname)}}</div> <div class="dashboard-hello">{{dashboardHello}}</div>
<div v-if="systemConfig.timezoneDifference" class="dashboard-time"> <div v-if="systemConfig.timezoneDifference" class="dashboard-time">
<span>{{$L('服务器时间')}}:</span> <span>{{$L('服务器时间')}}:</span>
<span>{{$A.daytz().format('YYYY-MM-DD HH:mm:ss')}}</span> <span>{{$A.daytz().format('YYYY-MM-DD HH:mm:ss')}}</span>
@ -183,6 +183,14 @@ export default {
'max-height': 'calc(100% - 50px)' 'max-height': 'calc(100% - 50px)'
} : null } : null
}, },
dashboardHello({systemConfig, userInfo}) {
let hello = '欢迎您,{username}';
if (systemConfig.system_welcome) {
hello = systemConfig.system_welcome
}
return this.$L(hello.replace(/\{username}/g, userInfo.nickname))
}
}, },
watch: { watch: {

View File

@ -217,6 +217,12 @@
</div> </div>
<div class="form-tip">{{$L('用于网页默认标题、邮件发送等')}}</div> <div class="form-tip">{{$L('用于网页默认标题、邮件发送等')}}</div>
</FormItem> </FormItem>
<FormItem :label="$L('欢迎词')" prop="system_welcome">
<div style="width: 220px;">
<Input v-model="formDatum.system_welcome" :placeholder="$L('欢迎您,{username}')"/>
</div>
<div class="form-tip">{{$L('仪表盘欢迎词,{username} 代表用户昵称')}}</div>
</FormItem>
<FormItem :label="$L('图片优化')" prop="image_compress"> <FormItem :label="$L('图片优化')" prop="image_compress">
<RadioGroup v-model="formDatum.image_compress"> <RadioGroup v-model="formDatum.image_compress">
<Radio label="open">{{$L('开启')}}</Radio> <Radio label="open">{{$L('开启')}}</Radio>