删除 tipsPreference.
This commit is contained in:
@@ -37,7 +37,4 @@ public class UserCollectInfoVO {
|
|||||||
@Schema(description = "系统偏好")
|
@Schema(description = "系统偏好")
|
||||||
private Map<String, Object> systemPreference;
|
private Map<String, Object> systemPreference;
|
||||||
|
|
||||||
@Schema(description = "提示偏好")
|
|
||||||
private Map<String, Object> tipsPreference;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,11 +20,6 @@ public enum PreferenceTypeEnum {
|
|||||||
*/
|
*/
|
||||||
SYSTEM("systemPreferenceStrategy"),
|
SYSTEM("systemPreferenceStrategy"),
|
||||||
|
|
||||||
/**
|
|
||||||
* 提示偏好
|
|
||||||
*/
|
|
||||||
TIPS("tipsPreferenceStrategy"),
|
|
||||||
|
|
||||||
;
|
;
|
||||||
|
|
||||||
PreferenceTypeEnum(String beanName) {
|
PreferenceTypeEnum(String beanName) {
|
||||||
|
|||||||
@@ -1,25 +0,0 @@
|
|||||||
package com.orion.ops.module.infra.handler.preference.model;
|
|
||||||
|
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
|
||||||
import lombok.AllArgsConstructor;
|
|
||||||
import lombok.Builder;
|
|
||||||
import lombok.Data;
|
|
||||||
import lombok.NoArgsConstructor;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 提示偏好模型
|
|
||||||
*
|
|
||||||
* @author Jiahang Li
|
|
||||||
* @version 1.0.0
|
|
||||||
* @since 2023/10/8 13:59
|
|
||||||
*/
|
|
||||||
@Data
|
|
||||||
@Builder
|
|
||||||
@NoArgsConstructor
|
|
||||||
@AllArgsConstructor
|
|
||||||
public class TipsPreferenceModel implements PreferenceModel {
|
|
||||||
|
|
||||||
@Schema(description = "是否提示过系统偏好设置模态框")
|
|
||||||
private Boolean tippedSystemPreferenceModal;
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,23 +0,0 @@
|
|||||||
package com.orion.ops.module.infra.handler.preference.strategy;
|
|
||||||
|
|
||||||
import com.orion.ops.module.infra.handler.preference.model.TipsPreferenceModel;
|
|
||||||
import org.springframework.stereotype.Component;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 提示偏好处理策略
|
|
||||||
*
|
|
||||||
* @author Jiahang Li
|
|
||||||
* @version 1.0.0
|
|
||||||
* @since 2023/10/8 15:11
|
|
||||||
*/
|
|
||||||
@Component
|
|
||||||
public class TipsPreferenceStrategy implements IPreferenceStrategy<TipsPreferenceModel> {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public TipsPreferenceModel getDefault() {
|
|
||||||
return TipsPreferenceModel.builder()
|
|
||||||
.tippedSystemPreferenceModal(false)
|
|
||||||
.build();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -201,8 +201,6 @@ public class PermissionServiceImpl implements PermissionService {
|
|||||||
Long id = user.getId();
|
Long id = user.getId();
|
||||||
// 获取用户系统偏好
|
// 获取用户系统偏好
|
||||||
Future<Map<String, Object>> systemPreference = preferenceService.getPreference(id, PreferenceTypeEnum.SYSTEM);
|
Future<Map<String, Object>> systemPreference = preferenceService.getPreference(id, PreferenceTypeEnum.SYSTEM);
|
||||||
// 获取用户提示偏好
|
|
||||||
Future<Map<String, Object>> tipsPreference = preferenceService.getPreference(id, PreferenceTypeEnum.TIPS);
|
|
||||||
// 获取用户角色
|
// 获取用户角色
|
||||||
List<String> roles = this.getUserEnabledRoles();
|
List<String> roles = this.getUserEnabledRoles();
|
||||||
// 获取用户权限
|
// 获取用户权限
|
||||||
@@ -228,7 +226,6 @@ public class PermissionServiceImpl implements PermissionService {
|
|||||||
}
|
}
|
||||||
// 获取异步结果
|
// 获取异步结果
|
||||||
user.setSystemPreference(systemPreference.get());
|
user.setSystemPreference(systemPreference.get());
|
||||||
user.setTipsPreference(tipsPreference.get());
|
|
||||||
// 组装数据
|
// 组装数据
|
||||||
return UserPermissionVO.builder()
|
return UserPermissionVO.builder()
|
||||||
.user(user)
|
.user(user)
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
|
|
||||||
type Preference = 'SYSTEM' | 'TIPS'
|
type Preference = 'SYSTEM'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 用户偏好更新请求
|
* 用户偏好更新请求
|
||||||
|
|||||||
@@ -1,16 +1,18 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="block">
|
<div class="block">
|
||||||
<h5 class="title">{{ title }}</h5>
|
<h5 class="title">{{ title }}</h5>
|
||||||
<div v-for="option in options" :key="option.name" class="option-wrapper">
|
<template v-for="option in options" :key="option.name">
|
||||||
<!-- 偏好项 -->
|
<div class="option-wrapper" v-permission="option.permission || []">
|
||||||
<span>{{ option.name }}</span>
|
<!-- 偏好项 -->
|
||||||
<!-- 偏好值 -->
|
<span>{{ option.name }}</span>
|
||||||
<form-wrapper :name="option.key"
|
<!-- 偏好值 -->
|
||||||
:type="option.type as string"
|
<form-wrapper :name="option.key"
|
||||||
:default-value="option.defaultVal"
|
:type="option.type as string"
|
||||||
:options="option.options"
|
:default-value="option.defaultVal"
|
||||||
@input-change="handleChange" />
|
:options="option.options"
|
||||||
</div>
|
@input-change="handleChange" />
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@@ -26,6 +28,7 @@
|
|||||||
name: string;
|
name: string;
|
||||||
key: string;
|
key: string;
|
||||||
type?: string;
|
type?: string;
|
||||||
|
permission?: string[];
|
||||||
defaultVal?: boolean | string | number;
|
defaultVal?: boolean | string | number;
|
||||||
options?: Array<RadioOption>;
|
options?: Array<RadioOption>;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -78,6 +78,7 @@
|
|||||||
name: '主机列表',
|
name: '主机列表',
|
||||||
key: 'hostView',
|
key: 'hostView',
|
||||||
type: 'radio-group',
|
type: 'radio-group',
|
||||||
|
permission: ['asset:host:query'],
|
||||||
defaultVal: appStore.hostView,
|
defaultVal: appStore.hostView,
|
||||||
options: [{ value: 'table', label: '表格' }, { value: 'card', label: '卡片' }]
|
options: [{ value: 'table', label: '表格' }, { value: 'card', label: '卡片' }]
|
||||||
},
|
},
|
||||||
@@ -85,6 +86,7 @@
|
|||||||
name: '主机秘钥',
|
name: '主机秘钥',
|
||||||
key: 'hostKeyView',
|
key: 'hostKeyView',
|
||||||
type: 'radio-group',
|
type: 'radio-group',
|
||||||
|
permission: ['asset:host-key:query'],
|
||||||
defaultVal: appStore.hostKeyView,
|
defaultVal: appStore.hostKeyView,
|
||||||
options: [{ value: 'table', label: '表格' }, { value: 'card', label: '卡片' }]
|
options: [{ value: 'table', label: '表格' }, { value: 'card', label: '卡片' }]
|
||||||
},
|
},
|
||||||
@@ -92,6 +94,7 @@
|
|||||||
name: '主机身份',
|
name: '主机身份',
|
||||||
key: 'hostIdentityView',
|
key: 'hostIdentityView',
|
||||||
type: 'radio-group',
|
type: 'radio-group',
|
||||||
|
permission: ['asset:host-identity:query'],
|
||||||
defaultVal: appStore.hostIdentityView,
|
defaultVal: appStore.hostIdentityView,
|
||||||
options: [{ value: 'table', label: '表格' }, { value: 'card', label: '卡片' }]
|
options: [{ value: 'table', label: '表格' }, { value: 'card', label: '卡片' }]
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -117,16 +117,31 @@
|
|||||||
</li>
|
</li>
|
||||||
<!-- 偏好设置 -->
|
<!-- 偏好设置 -->
|
||||||
<li>
|
<li>
|
||||||
<a-tooltip content="偏好设置">
|
<a-popover :popup-visible="tippedPreference" position="br">
|
||||||
<a-button class="nav-btn"
|
<template #title>
|
||||||
type="outline"
|
💡 点击这里可以修改系统偏好~
|
||||||
shape="circle"
|
</template>
|
||||||
@click="openGlobalSetting">
|
<template #content>
|
||||||
<template #icon>
|
<span style="line-height: 1.8">
|
||||||
<icon-settings />
|
◾ 可以修改页面布局<br>
|
||||||
</template>
|
◾ 可以切换显示视图
|
||||||
</a-button>
|
</span>
|
||||||
</a-tooltip>
|
<div class="tips-buttons">
|
||||||
|
<a-button size="mini" class="mr8" @click="closePreferenceTip(false)">关闭</a-button>
|
||||||
|
<a-button size="mini" type="primary" @click="closePreferenceTip(true)">不在提醒</a-button>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
<a-tooltip content="偏好设置">
|
||||||
|
<a-button class="nav-btn"
|
||||||
|
type="outline"
|
||||||
|
shape="circle"
|
||||||
|
@click="openGlobalSetting">
|
||||||
|
<template #icon>
|
||||||
|
<icon-settings />
|
||||||
|
</template>
|
||||||
|
</a-button>
|
||||||
|
</a-tooltip>
|
||||||
|
</a-popover>
|
||||||
</li>
|
</li>
|
||||||
<!-- 用户信息 -->
|
<!-- 用户信息 -->
|
||||||
<li>
|
<li>
|
||||||
@@ -177,6 +192,8 @@
|
|||||||
import MessageBox from '../message-box/index.vue';
|
import MessageBox from '../message-box/index.vue';
|
||||||
import { openGlobalSettingKey, toggleDrawerMenuKey } from '@/types/symbol';
|
import { openGlobalSettingKey, toggleDrawerMenuKey } from '@/types/symbol';
|
||||||
|
|
||||||
|
// TODO 默认值
|
||||||
|
const tippedPreference = ref(true);
|
||||||
const appStore = useAppStore();
|
const appStore = useAppStore();
|
||||||
const userStore = useUserStore();
|
const userStore = useUserStore();
|
||||||
const { logout } = useUser();
|
const { logout } = useUser();
|
||||||
@@ -201,7 +218,9 @@
|
|||||||
valueLight: 'light',
|
valueLight: 'light',
|
||||||
storageKey: 'arco-theme',
|
storageKey: 'arco-theme',
|
||||||
onChanged(dark: boolean) {
|
onChanged(dark: boolean) {
|
||||||
appStore.toggleTheme(dark);
|
appStore.updateSettings({
|
||||||
|
theme: dark ? 'dark' : 'light'
|
||||||
|
});
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -232,6 +251,15 @@
|
|||||||
|
|
||||||
// 注入收缩菜单
|
// 注入收缩菜单
|
||||||
const toggleDrawerMenu = inject(toggleDrawerMenuKey) as () => void;
|
const toggleDrawerMenu = inject(toggleDrawerMenuKey) as () => void;
|
||||||
|
|
||||||
|
// 关闭偏好提示
|
||||||
|
const closePreferenceTip = (ack: boolean) => {
|
||||||
|
tippedPreference.value = false;
|
||||||
|
if (ack) {
|
||||||
|
// TODO 修改
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped lang="less">
|
<style scoped lang="less">
|
||||||
@@ -296,4 +324,11 @@
|
|||||||
margin-top: 0;
|
margin-top: 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.tips-buttons {
|
||||||
|
margin-top: 12px;
|
||||||
|
display: flex;
|
||||||
|
justify-content: flex-end;
|
||||||
|
}
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import { FavoriteType, addFavorite, cancelFavorite } from '@/api/meta/favorite';
|
|||||||
export default function useFavorite(type: FavoriteType) {
|
export default function useFavorite(type: FavoriteType) {
|
||||||
const toggle = async (record: any, id: number, cancelField = 'favorite') => {
|
const toggle = async (record: any, id: number, cancelField = 'favorite') => {
|
||||||
const request = { relId: id, type };
|
const request = { relId: id, type };
|
||||||
|
Message.clear();
|
||||||
const loading = Message.loading(record[cancelField] ? '取消中' : '收藏中');
|
const loading = Message.loading(record[cancelField] ? '取消中' : '收藏中');
|
||||||
try {
|
try {
|
||||||
if (record[cancelField]) {
|
if (record[cancelField]) {
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ export {
|
|||||||
useMenuStore,
|
useMenuStore,
|
||||||
useUserStore,
|
useUserStore,
|
||||||
useTabBarStore,
|
useTabBarStore,
|
||||||
useCacheStore
|
useCacheStore,
|
||||||
};
|
};
|
||||||
|
|
||||||
export default pinia;
|
export default pinia;
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
import { defineStore } from 'pinia';
|
import { defineStore } from 'pinia';
|
||||||
import { AppState } from './types';
|
import { AppState } from './types';
|
||||||
import TimeScale from 'echarts/types/src/scale/Time';
|
|
||||||
|
|
||||||
const defaultConfig: AppState = {
|
const defaultConfig: AppState = {
|
||||||
// 应用设置
|
// 应用设置
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
export type Theme = 'light' | 'dark'
|
type Theme = 'light' | 'dark';
|
||||||
export type Device = 'desktop' | 'mobile'
|
type Device = 'desktop' | 'mobile';
|
||||||
export type ViewType = 'table' | 'card' | undefined
|
type ViewType = 'table' | 'card' | undefined;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 应用状态
|
* 应用状态
|
||||||
|
|||||||
Reference in New Issue
Block a user