1
0
mirror of synced 2026-04-18 01:59:36 +08:00

feat: 新增管理端demo代码

feat: 补充遗漏的文件

fix: 移除license
This commit is contained in:
parisma
2022-03-11 15:21:32 +08:00
committed by jia000
parent 66eb52f8da
commit 2bfb85bdbf
109 changed files with 36582 additions and 0 deletions

View File

@@ -0,0 +1,160 @@
/*
* Tencent is pleased to support the open source community by making MagicEditor available.
*
* Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// 活动相关请求
import fetch, { Res } from '@src/util/request';
// 排序项
export interface OrderItem {
columnName: string;
direction: string;
}
// 活动查询参数
export interface ActListQuery {
where: {
onlySelf: boolean;
search: string | string[];
pageTitle: string;
actStatus: number;
};
orderBy: OrderItem[];
pgIndex: number;
pgSize: number;
userName: string;
}
// 活动复制参数
export interface CopyInfo {
actId: number;
userName: string;
}
// 活动创建参数
export interface ActInfoDetail {
actName: string;
actBeginTime: string;
actEndTime: string;
operator: string;
}
// 活动页面基本信息
export interface PageInfo extends PageListItem {
id: number;
actId?: number;
}
export interface PageListItem {
pageTitle: string;
pagePublishTime?: string;
pagePublishStatus: number;
pagePublishOperator?: string;
}
// 活动列表项
export interface ActListItem {
actId: number;
actCryptoId: string;
actName: string;
actBeginTime: string;
actEndTime: string;
operator: string;
actStatus: number;
items: PageInfo[];
[key: string]: any;
}
// 活动列表返回类型
export interface ActListRes {
data: ActListItem[];
total: number;
fetch: boolean;
errorMsg: string;
}
export default {
/**
* 获取活动列表
* @param {Object} options
* @param {ActListQuery} options.data 活动查询参数
* @returns {Promise<ActListRes>} 查询结果
*/
getList(options: { data: ActListQuery }): Promise<ActListRes> {
return fetch.post({
_c: 'act',
_a: 'getList',
...options,
});
},
/**
* 新建活动
* @param {Object} options
* @param {ActInfoDetail} options.data 新建活动参数:活动基础信息
* @returns {Promise<Res<{ actId: number }>>} 新活动Id
*/
saveAct(options: { data: ActInfoDetail }): Promise<Res<{ actId: number }>> {
return fetch.post({
_c: 'act',
_a: 'create',
...options,
});
},
/**
* 复制活动
* @param {Object} options
* @param {CopyInfo} options.data 复制活动所需信息
* @returns {Promise<Res>} 操作结果
*/
copyAct(options: { data: CopyInfo }): Promise<Res> {
return fetch.post({
_c: 'act',
_a: 'copy',
...options,
});
},
/**
* 根据id获取活动详情
* @param {Object} params
* @param {number} options.id 活动ID
* @returns {Promise<Res>} 查询结果
*/
getAct(params: { id: number }): Promise<Res> {
return fetch.get({
_c: 'act',
_a: 'get',
params,
});
},
/**
* 删除页面
* @param {Object} options
* @param {number} options.pageId
* @returns {Promise<Res>} 删除结果
*/
removePage(options: { data: { pageId: number } }): Promise<Res> {
return fetch.post({
_c: 'act',
_a: 'removePage',
...options,
});
},
};

View File

@@ -0,0 +1,47 @@
/*
* Tencent is pleased to support the open source community by making MagicEditor available.
*
* Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import fetch, { Res } from '@src/util/request';
// 编辑器左侧组件分类
export interface CompClassifyForEditor {
title: string;
items: CompListInClassify[];
}
// 编辑器左侧组件列表
export interface CompListInClassify {
icon: string;
id: number;
renderType: number;
reportType: string;
text: string;
type: string;
}
export default {
/**
* 获取组件列表
* @returns {Promise<Res>} 查询结果
*/
getComponentList(): Promise<Res> {
return fetch.get({
_c: 'editor',
_a: 'getComponentList',
});
},
};

View File

@@ -0,0 +1,55 @@
/*
* Tencent is pleased to support the open source community by making MagicEditor available.
*
* Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import type { ActInfo } from '@src/typings';
import fetch, { Res } from '@src/util/request';
export default {
/**
* 保存活动
* @param {Object} options
* @param {Object} options.data
* @param {ActInfo} options.data.actInfo 活动基本信息
* @param {string} options.data.rootInfo 页面组件配置信息
* @returns {Promise<Res>} 保存结果
*/
saveActInfo(options: { data: { actInfo: ActInfo; rootInfo: string } }): Promise<Res> {
return fetch.post({
_c: 'publish',
_a: 'saveActInfo',
...options,
});
},
/**
* 发布活动
* @param {Object} options
* @param {Object} options.data
* @param {number} options.data.actId 活动ID
* @param {string[]} options.data.publishPages 待发布的页面
* @param {string} options.data.rootInfo 页面组件配置信息
* @returns {Promise<Res>} 发布结果
*/
publishPage(options: { data: { actId: number; publishPages: string[]; rootInfo: string } }): Promise<Res> {
return fetch.post({
_c: 'publish',
_a: 'publish',
...options,
});
},
};

View File

@@ -0,0 +1,32 @@
/*
* Tencent is pleased to support the open source community by making MagicEditor available.
*
* Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import fetch, { Res } from '@src/util/request';
export interface UserState {
loginName: string;
}
export default {
getUser(): Promise<Res<UserState>> {
return fetch.get({
_c: 'user',
_a: 'getUser',
});
},
};