feat: 增加反馈消息闭环相关功能及文件

新增反馈目标登录白名单、账户切换守卫、待确认反馈存储、缓存生命周期管理,补充相关文档及截图,完善消息跳转逻辑
This commit is contained in:
hujun
2026-10-05 20:11:24 +08:00
parent 6b16d4fd55
commit 1723363b7e
154 changed files with 16407 additions and 114 deletions
+2
View File
@@ -39,6 +39,8 @@
afterLoginUrl = '/packages/account/messages/messages'
} else if (options?.['resumeHelp'] == '1') {
afterLoginUrl = '/packages/content/help/help?feedback=1'
const feedbackId = options?.['feedbackId'] ?? ''
if (/^[1-9][0-9]{0,9}$/.test(feedbackId) && !(feedbackId.length == 10 && feedbackId > '2147483647')) afterLoginUrl += '&feedbackId=' + feedbackId
} else if (options?.['resumeAssistant'] == '1') {
const target = assistantReturnPath(options?.['assessmentId'] ?? '', options?.['productIds'] ?? '', options?.['chatId'] ?? '', options?.['from'] ?? '', options?.['revisionId'] ?? '')
if (target.length > 0) afterLoginUrl = target
+6 -2
View File
@@ -38,7 +38,7 @@
const categoryLabel = computed((): string => tabs.find((item: MessageTab): boolean => item.type == tab.value)?.label ?? '')
const snapshotId = ref(''); const nextBeforeId = ref(''); const loading = ref(false); const loadingMore = ref(false)
const marking = ref(false); const opening = ref(''); const error = ref(''); const actionError = ref(''); const paginationError = ref('')
let visible = false; let generation = 0
let visible = false; let generation = 0; let owner = ''
const login = () => { uni.redirectTo({ url: '/packages/account/login/login?resumeMessages=1' }) }
const reset = () => { notices.value = []; unreadCount.value = 0; snapshotId.value = ''; nextBeforeId.value = ''; error.value = ''; actionError.value = ''; paginationError.value = ''; marking.value = false; opening.value = ''; loading.value = false; loadingMore.value = false }
// UTS原生端不支持局部函数前向引用,账户切换回调在加载函数声明后绑定。
@@ -55,6 +55,8 @@
if (!visible || loading.value || loadingMore.value || marking.value || opening.value.length > 0) return
const token = getSession()?.getString('token') ?? ''
if (token.length == 0) { reset(); login(); return }
if (append && token != owner) { generation++; reset(); reloadAfterAccountChange(); return }
owner = token
const request = append ? generation : ++generation
if (append) { if (nextBeforeId.value.length == 0) return; loadingMore.value = true; paginationError.value = '' }
else { reset(); loading.value = true }
@@ -78,6 +80,7 @@
const changeTab = (type: string) => { if (type == tab.value || marking.value || opening.value.length > 0) return; generation++; reset(); tab.value = type; reload() }
const openNotice = async (item: UserMessage) => {
if (opening.value.length > 0 || marking.value || loading.value || loadingMore.value) return
if (!current(generation, owner)) return
const token = getSession()?.getString('token') ?? ''; if (token.length == 0) { login(); return }
const request = generation; opening.value = item.id; actionError.value = ''
try {
@@ -86,7 +89,7 @@
const unread = await readMessage(item.id)
if (!current(request, token)) return
item.isRead = true; unreadCount.value = unread
uni.showModal({ title: detail.item.title, content: detail.item.content + (detail.targetUnavailable ? '\n关联评估已不可用,可从融资档案查看其他记录。' : ''),
uni.showModal({ title: detail.item.title, content: detail.item.content + (detail.targetUnavailable ? '\n关联记录已不可用,请刷新或查看其他记录。' : ''),
showCancel: detail.targetUrl.length > 0, cancelText: '关闭', confirmText: detail.targetLabel.length > 0 ? detail.targetLabel : '知道了',
success: (result) => { if (result.confirm && detail.targetUrl.length > 0 && current(request, token)) uni.navigateTo({ url: detail.targetUrl }) } })
} catch (err) { if (current(request, token)) actionError.value = err instanceof Error ? err.message : '消息读取失败,请重试' }
@@ -94,6 +97,7 @@
}
const markAllRead = async () => {
if (marking.value || opening.value.length > 0 || loading.value || loadingMore.value || snapshotId.value.length == 0 || snapshotId.value == '0') return
if (!current(generation, owner)) return
const token = getSession()?.getString('token') ?? ''; if (token.length == 0) { login(); return }
const request = generation; marking.value = true; actionError.value = ''
try {