From 5f6fff865df74724218e651075c16d6e8f2fe656 Mon Sep 17 00:00:00 2001
From: wally <18603454788@163.com>
Date: Thu, 29 Jul 2021 11:56:04 +0800
Subject: [PATCH] =?UTF-8?q?refactor:=20=E9=87=8D=E6=9E=84store=E5=88=86?=
=?UTF-8?q?=E5=B1=82?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
分层分类project role task 去掉了home
---
.env | 1 +
CHANGELOG.md | 3 +-
src/apis/plugin.js | 3 +-
src/apis/project.js | 6 +-
src/apis/role.js | 5 +-
src/apis/task.js | 9 +-
src/components/Globals/Globals.vue | 2 +-
src/components/Roles/Roles.vue | 12 +-
src/components/TimeLine/TimeLine.vue | 10 +-
src/components/TimeLine/component/TimeBox.vue | 9 +-
.../TimeLine/component/TimeStatus.vue | 2 +-
src/components/Tips/Tips.vue | 6 +-
src/components/Title/Title.vue | 2 +-
src/config/domains.js | 14 ++
src/pages/project/project.vue | 40 ++---
src/store/index.js | 6 +-
src/store/project/actions.js | 18 +++
src/store/project/getters.js | 11 ++
src/store/project/index.js | 12 ++
src/store/project/mutations.js | 21 +++
src/store/project/state.js | 5 +
src/store/role/actions.js | 19 +++
src/store/role/getters.js | 3 +
src/store/role/index.js | 12 ++
src/store/role/mutations.js | 30 ++++
src/store/role/state.js | 7 +
src/store/task/actions.js | 18 +++
src/store/task/getters.js | 3 +
src/store/task/index.js | 12 ++
src/store/task/mutations.js | 142 ++++++++++++++++++
src/store/task/state.js | 35 +++++
31 files changed, 425 insertions(+), 53 deletions(-)
create mode 100644 src/config/domains.js
create mode 100644 src/store/project/actions.js
create mode 100644 src/store/project/getters.js
create mode 100644 src/store/project/index.js
create mode 100644 src/store/project/mutations.js
create mode 100644 src/store/project/state.js
create mode 100644 src/store/role/actions.js
create mode 100644 src/store/role/getters.js
create mode 100644 src/store/role/index.js
create mode 100644 src/store/role/mutations.js
create mode 100644 src/store/role/state.js
create mode 100644 src/store/task/actions.js
create mode 100644 src/store/task/getters.js
create mode 100644 src/store/task/index.js
create mode 100644 src/store/task/mutations.js
create mode 100644 src/store/task/state.js
diff --git a/.env b/.env
index e69de29..5eef0b0 100644
--- a/.env
+++ b/.env
@@ -0,0 +1 @@
+VUE_APP_DOMAIN=qcp
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 2beda9b..1a27f68 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,4 +1,4 @@
-# 0.1.0 (2021-07-28)
+# 0.1.0 (2021-07-29)
### 🌟 新功能
范围|描述|commitId
@@ -44,6 +44,7 @@
- | 日常任务修改 | dfa7ee2
- | 更新代码 | 8c27e68
- | 更新代码 | 1f40a76
+ - | 格式细节调整 | b907a03
- | 添加插件数据 | 2f11b42
- | 组件新建 | 89c0035
diff --git a/src/apis/plugin.js b/src/apis/plugin.js
index caeb006..0bc9630 100644
--- a/src/apis/plugin.js
+++ b/src/apis/plugin.js
@@ -1,5 +1,6 @@
+import domain from '@/config/domains';
const apiUrl = process.env.VUE_APP_API_URL;
-const mock = `${apiUrl}/defaultwbs`;
+const mock = `${apiUrl}${domain}`;
const plugin = `${apiUrl}/pluginshop/plugin`;
const install = (Vue, vm) => {
diff --git a/src/apis/project.js b/src/apis/project.js
index 2aa7a8d..03b9cb0 100644
--- a/src/apis/project.js
+++ b/src/apis/project.js
@@ -1,10 +1,12 @@
const apiUrl = process.env.VUE_APP_API_URL;
-const tall = `${apiUrl}/defaultwbs/project`;
+import domainPath from '@/config/domains';
+const tall = `${apiUrl}${domainPath}`;
+const project = `${tall}/project`;
const install = (Vue, vm) => {
vm.$u.api = { ...vm.$u.api } || {};
//根据id获取项目信息
- vm.$u.api.findProjectById = param => vm.$u.post(`${tall}/findProjectById`, param);
+ vm.$u.api.findProjectById = param => vm.$u.post(`${project}/findProjectById`, param);
};
export default { install };
diff --git a/src/apis/role.js b/src/apis/role.js
index d741a2d..275aae6 100644
--- a/src/apis/role.js
+++ b/src/apis/role.js
@@ -1,10 +1,11 @@
const apiUrl = process.env.VUE_APP_API_URL;
-const tall = `${apiUrl}/defaultwbs/role`;
+import domain from '@/config/domains';
+const role = `${apiUrl}${domain}/role`;
const install = (Vue, vm) => {
vm.$u.api = { ...vm.$u.api } || {};
//根据时间基准点和角色查找定期任务
- vm.$u.api.findShowRole = param => vm.$u.post(`${tall}/show`, param);
+ vm.$u.api.findShowRole = param => vm.$u.post(`${role}/show`, param);
};
export default { install };
diff --git a/src/apis/task.js b/src/apis/task.js
index a097752..9dfe9bb 100644
--- a/src/apis/task.js
+++ b/src/apis/task.js
@@ -1,12 +1,13 @@
const apiUrl = process.env.VUE_APP_API_URL;
-const tall = `${apiUrl}/defaultwbs/task`;
+import domain from '@/config/domains';
+const task = `${apiUrl}${domain}/task`;
const install = (Vue, vm) => {
vm.$u.api = { ...vm.$u.api } || {};
- vm.$u.api.getGlobal = param => vm.$u.post(`${tall}/global`, param);
- vm.$u.api.getPermanent = param => vm.$u.post(`${tall}/permanent`, param);
+ vm.$u.api.getGlobal = param => vm.$u.post(`${task}/global`, param);
+ vm.$u.api.getPermanent = param => vm.$u.post(`${task}/permanent`, param);
//根据时间基准点和角色查找定期任务
- vm.$u.api.getRegularTask = param => vm.$u.post(`${tall}/regular`, param);
+ vm.$u.api.getRegularTask = param => vm.$u.post(`${task}/regular`, param);
};
export default { install };
diff --git a/src/components/Globals/Globals.vue b/src/components/Globals/Globals.vue
index 15b2634..373e906 100644
--- a/src/components/Globals/Globals.vue
+++ b/src/components/Globals/Globals.vue
@@ -43,7 +43,7 @@ export default {
};
},
- computed: mapState('home', ['isShrink']),
+ computed: mapState('task', ['isShrink']),
methods: {
getClass(col, row) {
diff --git a/src/components/Roles/Roles.vue b/src/components/Roles/Roles.vue
index 758d083..d503c22 100644
--- a/src/components/Roles/Roles.vue
+++ b/src/components/Roles/Roles.vue
@@ -1,5 +1,5 @@
-
+
@@ -43,7 +43,10 @@ export default {
};
},
- computed: { ...mapState('home', ['visibleRoles', 'roleId', 'tasks']) },
+ computed: {
+ ...mapState('role', ['visibleRoles', 'roleId']),
+ ...mapState('task', ['tasks']),
+ },
watch: {
visibleRoles(val) {
@@ -63,8 +66,9 @@ export default {
},
methods: {
- ...mapMutations('home', ['setRoleId', 'setTasks']),
- ...mapActions('home', ['handleRegularTask']),
+ ...mapActions('task', ['handleRegularTask']),
+ ...mapMutations('role', ['setRoleId']),
+ ...mapMutations('task', ['setTasks']),
// 设置滚动位置
setCurrentRole(index) {
diff --git a/src/components/TimeLine/TimeLine.vue b/src/components/TimeLine/TimeLine.vue
index 59715cc..d6b57a9 100644
--- a/src/components/TimeLine/TimeLine.vue
+++ b/src/components/TimeLine/TimeLine.vue
@@ -14,7 +14,9 @@
>
到顶啦
+
+
到底啦
@@ -31,14 +33,18 @@ export default {
return { top: 0 };
},
- computed: mapState('home', ['scrollTop', 'showTips', 'visibleRoles', 'tasks', 'topEnd', 'bottomEnd']),
+ computed: {
+ ...mapState('role', ['visibleRoles']),
+ ...mapState('task', ['scrollTop', 'showTips', 'tasks', 'topEnd', 'bottomEnd']),
+ },
mounted() {
this.setDatumPoint();
},
methods: {
- ...mapMutations('home', ['setScrollTop', 'setShrink', 'setRoleId', 'setUpTasks', 'setDownTasks']),
+ ...mapMutations('role', ['setRoleId']),
+ ...mapMutations('task', ['setScrollTop', 'setShrink', 'setUpTasks', 'setDownTasks']),
// 滚动
scroll(e) {
diff --git a/src/components/TimeLine/component/TimeBox.vue b/src/components/TimeLine/component/TimeBox.vue
index 874f6d5..cb6dea3 100644
--- a/src/components/TimeLine/component/TimeBox.vue
+++ b/src/components/TimeLine/component/TimeBox.vue
@@ -67,12 +67,13 @@ export default {
return { currentComponent: '', styleType: 0 };
},
- computed: mapState('home', ['roleId', 'timeNode', 'timeUnit', 'tasks', 'taskLoading']),
-
- created() {},
+ computed: {
+ ...mapState('role', ['roleId']),
+ ...mapState('task', ['timeNode', 'timeUnit', 'tasks', 'taskLoading']),
+ },
methods: {
- ...mapMutations('home', ['setTipsContent', 'setTipsContent', 'setTimeNode']),
+ ...mapMutations('task', ['setTipsContent', 'setTipsContent', 'setTimeNode']),
// 设置任务面板高度
setHeight(panel) {
diff --git a/src/components/TimeLine/component/TimeStatus.vue b/src/components/TimeLine/component/TimeStatus.vue
index eed6809..70c0ed8 100644
--- a/src/components/TimeLine/component/TimeStatus.vue
+++ b/src/components/TimeLine/component/TimeStatus.vue
@@ -73,7 +73,7 @@ export default {
};
},
methods: {
- ...mapMutations('home', ['setClient', 'setTips', 'setStatus', 'setTipsContent']),
+ ...mapMutations('task', ['setClient', 'setTips', 'setStatus', 'setTipsContent']),
chooseList() {
return this.start;
diff --git a/src/components/Tips/Tips.vue b/src/components/Tips/Tips.vue
index 18b290f..d340ec6 100644
--- a/src/components/Tips/Tips.vue
+++ b/src/components/Tips/Tips.vue
@@ -1,6 +1,6 @@