353 lines
9.8 KiB
TypeScript
353 lines
9.8 KiB
TypeScript
import { http, HttpResponse } from '@lingshu/vite-plugin-msw/msw';
|
|
|
|
const handlers = [
|
|
http.post('/api/lcdp/v1/component/group/query', () => {
|
|
return HttpResponse.json({
|
|
code: '0',
|
|
message: '',
|
|
data: [
|
|
{
|
|
id: 'comGroup1',
|
|
code: 'id1',
|
|
name: {
|
|
'zh-CN': '分组1',
|
|
},
|
|
},
|
|
{
|
|
id: 'comGroup2',
|
|
code: 'id2',
|
|
name: {
|
|
'zh-CN': '分组2',
|
|
},
|
|
},
|
|
],
|
|
});
|
|
}),
|
|
http.post('/api/lcdp/v1/component/query-grouped', () => {
|
|
return HttpResponse.json({
|
|
code: '0',
|
|
message: '',
|
|
data: [
|
|
{
|
|
groupId: 'g1',
|
|
groupCode: 'code1',
|
|
groupName: {
|
|
'zh-CN': '分组1',
|
|
},
|
|
components: [
|
|
{
|
|
id: '1',
|
|
groupId: 'g1',
|
|
name: {
|
|
'zh-CN': '组件名称',
|
|
},
|
|
code: 'compCode1',
|
|
icon: '1916809468434821122',
|
|
fileId: '1',
|
|
languageModuleName: 'cutstomLangMode1',
|
|
resourceDirectory: 'http://127.0.0.1:5500/dist/CssImport/',
|
|
componentSchema: {
|
|
lang: {
|
|
'customGoods-CompA': {
|
|
text: '文案',
|
|
},
|
|
},
|
|
entry: [
|
|
'index.js',
|
|
],
|
|
format: 'var',
|
|
umdPath: [
|
|
'V3Com',
|
|
'LcdpCom_b9a47cc0',
|
|
],
|
|
framework: 'vue3',
|
|
widgetSchema: {
|
|
widget: {
|
|
metaProps: {
|
|
component: {
|
|
inputValue: '789789789',
|
|
selectValue: 1,
|
|
multipleSelectValue: [1, 2],
|
|
switchValue: 15,
|
|
},
|
|
},
|
|
},
|
|
formSetting: [
|
|
{
|
|
formItemShowPath: ['attribute', 'basicSettings', 'generalAttr'],
|
|
fieldKey: 'metaProps.component.inputValue',
|
|
formItemType: 'el-input',
|
|
formItemProps: {
|
|
label: '测试input label',
|
|
required: true,
|
|
},
|
|
compnentProps: {
|
|
placeholder: '测试placeholder',
|
|
},
|
|
},
|
|
{
|
|
formItemShowPath: ['attribute', 'seniorSettings', 'businessAttr'],
|
|
fieldKey: 'metaProps.component.selectValue',
|
|
formItemType: 'el-select',
|
|
formItemProps: {
|
|
label: '测试select label',
|
|
required: true,
|
|
},
|
|
compnentProps: {
|
|
placeholder: '测试placeholder',
|
|
options: [
|
|
{
|
|
value: 1,
|
|
label: '选项1',
|
|
},
|
|
{
|
|
value: 2,
|
|
label: '选项2',
|
|
},
|
|
{
|
|
value: 3,
|
|
label: '选项3',
|
|
},
|
|
],
|
|
},
|
|
},
|
|
{
|
|
formItemShowPath: ['attribute', 'seniorSettings', 'businessAttr'],
|
|
fieldKey: 'metaProps.component.multipleSelectValue',
|
|
formItemType: 'el-select',
|
|
formItemProps: {
|
|
label: '测试多选select label',
|
|
required: true,
|
|
},
|
|
compnentProps: {
|
|
multiple: true,
|
|
placeholder: '测试placeholder',
|
|
options: [
|
|
{
|
|
value: 1,
|
|
label: '选项1',
|
|
},
|
|
{
|
|
value: 2,
|
|
label: '选项2',
|
|
},
|
|
{
|
|
value: 3,
|
|
label: '选项3',
|
|
},
|
|
],
|
|
},
|
|
},
|
|
{
|
|
formItemShowPath: ['attribute', 'seniorSettings', 'generalAttr'],
|
|
fieldKey: 'metaProps.component.switchValue',
|
|
formItemType: 'el-switch',
|
|
formItemProps: {
|
|
label: '测试switch label',
|
|
required: true,
|
|
},
|
|
compnentProps: {
|
|
activeValue: 15,
|
|
inactiveValue: 16,
|
|
},
|
|
},
|
|
],
|
|
},
|
|
},
|
|
},
|
|
],
|
|
},
|
|
{
|
|
groupId: 'g2',
|
|
groupCode: 'code2',
|
|
groupName: {
|
|
'zh-CN': '分组2',
|
|
},
|
|
components: [
|
|
{
|
|
id: '2',
|
|
groupId: 'g2',
|
|
name: {
|
|
'zh-CN': '组件名称123',
|
|
},
|
|
code: 'compCode2',
|
|
icon: '1916809468434821122',
|
|
fileId: '1',
|
|
languageModuleName: 'cutstomLangMode2',
|
|
resourceDirectory: 'http://127.0.0.1:5500/dist/CompA/',
|
|
},
|
|
],
|
|
},
|
|
],
|
|
});
|
|
}),
|
|
http.post('/api/lcdp/v1/component/group/save', () => {
|
|
return HttpResponse.json({
|
|
code: '0',
|
|
message: '',
|
|
});
|
|
}),
|
|
http.post('/api/lcdp/v1/component/query', () => {
|
|
return HttpResponse.json({
|
|
code: '0',
|
|
message: '',
|
|
data: [
|
|
{
|
|
id: 'id1',
|
|
name: {
|
|
'zh-CN': '组件名称1',
|
|
},
|
|
group: {
|
|
id: 'g1',
|
|
code: 'code1',
|
|
name: {
|
|
'zh-CN': '分组名称1',
|
|
},
|
|
},
|
|
code: 'compCode1',
|
|
icon: '1916809468434821122',
|
|
description: {
|
|
'zh-CN': '我是描述文案',
|
|
},
|
|
status: 1,
|
|
semanticVersion: '1.0.0',
|
|
createTime: '1745920232',
|
|
createBy: 'admin',
|
|
updateTime: '1745920232',
|
|
updateBy: 'admin',
|
|
resourceDirectory: 'http://127.0.0.1:5500/dist/CssImport/',
|
|
languageModuleName: 'cutstomLangMode1',
|
|
componentSchema: {
|
|
lang: {
|
|
'customGoods-CompA': {
|
|
text: '文案',
|
|
},
|
|
},
|
|
entry: [
|
|
'index.js',
|
|
],
|
|
format: 'var',
|
|
umdPath: [
|
|
'V3Com',
|
|
'LcdpCom_b9a47cc0',
|
|
],
|
|
framework: 'vue3',
|
|
widgetSchema: {
|
|
widget: {
|
|
metaProps: {
|
|
component: {
|
|
inputValue: '789789789',
|
|
},
|
|
},
|
|
},
|
|
formSetting: [
|
|
{
|
|
formItemShowPath: [],
|
|
fieldKey: 'metaProps.component.inputValue',
|
|
formItemType: '',
|
|
formItemProps: {},
|
|
compnentProps: {},
|
|
},
|
|
],
|
|
},
|
|
},
|
|
},
|
|
{
|
|
id: 'id2',
|
|
name: {
|
|
'zh-CN': '组件名称2',
|
|
},
|
|
group: {
|
|
id: 'g2',
|
|
code: 'code2',
|
|
name: {
|
|
'zh-CN': '分组名称2',
|
|
},
|
|
},
|
|
code: 'compCode2',
|
|
icon: '1916809468434821122',
|
|
description: {
|
|
'zh-CN': '我是描述文案',
|
|
},
|
|
status: 0,
|
|
semanticVersion: '2.0.0',
|
|
createTime: '1745920232',
|
|
createBy: 'admin',
|
|
updateTime: '1745920232',
|
|
updateBy: 'admin',
|
|
},
|
|
],
|
|
});
|
|
}),
|
|
http.post('/api/lcdp/v1/component/delete', () => {
|
|
return HttpResponse.json({
|
|
code: '0',
|
|
message: '',
|
|
});
|
|
}),
|
|
http.post('/api/lcdp/v1/component/group/delete', () => {
|
|
return HttpResponse.json({
|
|
code: '0',
|
|
message: '',
|
|
});
|
|
}),
|
|
http.post('/api/lcdp/v1/component/group/update', () => {
|
|
return HttpResponse.json({
|
|
code: '0',
|
|
message: '',
|
|
});
|
|
}),
|
|
http.post('/api/lcdp/v1/component/switch-status/enable', () => {
|
|
return HttpResponse.json({
|
|
code: '0',
|
|
message: '',
|
|
});
|
|
}),
|
|
http.post('/api/lcdp/v1/component/switch-status/disable', () => {
|
|
return HttpResponse.json({
|
|
code: '0',
|
|
message: '',
|
|
});
|
|
}),
|
|
http.post('/api/lcdp/v1component/update', () => {
|
|
return HttpResponse.json({
|
|
code: '0',
|
|
message: '',
|
|
data: null,
|
|
});
|
|
}),
|
|
http.post('/api/lcdp/v1/component/save', () => {
|
|
return HttpResponse.json({
|
|
code: '0',
|
|
message: '',
|
|
data: null,
|
|
});
|
|
}),
|
|
http.get('/api/lcdp/v1/component/detail', () => {
|
|
return HttpResponse.json({
|
|
code: '0',
|
|
message: '',
|
|
data: {
|
|
name: {
|
|
'zh-CN': '组件名',
|
|
},
|
|
code: 'asxz',
|
|
group: {
|
|
id: 'comGroup1',
|
|
},
|
|
groupId: 'comGroup1',
|
|
icon: '1909854373932916738',
|
|
fileId: '1914602934984368129',
|
|
pluginFileId: '1914602934984368129',
|
|
status: 1,
|
|
id: '123455',
|
|
description: {
|
|
'zh-CN': '组件状态',
|
|
},
|
|
},
|
|
});
|
|
}),
|
|
];
|
|
|
|
export default handlers;
|