保存进度!
This commit is contained in:
parent
efebd548c6
commit
2edd5f67db
@ -12,4 +12,7 @@
|
|||||||
|
|
||||||
// testRankingListRequest();
|
// testRankingListRequest();
|
||||||
|
|
||||||
|
const arr: string[] = [];
|
||||||
|
|
||||||
console.log( "test" );
|
console.log( "test" );
|
||||||
|
console.log( "检查instanceof:", arr instanceof String );
|
||||||
|
@ -26,4 +26,9 @@ export const API_URL = {
|
|||||||
|
|
||||||
// 坐席业绩查询
|
// 坐席业绩查询
|
||||||
URL_CALLER_ARCHIEVEMENT: "http://10.39.0.41:8081/desktop_archievement_backend/archievement/query_caller_archievement.do",
|
URL_CALLER_ARCHIEVEMENT: "http://10.39.0.41:8081/desktop_archievement_backend/archievement/query_caller_archievement.do",
|
||||||
|
|
||||||
|
/** 奖项相关 **/
|
||||||
|
// 查询奖励项目
|
||||||
|
// URL_RWARD_PROJECTS: "http://222.76.244.118:11101/desktop_archievement_backend/rewards/query_reward_projects.do"
|
||||||
|
URL_RWARD_PROJECTS: "http://10.39.0.41:8081/desktop_archievement_backend/rewards/query_reward_projects.do",
|
||||||
};
|
};
|
||||||
|
96
code/web/task_schedule/src/utils/reward.ts
Normal file
96
code/web/task_schedule/src/utils/reward.ts
Normal file
@ -0,0 +1,96 @@
|
|||||||
|
/*
|
||||||
|
* @Author: Kane
|
||||||
|
* @Date: 2023-09-11 09:59:00
|
||||||
|
* @LastEditors: Kane
|
||||||
|
* @FilePath: /task_schedule/src/utils/reward.ts
|
||||||
|
* @Description:
|
||||||
|
*
|
||||||
|
* Copyright (c) ${2022} by Kane, All Rights Reserved.
|
||||||
|
*/
|
||||||
|
import { type AxiosResponse } from "axios";
|
||||||
|
import { service as instance } from "./api/request.js";
|
||||||
|
import { API_URL } from "./api/config.js";
|
||||||
|
|
||||||
|
interface RewardProject
|
||||||
|
{
|
||||||
|
rewardCode: number;
|
||||||
|
rewardName: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface RewardProjectResponse
|
||||||
|
{
|
||||||
|
success: boolean;
|
||||||
|
message: string;
|
||||||
|
rewardList: RewardProject[];
|
||||||
|
}
|
||||||
|
|
||||||
|
interface RewardGainer
|
||||||
|
{
|
||||||
|
acquiredDate: string;
|
||||||
|
callerName: string;
|
||||||
|
callerCode: string;
|
||||||
|
rewardProjectCode: string;
|
||||||
|
rewardProjectName: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 请求奖项清单
|
||||||
|
* @param handler 用于处理请求数据的回调函数;
|
||||||
|
*/
|
||||||
|
function requestRewardPorjectsList( handler: any ): void
|
||||||
|
{
|
||||||
|
if ( handler === undefined || handler === null )
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
instance.request({
|
||||||
|
url: API_URL.URL_RWARD_PROJECTS,
|
||||||
|
method: "post",
|
||||||
|
})
|
||||||
|
// 请求成功,检查服务器返回结果
|
||||||
|
.then(( response: AxiosResponse<any, any> ): void =>
|
||||||
|
{
|
||||||
|
const data = response.data ?? {};
|
||||||
|
const success = data.success ?? false;
|
||||||
|
const message = data.message ?? "";
|
||||||
|
const rewardProjectList = checkRewardProjects( data.rewardList ?? []);
|
||||||
|
})
|
||||||
|
.catch(( error: any ): void =>
|
||||||
|
{
|
||||||
|
console.log( error );
|
||||||
|
|
||||||
|
handler( null, error );
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// **功能函数 **********************************/
|
||||||
|
function checkRewardProjects( data: any[]): RewardProject[] | null
|
||||||
|
{
|
||||||
|
const rewardList: RewardProject[] = [];
|
||||||
|
|
||||||
|
// 检查一下参数的类型,如果不是数组返回 null
|
||||||
|
if ( !( data instanceof Array ))
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
data.forEach(( item: any ) =>
|
||||||
|
{
|
||||||
|
const reward = {
|
||||||
|
rewardCode: item.rewardCode ?? "",
|
||||||
|
rewardName: item.rewardName ?? "",
|
||||||
|
};
|
||||||
|
|
||||||
|
rewardList.push( reward );
|
||||||
|
});
|
||||||
|
|
||||||
|
return rewardList;
|
||||||
|
}
|
||||||
|
|
||||||
|
export {
|
||||||
|
type RewardProject,
|
||||||
|
type RewardGainer,
|
||||||
|
type RewardProjectResponse,
|
||||||
|
requestRewardPorjectsList
|
||||||
|
};
|
Loading…
x
Reference in New Issue
Block a user