api结构的重构
This commit is contained in:
parent
71ef5c256e
commit
dad1e60d73
301
common/api.js
301
common/api.js
|
|
@ -1,293 +1,26 @@
|
|||
/**
|
||||
* API 接口封装
|
||||
* 统一管理所有 API 请求
|
||||
*
|
||||
* 按功能模块分类:
|
||||
* - user: 用户相关 API
|
||||
* - dashboard: 仪表板相关 API
|
||||
* - task: 任务相关 API
|
||||
* - customer: 客户相关 API
|
||||
* - common: 通用 API(七牛云、地区树等)
|
||||
*/
|
||||
|
||||
/**
|
||||
* 获取用户信息
|
||||
* @returns {Promise} 返回用户信息
|
||||
*/
|
||||
export const getUserInfo = () => {
|
||||
return uni.$uv.http.get('/getInfo', {
|
||||
custom: {
|
||||
auth: true // 启用 token 认证
|
||||
}
|
||||
});
|
||||
};
|
||||
// 导入用户相关 API
|
||||
export * from './api/user';
|
||||
|
||||
/**
|
||||
* 获取仪表板简要信息
|
||||
* @param {Object} params 请求参数
|
||||
* @param {string} params.joinUserId 用户ID
|
||||
* @param {string[]} params.keys 需要获取的数据键名数组
|
||||
* @returns {Promise} 返回仪表板简要信息
|
||||
*/
|
||||
export const getDashboardBrief = ({ joinUserId, keys }) => {
|
||||
// 构建查询参数字符串
|
||||
const params = [`joinUserId=${joinUserId}`];
|
||||
if (keys && Array.isArray(keys)) {
|
||||
keys.forEach((key) => {
|
||||
params.push(`keys=${encodeURIComponent(key)}`);
|
||||
});
|
||||
}
|
||||
const queryString = params.join('&');
|
||||
|
||||
return uni.$uv.http.get(`dashboard/brief?${queryString}`, {
|
||||
custom: {
|
||||
auth: true // 启用 token 认证
|
||||
}
|
||||
});
|
||||
};
|
||||
// 导入仪表板相关 API
|
||||
export * from './api/dashboard';
|
||||
|
||||
/**
|
||||
* 获取任务列表
|
||||
* @param {Object} params 请求参数
|
||||
* @param {boolean} params.overdue 是否获取逾期任务
|
||||
* @param {number[]} params.statusList 任务状态列表,4对应已完成
|
||||
* @param {string} params.expireTimeStart 过期时间开始范围(格式:yyyy-MM-dd HH:mm:ss)
|
||||
* @param {string} params.expireTimeEnd 过期时间结束范围(格式:yyyy-MM-dd HH:mm:ss)
|
||||
* @returns {Promise} 返回任务列表
|
||||
*/
|
||||
export const getTaskList = ({ overdue, statusList, expireTimeStart, expireTimeEnd }) => {
|
||||
const queryParams = [];
|
||||
if (overdue !== undefined) {
|
||||
queryParams.push(`overdue=${overdue}`);
|
||||
}
|
||||
if (statusList !== undefined && Array.isArray(statusList) && statusList.length > 0) {
|
||||
// 将数组转换为逗号分隔的字符串,例如 [4] => "4" 或 [1,2,3] => "1,2,3"
|
||||
queryParams.push(`statusList=${statusList.join(',')}`);
|
||||
}
|
||||
if (expireTimeStart !== undefined && expireTimeStart !== null && expireTimeStart !== '') {
|
||||
queryParams.push(`expireTimeStart=${encodeURIComponent(expireTimeStart)}`);
|
||||
}
|
||||
if (expireTimeEnd !== undefined && expireTimeEnd !== null && expireTimeEnd !== '') {
|
||||
queryParams.push(`expireTimeEnd=${encodeURIComponent(expireTimeEnd)}`);
|
||||
}
|
||||
const queryString = queryParams.length > 0 ? `?${queryParams.join('&')}` : '';
|
||||
|
||||
return uni.$uv.http.get(`bst/task/list${queryString}`, {
|
||||
custom: {
|
||||
auth: true // 启用 token 认证
|
||||
}
|
||||
});
|
||||
};
|
||||
// 导入任务相关 API
|
||||
export * from './api/task';
|
||||
|
||||
/**
|
||||
* 获取任务详情
|
||||
* @param {string} id 任务ID
|
||||
* @returns {Promise} 返回任务详情
|
||||
*/
|
||||
export const getTaskDetail = (id) => {
|
||||
return uni.$uv.http.get(`bst/task/${id}`, {
|
||||
custom: {
|
||||
auth: true // 启用 token 认证
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* 获取七牛云上传token
|
||||
* @returns {Promise} 返回七牛云上传token
|
||||
*/
|
||||
export const getQiniuUploadToken = () => {
|
||||
return uni.$uv.http.get('/common/qiniuToken', {
|
||||
custom: {
|
||||
auth: true // 启用 token 认证
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* 提交任务
|
||||
* @param {Object} params 请求参数
|
||||
* @param {string} params.id 任务ID
|
||||
* @param {string} params.submitAttaches 附件, 逗号分隔的URL字符串
|
||||
* @param {string} params.submitRemark 备注
|
||||
* @returns {Promise} 返回提交结果
|
||||
*/
|
||||
export const submitTask = ({ id, submitAttaches, submitRemark }) => {
|
||||
return uni.$uv.http.put('/bst/task/submit', {
|
||||
id: id,
|
||||
submitAttaches: submitAttaches || '',
|
||||
submitRemark: submitRemark || ''
|
||||
}, {
|
||||
custom: {
|
||||
auth: true // 启用 token 认证
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* 获取客户列表
|
||||
* @param {Object} params 请求参数(可选)
|
||||
* @param {string[]} params.statusList 客户状态列表:["1"] 正在跟进, ["2"] 待跟进
|
||||
* @param {string} params.excludeld 排除id
|
||||
* @param {string[]} params.ids id列表
|
||||
* @param {string} params.intent 意向
|
||||
* @param {string} params.createDate 创建日期 (yyyy-MM-dd)
|
||||
* @param {string} params.joinUserld 参与人id
|
||||
* @param {string} params.lastFollowDate 上次跟进日期 (yyyy-MM-dd)
|
||||
* @param {string} params.nextFollowDate 下次跟进日期 (yyyy-MM-dd)
|
||||
* @param {string} params.nextFollowDateStart 下次跟进日期开始 (yyyy-MM-dd)
|
||||
* @param {string} params.nextFollowDateEnd 下次跟进日期结束 (yyyy-MM-dd)
|
||||
* @param {string[]} params.createDateRange 创建日期范围 (yyyy-MM-dd)
|
||||
* @param {string[]} params.saleList 销售列表
|
||||
* @returns {Promise} 返回客户列表 { total: number, rows: array }
|
||||
*/
|
||||
export const getCustomerList = (params = {}) => {
|
||||
const queryParams = [];
|
||||
|
||||
// 处理数组参数
|
||||
if (params.statusList && Array.isArray(params.statusList) && params.statusList.length > 0) {
|
||||
params.statusList.forEach(status => {
|
||||
queryParams.push(`statusList=${encodeURIComponent(status)}`);
|
||||
});
|
||||
}
|
||||
|
||||
if (params.ids && Array.isArray(params.ids) && params.ids.length > 0) {
|
||||
params.ids.forEach(id => {
|
||||
queryParams.push(`ids=${encodeURIComponent(id)}`);
|
||||
});
|
||||
}
|
||||
|
||||
if (params.createDateRange && Array.isArray(params.createDateRange) && params.createDateRange.length > 0) {
|
||||
params.createDateRange.forEach(date => {
|
||||
queryParams.push(`createDateRange=${encodeURIComponent(date)}`);
|
||||
});
|
||||
}
|
||||
|
||||
if (params.saleList && Array.isArray(params.saleList) && params.saleList.length > 0) {
|
||||
params.saleList.forEach(sale => {
|
||||
queryParams.push(`saleList=${encodeURIComponent(sale)}`);
|
||||
});
|
||||
}
|
||||
|
||||
// 处理字符串参数
|
||||
if (params.excludeld) {
|
||||
queryParams.push(`excludeld=${encodeURIComponent(params.excludeld)}`);
|
||||
}
|
||||
|
||||
if (params.intent) {
|
||||
queryParams.push(`intent=${encodeURIComponent(params.intent)}`);
|
||||
}
|
||||
|
||||
if (params.createDate) {
|
||||
queryParams.push(`createDate=${encodeURIComponent(params.createDate)}`);
|
||||
}
|
||||
|
||||
if (params.joinUserld) {
|
||||
queryParams.push(`joinUserld=${encodeURIComponent(params.joinUserld)}`);
|
||||
}
|
||||
|
||||
if (params.lastFollowDate) {
|
||||
queryParams.push(`lastFollowDate=${encodeURIComponent(params.lastFollowDate)}`);
|
||||
}
|
||||
|
||||
if (params.nextFollowDate) {
|
||||
queryParams.push(`nextFollowDate=${encodeURIComponent(params.nextFollowDate)}`);
|
||||
}
|
||||
|
||||
if (params.nextFollowDateStart) {
|
||||
queryParams.push(`nextFollowDateStart=${encodeURIComponent(params.nextFollowDateStart)}`);
|
||||
}
|
||||
|
||||
if (params.nextFollowDateEnd) {
|
||||
queryParams.push(`nextFollowDateEnd=${encodeURIComponent(params.nextFollowDateEnd)}`);
|
||||
}
|
||||
|
||||
const queryString = queryParams.length > 0 ? `?${queryParams.join('&')}` : '';
|
||||
|
||||
return uni.$uv.http.get(`bst/customer/list${queryString}`, {
|
||||
custom: {
|
||||
auth: true // 启用 token 认证
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* 获取客户详情
|
||||
* @param {string} id 客户ID
|
||||
* @returns {Promise} 返回客户详情
|
||||
*/
|
||||
export const getCustomerDetail = (id) => {
|
||||
return uni.$uv.http.get(`bst/customer/${id}`, {
|
||||
custom: {
|
||||
auth: true // 启用 token 认证
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* 获取客户跟进动态列表
|
||||
* @param {string} customerId 客户ID
|
||||
* @returns {Promise} 返回跟进动态列表
|
||||
*/
|
||||
export const getCustomerFollowupList = (customerId) => {
|
||||
return uni.$uv.http.get(`bst/customer/followup/list`, {
|
||||
params: {
|
||||
customerId: customerId
|
||||
},
|
||||
custom: {
|
||||
auth: true
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* 获取客户项目列表
|
||||
* @param {string} customerId 客户ID
|
||||
* @returns {Promise} 返回项目列表
|
||||
*/
|
||||
export const getCustomerProjects = (customerId) => {
|
||||
return uni.$uv.http.get(`bst/customer/projects`, {
|
||||
params: {
|
||||
customerId: customerId
|
||||
},
|
||||
custom: {
|
||||
auth: true
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* 获取地区树
|
||||
* @returns {Promise} 返回地区树数据
|
||||
*/
|
||||
export const getRegionTree = () => {
|
||||
return uni.$uv.http.get(`/bst/region/treaDity`, {
|
||||
custom: {
|
||||
auth: true
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* 创建客户
|
||||
* @param {Object} data 客户数据
|
||||
* @param {string} data.type 类型(固定为2)
|
||||
* @param {string} data.name 客户名
|
||||
* @param {string} data.mobile 手机号
|
||||
* @param {string} data.wechat 微信号
|
||||
* @param {string} data.source 来源
|
||||
* @param {string} data.intents 意向的设备,逗号分离
|
||||
* @param {string} data.status 状态(1潜在2意向3成交4失效)
|
||||
* @param {string} data.intentLevel 意向强度
|
||||
* @param {string} data.customerStatus 客户状态
|
||||
* @param {string} data.customerIntentLevel 客户意向强度
|
||||
* @param {string} data.nextFollowTime 下次跟进时间
|
||||
* @param {string} data.followId 跟进人id
|
||||
* @param {string} data.remark 备注
|
||||
* @param {string} data.concern 顾虑点
|
||||
* @param {string} data.pain 痛点
|
||||
* @param {string} data.attention 关注点
|
||||
* @param {string} data.demand 需求点
|
||||
* @returns {Promise} 返回创建结果
|
||||
*/
|
||||
export const createCustomer = (data) => {
|
||||
return uni.$uv.http.post(`bst/customer`, data, {
|
||||
custom: {
|
||||
auth: true
|
||||
}
|
||||
});
|
||||
};
|
||||
// 导入客户相关 API
|
||||
export * from './api/customer';
|
||||
|
||||
// 导入通用 API
|
||||
export * from './api/common';
|
||||
|
|
|
|||
28
common/api/common.js
Normal file
28
common/api/common.js
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
/**
|
||||
* 通用 API(工具类接口)
|
||||
*/
|
||||
|
||||
/**
|
||||
* 获取七牛云上传token
|
||||
* @returns {Promise} 返回七牛云上传token
|
||||
*/
|
||||
export const getQiniuUploadToken = () => {
|
||||
return uni.$uv.http.get('/common/qiniuToken', {
|
||||
custom: {
|
||||
auth: true // 启用 token 认证
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* 获取地区树
|
||||
* @returns {Promise} 返回地区树数据
|
||||
*/
|
||||
export const getRegionTree = () => {
|
||||
return uni.$uv.http.get(`/bst/region/treaDity`, {
|
||||
custom: {
|
||||
auth: true
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
166
common/api/customer.js
Normal file
166
common/api/customer.js
Normal file
|
|
@ -0,0 +1,166 @@
|
|||
/**
|
||||
* 客户相关 API
|
||||
*/
|
||||
|
||||
/**
|
||||
* 获取客户列表
|
||||
* @param {Object} params 请求参数(可选)
|
||||
* @param {string[]} params.statusList 客户状态列表:["1"] 正在跟进, ["2"] 待跟进
|
||||
* @param {string} params.excludeld 排除id
|
||||
* @param {string[]} params.ids id列表
|
||||
* @param {string} params.intent 意向
|
||||
* @param {string} params.createDate 创建日期 (yyyy-MM-dd)
|
||||
* @param {string} params.joinUserld 参与人id
|
||||
* @param {string} params.lastFollowDate 上次跟进日期 (yyyy-MM-dd)
|
||||
* @param {string} params.nextFollowDate 下次跟进日期 (yyyy-MM-dd)
|
||||
* @param {string} params.nextFollowDateStart 下次跟进日期开始 (yyyy-MM-dd)
|
||||
* @param {string} params.nextFollowDateEnd 下次跟进日期结束 (yyyy-MM-dd)
|
||||
* @param {string[]} params.createDateRange 创建日期范围 (yyyy-MM-dd)
|
||||
* @param {string[]} params.saleList 销售列表
|
||||
* @returns {Promise} 返回客户列表 { total: number, rows: array }
|
||||
*/
|
||||
export const getCustomerList = (params = {}) => {
|
||||
const queryParams = [];
|
||||
|
||||
// 处理数组参数
|
||||
if (params.statusList && Array.isArray(params.statusList) && params.statusList.length > 0) {
|
||||
params.statusList.forEach(status => {
|
||||
queryParams.push(`statusList=${encodeURIComponent(status)}`);
|
||||
});
|
||||
}
|
||||
|
||||
if (params.ids && Array.isArray(params.ids) && params.ids.length > 0) {
|
||||
params.ids.forEach(id => {
|
||||
queryParams.push(`ids=${encodeURIComponent(id)}`);
|
||||
});
|
||||
}
|
||||
|
||||
if (params.createDateRange && Array.isArray(params.createDateRange) && params.createDateRange.length > 0) {
|
||||
params.createDateRange.forEach(date => {
|
||||
queryParams.push(`createDateRange=${encodeURIComponent(date)}`);
|
||||
});
|
||||
}
|
||||
|
||||
if (params.saleList && Array.isArray(params.saleList) && params.saleList.length > 0) {
|
||||
params.saleList.forEach(sale => {
|
||||
queryParams.push(`saleList=${encodeURIComponent(sale)}`);
|
||||
});
|
||||
}
|
||||
|
||||
// 处理字符串参数
|
||||
if (params.excludeld) {
|
||||
queryParams.push(`excludeld=${encodeURIComponent(params.excludeld)}`);
|
||||
}
|
||||
|
||||
if (params.intent) {
|
||||
queryParams.push(`intent=${encodeURIComponent(params.intent)}`);
|
||||
}
|
||||
|
||||
if (params.createDate) {
|
||||
queryParams.push(`createDate=${encodeURIComponent(params.createDate)}`);
|
||||
}
|
||||
|
||||
if (params.joinUserld) {
|
||||
queryParams.push(`joinUserld=${encodeURIComponent(params.joinUserld)}`);
|
||||
}
|
||||
|
||||
if (params.lastFollowDate) {
|
||||
queryParams.push(`lastFollowDate=${encodeURIComponent(params.lastFollowDate)}`);
|
||||
}
|
||||
|
||||
if (params.nextFollowDate) {
|
||||
queryParams.push(`nextFollowDate=${encodeURIComponent(params.nextFollowDate)}`);
|
||||
}
|
||||
|
||||
if (params.nextFollowDateStart) {
|
||||
queryParams.push(`nextFollowDateStart=${encodeURIComponent(params.nextFollowDateStart)}`);
|
||||
}
|
||||
|
||||
if (params.nextFollowDateEnd) {
|
||||
queryParams.push(`nextFollowDateEnd=${encodeURIComponent(params.nextFollowDateEnd)}`);
|
||||
}
|
||||
|
||||
const queryString = queryParams.length > 0 ? `?${queryParams.join('&')}` : '';
|
||||
|
||||
return uni.$uv.http.get(`bst/customer/list${queryString}`, {
|
||||
custom: {
|
||||
auth: true // 启用 token 认证
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* 获取客户详情
|
||||
* @param {string} id 客户ID
|
||||
* @returns {Promise} 返回客户详情
|
||||
*/
|
||||
export const getCustomerDetail = (id) => {
|
||||
return uni.$uv.http.get(`bst/customer/${id}`, {
|
||||
custom: {
|
||||
auth: true // 启用 token 认证
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* 获取客户跟进动态列表
|
||||
* @param {string} customerId 客户ID
|
||||
* @returns {Promise} 返回跟进动态列表
|
||||
*/
|
||||
export const getCustomerFollowupList = (customerId) => {
|
||||
return uni.$uv.http.get(`bst/customer/followup/list`, {
|
||||
params: {
|
||||
customerId: customerId
|
||||
},
|
||||
custom: {
|
||||
auth: true
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* 获取客户项目列表
|
||||
* @param {string} customerId 客户ID
|
||||
* @returns {Promise} 返回项目列表
|
||||
*/
|
||||
export const getCustomerProjects = (customerId) => {
|
||||
return uni.$uv.http.get(`bst/customer/projects`, {
|
||||
params: {
|
||||
customerId: customerId
|
||||
},
|
||||
custom: {
|
||||
auth: true
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* 创建客户
|
||||
* @param {Object} data 客户数据
|
||||
* @param {string} data.type 类型(固定为2)
|
||||
* @param {string} data.name 客户名
|
||||
* @param {string} data.mobile 手机号
|
||||
* @param {string} data.wechat 微信号
|
||||
* @param {string} data.source 来源
|
||||
* @param {string} data.intents 意向的设备,逗号分离
|
||||
* @param {string} data.status 状态(1潜在2意向3成交4失效)
|
||||
* @param {string} data.intentLevel 意向强度
|
||||
* @param {string} data.customerStatus 客户状态
|
||||
* @param {string} data.customerIntentLevel 客户意向强度
|
||||
* @param {string} data.nextFollowTime 下次跟进时间
|
||||
* @param {string} data.followId 跟进人id
|
||||
* @param {string} data.remark 备注
|
||||
* @param {string} data.concern 顾虑点
|
||||
* @param {string} data.pain 痛点
|
||||
* @param {string} data.attention 关注点
|
||||
* @param {string} data.demand 需求点
|
||||
* @returns {Promise} 返回创建结果
|
||||
*/
|
||||
export const createCustomer = (data) => {
|
||||
return uni.$uv.http.post(`bst/customer`, data, {
|
||||
custom: {
|
||||
auth: true
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
28
common/api/dashboard.js
Normal file
28
common/api/dashboard.js
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
/**
|
||||
* 仪表板相关 API
|
||||
*/
|
||||
|
||||
/**
|
||||
* 获取仪表板简要信息
|
||||
* @param {Object} params 请求参数
|
||||
* @param {string} params.joinUserId 用户ID
|
||||
* @param {string[]} params.keys 需要获取的数据键名数组
|
||||
* @returns {Promise} 返回仪表板简要信息
|
||||
*/
|
||||
export const getDashboardBrief = ({ joinUserId, keys }) => {
|
||||
// 构建查询参数字符串
|
||||
const params = [`joinUserId=${joinUserId}`];
|
||||
if (keys && Array.isArray(keys)) {
|
||||
keys.forEach((key) => {
|
||||
params.push(`keys=${encodeURIComponent(key)}`);
|
||||
});
|
||||
}
|
||||
const queryString = params.join('&');
|
||||
|
||||
return uni.$uv.http.get(`dashboard/brief?${queryString}`, {
|
||||
custom: {
|
||||
auth: true // 启用 token 认证
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
70
common/api/task.js
Normal file
70
common/api/task.js
Normal file
|
|
@ -0,0 +1,70 @@
|
|||
/**
|
||||
* 任务相关 API
|
||||
*/
|
||||
|
||||
/**
|
||||
* 获取任务列表
|
||||
* @param {Object} params 请求参数
|
||||
* @param {boolean} params.overdue 是否获取逾期任务
|
||||
* @param {number[]} params.statusList 任务状态列表,4对应已完成
|
||||
* @param {string} params.expireTimeStart 过期时间开始范围(格式:yyyy-MM-dd HH:mm:ss)
|
||||
* @param {string} params.expireTimeEnd 过期时间结束范围(格式:yyyy-MM-dd HH:mm:ss)
|
||||
* @returns {Promise} 返回任务列表
|
||||
*/
|
||||
export const getTaskList = ({ overdue, statusList, expireTimeStart, expireTimeEnd }) => {
|
||||
const queryParams = [];
|
||||
if (overdue !== undefined) {
|
||||
queryParams.push(`overdue=${overdue}`);
|
||||
}
|
||||
if (statusList !== undefined && Array.isArray(statusList) && statusList.length > 0) {
|
||||
// 将数组转换为逗号分隔的字符串,例如 [4] => "4" 或 [1,2,3] => "1,2,3"
|
||||
queryParams.push(`statusList=${statusList.join(',')}`);
|
||||
}
|
||||
if (expireTimeStart !== undefined && expireTimeStart !== null && expireTimeStart !== '') {
|
||||
queryParams.push(`expireTimeStart=${encodeURIComponent(expireTimeStart)}`);
|
||||
}
|
||||
if (expireTimeEnd !== undefined && expireTimeEnd !== null && expireTimeEnd !== '') {
|
||||
queryParams.push(`expireTimeEnd=${encodeURIComponent(expireTimeEnd)}`);
|
||||
}
|
||||
const queryString = queryParams.length > 0 ? `?${queryParams.join('&')}` : '';
|
||||
|
||||
return uni.$uv.http.get(`bst/task/list${queryString}`, {
|
||||
custom: {
|
||||
auth: true // 启用 token 认证
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* 获取任务详情
|
||||
* @param {string} id 任务ID
|
||||
* @returns {Promise} 返回任务详情
|
||||
*/
|
||||
export const getTaskDetail = (id) => {
|
||||
return uni.$uv.http.get(`bst/task/${id}`, {
|
||||
custom: {
|
||||
auth: true // 启用 token 认证
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* 提交任务
|
||||
* @param {Object} params 请求参数
|
||||
* @param {string} params.id 任务ID
|
||||
* @param {string} params.submitAttaches 附件, 逗号分隔的URL字符串
|
||||
* @param {string} params.submitRemark 备注
|
||||
* @returns {Promise} 返回提交结果
|
||||
*/
|
||||
export const submitTask = ({ id, submitAttaches, submitRemark }) => {
|
||||
return uni.$uv.http.put('/bst/task/submit', {
|
||||
id: id,
|
||||
submitAttaches: submitAttaches || '',
|
||||
submitRemark: submitRemark || ''
|
||||
}, {
|
||||
custom: {
|
||||
auth: true // 启用 token 认证
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
16
common/api/user.js
Normal file
16
common/api/user.js
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
/**
|
||||
* 用户相关 API
|
||||
*/
|
||||
|
||||
/**
|
||||
* 获取用户信息
|
||||
* @returns {Promise} 返回用户信息
|
||||
*/
|
||||
export const getUserInfo = () => {
|
||||
return uni.$uv.http.get('/getInfo', {
|
||||
custom: {
|
||||
auth: true // 启用 token 认证
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
Loading…
Reference in New Issue
Block a user