diff --git a/password-xl-web/src/components/common/setting/ImportExcel.vue b/password-xl-web/src/components/common/setting/ImportExcel.vue index ee579a7..4dcabee 100644 --- a/password-xl-web/src/components/common/setting/ImportExcel.vue +++ b/password-xl-web/src/components/common/setting/ImportExcel.vue @@ -150,6 +150,19 @@ const importData = async (buffer: Buffer) => { let favorite = columnIndex.favorite !== -1 ? row.getCell(columnIndex.favorite) : null let customFields = columnIndex.customFields !== -1 ? row.getCell(columnIndex.customFields) : null + if (address && typeof address.value === 'object') { + address.value = address.value.text + } + if (username && typeof username.value === 'object') { + username.value = username.value.text + } + if (passwordValue && typeof passwordValue.value === 'object') { + passwordValue.value = passwordValue.value.text + } + if (remark && typeof remark.value === 'object') { + remark.value = remark.value.text + } + // 收藏 let favoriteValue = favorite && favorite.value === '是' diff --git a/password-xl-web/src/utils/global.ts b/password-xl-web/src/utils/global.ts index 92539a1..9a84527 100644 --- a/password-xl-web/src/utils/global.ts +++ b/password-xl-web/src/utils/global.ts @@ -51,13 +51,18 @@ export const searchStr = (searchText: string, value: string): boolean => { if (!value) return false; if (!searchText) return false; - const lowerSearchText = searchText.toLowerCase(); - const lowerValue = value.toLowerCase(); + try { + const lowerSearchText = searchText.toLowerCase(); + const lowerValue = value.toLowerCase(); - // 普通大小写忽略搜索 - if (lowerValue.includes(lowerSearchText)) { - return true; + // 普通大小写忽略搜索 + if (lowerValue.includes(lowerSearchText)) { + return true; + } + } catch (e) { + console.log(e) } + return false; }; @@ -121,7 +126,7 @@ export function randomPassword(generateRule: GenerateRule) { pool = pool.filter(Boolean) if (!pool.length) { - ElNotification.error({title: '生成失败',message: '请检查易混淆字符配置'}) + ElNotification.error({title: '生成失败', message: '请检查易混淆字符配置'}) return '' } @@ -425,13 +430,13 @@ const joinPassword = (password: Password) => { // 比较密码 export const comparePassword = (a: Password, b: Password): boolean => { - return joinPassword(a) ===joinPassword(b) + return joinPassword(a) === joinPassword(b) } // 获取当前域名地址 export const getLocationUrl = () => { let url = location.origin - if(url.startsWith('file://')){ + if (url.startsWith('file://')) { url += location.pathname } return url