fix(aihr): close Figma UI regression gaps
This commit is contained in:
@@ -84,20 +84,51 @@
|
||||
<button
|
||||
class="secondary-button"
|
||||
:class="{ active: feedbackVerdict === 'up' }"
|
||||
:disabled="feedbackSubmitting || Boolean(feedbackVerdict)"
|
||||
:disabled="feedbackSubmitting || Boolean(feedbackVerdict) || showNegativeFeedback"
|
||||
@click="feedback('up')"
|
||||
>
|
||||
有帮助
|
||||
</button>
|
||||
<button
|
||||
class="secondary-button"
|
||||
:class="{ active: feedbackVerdict === 'down', negative: feedbackVerdict === 'down' }"
|
||||
:class="{ active: feedbackVerdict === 'down' || showNegativeFeedback, negative: feedbackVerdict === 'down' || showNegativeFeedback }"
|
||||
:disabled="feedbackSubmitting || Boolean(feedbackVerdict)"
|
||||
@click="feedback('down')"
|
||||
@click="openNegativeFeedback"
|
||||
>
|
||||
没解决
|
||||
</button>
|
||||
</view>
|
||||
<view v-if="showNegativeFeedback && !feedbackVerdict" class="negative-feedback-panel">
|
||||
<text class="negative-feedback-title">哪里没有解决?(可多选)</text>
|
||||
<view class="negative-reason-list">
|
||||
<button
|
||||
v-for="item in feedbackReasonOptions"
|
||||
:key="item.code"
|
||||
class="negative-reason"
|
||||
:class="{ active: selectedFeedbackReasons.includes(item.code) }"
|
||||
:disabled="feedbackSubmitting"
|
||||
@click="toggleFeedbackReason(item.code)"
|
||||
>
|
||||
{{ item.label }}
|
||||
</button>
|
||||
</view>
|
||||
<textarea
|
||||
v-model="feedbackComment"
|
||||
class="textarea negative-feedback-comment"
|
||||
maxlength="500"
|
||||
placeholder="补充说明(可选)"
|
||||
/>
|
||||
<view class="negative-feedback-actions">
|
||||
<button class="secondary-button" :disabled="feedbackSubmitting" @click="closeNegativeFeedback">取消</button>
|
||||
<button
|
||||
class="primary-button"
|
||||
:disabled="feedbackSubmitting || !selectedFeedbackReasons.length"
|
||||
@click="submitNegativeFeedback"
|
||||
>
|
||||
{{ feedbackSubmitting ? '提交中' : '提交反馈' }}
|
||||
</button>
|
||||
</view>
|
||||
</view>
|
||||
<text v-if="feedbackVerdict" class="feedback-status">
|
||||
{{ feedbackVerdict === 'up' ? '已记录为有帮助' : '已提交未解决反馈,后续会继续优化这条答案' }}
|
||||
</text>
|
||||
@@ -220,15 +251,28 @@ const loading = ref(false);
|
||||
const summaryLoading = ref(false);
|
||||
const feedbackSubmitting = ref(false);
|
||||
const feedbackVerdict = ref<AnswerFeedbackVerdict | ''>('');
|
||||
const showNegativeFeedback = ref(false);
|
||||
const selectedFeedbackReasons = ref<string[]>([]);
|
||||
const feedbackComment = ref('');
|
||||
const message = ref('');
|
||||
const loggedIn = ref(false);
|
||||
const pendingSopQueryKey = 'aihr_sop_pending_query';
|
||||
const feedbackReasonOptions = [
|
||||
{ code: 'no_answer', label: '没有回答问题' },
|
||||
{ code: 'not_specific', label: '步骤不够具体' },
|
||||
{ code: 'wrong_reference', label: '引用依据不准确' },
|
||||
{ code: 'outdated', label: '内容已经过期' },
|
||||
{ code: 'not_applicable', label: '话术不适合现场' }
|
||||
];
|
||||
|
||||
const resetResultState = () => {
|
||||
result.value = null;
|
||||
summaryCard.value = null;
|
||||
feedbackVerdict.value = '';
|
||||
feedbackSubmitting.value = false;
|
||||
showNegativeFeedback.value = false;
|
||||
selectedFeedbackReasons.value = [];
|
||||
feedbackComment.value = '';
|
||||
};
|
||||
|
||||
const refreshAuthState = () => {
|
||||
@@ -271,6 +315,7 @@ const search = async () => {
|
||||
resetResultState();
|
||||
try {
|
||||
result.value = await searchKnowledge(value);
|
||||
resetPageScroll();
|
||||
if (!result.value.answer && !result.value.snippets?.length) {
|
||||
message.value = '未检索到可引用内容';
|
||||
}
|
||||
@@ -297,7 +342,10 @@ const cleanOrderedText = (text = '') =>
|
||||
.replace(/^(?:[一二三四五六七八九十]+[、..]|[0-9]+[.)、..])\s*/, '')
|
||||
.trim();
|
||||
|
||||
const feedback = async (verdict: AnswerFeedbackVerdict) => {
|
||||
const feedback = async (
|
||||
verdict: AnswerFeedbackVerdict,
|
||||
details: { reasonCodes?: string[]; comment?: string } = {}
|
||||
) => {
|
||||
if (!result.value || feedbackSubmitting.value || feedbackVerdict.value) return;
|
||||
const fragmentIds = Array.from(
|
||||
new Set(
|
||||
@@ -317,9 +365,12 @@ const feedback = async (verdict: AnswerFeedbackVerdict) => {
|
||||
queryText: result.value.queryText || query.value,
|
||||
fragmentIds,
|
||||
verdict,
|
||||
reviewId: result.value.reviewId
|
||||
reviewId: result.value.reviewId,
|
||||
reasonCodes: details.reasonCodes,
|
||||
comment: details.comment
|
||||
});
|
||||
feedbackVerdict.value = verdict;
|
||||
showNegativeFeedback.value = false;
|
||||
uni.showToast({ title: verdict === 'down' ? '已进入复核' : '已记录', icon: 'none' });
|
||||
} catch (error) {
|
||||
if (!handleRequestError(error, '反馈失败', true)) {
|
||||
@@ -333,6 +384,32 @@ const feedback = async (verdict: AnswerFeedbackVerdict) => {
|
||||
}
|
||||
};
|
||||
|
||||
const openNegativeFeedback = () => {
|
||||
if (feedbackSubmitting.value || feedbackVerdict.value) return;
|
||||
showNegativeFeedback.value = true;
|
||||
selectedFeedbackReasons.value = [];
|
||||
feedbackComment.value = '';
|
||||
};
|
||||
|
||||
const closeNegativeFeedback = () => {
|
||||
if (feedbackSubmitting.value) return;
|
||||
showNegativeFeedback.value = false;
|
||||
};
|
||||
|
||||
const toggleFeedbackReason = (code: string) => {
|
||||
selectedFeedbackReasons.value = selectedFeedbackReasons.value.includes(code)
|
||||
? selectedFeedbackReasons.value.filter((item) => item !== code)
|
||||
: [...selectedFeedbackReasons.value, code];
|
||||
};
|
||||
|
||||
const submitNegativeFeedback = () => {
|
||||
if (!selectedFeedbackReasons.value.length) return;
|
||||
void feedback('down', {
|
||||
reasonCodes: selectedFeedbackReasons.value,
|
||||
comment: feedbackComment.value.trim()
|
||||
});
|
||||
};
|
||||
|
||||
const buildSummaryCard = async () => {
|
||||
if (summaryLoading.value) return;
|
||||
const value = (result.value?.queryText || query.value).trim();
|
||||
@@ -624,6 +701,54 @@ onShow(() => {
|
||||
color: #c34d45;
|
||||
}
|
||||
|
||||
.negative-feedback-panel {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 12px;
|
||||
padding: 14px;
|
||||
border-radius: 16px;
|
||||
background: #fff8f8;
|
||||
}
|
||||
|
||||
.negative-feedback-title {
|
||||
color: var(--employee-text);
|
||||
font-size: 15px;
|
||||
font-weight: 900;
|
||||
}
|
||||
|
||||
.negative-reason-list {
|
||||
display: grid;
|
||||
grid-template-columns: 1fr 1fr;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.negative-reason {
|
||||
min-height: 40px;
|
||||
padding: 0 10px;
|
||||
border: 1px solid #f1d7d9;
|
||||
background: #ffffff;
|
||||
color: #5c626c;
|
||||
font-size: 13px;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.negative-reason.active {
|
||||
border-color: var(--employee-primary);
|
||||
background: var(--employee-primary-soft);
|
||||
color: var(--employee-primary);
|
||||
}
|
||||
|
||||
.negative-feedback-comment {
|
||||
min-height: 84px;
|
||||
border-color: #f1d7d9;
|
||||
}
|
||||
|
||||
.negative-feedback-actions {
|
||||
display: grid;
|
||||
grid-template-columns: 1fr 1fr;
|
||||
gap: 10px;
|
||||
}
|
||||
|
||||
.feedback-status {
|
||||
display: block;
|
||||
padding: 10px 12px;
|
||||
|
||||
Reference in New Issue
Block a user