You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
52 lines
1.5 KiB
52 lines
1.5 KiB
const actions = {
|
|
/**
|
|
* 根据角色查找永久的日常任务
|
|
* @param {*} commit
|
|
* @param {string} roleId 角色id
|
|
*/
|
|
async getPermanent({ commit }, roleId) {
|
|
try {
|
|
const data = await uni.$u.api.getPermanent({ roleId });
|
|
commit('setPermanents', data);
|
|
} catch (error) {
|
|
console.log('task actions getPermanent error: ', error);
|
|
}
|
|
},
|
|
|
|
/**
|
|
* 根据时间和角色查找日常任务
|
|
* @param {*} commit
|
|
* @param {object} param 请求参数 roleId, timeNode, timeUnit
|
|
*/
|
|
async getGlobal({ commit }, param) {
|
|
try {
|
|
const data = await uni.$u.api.getGlobal(param);
|
|
commit('setDailyTasks', data);
|
|
} catch (error) {
|
|
console.log('task actions getGlobal error: ', error);
|
|
}
|
|
},
|
|
|
|
/**
|
|
* 根据时间基准点和角色查找定期任务
|
|
* @param {object} param 查询参数
|
|
* @param {number} param.queryType 必填 0 -> 向上 1 -> 向下
|
|
*/
|
|
// eslint-disable-next-line
|
|
async getRegulars({ commit, state }, param) {
|
|
try {
|
|
// 向上查 且 上边没数据了 不查
|
|
// if (param.queryType === 0) return;
|
|
// 向下查 且 下边美术家了 不查
|
|
// if (param.queryType === 1) return;
|
|
const data = await uni.$u.api.getRegularTask(param);
|
|
// 0 -> 向上 1 -> 向下
|
|
// data 有无的判断在mutations里
|
|
param.queryType === 0 ? commit('setUpTasks', data) : commit('setDownTasks', data);
|
|
} catch (error) {
|
|
throw error || '获取定期任务失败';
|
|
}
|
|
},
|
|
};
|
|
|
|
export default actions;
|
|
|