-
Notifications
You must be signed in to change notification settings - Fork 2.8k
fix: optimization chart operation style #2768
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -113,7 +113,7 @@ | |
| </el-space> | ||
| </div> | ||
| </el-scrollbar> | ||
| <div class="flex"> | ||
| <div class="flex" :style="{ alignItems: isMicrophone ? 'center' : 'end' }"> | ||
| <TouchChat | ||
| v-if="isMicrophone" | ||
| @TouchStart="startRecording" | ||
|
|
@@ -554,7 +554,7 @@ class RecorderManage { | |
| MsgAlert( | ||
| t('common.tip'), | ||
| `${err} | ||
| <div style="width: 100%;height:1px;border-top:1px var(--el-border-color) var(--el-border-style);margin:10px 0;"></div> | ||
| <div style="width: 100%;height:1px;border-top:1px var(--el-border-color) var(--el-border-style);margin:10px 0;"></div> | ||
| ${t('chat.tip.recorderTip')} | ||
| <img src="${new URL(`@/assets/tipIMG.jpg`, import.meta.url).href}" style="width: 100%;" />`, | ||
| { | ||
|
|
@@ -653,13 +653,23 @@ function autoSendMessage() { | |
| audio_list: uploadAudioList.value, | ||
| video_list: uploadVideoList.value | ||
| }) | ||
| inputValue.value = '' | ||
| uploadImageList.value = [] | ||
| uploadDocumentList.value = [] | ||
| uploadAudioList.value = [] | ||
| uploadVideoList.value = [] | ||
| if (quickInputRef.value) { | ||
| quickInputRef.value.textareaStyle.height = '45px' | ||
|
|
||
| if ( | ||
| props.sendMessage(inputValue.value, { | ||
| image_list: uploadImageList.value, | ||
| document_list: uploadDocumentList.value, | ||
| audio_list: uploadAudioList.value, | ||
| video_list: uploadVideoList.value | ||
| }) !== undefined | ||
| ) { | ||
| inputValue.value = '' | ||
| uploadImageList.value = [] | ||
| uploadDocumentList.value = [] | ||
| uploadAudioList.value = [] | ||
| uploadVideoList.value = [] | ||
| if (quickInputRef.value) { | ||
| quickInputRef.value.textareaStyle.height = '45px' | ||
| } | ||
| } | ||
| } | ||
|
|
||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The given code does not contain any major irregularities or critical bugs; however, there are some minor suggestions for improvement:
Overall, the code should work flawlessly under normal conditions. Only if more specific functionality needs adjustment or additional features (not shown here but potentially required), I would recommend updating those accordingly. |
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5,18 +5,15 @@ | |
| :class="type" | ||
| :style="{ height: firsUserInput ? '100%' : undefined }" | ||
| > | ||
| <div | ||
| v-show="showUserInputContent" | ||
| :class="firsUserInput ? 'firstUserInput' : 'popperUserInput'" | ||
| > | ||
| <div v-if="showUserInputContent" :class="firsUserInput ? 'firstUserInput' : 'popperUserInput'"> | ||
| <UserForm | ||
| v-model:api_form_data="api_form_data" | ||
| v-model:form_data="form_data" | ||
| :application="applicationDetails" | ||
| :type="type" | ||
| :first="firsUserInput" | ||
| @confirm="UserFormConfirm" | ||
| @cancel="() => (showUserInput = false)" | ||
| @cancel="UserFormCancel" | ||
| ref="userFormRef" | ||
| ></UserForm> | ||
| </div> | ||
|
|
@@ -150,6 +147,9 @@ const userFormRef = ref<InstanceType<typeof UserForm>>() | |
| // 用户输入 | ||
| const firsUserInput = ref(true) | ||
| const showUserInput = ref(false) | ||
| // 初始表单数据(用于恢复) | ||
| const initialFormData = ref({}) | ||
| const initialApiFormData = ref({}) | ||
|
|
||
| const isUserInput = computed( | ||
| () => | ||
|
|
@@ -193,6 +193,11 @@ watch( | |
|
|
||
| const toggleUserInput = () => { | ||
| showUserInput.value = !showUserInput.value | ||
| if (showUserInput.value) { | ||
| // 保存当前数据作为初始数据(用于可能的恢复) | ||
| initialFormData.value = JSON.parse(JSON.stringify(form_data.value)) | ||
| initialApiFormData.value = JSON.parse(JSON.stringify(api_form_data.value)) | ||
| } | ||
| } | ||
|
|
||
| function UserFormConfirm() { | ||
|
|
@@ -201,6 +206,12 @@ function UserFormConfirm() { | |
| showUserInput.value = false | ||
| } | ||
| } | ||
| function UserFormCancel() { | ||
| // 恢复初始数据 | ||
| form_data.value = JSON.parse(JSON.stringify(initialFormData.value)) | ||
| api_form_data.value = JSON.parse(JSON.stringify(initialApiFormData.value)) | ||
| showUserInput.value = false | ||
| } | ||
|
|
||
| function sendMessage(val: string, other_params_data?: any, chat?: chatType) { | ||
| if (!userFormRef.value?.checkInputParam()) { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The provided code seems to have several improvements and corrections:
Here's the updated code with some minor formatting adjustments for readability: @@ -7,23 +6,20 @@
:style="{ height: firsUserInput ? '100%' : undefined }"
>
- <div
- v-show="showUserInputContent"
- :class="firsUserInput ? '' : 'popperUserInput'"
- >
+ <div v-if="showUserInputContent" :class="firsUserInput ? '' : 'popperUserInput'">
<UserForm
v-model:api_form_data="api_form_data"
v-model:form_data="form_data"
:application="applicationDetails"
:type="type"
:first="firsUserInput"
@confirm="handleConfirm"
- @cancel="() => ({ showUserInput })[this.showUserInput]"
+ @cancel="handleCancel"
ref="userFormRef"
></UserForm>
</div>Key Changes:
These changes should improve the reliability and functionality of the code while maintaining clarity. |
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see several potential issues and areas of optimization in this Vue.js component:
Redundant Code: The
<div class="close">element has been commented out but remains in the codebase. This can confuse future maintainers.Missing Imports: Without importing
Closefrom@element-plus/icons-vue, the icon might not render correctly.Inline Styling with Variables: In line 46, you set background color using
rgba, which can be replaced with variables for clearer organization.Unnecessary Visibility Control CSS: Since you toggle the visibility based on
isTouchingcondition, the.lighterstyle should ideally also control it indirectly.Code Structure: Consider separating reusable components like
.avatar-close-container.Here's an optimized version of your code:
Key Improvements:
This should make the component cleaner, more efficient, and easier to manage.