diff --git a/web_src/vuepages/components/BaseDialog.vue b/web_src/vuepages/components/BaseDialog.vue new file mode 100644 index 000000000..a95f99d18 --- /dev/null +++ b/web_src/vuepages/components/BaseDialog.vue @@ -0,0 +1,113 @@ + + + diff --git a/web_src/vuepages/pages/reward/point/utils.js b/web_src/vuepages/pages/reward/point/utils.js new file mode 100644 index 000000000..b19e41b1f --- /dev/null +++ b/web_src/vuepages/pages/reward/point/utils.js @@ -0,0 +1,98 @@ + +import { formatDate } from 'element-ui/lib/utils/date-util'; +import { SOURCE_TYPE, CONSUME_STATUS, POINT_ACTIONS } from './const'; + +const getSourceType = (key) => { + const find = SOURCE_TYPE.filter(item => item.k === key); + return find.length ? find[0].v : key; +}; +const getConsumeStatus = (key) => { + const find = CONSUME_STATUS.filter(item => item.k === key); + return find.length ? find[0].v : key; +}; +const getPointAction = (key) => { + const find = POINT_ACTIONS.filter(item => item.k === key); + return find.length ? find[0].v : key; +}; + +export const getRewardPointRecordInfo = (record) => { + const out = { + sn: record.SerialNo, + date: formatDate(new Date(record.LastOperateDate * 1000), 'yyyy-MM-DD HH:mm:ss'), + _status: record.Status, + status: getConsumeStatus(record.Status) || '--', + statusColor: record.Status === 'OPERATING' ? 'rgb(33, 186, 69)' : '', + _sourceType: record.SourceType, + sourceType: getSourceType(record.SourceType), + duration: record?.Cloudbrain?.Duration || '--', + taskName: record?.Cloudbrain?.DisplayJobName || '--', + taskId: record?.Cloudbrain?.ID, + action: record?.Action?.OpType ? getPointAction(record.Action.OpType) : '--', + remark: record.Remark, + amount: record.Amount, + }; + if (record.OperateType === 'INCREASE') { + if (record.SourceType === 'ADMIN_OPERATE') { + out.remark = record.Remark; + } else if (record.SourceType === 'ACCOMPLISH_TASK') { + switch (record?.Action?.OpType) { + case 1: // 创建公开项目 - 创建了项目OpenI/aiforge + out.remark = `创建了项目${record.Action.ShortRepoFullDisplayName}`; + break; + case 6: // 每日提出任务 - 创建了任务PCL-Platform.Intelligence/AISynergy#19 + out.remark = `创建了任务${record.Action.ShortRepoFullDisplayName}#${record.Action.IssueInfos[0]}`; + break; + case 7: // 每日提出PR - 创建了合并请求OpenI/aiforge#1 + out.remark = `创建了合并请求${record.Action.ShortRepoFullDisplayName}#${record.Action.IssueInfos[0]}`; + break; + case 10: // 发表评论 - 评论了任务PCL-Platform.Intelligence/AISynergy#19 + out.remark = `评论了任务${record.Action.ShortRepoFullDisplayName}#${record.Action.IssueInfos[0]}`; + break; + case 24: // 上传数据集文件 - 上传了数据集文件MMISTData.zip + out.remark = `上传了数据集文件${record.Action.RefName}`; + break; + case 30: // 导入新模型 - 导入了新模型resnet50_qx7l + break; + case 32: // 完成微信扫码验证 - 首次绑定微信奖励 + out.remark = '首次绑定微信奖励'; + break; + case 33: // 每日运行云脑任务 - 创建了(CPU/GPU/NPU)类型(调试/训练/推理/评测)任务tangl202204131431995 + out.remark = `创建了{{}}类型{{}}任务${record.Action.RefName}`; + break; + case 34: // 数据集被平台推荐 - 数据集XXX被设置为推荐数据集 + out.remark = `数据集${record.Action.RefName}被设置为推荐数据集`; + break; + case 35: // 提交新公开镜像 - 提交了镜像jiangxiang_ceshi_tang03 + out.remark = `提交了镜像${record.Action.RefName}`; + break; + case 36: // 镜像被平台推荐 - 镜像XXX被设置为推荐镜像 + out.remark = `镜像${record.Action.RefName}被设置为推荐镜像`; + break; + case 37: // 首次更换头像 - 更新了头像 + out.remark = '更新了头像'; + break; + case 38: // 每日commit - 推送了xxxx分支的代码到OpenI/aiforge + const words = record.Action.RefName.split('/'); + const branch = words[words.length - 1]; + out.remark = `推送了${branch}分支的代码到${record.Action.ShortRepoFullDisplayName}`; + break; + case 39: // 每日首次Fork项目 - 创建了项目OpenI/fork_aiforge + out.remark = `创建了项目${record.Action.ShortRepoFullDisplayName}`; + break; + default: + break; + } + } else if (record.SourceType === 'RUN_CLOUDBRAIN_TASK') { + + } + } else if (record.OperateType === 'DECREASE') { + if (record.SourceType === 'ADMIN_OPERATE') { + out.remark = record.Remark; + } else if (record.SourceType === 'ACCOMPLISH_TASK') { + + } else if (record.SourceType === 'RUN_CLOUDBRAIN_TASK') { + + } + } + return out; +}; diff --git a/web_src/vuepages/pages/reward/point/vp-point.vue b/web_src/vuepages/pages/reward/point/vp-point.vue index 22bb1f47e..65b48f1c9 100644 --- a/web_src/vuepages/pages/reward/point/vp-point.vue +++ b/web_src/vuepages/pages/reward/point/vp-point.vue @@ -41,30 +41,53 @@
-
- - - - +
+ + + + + + + + - - - + + + +
+
+ + - + - + + - + + + + - + + @@ -88,7 +111,7 @@