refactor(qdreader): align account menu with rabbit pattern
This commit is contained in:
@@ -4,7 +4,7 @@
|
||||
//[author: Hermes]
|
||||
//[service: BOSS]
|
||||
//[class: 工具类]
|
||||
// [version: 2.13.0]
|
||||
// [version: 2.14.0]
|
||||
// [platform: web,qq,wx,tg,tb,fs,we]
|
||||
// [public: false]
|
||||
// [price: 0]
|
||||
@@ -279,7 +279,7 @@ function contentText() {
|
||||
}
|
||||
function usage() {
|
||||
return [
|
||||
"启点读书签到插件 v2.13.0",
|
||||
"启点读书签到插件 v2.14.0",
|
||||
"【一级菜单】",
|
||||
"账号管理:启点账号",
|
||||
"执行查询:启点查询",
|
||||
@@ -971,18 +971,17 @@ function listenInput(timeoutMs) {
|
||||
function accountMenuText(store, bind) {
|
||||
var uids = visibleUids(store || getStore(), bind || getBindStore(), false)
|
||||
var remarks = remarksForStore(store || {})
|
||||
var lines = ["启点账号管理"]
|
||||
if (!uids.length) lines.push("当前用户还没有保存启点读书CK")
|
||||
var lines = ["启点账号管理", "账号列表如下:"]
|
||||
if (!uids.length) lines.push("暂无账号,请回复 0 添加/更新账号")
|
||||
else {
|
||||
lines.push("现有账号:")
|
||||
for (var i = 0; i < uids.length; i++) {
|
||||
var uid = uids[i]
|
||||
lines.push((i + 1) + ". " + maskUid(uid) + (remarks[uid] ? "(" + remarks[uid] + ")" : ""))
|
||||
lines.push((i + 1) + "、" + maskUid(uid) + (remarks[uid] ? "[" + remarks[uid] + "]" : ""))
|
||||
}
|
||||
}
|
||||
lines.push("回复编号进入账号配置,例如 1")
|
||||
lines.push("回复负编号删除账号,例如 -1")
|
||||
lines.push("回复 a 添加/更新账号;all 清空账号;q 退出")
|
||||
lines.push("0、添加/更新账号")
|
||||
lines.push("负编号删除账号,例如 -1")
|
||||
lines.push("q、退出")
|
||||
return lines.join("\n")
|
||||
}
|
||||
function queryMenuText() {
|
||||
@@ -1061,7 +1060,7 @@ function accountDetailText(uid, store, bind) {
|
||||
function accountConfigText(uid, store, bind) {
|
||||
var detail = accountDetailText(uid, store, bind)
|
||||
if (/^(无权|未找到)/.test(detail)) return detail
|
||||
return detail + "\n\n账号配置:\n1. 修改备注\n2. 任务配置\n3. 立即签到该账号\n-1. 删除该账号\nq. 返回/退出\n请回复选项"
|
||||
return detail + "\n\n账号操作:\n1、修改备注\n2、任务配置\n3、立即签到该账号\n-1、删除该账号\nq、返回/退出"
|
||||
}
|
||||
function accountConfigMenu(uid, store, bind) {
|
||||
if (!uid) return reply("未选择账号,已退出")
|
||||
@@ -1094,7 +1093,7 @@ function accountMenu(store, bind) {
|
||||
reply(accountMenuText(store, bind))
|
||||
var op = listenInput(60000)
|
||||
if (!op || /^(q|退出|取消)$/i.test(op)) return reply("已退出")
|
||||
if (/^(a|add|添加|新增|更新)$/i.test(op)) {
|
||||
if (/^(0|a|add|添加|新增|更新)$/i.test(op)) {
|
||||
reply("请在60秒内发送 QX 抓到的完整 Cookie(q:退出)")
|
||||
var ck = listenInput(60000)
|
||||
if (!ck || /^(q|退出|取消)$/i.test(ck)) return reply("已退出")
|
||||
@@ -1102,7 +1101,6 @@ function accountMenu(store, bind) {
|
||||
var remarkMsg = (save.ok && save.uids.length === 1) ? maybePromptRemark(save.uids[0], store) : ""
|
||||
return reply(save.text + remarkMsg)
|
||||
}
|
||||
if (/^(all|清空|全部)$/i.test(op)) return reply(handleDelete("删除 all", store, bind))
|
||||
var n = parseInt(op, 10)
|
||||
if (!isNaN(n) && String(n) === op.replace(/^\+/, "")) {
|
||||
if (n > 0) {
|
||||
@@ -1115,18 +1113,6 @@ function accountMenu(store, bind) {
|
||||
return reply(handleDelete("删除 " + uids[idx - 1], store, bind))
|
||||
}
|
||||
}
|
||||
if (/^(查看|查询|列表|账号)$/i.test(op)) return reply(accountListText(store, bind))
|
||||
if (/^(详情|备注|改名|名称)$/i.test(op)) return accountDetailMenu(store, bind)
|
||||
if (/^(任务|配置|开关)$/i.test(op)) {
|
||||
var taskUid = chooseUid(store, bind, "请选择要配置任务的账号:")
|
||||
if (!taskUid) return reply("已退出")
|
||||
return taskMenuForUid(taskUid)
|
||||
}
|
||||
if (/^(删除)$/i.test(op)) {
|
||||
var uid = chooseUid(store, bind, "请选择要删除的账号:")
|
||||
if (!uid) return reply("已退出")
|
||||
return reply(handleDelete("删除 " + uid, store, bind))
|
||||
}
|
||||
return reply("未识别选项,已退出")
|
||||
}
|
||||
function queryMenu() {
|
||||
|
||||
Reference in New Issue
Block a user