mirror of
https://github.com/geekgeekrun/geekgeekrun.git
synced 2026-09-06 16:07:17 +08:00
add rechatLimitDay field; enhance ui text
This commit is contained in:
@@ -19,6 +19,7 @@ import { BossInfo } from '@geekgeekrun/sqlite-plugin/dist/entity/BossInfo'
|
||||
|
||||
const throttleIntervalMinutes =
|
||||
readConfigFile('boss.json').autoReminder?.throttleIntervalMinutes ?? 10
|
||||
const rechatLimitDay = readConfigFile('boss.json').autoReminder?.rechatLimitDay ?? 21
|
||||
const dbInitPromise = initDb(getPublicDbFilePath())
|
||||
|
||||
export const pageMapByName: {
|
||||
@@ -176,13 +177,17 @@ const mainLoop = async () => {
|
||||
document.querySelector('.main-wrap .chat-user')?.__vue__?.list
|
||||
`
|
||||
)) as Array<ChatListItem>
|
||||
const toCheckItemAtIndex = friendListData.findIndex(
|
||||
(it, index) =>
|
||||
const toCheckItemAtIndex = friendListData.findIndex((it, index) => {
|
||||
return (
|
||||
index >= cursorToContinueFind &&
|
||||
(rechatLimitDay && it.updateTime
|
||||
? +new Date() - it.updateTime < rechatLimitDay * 24 * 60 * 60 * 1000
|
||||
: true) &&
|
||||
((it.lastIsSelf && it.lastMsgStatus === MsgStatus.HAS_READ) ||
|
||||
canNotConfirmIfHasReadMsgTemplateList.some((regExp) => regExp.test(it.lastText))) &&
|
||||
!it.unreadCount
|
||||
)
|
||||
)
|
||||
})
|
||||
|
||||
if (toCheckItemAtIndex < 0) {
|
||||
const isFinished = await pageMapByName.boss!.evaluate(
|
||||
|
||||
@@ -11,16 +11,35 @@
|
||||
>编辑Cookie</el-button
|
||||
>
|
||||
</el-form-item>
|
||||
<el-form-item label="复聊话术" class="color-orange">
|
||||
<el-form-item label="跟进话术" class="color-orange">
|
||||
当发现已读不回的Boss时,将向Boss发出“[盼回复]”表情
|
||||
</el-form-item>
|
||||
<el-form-item label="复聊间隔" prop="throttleIntervalMinutes">
|
||||
<el-input
|
||||
<el-form-item label="跟进间隔(分钟)" prop="throttleIntervalMinutes">
|
||||
<el-input-number
|
||||
v-model="formContent.autoReminder.throttleIntervalMinutes"
|
||||
class="w-100px"
|
||||
min="3"
|
||||
class="w-150px"
|
||||
:min="3"
|
||||
:precision="1"
|
||||
:step="0.5"
|
||||
@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 class="last-form-item">
|
||||
<el-button type="primary" @click="handleSubmit">开始提醒</el-button>
|
||||
@@ -30,27 +49,51 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref } from 'vue'
|
||||
import { ElForm } from 'element-plus'
|
||||
import { computed, nextTick, onUnmounted, ref, watch } from 'vue'
|
||||
import { dayjs, ElForm } from 'element-plus'
|
||||
import { useRouter } from 'vue-router'
|
||||
const router = useRouter()
|
||||
|
||||
const formContent = ref({
|
||||
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) => {
|
||||
formContent.value.autoReminder = res.config['boss.json']?.autoReminder ?? {
|
||||
throttleIntervalMinutes: 10
|
||||
}
|
||||
const conf = res.config['boss.json']?.autoReminder || {}
|
||||
conf.throttleIntervalMinutes = conf.throttleIntervalMinutes ?? 10
|
||||
conf.rechatLimitDay = conf.rechatLimitDay ?? 21
|
||||
|
||||
formContent.value.autoReminder = conf
|
||||
})
|
||||
|
||||
const formRules = {
|
||||
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))) {
|
||||
cb(new Error(`请输入数字!`))
|
||||
} else {
|
||||
@@ -61,6 +104,18 @@ const formRules = {
|
||||
}
|
||||
|
||||
const formRef = ref<InstanceType<typeof ElForm>>()
|
||||
watch(
|
||||
() => formContent.value.autoReminder,
|
||||
() => {
|
||||
nextTick(() => {
|
||||
formRef.value?.validate?.()
|
||||
})
|
||||
},
|
||||
{
|
||||
immediate: true
|
||||
}
|
||||
)
|
||||
|
||||
const handleSubmit = async () => {
|
||||
await formRef.value!.validate()
|
||||
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' }
|
||||
})
|
||||
}
|
||||
function handleThrottleIntervalMinutesBlur () {
|
||||
function handleThrottleIntervalMinutesBlur() {
|
||||
if (formContent.value.autoReminder.throttleIntervalMinutes < 3) {
|
||||
formContent.value.autoReminder.throttleIntervalMinutes = 3
|
||||
}
|
||||
@@ -81,6 +136,23 @@ function handleThrottleIntervalMinutesBlur () {
|
||||
const handleClickLaunchLogin = () => {
|
||||
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>
|
||||
|
||||
<style scoped lang="scss">
|
||||
|
||||
Reference in New Issue
Block a user