fix: 修改公共脚本不同语言分号问题&评论组件展开折叠问题

This commit is contained in:
xinxin.wu 2024-04-23 18:11:00 +08:00 committed by 刘瑞斌
parent e8295cd86b
commit 6805e8cf06
5 changed files with 55 additions and 54 deletions

View File

@ -143,13 +143,6 @@ export default defineComponent({
);
};
watch(
() => props.commentList,
() => {
expendedIds.value = [];
}
);
const renderChildrenList = (list?: CommentItem[]) => {
if (!list || list.length === 0) {
return null;
@ -176,6 +169,7 @@ export default defineComponent({
const renderParentList = (list: CommentItem[]) => {
return list.map((item) => (
<>
{/* {expendedIds.value}--expendedIds */}
<Item
mode={'parent'}
onReply={() => handleReply(item)}

View File

@ -136,7 +136,7 @@
result: '',
};
const form = ref({ ...initForm });
const form = ref({ ...cloneDeep(initForm) });
const columns: MsTableColumn = [
{
@ -243,7 +243,7 @@
() => showScriptDrawer.value,
(val) => {
if (val) {
form.value = { ...initForm };
form.value = { ...cloneDeep(initForm) };
innerParams.value = [];
editScriptId.value = props.scriptId;
if (editScriptId.value) {

View File

@ -27,7 +27,7 @@
</div>
</div>
<div class="p-[12px] pt-0">
<div v-for="item of SCRIPT_MENU" :key="item.value" class="menuItem px-1" @click="handleClick(item)">
<div v-for="item of scriptMenus" :key="item.value" class="menuItem px-1" @click="handleClick(item)">
{{ item.title }}
</div>
</div>
@ -50,7 +50,7 @@
import { useI18n } from '@/hooks/useI18n';
import type { CommonScriptMenu } from './types';
import { getCodeTemplate, SCRIPT_MENU } from './utils';
import { getCodeTemplate, getScriptMenu } from './utils';
const { t } = useI18n();
@ -81,6 +81,10 @@
{ text: 'JavaScript', value: LanguageEnum.JAVASCRIPT },
];
const scriptMenus = computed(() => {
return innerLanguageType.value !== LanguageEnum.PYTHON ? getScriptMenu(';') : getScriptMenu('');
});
function expandedHandler() {
innerExpand.value = !innerExpand.value;
}

View File

@ -21,7 +21,8 @@ function getInsertCommonScript() {
return [];
}
export const SCRIPT_MENU: CommonScriptMenu[] = [
export function getScriptMenu(SemicolonStr: string) {
return [
// TODO 这个版本不上
// {
// title: t('project.code_segment.importApiTest'),
@ -35,23 +36,23 @@ export const SCRIPT_MENU: CommonScriptMenu[] = [
},
{
title: t('project.processor.codeTemplateGetVariable'),
value: 'vars.get("variable_name");',
value: `vars.get("variable_name")${SemicolonStr}`,
},
{
title: t('project.processor.codeTemplateSetVariable'),
value: 'vars.put("variable_name", "variable_value");',
value: `vars.put("variable_name", "variable_value")${SemicolonStr}`,
},
{
title: t('project.processor.codeTemplateGetResponseHeader'),
value: 'prev.getResponseHeaders();',
value: `prev.getResponseHeaders()${SemicolonStr}`,
},
{
title: t('project.processor.codeTemplateGetResponseCode'),
value: 'prev.getResponseCode();',
value: `prev.getResponseCode()${SemicolonStr}`,
},
{
title: t('project.processor.codeTemplateGetResponseResult'),
value: 'prev.getResponseDataAsString();',
value: `prev.getResponseDataAsString()${SemicolonStr}`,
},
{
title: t('project.processor.paramEnvironmentSetGlobalVariable'),
@ -64,6 +65,7 @@ export const SCRIPT_MENU: CommonScriptMenu[] = [
command: 'api_stop',
},
];
}
// 处理groovyCode 请求头
function getGroovyHeaders(requestHeaders: Record<string, any>) {

View File

@ -92,6 +92,7 @@
value: 'LIST',
},
],
width: 150,
titleSlotName: 'typeTitle',
typeTitleTooltip: t('apiScenario.params.typeTooltip'),
},