mirror of
https://github.com/geekgeekrun/geekgeekrun.git
synced 2026-09-08 17:09:07 +08:00
add rechatLimitDay field; enhance ui text
This commit is contained in:
@@ -8,6 +8,7 @@
|
|||||||
},
|
},
|
||||||
"expectJobRegExpStr": "",
|
"expectJobRegExpStr": "",
|
||||||
"autoReminder": {
|
"autoReminder": {
|
||||||
"throttleIntervalMinutes": 10
|
"throttleIntervalMinutes": 10,
|
||||||
|
"rechatLimitDay": 21
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -19,6 +19,7 @@ import { BossInfo } from '@geekgeekrun/sqlite-plugin/dist/entity/BossInfo'
|
|||||||
|
|
||||||
const throttleIntervalMinutes =
|
const throttleIntervalMinutes =
|
||||||
readConfigFile('boss.json').autoReminder?.throttleIntervalMinutes ?? 10
|
readConfigFile('boss.json').autoReminder?.throttleIntervalMinutes ?? 10
|
||||||
|
const rechatLimitDay = readConfigFile('boss.json').autoReminder?.rechatLimitDay ?? 21
|
||||||
const dbInitPromise = initDb(getPublicDbFilePath())
|
const dbInitPromise = initDb(getPublicDbFilePath())
|
||||||
|
|
||||||
export const pageMapByName: {
|
export const pageMapByName: {
|
||||||
@@ -176,13 +177,17 @@ const mainLoop = async () => {
|
|||||||
document.querySelector('.main-wrap .chat-user')?.__vue__?.list
|
document.querySelector('.main-wrap .chat-user')?.__vue__?.list
|
||||||
`
|
`
|
||||||
)) as Array<ChatListItem>
|
)) as Array<ChatListItem>
|
||||||
const toCheckItemAtIndex = friendListData.findIndex(
|
const toCheckItemAtIndex = friendListData.findIndex((it, index) => {
|
||||||
(it, index) =>
|
return (
|
||||||
index >= cursorToContinueFind &&
|
index >= cursorToContinueFind &&
|
||||||
|
(rechatLimitDay && it.updateTime
|
||||||
|
? +new Date() - it.updateTime < rechatLimitDay * 24 * 60 * 60 * 1000
|
||||||
|
: true) &&
|
||||||
((it.lastIsSelf && it.lastMsgStatus === MsgStatus.HAS_READ) ||
|
((it.lastIsSelf && it.lastMsgStatus === MsgStatus.HAS_READ) ||
|
||||||
canNotConfirmIfHasReadMsgTemplateList.some((regExp) => regExp.test(it.lastText))) &&
|
canNotConfirmIfHasReadMsgTemplateList.some((regExp) => regExp.test(it.lastText))) &&
|
||||||
!it.unreadCount
|
!it.unreadCount
|
||||||
)
|
)
|
||||||
|
})
|
||||||
|
|
||||||
if (toCheckItemAtIndex < 0) {
|
if (toCheckItemAtIndex < 0) {
|
||||||
const isFinished = await pageMapByName.boss!.evaluate(
|
const isFinished = await pageMapByName.boss!.evaluate(
|
||||||
|
|||||||
@@ -11,16 +11,35 @@
|
|||||||
>编辑Cookie</el-button
|
>编辑Cookie</el-button
|
||||||
>
|
>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="复聊话术" class="color-orange">
|
<el-form-item label="跟进话术" class="color-orange">
|
||||||
当发现已读不回的Boss时,将向Boss发出“[盼回复]”表情
|
当发现已读不回的Boss时,将向Boss发出“[盼回复]”表情
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="复聊间隔" prop="throttleIntervalMinutes">
|
<el-form-item label="跟进间隔(分钟)" prop="throttleIntervalMinutes">
|
||||||
<el-input
|
<el-input-number
|
||||||
v-model="formContent.autoReminder.throttleIntervalMinutes"
|
v-model="formContent.autoReminder.throttleIntervalMinutes"
|
||||||
class="w-100px"
|
class="w-150px"
|
||||||
min="3"
|
:min="3"
|
||||||
|
:precision="1"
|
||||||
|
:step="0.5"
|
||||||
@blur="handleThrottleIntervalMinutesBlur"
|
@blur="handleThrottleIntervalMinutesBlur"
|
||||||
/> 分钟内不向同一Boss多次复聊
|
/> 分钟内不多次跟进同一Boss
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="跟进时限(天)" prop="rechatLimitDay">
|
||||||
|
<div>
|
||||||
|
<div><el-checkbox v-model="enableRechatLimit" /> 启用</div>
|
||||||
|
<el-input-number
|
||||||
|
v-model="formContent.autoReminder.rechatLimitDay"
|
||||||
|
class="w-150px"
|
||||||
|
:min="0"
|
||||||
|
:precision="1"
|
||||||
|
:step="0.5"
|
||||||
|
:disabled="!enableRechatLimit"
|
||||||
|
/> 天<br />
|
||||||
|
<div v-if="enableRechatLimit">
|
||||||
|
不再跟进 (<span class="text-orange">{{ rechatLimitDateString }}</span>)之前列表中没有进展的聊天
|
||||||
|
</div>
|
||||||
|
<div v-else>这将会跟进列表中所有聊天(<span class="text-orange">不建议</span>)</div>
|
||||||
|
</div>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item class="last-form-item">
|
<el-form-item class="last-form-item">
|
||||||
<el-button type="primary" @click="handleSubmit">开始提醒</el-button>
|
<el-button type="primary" @click="handleSubmit">开始提醒</el-button>
|
||||||
@@ -30,27 +49,51 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ref } from 'vue'
|
import { computed, nextTick, onUnmounted, ref, watch } from 'vue'
|
||||||
import { ElForm } from 'element-plus'
|
import { dayjs, ElForm } from 'element-plus'
|
||||||
import { useRouter } from 'vue-router'
|
import { useRouter } from 'vue-router'
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
|
|
||||||
const formContent = ref({
|
const formContent = ref({
|
||||||
autoReminder: {
|
autoReminder: {
|
||||||
throttleIntervalMinutes: 10
|
throttleIntervalMinutes: 10,
|
||||||
|
rechatLimitDay: 21
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
const enableRechatLimit = computed({
|
||||||
|
get() {
|
||||||
|
return Boolean(formContent.value.autoReminder?.rechatLimitDay)
|
||||||
|
},
|
||||||
|
set(val) {
|
||||||
|
if (!val) {
|
||||||
|
formContent.value.autoReminder.rechatLimitDay = 0
|
||||||
|
} else {
|
||||||
|
formContent.value.autoReminder.rechatLimitDay = 21
|
||||||
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
electron.ipcRenderer.invoke('fetch-config-file-content').then((res) => {
|
electron.ipcRenderer.invoke('fetch-config-file-content').then((res) => {
|
||||||
formContent.value.autoReminder = res.config['boss.json']?.autoReminder ?? {
|
const conf = res.config['boss.json']?.autoReminder || {}
|
||||||
throttleIntervalMinutes: 10
|
conf.throttleIntervalMinutes = conf.throttleIntervalMinutes ?? 10
|
||||||
}
|
conf.rechatLimitDay = conf.rechatLimitDay ?? 21
|
||||||
|
|
||||||
|
formContent.value.autoReminder = conf
|
||||||
})
|
})
|
||||||
|
|
||||||
const formRules = {
|
const formRules = {
|
||||||
throttleIntervalMinutes: {
|
throttleIntervalMinutes: {
|
||||||
trigger: 'blur',
|
validator(_, value, cb) {
|
||||||
validator (_, value, cb) {
|
if (/[^0-9.]/.test(String(value)) || isNaN(parseFloat(value)) || isNaN(Number(value))) {
|
||||||
|
cb(new Error(`请输入数字!`))
|
||||||
|
} else {
|
||||||
|
cb()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
rechatLimitDay: {
|
||||||
|
validator(_, value, cb) {
|
||||||
if (/[^0-9.]/.test(String(value)) || isNaN(parseFloat(value)) || isNaN(Number(value))) {
|
if (/[^0-9.]/.test(String(value)) || isNaN(parseFloat(value)) || isNaN(Number(value))) {
|
||||||
cb(new Error(`请输入数字!`))
|
cb(new Error(`请输入数字!`))
|
||||||
} else {
|
} else {
|
||||||
@@ -61,6 +104,18 @@ const formRules = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const formRef = ref<InstanceType<typeof ElForm>>()
|
const formRef = ref<InstanceType<typeof ElForm>>()
|
||||||
|
watch(
|
||||||
|
() => formContent.value.autoReminder,
|
||||||
|
() => {
|
||||||
|
nextTick(() => {
|
||||||
|
formRef.value?.validate?.()
|
||||||
|
})
|
||||||
|
},
|
||||||
|
{
|
||||||
|
immediate: true
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
const handleSubmit = async () => {
|
const handleSubmit = async () => {
|
||||||
await formRef.value!.validate()
|
await formRef.value!.validate()
|
||||||
await electron.ipcRenderer.invoke('save-config-file-from-ui', JSON.stringify(formContent.value))
|
await electron.ipcRenderer.invoke('save-config-file-from-ui', JSON.stringify(formContent.value))
|
||||||
@@ -69,7 +124,7 @@ const handleSubmit = async () => {
|
|||||||
query: { flow: 'read-no-reply-reminder' }
|
query: { flow: 'read-no-reply-reminder' }
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
function handleThrottleIntervalMinutesBlur () {
|
function handleThrottleIntervalMinutesBlur() {
|
||||||
if (formContent.value.autoReminder.throttleIntervalMinutes < 3) {
|
if (formContent.value.autoReminder.throttleIntervalMinutes < 3) {
|
||||||
formContent.value.autoReminder.throttleIntervalMinutes = 3
|
formContent.value.autoReminder.throttleIntervalMinutes = 3
|
||||||
}
|
}
|
||||||
@@ -81,6 +136,23 @@ function handleThrottleIntervalMinutesBlur () {
|
|||||||
const handleClickLaunchLogin = () => {
|
const handleClickLaunchLogin = () => {
|
||||||
router.replace('/cookieAssistant')
|
router.replace('/cookieAssistant')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const currentStamp = ref(new Date())
|
||||||
|
let timer = 0
|
||||||
|
function updateCurrentStamp() {
|
||||||
|
currentStamp.value = new Date()
|
||||||
|
timer = window.setTimeout(updateCurrentStamp, 1000)
|
||||||
|
}
|
||||||
|
updateCurrentStamp()
|
||||||
|
onUnmounted(() => {
|
||||||
|
window.clearTimeout(timer)
|
||||||
|
})
|
||||||
|
|
||||||
|
const rechatLimitDateString = computed(() => {
|
||||||
|
return dayjs(
|
||||||
|
+currentStamp.value - formContent.value.autoReminder.rechatLimitDay * 24 * 60 * 60 * 1000
|
||||||
|
).format('YYYY-MM-DD HH:mm:ss')
|
||||||
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped lang="scss">
|
<style scoped lang="scss">
|
||||||
|
|||||||
Reference in New Issue
Block a user