fix: 修改公共脚本不同语言分号问题&评论组件展开折叠问题
This commit is contained in:
parent
e8295cd86b
commit
6805e8cf06
|
@ -143,13 +143,6 @@ export default defineComponent({
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
watch(
|
|
||||||
() => props.commentList,
|
|
||||||
() => {
|
|
||||||
expendedIds.value = [];
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
const renderChildrenList = (list?: CommentItem[]) => {
|
const renderChildrenList = (list?: CommentItem[]) => {
|
||||||
if (!list || list.length === 0) {
|
if (!list || list.length === 0) {
|
||||||
return null;
|
return null;
|
||||||
|
@ -176,6 +169,7 @@ export default defineComponent({
|
||||||
const renderParentList = (list: CommentItem[]) => {
|
const renderParentList = (list: CommentItem[]) => {
|
||||||
return list.map((item) => (
|
return list.map((item) => (
|
||||||
<>
|
<>
|
||||||
|
{/* {expendedIds.value}--expendedIds */}
|
||||||
<Item
|
<Item
|
||||||
mode={'parent'}
|
mode={'parent'}
|
||||||
onReply={() => handleReply(item)}
|
onReply={() => handleReply(item)}
|
||||||
|
|
|
@ -136,7 +136,7 @@
|
||||||
result: '',
|
result: '',
|
||||||
};
|
};
|
||||||
|
|
||||||
const form = ref({ ...initForm });
|
const form = ref({ ...cloneDeep(initForm) });
|
||||||
|
|
||||||
const columns: MsTableColumn = [
|
const columns: MsTableColumn = [
|
||||||
{
|
{
|
||||||
|
@ -243,7 +243,7 @@
|
||||||
() => showScriptDrawer.value,
|
() => showScriptDrawer.value,
|
||||||
(val) => {
|
(val) => {
|
||||||
if (val) {
|
if (val) {
|
||||||
form.value = { ...initForm };
|
form.value = { ...cloneDeep(initForm) };
|
||||||
innerParams.value = [];
|
innerParams.value = [];
|
||||||
editScriptId.value = props.scriptId;
|
editScriptId.value = props.scriptId;
|
||||||
if (editScriptId.value) {
|
if (editScriptId.value) {
|
||||||
|
|
|
@ -27,7 +27,7 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="p-[12px] pt-0">
|
<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 }}
|
{{ item.title }}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -50,7 +50,7 @@
|
||||||
import { useI18n } from '@/hooks/useI18n';
|
import { useI18n } from '@/hooks/useI18n';
|
||||||
|
|
||||||
import type { CommonScriptMenu } from './types';
|
import type { CommonScriptMenu } from './types';
|
||||||
import { getCodeTemplate, SCRIPT_MENU } from './utils';
|
import { getCodeTemplate, getScriptMenu } from './utils';
|
||||||
|
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
|
|
||||||
|
@ -81,6 +81,10 @@
|
||||||
{ text: 'JavaScript', value: LanguageEnum.JAVASCRIPT },
|
{ text: 'JavaScript', value: LanguageEnum.JAVASCRIPT },
|
||||||
];
|
];
|
||||||
|
|
||||||
|
const scriptMenus = computed(() => {
|
||||||
|
return innerLanguageType.value !== LanguageEnum.PYTHON ? getScriptMenu(';') : getScriptMenu('');
|
||||||
|
});
|
||||||
|
|
||||||
function expandedHandler() {
|
function expandedHandler() {
|
||||||
innerExpand.value = !innerExpand.value;
|
innerExpand.value = !innerExpand.value;
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,7 +21,8 @@ function getInsertCommonScript() {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
export const SCRIPT_MENU: CommonScriptMenu[] = [
|
export function getScriptMenu(SemicolonStr: string) {
|
||||||
|
return [
|
||||||
// TODO 这个版本不上
|
// TODO 这个版本不上
|
||||||
// {
|
// {
|
||||||
// title: t('project.code_segment.importApiTest'),
|
// title: t('project.code_segment.importApiTest'),
|
||||||
|
@ -35,23 +36,23 @@ export const SCRIPT_MENU: CommonScriptMenu[] = [
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: t('project.processor.codeTemplateGetVariable'),
|
title: t('project.processor.codeTemplateGetVariable'),
|
||||||
value: 'vars.get("variable_name");',
|
value: `vars.get("variable_name")${SemicolonStr}`,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: t('project.processor.codeTemplateSetVariable'),
|
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'),
|
title: t('project.processor.codeTemplateGetResponseHeader'),
|
||||||
value: 'prev.getResponseHeaders();',
|
value: `prev.getResponseHeaders()${SemicolonStr}`,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: t('project.processor.codeTemplateGetResponseCode'),
|
title: t('project.processor.codeTemplateGetResponseCode'),
|
||||||
value: 'prev.getResponseCode();',
|
value: `prev.getResponseCode()${SemicolonStr}`,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: t('project.processor.codeTemplateGetResponseResult'),
|
title: t('project.processor.codeTemplateGetResponseResult'),
|
||||||
value: 'prev.getResponseDataAsString();',
|
value: `prev.getResponseDataAsString()${SemicolonStr}`,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: t('project.processor.paramEnvironmentSetGlobalVariable'),
|
title: t('project.processor.paramEnvironmentSetGlobalVariable'),
|
||||||
|
@ -63,7 +64,8 @@ export const SCRIPT_MENU: CommonScriptMenu[] = [
|
||||||
value: 'api_stop',
|
value: 'api_stop',
|
||||||
command: 'api_stop',
|
command: 'api_stop',
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
}
|
||||||
|
|
||||||
// 处理groovyCode 请求头
|
// 处理groovyCode 请求头
|
||||||
function getGroovyHeaders(requestHeaders: Record<string, any>) {
|
function getGroovyHeaders(requestHeaders: Record<string, any>) {
|
||||||
|
|
|
@ -92,6 +92,7 @@
|
||||||
value: 'LIST',
|
value: 'LIST',
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
width: 150,
|
||||||
titleSlotName: 'typeTitle',
|
titleSlotName: 'typeTitle',
|
||||||
typeTitleTooltip: t('apiScenario.params.typeTooltip'),
|
typeTitleTooltip: t('apiScenario.params.typeTooltip'),
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in New Issue