diff --git a/templates/base/head_navbar.tmpl b/templates/base/head_navbar.tmpl
index 51761a7e5..0cf2f7484 100755
--- a/templates/base/head_navbar.tmpl
+++ b/templates/base/head_navbar.tmpl
@@ -27,7 +27,8 @@
{{.i18n.Tr "issues"}}
{{.i18n.Tr "pull_requests"}}
{{.i18n.Tr "milestones"}}
- {{.i18n.Tr "repo.cloudbrain.task"}}
+ {{.i18n.Tr "repo.cloudbrain.task"}}
+ 算力积分
@@ -58,7 +59,8 @@
{{.i18n.Tr "issues"}}
{{.i18n.Tr "pull_requests"}}
{{.i18n.Tr "milestones"}}
- {{.i18n.Tr "repo.cloudbrain.task"}}
+ {{.i18n.Tr "repo.cloudbrain.task"}}
+ 算力积分
diff --git a/templates/base/head_navbar_fluid.tmpl b/templates/base/head_navbar_fluid.tmpl
index 6baeced54..74827e12c 100644
--- a/templates/base/head_navbar_fluid.tmpl
+++ b/templates/base/head_navbar_fluid.tmpl
@@ -28,6 +28,7 @@
{{.i18n.Tr "pull_requests"}}
{{.i18n.Tr "milestones"}}
{{.i18n.Tr "repo.cloudbrain.task"}}
+ 算力积分
@@ -58,6 +59,7 @@
{{.i18n.Tr "pull_requests"}}
{{.i18n.Tr "milestones"}}
{{.i18n.Tr "repo.cloudbrain.task"}}
+ 算力积分
diff --git a/templates/base/head_navbar_home.tmpl b/templates/base/head_navbar_home.tmpl
index c9ea13b8a..1864bee6e 100644
--- a/templates/base/head_navbar_home.tmpl
+++ b/templates/base/head_navbar_home.tmpl
@@ -19,7 +19,8 @@
{{.i18n.Tr "issues"}}
{{.i18n.Tr "pull_requests"}}
{{.i18n.Tr "milestones"}}
- {{.i18n.Tr "repo.cloudbrain.task"}}
+ {{.i18n.Tr "repo.cloudbrain.task"}}
+ 算力积分
@@ -49,7 +50,8 @@
{{.i18n.Tr "issues"}}
{{.i18n.Tr "pull_requests"}}
{{.i18n.Tr "milestones"}}
- {{.i18n.Tr "repo.cloudbrain.task"}}
+ {{.i18n.Tr "repo.cloudbrain.task"}}
+ 算力积分
diff --git a/templates/base/head_navbar_pro.tmpl b/templates/base/head_navbar_pro.tmpl
index e744508f0..ba50c88fe 100644
--- a/templates/base/head_navbar_pro.tmpl
+++ b/templates/base/head_navbar_pro.tmpl
@@ -28,7 +28,8 @@
{{.i18n.Tr "issues"}}
{{.i18n.Tr "pull_requests"}}
{{.i18n.Tr "milestones"}}
- {{.i18n.Tr "repo.cloudbrain.task"}}
+ {{.i18n.Tr "repo.cloudbrain.task"}}
+ 算力积分
@@ -59,7 +60,8 @@
{{.i18n.Tr "issues"}}
{{.i18n.Tr "pull_requests"}}
{{.i18n.Tr "milestones"}}
- {{.i18n.Tr "repo.cloudbrain.task"}}
+ {{.i18n.Tr "repo.cloudbrain.task"}}
+ 算力积分
diff --git a/templates/reward/point.tmpl b/templates/reward/point.tmpl
new file mode 100644
index 000000000..359564b35
--- /dev/null
+++ b/templates/reward/point.tmpl
@@ -0,0 +1,6 @@
+{{template "base/head" .}}
+
+
+
+
+{{template "base/footer" .}}
diff --git a/web_src/js/features/notification.js b/web_src/js/features/notification.js
index 6f362eee6..aa8ed844e 100644
--- a/web_src/js/features/notification.js
+++ b/web_src/js/features/notification.js
@@ -47,7 +47,66 @@ export function initNotificationCount() {
});
source.addEventListener('reward-operation', async (e) => {
try {
- console.log(e.data);
+ const data = JSON.parse(e.data);
+ const notice = $(`
+
+
+
+
+
+ ${data.OperateType === 'INCREASE' ? ('奖励积分 + ' + data.Amount) : ('扣减积分 - ' + data.Amount) }
+
+
+
+ `);
+ $('body').append(notice);
+ notice.fadeIn();
+ setTimeout(() => {
+ notice.fadeOut();
+ }, 3000);
+ setTimeout(() => {
+ notice.remove();
+ }, 5000);
} catch (error) {
console.error(error);
}
diff --git a/web_src/vuepages/apis/modules/point.js b/web_src/vuepages/apis/modules/point.js
new file mode 100644
index 000000000..60b1df601
--- /dev/null
+++ b/web_src/vuepages/apis/modules/point.js
@@ -0,0 +1,41 @@
+import service from '../service';
+
+// 算力积分概要
+export const getPointAccount = () => {
+ return service({
+ url: '/reward/point/account',
+ method: 'get',
+ params: {},
+ });
+}
+
+// 算力积分获取、消耗明细
+// operate-INCREASE 表示获取明细 DECREASE表示消耗明细, page-当前页, pageSize-每页条数
+export const getPointList = (params) => {
+ return service({
+ url: '/reward/point/record/list',
+ method: 'get',
+ params,
+ });
+}
+
+// 管理员充值、扣减用户积分
+// TargetUserId, OperateType-INCREASE,DECREASE, Amount, Remark, RewardType-POINT
+export const setPointOperate = (data) => {
+ return service({
+ url: '/operation/reward/point/operate',
+ method: 'post',
+ data,
+ params: {}
+ });
+}
+
+// 算力积分页面
+export const getPoint = () => {
+ return service({
+ url: '/reward/point',
+ method: 'get',
+ params: {},
+ data: {},
+ });
+}
diff --git a/web_src/vuepages/apis/service.js b/web_src/vuepages/apis/service.js
new file mode 100644
index 000000000..292b9ef78
--- /dev/null
+++ b/web_src/vuepages/apis/service.js
@@ -0,0 +1,26 @@
+import axios from 'axios';
+
+const service = axios.create({
+ baseURL: '/',
+ timeout: 20000,
+});
+
+service.interceptors.request.use((config) => {
+ config.data && Object.assign(config.data, {
+ _csrf: window.config ? window.config.csrf : '',
+ });
+ config.params && Object.assign(config.params, {
+ _csrf: window.config ? window.config.csrf : '',
+ });
+ return config;
+}, (error) => {
+ return Promise.reject(error);
+});
+
+service.interceptors.response.use((response) => {
+ return response;
+}, (error) => {
+ return Promise.reject(error);
+});
+
+export default service;
diff --git a/web_src/vuepages/pages/reward/point/const.js b/web_src/vuepages/pages/reward/point/const.js
new file mode 100644
index 000000000..af0332cc7
--- /dev/null
+++ b/web_src/vuepages/pages/reward/point/const.js
@@ -0,0 +1,6 @@
+export const SOURCE_TYPE = [{ k: 'ACCOMPLISH_TASK', v: '积分任务' }, { k: 'ADMIN_OPERATE', v: '管理员操作' }, { k: 'RUN_CLOUDBRAIN_TASK', v: '运行云脑任务' }];
+export const CONSUME_STATUS = [{ k: 'OPERATING', v: '进行中' }, { k: 'SUCCEEDED', v: '已完成' }];
+export const POINT_ACTIONS = [
+ { k: 1, v: '创建公开项目' }, { k: 6, v: '每日提出任务' }, { k: 7, v: '每日提出PR' }, { k: 10, v: '发表评论' }, { k: 24, v: '上传数据集文件' }, { k: 30, v: '导入新模型' }, { k: 32, v: '完成微信扫码验证' },
+ { k: 33, v: '每日运行云脑任务' }, { k: 34, v: '数据集被平台推荐' }, { k: 35, v: '提交新公开镜像' }, { k: 36, v: '镜像被平台推荐' }, { k: 37, v: '首次更换头像' }, { k: 38, v: '每日commit' }, { k: 39, v: '每日首次Fork项目' },
+];
diff --git a/web_src/vuepages/pages/reward/point/vp-point.js b/web_src/vuepages/pages/reward/point/vp-point.js
new file mode 100644
index 000000000..8039d3f2c
--- /dev/null
+++ b/web_src/vuepages/pages/reward/point/vp-point.js
@@ -0,0 +1,12 @@
+import Vue from 'vue';
+import ElementUI from 'element-ui';
+import 'element-ui/lib/theme-chalk/index.css';
+
+Vue.use(ElementUI);
+import App from './vp-point.vue';
+// import App from '../manage/vp-point-manage.vue';
+
+new Vue({
+ el: '#__vue-root',
+ render: (h) => h(App),
+});
diff --git a/web_src/vuepages/pages/reward/point/vp-point.vue b/web_src/vuepages/pages/reward/point/vp-point.vue
new file mode 100644
index 000000000..22bb1f47e
--- /dev/null
+++ b/web_src/vuepages/pages/reward/point/vp-point.vue
@@ -0,0 +1,293 @@
+
+
+
+
+
+
+
{{ summaryInfo.available }}
+
当前可用算力积分(分)
+
+
+
+
{{ summaryInfo.gain }}
+
总获取算力积分(分)
+
+
+
{{ summaryInfo.used }}
+
总消耗算力积分(分)
+
+
+
+
+ 总获取明细
+
+
+ 总消耗明细
+
+
+
+
+
+
+
+
+
+ {{ scope.row.status }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{ loading ? "加载加..." : "暂无数据" }}
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/webpack.config.js b/webpack.config.js
index cd3635427..8b8800150 100755
--- a/webpack.config.js
+++ b/webpack.config.js
@@ -20,6 +20,11 @@ for (const path of glob('web_src/less/themes/*.less')) {
themes[parse(path).name] = [path];
}
+const vuePages = {};
+for (const path of glob('web_src/vuepages/**/vp-*.js')) {
+ vuePages[parse(path).name] = [path];
+}
+
const isProduction = process.env.NODE_ENV !== 'development';
module.exports = {
@@ -37,6 +42,7 @@ module.exports = {
],
icons: glob('node_modules/@primer/octicons/build/svg/**/*.svg'),
...themes,
+ ...vuePages,
},
devtool: false,
output: {