Commit 53b816a1 authored by rockyl's avatar rockyl

增加updateOperators方法

parent 6b9e549e
...@@ -7,6 +7,14 @@ ...@@ -7,6 +7,14 @@
import { fetchApi } from "./common" import { fetchApi } from "./common"
import { getCookie } from './utils' import { getCookie } from './utils'
/**
* 获取项目列表
* @param keyword
* @param currentPage
* @param pageSize
* @param onlyMine
* @return {Promise<*|any>}
*/
export async function fetchAll(keyword, currentPage, pageSize, onlyMine) { export async function fetchAll(keyword, currentPage, pageSize, onlyMine) {
return await fetchApi('/api/project/query', { return await fetchApi('/api/project/query', {
params: {name: keyword, currentPage, pageSize, isAll: onlyMine ? 0 : 1 }, params: {name: keyword, currentPage, pageSize, isAll: onlyMine ? 0 : 1 },
...@@ -14,6 +22,11 @@ export async function fetchAll(keyword, currentPage, pageSize, onlyMine) { ...@@ -14,6 +22,11 @@ export async function fetchAll(keyword, currentPage, pageSize, onlyMine) {
}) })
} }
/**
* 创建一个项目
* @param project
* @return {Promise<*|any>}
*/
export async function createOne(project) { export async function createOne(project) {
return await fetchApi('/api/project/create', { return await fetchApi('/api/project/create', {
params: project, params: project,
...@@ -22,6 +35,11 @@ export async function createOne(project) { ...@@ -22,6 +35,11 @@ export async function createOne(project) {
}) })
} }
/**
* 复制一个项目
* @param project
* @return {Promise<*|any>}
*/
export async function duplicateOne(project) { export async function duplicateOne(project) {
return await fetchApi('/api/project/copy', { return await fetchApi('/api/project/copy', {
params: project, params: project,
...@@ -30,6 +48,11 @@ export async function duplicateOne(project) { ...@@ -30,6 +48,11 @@ export async function duplicateOne(project) {
}) })
} }
/**
* 删除一个项目
* @param id
* @return {Promise<*|any>}
*/
export async function deleteOne(id) { export async function deleteOne(id) {
return await fetchApi('/api/project/delete', { return await fetchApi('/api/project/delete', {
params: { id }, params: { id },
...@@ -38,6 +61,11 @@ export async function deleteOne(id) { ...@@ -38,6 +61,11 @@ export async function deleteOne(id) {
}) })
} }
/**
* 获取一个项目
* @param id
* @return {Promise<*|any>}
*/
export async function fetchOne(id) { export async function fetchOne(id) {
return await fetchApi('/api/project/query/data', { return await fetchApi('/api/project/query/data', {
params: { id }, params: { id },
...@@ -46,6 +74,11 @@ export async function fetchOne(id) { ...@@ -46,6 +74,11 @@ export async function fetchOne(id) {
}) })
} }
/**
* 从历史版本打开
* @param dataUrl
* @return {Promise<*|any>}
*/
export async function fetchOneFromDataUrl(dataUrl) { export async function fetchOneFromDataUrl(dataUrl) {
return await fetchApi(dataUrl, { return await fetchApi(dataUrl, {
auth: false, auth: false,
...@@ -54,6 +87,13 @@ export async function fetchOneFromDataUrl(dataUrl) { ...@@ -54,6 +87,13 @@ export async function fetchOneFromDataUrl(dataUrl) {
}) })
} }
/**
* 获取历史保存列表
* @param id
* @param currentPage
* @param pageSize
* @return {Promise<*|any>}
*/
export async function fetchHistory(id, currentPage, pageSize) { export async function fetchHistory(id, currentPage, pageSize) {
return await fetchApi('/api/project/history', { return await fetchApi('/api/project/history', {
params: { id, currentPage, pageSize }, params: { id, currentPage, pageSize },
...@@ -62,8 +102,14 @@ export async function fetchHistory(id, currentPage, pageSize) { ...@@ -62,8 +102,14 @@ export async function fetchHistory(id, currentPage, pageSize) {
}) })
} }
/**
* 保存项目
* @param project
* @param remark
* @return {Promise<*|any>}
*/
export async function saveOne(project, remark) { export async function saveOne(project, remark) {
project.remark = remark project.remark = remark;
return await fetchApi('/api/project/update', { return await fetchApi('/api/project/update', {
params: project, params: project,
method: 'post', method: 'post',
...@@ -71,6 +117,13 @@ export async function saveOne(project, remark) { ...@@ -71,6 +117,13 @@ export async function saveOne(project, remark) {
}) })
} }
/**
* 打包项目
* @param id
* @param debug
* @param packedAssets
* @return {Promise<*|any>}
*/
export async function pack(id, debug, packedAssets) { export async function pack(id, debug, packedAssets) {
return await fetchApi('/api/project/pack', { return await fetchApi('/api/project/pack', {
params: { id, debug, packedAssets }, params: { id, debug, packedAssets },
...@@ -78,3 +131,17 @@ export async function pack(id, debug, packedAssets) { ...@@ -78,3 +131,17 @@ export async function pack(id, debug, packedAssets) {
errMessage: 'Failed to pack project', errMessage: 'Failed to pack project',
}) })
} }
/**
* 修改开发人员名单
* @param id
* @param operators
* @return {Promise<*|any|>}
*/
export async function updateOperators(id, operators) {
return await fetchApi('/api/project/updateOperators', {
params: { id, operators },
method: 'post',
errMessage: 'Failed to update operator',
})
}
...@@ -96,6 +96,8 @@ export const projectStore = { ...@@ -96,6 +96,8 @@ export const projectStore = {
id: '', id: '',
name: '', name: '',
creator: '', creator: '',
operator: '',
operators: '',
data: { data: {
options: {}, options: {},
views: [], views: [],
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment