Commit eb581b8c authored by tyyin lan's avatar tyyin lan

chore(首页): 推荐问题更换按钮调整

parent f7c6a93c
......@@ -52,6 +52,7 @@ common_module:
deletion_failed_please_try_again: '删除失败,请重试'
select_all: '全选'
quit: '退出'
retry: '重试'
dialogue_module:
continue_question_message: '你可以继续提问'
......
......@@ -52,6 +52,7 @@ common_module:
deletion_failed_please_try_again: '刪除失敗,請重試'
select_all: '全選'
quit: '退出'
retry: '重試'
dialogue_module:
continue_question_message: '你可以繼續提問'
......
......@@ -23,6 +23,7 @@ const questionContent = defineModel<string>('questionContent', { required: true
const { t } = useI18n()
const recommendQuestionList = ref<RecommendQuestionItem[]>([])
const promptChangeBtnStatus = ref<'normal' | 'loading' | 'failed'>('normal')
const isShowAgentAbout = computed(() => {
return props.messageListLength === 0
......@@ -50,10 +51,18 @@ function handleQuestionClick(question: string) {
const handleRecommendQuestionListUpdate = debounce(
() => {
const loadingCtl = window.$message.loading(`${t('common_module.updating')}...`)
if (promptChangeBtnStatus.value === 'loading') {
return
}
getRecommendQuestionList().then(() => {
loadingCtl.destroy()
promptChangeBtnStatus.value = 'loading'
getRecommendQuestionList()
.then(() => {
promptChangeBtnStatus.value = 'normal'
})
.catch(() => {
promptChangeBtnStatus.value = 'failed'
})
},
700,
......@@ -99,13 +108,21 @@ const handleRecommendQuestionListUpdate = debounce(
<li class="mt-[10px] pl-[20px] text-[12px]">
<span
class="group cursor-pointer text-[#0B7DFF] transition hover:text-[#096EE0]"
class="group cursor-pointer text-[#0B7DFF] transition"
:class="{
'hover:text-[#096EE0]': promptChangeBtnStatus !== 'loading',
'cursor-not-allowed': promptChangeBtnStatus === 'loading',
'text-[#BDBDBD]': promptChangeBtnStatus === 'loading',
}"
@click="handleRecommendQuestionListUpdate"
>
<i
class="iconfont icon-huanyihuan group-active:rotate-360 mr-[2px] inline-block text-[11px] transition-[rotate] duration-150 ease-in-out"
class="iconfont icon-huanyihuan mr-[2px] inline-block text-[11px] transition-[rotate] duration-150 ease-in-out"
:class="{ 'group-active:rotate-360': promptChangeBtnStatus !== 'loading' }"
></i>
<span>{{ t('common_module.exchange') }}</span>
<span>
{{ promptChangeBtnStatus === 'failed' ? t('common_module.retry') : t('common_module.exchange') }}
</span>
</span>
</li>
</ul>
......
......@@ -53,6 +53,7 @@ declare namespace I18n {
deletion_failed_please_try_again: string
select_all: string
quit: string
retry: string
dialogue_module: {
continue_question_message: string
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment