feat: 登录盐放local里&表格行hover显示编辑按钮

This commit is contained in:
RubyLiu 2023-09-07 11:39:54 +08:00 committed by 刘瑞斌
parent 93dd304453
commit c60f7ffc8d
6 changed files with 22 additions and 14 deletions

View File

@ -9,7 +9,7 @@
</template>
<script lang="ts" setup>
import { computed, onBeforeMount, onMounted, watchEffect } from 'vue';
import { computed, onBeforeMount, onMounted } from 'vue';
import { useRouter } from 'vue-router';
import enUS from '@arco-design/web-vue/es/locale/lang/en-us';
import zhCN from '@arco-design/web-vue/es/locale/lang/zh-cn';

View File

@ -1,5 +1,5 @@
<template>
<div class="ms-base-tale">
<div class="ms-base-table">
<select-all
v-if="attrs.selectable && attrs.showSelectAll"
class="custom-action"
@ -101,7 +101,7 @@
</slot>
</div>
</a-tooltip>
<div>
<div class="edit-icon">
<MsIcon
v-if="item.editType && editActiveKey !== `${item.dataIndex}${rowIndex}` && !record.deleted"
class="ml-2 cursor-pointer"
@ -201,7 +201,7 @@
const editActiveKey = ref<string>('');
// inputRef
const currentInputRef = ref();
const { rowKey, editKey }: Partial<MsTableProps<any>> = attrs;
const { rowKey }: Partial<MsTableProps<any>> = attrs;
//
const currentSpanMethod = ({
rowIndex,
@ -369,7 +369,7 @@
</script>
<style lang="less" scoped>
.ms-base-tale {
.ms-base-table {
position: relative;
.custom-action {
position: absolute;
@ -386,5 +386,20 @@
.ms-table-edit-active {
color: rgb(var(--primary-5));
}
.edit-icon {
color: rgb(var(--primary-7));
opacity: 0;
}
:deep(.arco-table-hover) {
:not(.arco-table-dragging) {
.arco-table-tr:not(.arco-table-tr-empty):not(.arco-table-tr-summary):hover {
.arco-table-td:not(.arco-table-col-fixed-left):not(.arco-table-col-fixed-right) {
.edit-icon {
opacity: 1;
}
}
}
}
}
}
</style>

View File

@ -22,7 +22,7 @@ export default function useUser() {
};
const setSalt = (salt: string) => {
userStore.setSalt(salt);
localStorage.setItem('salt', salt);
};
const isLoginPage = () => {

View File

@ -29,7 +29,6 @@ const useUserStore = defineStore('user', {
id: undefined,
certification: undefined,
role: '',
salt: '',
}),
getters: {
@ -105,10 +104,6 @@ const useUserStore = defineStore('user', {
return false;
}
},
// 加盐
setSalt(salt: string) {
this.$patch({ salt });
},
},
});

View File

@ -18,6 +18,4 @@ export interface UserState {
role: RoleType;
lastOrganizationId?: string;
lastProjectId?: string;
// 盐
salt: string;
}

View File

@ -117,7 +117,7 @@
if (!errors) {
setLoading(true);
try {
const publicKey = userStore.salt;
const publicKey = localStorage.getItem('salt') || '';
await userStore.login({
username: encrypted(values.username, publicKey),
password: encrypted(values.password, publicKey),