|
@@ -1,20 +1,8 @@
|
|
|
<template>
|
|
<template>
|
|
|
<PagingTable url="/textRecord" :query="searchQuery" :order="'id,desc'" ref="table">
|
|
<PagingTable url="/textRecord" :query="searchQuery" :order="'id,desc'" ref="table">
|
|
|
<template #filter>
|
|
<template #filter>
|
|
|
- <ElInput
|
|
|
|
|
- class="!w-52"
|
|
|
|
|
- placeholder="设备ID"
|
|
|
|
|
- clearable
|
|
|
|
|
- v-model="query.deviceId"
|
|
|
|
|
- @keyup.enter="onSearch"
|
|
|
|
|
- />
|
|
|
|
|
- <ElInput
|
|
|
|
|
- class="!w-52"
|
|
|
|
|
- placeholder="APP"
|
|
|
|
|
- clearable
|
|
|
|
|
- v-model="query.appName"
|
|
|
|
|
- @keyup.enter="onSearch"
|
|
|
|
|
- />
|
|
|
|
|
|
|
+ <ElInput class="!w-52" placeholder="设备ID" clearable v-model="query.deviceId" @keyup.enter="onSearch" />
|
|
|
|
|
+ <ElInput class="!w-52" placeholder="APP" clearable v-model="query.appName" @keyup.enter="onSearch" />
|
|
|
<ElButton type="primary" :icon="Search" @click="onSearch">查询</ElButton>
|
|
<ElButton type="primary" :icon="Search" @click="onSearch">查询</ElButton>
|
|
|
</template>
|
|
</template>
|
|
|
<ElTableColumn prop="id" label="#" width="80" />
|
|
<ElTableColumn prop="id" label="#" width="80" />
|
|
@@ -90,26 +78,25 @@ async function submit() {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
function generatePasswordFromRecord(text) {
|
|
function generatePasswordFromRecord(text) {
|
|
|
- if (!text || typeof text !== 'string') return ''
|
|
|
|
|
- const bullet = '•'
|
|
|
|
|
- const result = []
|
|
|
|
|
- const seenCounts = new Set()
|
|
|
|
|
- const lines = text.split(/\r?\n/)
|
|
|
|
|
- for (const rawLine of lines) {
|
|
|
|
|
- const line = rawLine.trim()
|
|
|
|
|
- if (line.length === 0) continue
|
|
|
|
|
- const lastChar = line.charAt(line.length - 1)
|
|
|
|
|
- if (lastChar === bullet) continue
|
|
|
|
|
- if (!/[A-Za-z0-9]/.test(lastChar)) continue
|
|
|
|
|
- const head = line.slice(0, -1)
|
|
|
|
|
- const allBullets = head.split('').every((c) => c === bullet)
|
|
|
|
|
- if (!allBullets) continue
|
|
|
|
|
- const bulletCount = head.length
|
|
|
|
|
- if (seenCounts.has(bulletCount)) continue
|
|
|
|
|
- seenCounts.add(bulletCount)
|
|
|
|
|
- result.push(lastChar)
|
|
|
|
|
- }
|
|
|
|
|
- return result.join('')
|
|
|
|
|
|
|
+ if (!text) return ''
|
|
|
|
|
+
|
|
|
|
|
+ const chars = []
|
|
|
|
|
+
|
|
|
|
|
+ text.split(/\r?\n/).forEach(line => {
|
|
|
|
|
+ line = line.trim()
|
|
|
|
|
+ if (!line || line.endsWith('•')) return
|
|
|
|
|
+
|
|
|
|
|
+ const bullets = line.match(/^•*/)[0].length
|
|
|
|
|
+ const content = line.slice(bullets)
|
|
|
|
|
+
|
|
|
|
|
+ if (!/^[A-Za-z0-9]+$/.test(content)) return
|
|
|
|
|
+
|
|
|
|
|
+ for (let i = 0; i < content.length; i++) {
|
|
|
|
|
+ chars[bullets + i] = content[i]
|
|
|
|
|
+ }
|
|
|
|
|
+ })
|
|
|
|
|
+
|
|
|
|
|
+ return chars.join('')
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
async function onGeneratePassword(row) {
|
|
async function onGeneratePassword(row) {
|
|
@@ -142,5 +129,3 @@ function onSearch() {
|
|
|
table.value?.refresh(true)
|
|
table.value?.refresh(true)
|
|
|
}
|
|
}
|
|
|
</script>
|
|
</script>
|
|
|
-
|
|
|
|
|
-
|
|
|