Browse Source

perf: 测试接口

develop
lucky 4 years ago
parent
commit
215e074f3e
  1. 107
      CHANGELOG.md
  2. 11
      src/apis/project.js
  3. 10
      src/apis/role.js
  4. 3
      src/apis/task.js
  5. 20
      src/components/Globals/Globals.vue
  6. 56
      src/components/TimeLine/TimeLine.vue
  7. 51
      src/components/TimeLine/component/TimeBox.vue
  8. 16
      src/config/plugin.js
  9. 2
      src/main.js
  10. 3
      src/pages.json
  11. 66
      src/pages/project/project.vue
  12. 23
      src/plugins/TaskDescription/TaskDescription.vue
  13. 23
      src/plugins/TaskDurationDelay/TaskDurationDelay.vue
  14. 23
      src/plugins/TaskTitle copy/TaskTitle.vue
  15. 26
      src/plugins/TaskTitle/TaskTitle.vue
  16. 19
      src/plugins/p-deliverable/p-deliverable.vue
  17. 19
      src/plugins/p-subproject/p-subproject.vue
  18. 19
      src/plugins/p-subtasks/p-subtasks.vue
  19. 19
      src/plugins/p-task-countdown/p-task-countdown.vue
  20. 19
      src/plugins/p-task-description/p-task-description.vue
  21. 18
      src/plugins/p-task-duration-delay/p-task-duration-delay.vue
  22. 19
      src/plugins/p-task-start-time-delay/p-task-start-time-delay.vue
  23. 19
      src/plugins/p-task-title/p-task-title.vue
  24. 14
      src/store/home/actions.js
  25. 18
      src/store/home/mutations.js
  26. 1
      src/store/home/state.js
  27. 9
      src/store/user/actions.js
  28. 1
      src/utils/request.js

107
CHANGELOG.md

@ -3,91 +3,92 @@
### 🌟 新功能 ### 🌟 新功能
范围|描述|commitId 范围|描述|commitId
--|--|-- --|--|--
- | db store | [6414c4f](http://gitea@dd.tall.wiki:wally/TALL-MUI-3/commits/6414c4f) - | 标题栏变化 | [c0fcd9d](https://dd.tall.wiki/gitea/wally/TALL-MUI-3/commits/c0fcd9d)
- | indexedDB | [687394e](http://gitea@dd.tall.wiki:wally/TALL-MUI-3/commits/687394e) - | 标题栏角色栏全局任务组件新建 | [0500cb4](https://dd.tall.wiki/gitea/wally/TALL-MUI-3/commits/0500cb4)
- | post 封装 | [da52e94](http://gitea@dd.tall.wiki:wally/TALL-MUI-3/commits/da52e94) - | 插件数据获取 | [5b91bdc](https://dd.tall.wiki/gitea/wally/TALL-MUI-3/commits/5b91bdc)
- | tall插件封装 | [1bcb920](http://gitea@dd.tall.wiki:wally/TALL-MUI-3/commits/1bcb920) - | 存token | [b8a178d](https://dd.tall.wiki/gitea/wally/TALL-MUI-3/commits/b8a178d)
- | 存token | [b8a178d](http://gitea@dd.tall.wiki:wally/TALL-MUI-3/commits/b8a178d) - | 角色栏实现 | [94cd671](https://dd.tall.wiki/gitea/wally/TALL-MUI-3/commits/94cd671)
- | 提交到本地 | [9cbe411](http://gitea@dd.tall.wiki:wally/TALL-MUI-3/commits/9cbe411) - | 模拟接口测试 | [69e7931](https://dd.tall.wiki/gitea/wally/TALL-MUI-3/commits/69e7931)
- | 插件数据获取 | [5b91bdc](http://gitea@dd.tall.wiki:wally/TALL-MUI-3/commits/5b91bdc) - | 配置默认插件接口 | [f0c177d](https://dd.tall.wiki/gitea/wally/TALL-MUI-3/commits/f0c177d)
- | 时间基准线,默认插件 | [a33ba1e](http://gitea@dd.tall.wiki:wally/TALL-MUI-3/commits/a33ba1e) - | 时间基准线,默认插件 | [a33ba1e](https://dd.tall.wiki/gitea/wally/TALL-MUI-3/commits/a33ba1e)
- | 时间轴修改状态时提示框增加 | [e841392](http://gitea@dd.tall.wiki:wally/TALL-MUI-3/commits/e841392) - | 时间轴界面 | [33927e9](https://dd.tall.wiki/gitea/wally/TALL-MUI-3/commits/33927e9)
- | 时间轴界面 | [33927e9](http://gitea@dd.tall.wiki:wally/TALL-MUI-3/commits/33927e9) - | 时间轴修改状态时提示框增加 | [e841392](https://dd.tall.wiki/gitea/wally/TALL-MUI-3/commits/e841392)
- | 标题栏变化 | [c0fcd9d](http://gitea@dd.tall.wiki:wally/TALL-MUI-3/commits/c0fcd9d) - | 提交到本地 | [9cbe411](https://dd.tall.wiki/gitea/wally/TALL-MUI-3/commits/9cbe411)
- | 标题栏角色栏全局任务组件新建 | [0500cb4](http://gitea@dd.tall.wiki:wally/TALL-MUI-3/commits/0500cb4) - | 添加时间轴上下滚动 | [2b81bbc](https://dd.tall.wiki/gitea/wally/TALL-MUI-3/commits/2b81bbc)
- | 模拟接口测试 | [69e7931](http://gitea@dd.tall.wiki:wally/TALL-MUI-3/commits/69e7931) - | db store | [6414c4f](https://dd.tall.wiki/gitea/wally/TALL-MUI-3/commits/6414c4f)
- | 添加时间轴上下滚动 | [2b81bbc](http://gitea@dd.tall.wiki:wally/TALL-MUI-3/commits/2b81bbc) - | indexedDB | [687394e](https://dd.tall.wiki/gitea/wally/TALL-MUI-3/commits/687394e)
- | 角色栏实现 | [94cd671](http://gitea@dd.tall.wiki:wally/TALL-MUI-3/commits/94cd671) - | post 封装 | [da52e94](https://dd.tall.wiki/gitea/wally/TALL-MUI-3/commits/da52e94)
- | 配置默认插件接口 | [f0c177d](http://gitea@dd.tall.wiki:wally/TALL-MUI-3/commits/f0c177d) - | tall插件封装 | [1bcb920](https://dd.tall.wiki/gitea/wally/TALL-MUI-3/commits/1bcb920)
pinch | alloy finger实现图片的pinch放大缩小 | [de01343](http://gitea@dd.tall.wiki:wally/TALL-MUI-3/commits/de01343) 富文本插件 | 富文本插件demo测试 | [ed3d644](https://dd.tall.wiki/gitea/wally/TALL-MUI-3/commits/ed3d644)
富文本插件 | 富文本插件demo测试 | [ed3d644](http://gitea@dd.tall.wiki:wally/TALL-MUI-3/commits/ed3d644) pinch | alloy finger实现图片的pinch放大缩小 | [de01343](https://dd.tall.wiki/gitea/wally/TALL-MUI-3/commits/de01343)
### 🎨 代码样式 ### 🎨 代码样式
范围|描述|commitId 范围|描述|commitId
--|--|-- --|--|--
- | 代码格式细节调整 | [cb2532b](http://gitea@dd.tall.wiki:wally/TALL-MUI-3/commits/cb2532b) - | 代码格式细节调整 | [cb2532b](https://dd.tall.wiki/gitea/wally/TALL-MUI-3/commits/cb2532b)
- | 任务快捷方式图标增加 | [4aba872](http://gitea@dd.tall.wiki:wally/TALL-MUI-3/commits/4aba872) - | 更新代码 | [8c27e68](https://dd.tall.wiki/gitea/wally/TALL-MUI-3/commits/8c27e68)
- | 修改角色样式 | [73e268e](http://gitea@dd.tall.wiki:wally/TALL-MUI-3/commits/73e268e) - | 更新代码 | [1f40a76](https://dd.tall.wiki/gitea/wally/TALL-MUI-3/commits/1f40a76)
- | 删除插件携带的多余文件 | [0f392bb](http://gitea@dd.tall.wiki:wally/TALL-MUI-3/commits/0f392bb) - | 任务快捷方式图标增加 | [4aba872](https://dd.tall.wiki/gitea/wally/TALL-MUI-3/commits/4aba872)
- | 图标修改 | [54bca09](http://gitea@dd.tall.wiki:wally/TALL-MUI-3/commits/54bca09) - | 日常任务修改 | [dfa7ee2](https://dd.tall.wiki/gitea/wally/TALL-MUI-3/commits/dfa7ee2)
- | 无基本变化 | [21ac4bb](http://gitea@dd.tall.wiki:wally/TALL-MUI-3/commits/21ac4bb) - | 删除插件携带的多余文件 | [0f392bb](https://dd.tall.wiki/gitea/wally/TALL-MUI-3/commits/0f392bb)
- | 日常任务修改 | [dfa7ee2](http://gitea@dd.tall.wiki:wally/TALL-MUI-3/commits/dfa7ee2) - | 添加插件数据 | [2f11b42](https://dd.tall.wiki/gitea/wally/TALL-MUI-3/commits/2f11b42)
- | 更新代码 | [8c27e68](http://gitea@dd.tall.wiki:wally/TALL-MUI-3/commits/8c27e68) - | 图标修改 | [54bca09](https://dd.tall.wiki/gitea/wally/TALL-MUI-3/commits/54bca09)
- | 更新代码 | [1f40a76](http://gitea@dd.tall.wiki:wally/TALL-MUI-3/commits/1f40a76) - | 无基本变化 | [21ac4bb](https://dd.tall.wiki/gitea/wally/TALL-MUI-3/commits/21ac4bb)
- | 添加插件数据 | [2f11b42](http://gitea@dd.tall.wiki:wally/TALL-MUI-3/commits/2f11b42) - | 修改角色样式 | [73e268e](https://dd.tall.wiki/gitea/wally/TALL-MUI-3/commits/73e268e)
- | 组件新建 | [89c0035](http://gitea@dd.tall.wiki:wally/TALL-MUI-3/commits/89c0035) - | 组件新建 | [89c0035](https://dd.tall.wiki/gitea/wally/TALL-MUI-3/commits/89c0035)
### 🐛 Bug 修复 ### 🐛 Bug 修复
范围|描述|commitId 范围|描述|commitId
--|--|-- --|--|--
- | 上下滚动时间轴 | [d533a01](http://gitea@dd.tall.wiki:wally/TALL-MUI-3/commits/d533a01) - | 骨架屏替换 | [e9fdd71](https://dd.tall.wiki/gitea/wally/TALL-MUI-3/commits/e9fdd71)
- | 修改main | [749ae9a](http://gitea@dd.tall.wiki:wally/TALL-MUI-3/commits/749ae9a) - | 角色栏修改 | [19228d6](https://dd.tall.wiki/gitea/wally/TALL-MUI-3/commits/19228d6)
- | 修改角色栏组件 | [a54c601](http://gitea@dd.tall.wiki:wally/TALL-MUI-3/commits/a54c601) - | 上下滚动时间轴 | [d533a01](https://dd.tall.wiki/gitea/wally/TALL-MUI-3/commits/d533a01)
- | 提示信息显示bug及日常任务收缩问题 | [f2f06c5](http://gitea@dd.tall.wiki:wally/TALL-MUI-3/commits/f2f06c5) - | 时间轴上下滚动数据加载bug修改 | [e82ede4](https://dd.tall.wiki/gitea/wally/TALL-MUI-3/commits/e82ede4)
- | 时间轴上下滑动 | [4d0ae46](http://gitea@dd.tall.wiki:wally/TALL-MUI-3/commits/4d0ae46) - | 时间轴上下滑动 | [4d0ae46](https://dd.tall.wiki/gitea/wally/TALL-MUI-3/commits/4d0ae46)
- | 时间轴上下滚动数据加载bug修改 | [e82ede4](http://gitea@dd.tall.wiki:wally/TALL-MUI-3/commits/e82ede4) - | 提示信息显示bug及日常任务收缩问题 | [f2f06c5](https://dd.tall.wiki/gitea/wally/TALL-MUI-3/commits/f2f06c5)
- | 角色栏修改 | [19228d6](http://gitea@dd.tall.wiki:wally/TALL-MUI-3/commits/19228d6) - | 修改角色栏组件 | [a54c601](https://dd.tall.wiki/gitea/wally/TALL-MUI-3/commits/a54c601)
- | 骨架屏替换 | [e9fdd71](http://gitea@dd.tall.wiki:wally/TALL-MUI-3/commits/e9fdd71) - | 修改main | [749ae9a](https://dd.tall.wiki/gitea/wally/TALL-MUI-3/commits/749ae9a)
### 📝 文档 ### 📝 文档
范围|描述|commitId 范围|描述|commitId
--|--|-- --|--|--
- | README.md | [ab0eb05](http://gitea@dd.tall.wiki:wally/TALL-MUI-3/commits/ab0eb05) - | README.md | [ab0eb05](https://dd.tall.wiki/gitea/wally/TALL-MUI-3/commits/ab0eb05)
### 🔨 代码重构 ### 🔨 代码重构
范围|描述|commitId 范围|描述|commitId
--|--|-- --|--|--
template | eslint prettier sass uview tailwindcss | [9c966a1](http://gitea@dd.tall.wiki:wally/TALL-MUI-3/commits/9c966a1) template | eslint prettier sass uview tailwindcss | [9c966a1](https://dd.tall.wiki/gitea/wally/TALL-MUI-3/commits/9c966a1)
### 🚀 性能优化 ### 🚀 性能优化
范围|描述|commitId 范围|描述|commitId
--|--|-- --|--|--
- | 组件文件夹新建 | [22bfe7b](http://gitea@dd.tall.wiki:wally/TALL-MUI-3/commits/22bfe7b) - | 角色栏文字颜色修改 | [215c6b3](https://dd.tall.wiki/gitea/wally/TALL-MUI-3/commits/215c6b3)
- | 组件文件夹新建 | [17bb8c9](http://gitea@dd.tall.wiki:wally/TALL-MUI-3/commits/17bb8c9) - | 解决警告 | [c932b09](https://dd.tall.wiki/gitea/wally/TALL-MUI-3/commits/c932b09)
- | 组件文件夹新建 | [1421504](http://gitea@dd.tall.wiki:wally/TALL-MUI-3/commits/1421504) - | 组件文件夹新建 | [22bfe7b](https://dd.tall.wiki/gitea/wally/TALL-MUI-3/commits/22bfe7b)
- | 角色栏文字颜色修改 | [215c6b3](http://gitea@dd.tall.wiki:wally/TALL-MUI-3/commits/215c6b3) - | 组件文件夹新建 | [17bb8c9](https://dd.tall.wiki/gitea/wally/TALL-MUI-3/commits/17bb8c9)
- | 解决警告 | [c932b09](http://gitea@dd.tall.wiki:wally/TALL-MUI-3/commits/c932b09) - | 组件文件夹新建 | [1421504](https://dd.tall.wiki/gitea/wally/TALL-MUI-3/commits/1421504)
### chore ### chore
范围|描述|commitId 范围|描述|commitId
--|--|-- --|--|--
- | api 封装 | [8dcb8a2](http://gitea@dd.tall.wiki:wally/TALL-MUI-3/commits/8dcb8a2) - | api 封装 | [8dcb8a2](https://dd.tall.wiki/gitea/wally/TALL-MUI-3/commits/8dcb8a2)
- | env host修改 | [a79a4a5](http://gitea@dd.tall.wiki:wally/TALL-MUI-3/commits/a79a4a5) - | env host修改 | [a79a4a5](https://dd.tall.wiki/gitea/wally/TALL-MUI-3/commits/a79a4a5)
- | mock | [51c24a5](http://gitea@dd.tall.wiki:wally/TALL-MUI-3/commits/51c24a5) - | merge globals | [b0957cc](https://dd.tall.wiki/gitea/wally/TALL-MUI-3/commits/b0957cc)
pwa 小程序 | 移除了pwa,alloyFinger添加平台判断 | [875fab4](http://gitea@dd.tall.wiki:wally/TALL-MUI-3/commits/875fab4) - | mock | [51c24a5](https://dd.tall.wiki/gitea/wally/TALL-MUI-3/commits/51c24a5)
- | uview-ui | [a9ea34b](http://gitea@dd.tall.wiki:wally/TALL-MUI-3/commits/a9ea34b) pwa 小程序 | 移除了pwa,alloyFinger添加平台判断 | [875fab4](https://dd.tall.wiki/gitea/wally/TALL-MUI-3/commits/875fab4)
信息配置 | 配置eslint等配置 | [7421443](http://gitea@dd.tall.wiki:wally/TALL-MUI-3/commits/7421443) - | uview-ui | [a9ea34b](https://dd.tall.wiki/gitea/wally/TALL-MUI-3/commits/a9ea34b)
信息配置 | 配置eslint等配置 | [7421443](https://dd.tall.wiki/gitea/wally/TALL-MUI-3/commits/7421443)
范围|描述|commitId 范围|描述|commitId
--|--|-- --|--|--
- | style:index | [978f272](http://gitea@dd.tall.wiki:wally/TALL-MUI-3/commits/978f272) - | style:index | [978f272](https://dd.tall.wiki/gitea/wally/TALL-MUI-3/commits/978f272)
- | !2 基础模板v1.1.0 | [f5e61dd](http://gitea@dd.tall.wiki:wally/TALL-MUI-3/commits/f5e61dd) - | !2 基础模板v1.1.0 | [f5e61dd](https://dd.tall.wiki/gitea/wally/TALL-MUI-3/commits/f5e61dd)
- | init | [c0f1deb](http://gitea@dd.tall.wiki:wally/TALL-MUI-3/commits/c0f1deb) - | init | [c0f1deb](https://dd.tall.wiki/gitea/wally/TALL-MUI-3/commits/c0f1deb)

11
src/apis/project.js

@ -1,17 +1,10 @@
const apiUrl = process.env.VUE_APP_API_URL; const apiUrl = process.env.VUE_APP_API_URL;
const tall = `${apiUrl}/defaultwbs`; const tall = `${apiUrl}/defaultwbs/project`;
const project = `${tall}/project`;
const role = `${tall}/role`;
const task = `${tall}/task`;
const install = (Vue, vm) => { const install = (Vue, vm) => {
vm.$u.api = { ...vm.$u.api } || {}; vm.$u.api = { ...vm.$u.api } || {};
//根据id获取项目信息 //根据id获取项目信息
vm.$u.api.findProjectById = params => vm.$u.post(`${project}/findProjectById`, params); vm.$u.api.findProjectById = param => vm.$u.post(`${tall}/findProjectById`, param);
//查询角色栏展示的角色
vm.$u.api.findShowRoles = params => vm.$u.post(`${role}/show`, params);
//根据时间基准点和角色查找定期任务
vm.$u.api.getRegularTask = params => vm.$u.post(`${task}/regular`, params);
}; };
export default { install }; export default { install };

10
src/apis/role.js

@ -0,0 +1,10 @@
const apiUrl = process.env.VUE_APP_API_URL;
const tall = `${apiUrl}/defaultwbs/role`;
const install = (Vue, vm) => {
vm.$u.api = { ...vm.$u.api } || {};
//根据时间基准点和角色查找定期任务
vm.$u.api.findShowRole = param => vm.$u.post(`${tall}/show`, param);
};
export default { install };

3
src/apis/task.js

@ -5,7 +5,8 @@ const install = (Vue, vm) => {
vm.$u.api = { ...vm.$u.api } || {}; vm.$u.api = { ...vm.$u.api } || {};
vm.$u.api.getGlobal = param => vm.$u.post(`${tall}/global`, param); 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.getPermanent = param => vm.$u.post(`${tall}/permanent`, param);
vm.$u.api.getERegular = param => vm.$u.post(`${tall}/regular`, param); //根据时间基准点和角色查找定期任务
vm.$u.api.getRegularTask = param => vm.$u.post(`${tall}/regular`, param);
}; };
export default { install }; export default { install };

20
src/components/Globals/Globals.vue

@ -7,11 +7,11 @@
<view class="p-0 u-col-between"> <view class="p-0 u-col-between">
<view class="grid grid-cols-3 gap-2 h-36" v-if="plugins.length"> <view class="grid grid-cols-3 gap-2 h-36" v-if="plugins.length">
<Plugin <Plugin
:class="getClass(plugin.col, plugin.row)"
:key="pluginIndex"
:pluginId="pluginId" :pluginId="pluginId"
:styleType="styleType" :styleType="styleType"
v-for="(plugin, pluginIndex) in plugins" v-for="(plugin, pluginIndex) in plugins"
:key="pluginIndex"
:class="getClass(plugin.col, plugin.row)"
/> />
</view> </view>
</view> </view>
@ -28,28 +28,16 @@ import Skeleton from '@/components/Skeleton/Skeleton';
export default { export default {
name: 'Global', name: 'Global',
components: { Skeleton }, components: { Skeleton },
props: { plugins: { type: Array, default: () => [] } },
data() { data() {
return { return {
loading: true, loading: true,
pluginId: 0, pluginId: 0,
styleType: 0, styleType: 0,
task: null, task: null,
plugins: [],
}; };
}, },
async created() {
const permanent = await this.$u.api.getPermanent({ roleId: 0 });
const res = await this.$u.api.getGlobal({
roleId: 0,
timeNode: new Date().getTime(),
timeUnit: 7,
});
for (let item of res.plugins) {
this.plugins.push(...item);
}
this.task = res;
console.log('permanent', permanent);
},
mounted() { mounted() {
setTimeout(() => (this.loading = false), 5000); setTimeout(() => (this.loading = false), 5000);
}, },

56
src/components/TimeLine/TimeLine.vue

@ -19,7 +19,7 @@
id="scroll" id="scroll"
> >
<!-- 时间轴 --> <!-- 时间轴 -->
<TimeBox ref="child" /> <TimeBox />
</scroll-view> </scroll-view>
</template> </template>
@ -31,35 +31,22 @@ export default {
name: 'TimeLine', name: 'TimeLine',
components: { TimeBox }, components: { TimeBox },
data() { data() {
return { return { top: 0 };
top: 0,
list1: [
{
state: 0,
TaskPanel: { height: '100' },
},
{
state: 1,
TaskPanel: { height: '100' },
},
{
state: 2,
TaskPanel: { height: '100' },
},
],
};
}, },
computed: mapState('home', ['scrollTop', 'showTips', 'visibleRoles']), computed: mapState('home', ['scrollTop', 'showTips', 'visibleRoles', 'tasks']),
mounted() { mounted() {
let tasksHeight = 0; //
const scrollHeight = document.getElementById('scroll').clientHeight; // let tasksHeight = 0;
for (let i = 0; i < this.list1.length; i++) { // const scrollHeight = document.getElementById('scroll').clientHeight;
tasksHeight += this.list1[i].TaskPanel.height - 0 + 42; // if (this.visibleRoles && this.visibleRoles.length) {
} // for (let i = 0; i < 3; i++) {
this.top = tasksHeight - scrollHeight / 2; // tasksHeight += this.visibleRoles[i].panel.height - 0 + 42;
console.log('this.top: ', this.top); // }
// this.top = tasksHeight - scrollHeight / 2;
// }
// console.log('this.top: ', this.top);
}, },
methods: { methods: {
@ -75,13 +62,26 @@ export default {
// //
handleScrollTop() { handleScrollTop() {
console.log('滚动到顶部'); console.log('滚动到顶部');
this.$refs.child.addTopList(); this.$emit('getTasks', 0);
}, },
// //
handleScrollBottom() { handleScrollBottom() {
console.log('滚动到底部'); console.log('滚动到底部');
this.$refs.child.addBottomList(); this.$emit('getTasks', 0);
},
//
setDatumPoint() {
const { tasks } = this;
if (tasks && tasks.length) {
let tasksHeight = 0;
const scrollHeight = document.getElementById('scroll').clientHeight;
for (let i = 0; i < 3; i++) {
tasksHeight += +tasks[i].panel.height + 42;
}
this.top = tasksHeight - scrollHeight / 2;
}
}, },
}, },
}; };

51
src/components/TimeLine/component/TimeBox.vue

@ -27,11 +27,19 @@
<view slot="body"> <view slot="body">
<view :key="pluginIndex" class="p-0 u-col-between u-skeleton" v-for="(plugin, pluginIndex) in item.plugins"> <view :key="pluginIndex" class="p-0 u-col-between u-skeleton" v-for="(plugin, pluginIndex) in item.plugins">
<view :key="p.pluginId" v-for="p in plugin"> <view :key="p.pluginId" v-for="p in plugin">
<component <!-- <component
:is="$t.plugin.defaults.find(item => item.id === p.pluginId).component" :is="$t.plugin.defaults.find(item => item.id === p.pluginId).component"
:item="item" :item="item"
v-if="$t.plugin.defaults.find(item => item.id === p.pluginId)" v-if="$t.plugin.defaults.find(item => item.id === p.pluginId)"
></component> ></component>-->
<p-task-title :item="item" v-if="p.pluginId === 1" />
<p-task-description :item="item" v-if="p.pluginId === 2" />
<p-task-duration-delay :item="item" v-if="p.pluginId === 3" />
<p-task-start-time-delay :item="item" v-if="p.pluginId === 4" />
<p-deliverable :item="item" v-if="p.pluginId === 5" />
<p-subtasks :item="item" v-if="p.pluginId === 6" />
<p-subproject :item="item" v-if="p.pluginId === 7" />
<p-task-countdown :item="item" v-if="p.pluginId === 8" />
</view> </view>
<!-- <view :key="p.pluginId" v-for="p in plugin"> <!-- <view :key="p.pluginId" v-for="p in plugin">
<text v-if="p.pluginId === 4">这是个基准线</text> <text v-if="p.pluginId === 4">这是个基准线</text>
@ -52,53 +60,20 @@
<script> <script>
import { mapState, mapMutations } from 'vuex'; import { mapState, mapMutations } from 'vuex';
import TaskDescription from '@/plugins/TaskDescription/TaskDescription.vue';
import TaskTitle from '@/plugins/TaskTitle/TaskTitle.vue';
import TimeStatus from './TimeStatus.vue'; import TimeStatus from './TimeStatus.vue';
import TaskDurationDelay from '@/plugins/TaskDurationDelay/TaskDurationDelay.vue';
export default { export default {
name: 'TimeBox', name: 'TimeBox',
components: { TimeStatus, TaskTitle, TaskDescription, TaskDurationDelay }, components: { TimeStatus },
data() { data() {
return { return { currentComponent: '' };
currentComponent: '',
addList: [
{
state: 0,
plugins: [[{ pluginId: 1 }], [{ pluginId: 2 }]],
panel: { height: '100' },
},
{
state: 0,
plugins: [[{ pluginId: 1 }], [{ pluginId: 2 }]],
panel: { height: '100' },
},
{
state: 0,
plugins: [[{ pluginId: 1 }], [{ pluginId: 3 }]],
panel: { height: '100' },
},
],
};
}, },
computed: mapState('home', ['roleId', 'timeNode', 'timeUnit', 'tasks']), computed: mapState('home', ['roleId', 'timeNode', 'timeUnit', 'tasks']),
created() {}, created() {},
methods: { methods: { ...mapMutations('home', ['setTipsContent', 'setTipsContent']) },
...mapMutations('home', ['setTipsContent', 'setTipsContent']),
addTopList() {
this.tasks = this.addList.concat(this.tasks);
},
addBottomList() {
this.tasks = this.tasks.concat(this.addList);
},
},
}; };
</script> </script>

16
src/config/plugin.js

@ -6,49 +6,49 @@ export default {
id: 1, id: 1,
name: 'TASK_NAME', name: 'TASK_NAME',
description: '任务名插件', description: '任务名插件',
component: 'TaskTitle', component: 'p-task-title',
}, },
{ {
id: 2, id: 2,
name: 'TASK_DESCRIPTION', name: 'TASK_DESCRIPTION',
description: '任务描述插件', description: '任务描述插件',
component: 'TaskDescription', component: 'p-task-description',
}, },
{ {
id: 3, id: 3,
name: 'TASK_DURATION_DELAY', name: 'TASK_DURATION_DELAY',
description: '任务时长延迟插件(+-1min)时间格式可设置', description: '任务时长延迟插件(+-1min)时间格式可设置',
component: 'TaskDurationDelay', component: 'p-task-duration-delay',
}, },
{ {
id: 4, id: 4,
name: 'TASK_START_TIME_DELAY', name: 'TASK_START_TIME_DELAY',
description: '任务开始时间延迟插件(+-1hour)', description: '任务开始时间延迟插件(+-1hour)',
component: 'TaskStartTimeDelay', component: 'p-task-start-time-delay',
}, },
{ {
id: 5, id: 5,
name: 'DELIVERABLE', name: 'DELIVERABLE',
description: '交付物插件(人 + 交付物)可配置【仅人】 or 【仅交付物】 or 【人+交付物】', description: '交付物插件(人 + 交付物)可配置【仅人】 or 【仅交付物】 or 【人+交付物】',
component: 'Deliverable', component: 'p-deliverable',
}, },
{ {
id: 6, id: 6,
name: 'SUBTASKS', name: 'SUBTASKS',
description: '子任务插件:显示子任务', description: '子任务插件:显示子任务',
component: 'Subtasks', component: 'p-subtasks',
}, },
{ {
id: 7, id: 7,
name: 'SUBPROJECT', name: 'SUBPROJECT',
description: '子项目插件:显示子项目', description: '子项目插件:显示子项目',
component: 'Subproject', component: 'p-subproject',
}, },
{ {
id: 8, id: 8,
name: 'TASK_COUNTDOWN', name: 'TASK_COUNTDOWN',
description: '任务倒计时插件', description: '任务倒计时插件',
component: 'TaskCountdown', component: 'p-task-countdown',
}, },
], // 默认插件id列表 ], // 默认插件id列表
}; };

2
src/main.js

@ -28,6 +28,7 @@ import user from '@/apis/user.js';
import project from '@/apis/project.js'; import project from '@/apis/project.js';
import task from '@/apis/task.js'; import task from '@/apis/task.js';
import plugin from '@/apis/plugin.js'; import plugin from '@/apis/plugin.js';
import role from '@/apis/role.js';
window.vm = app; window.vm = app;
@ -36,5 +37,6 @@ Vue.use(user, app);
Vue.use(project, app); Vue.use(project, app);
Vue.use(task, app); Vue.use(task, app);
Vue.use(plugin, app); Vue.use(plugin, app);
Vue.use(role, app);
app.$mount(); app.$mount();

3
src/pages.json

@ -42,7 +42,8 @@
"easycom": { "easycom": {
"autoscan": true, "autoscan": true,
"custom": { "custom": {
"^u-(.*)": "uview-ui/components/u-$1/u-$1.vue" "^u-(.*)": "uview-ui/components/u-$1/u-$1.vue",
"^p-(.*)": "@/plugins/p-$1/p-$1.vue"
} }
} }
} }

66
src/pages/project/project.vue

@ -3,8 +3,8 @@
<Title /> <Title />
<view class="container flex flex-col flex-1 overflow-hidden bg-gray-100"> <view class="container flex flex-col flex-1 overflow-hidden bg-gray-100">
<Roles /> <Roles />
<Globals /> <Globals :plugins="plugins" />
<TimeLine class="flex-1 overflow-hidden" /> <TimeLine @getTasks="getTasks" class="flex-1 overflow-hidden" ref="child" />
</view> </view>
</view> </view>
</template> </template>
@ -13,7 +13,7 @@
import { mapState, mapMutations, mapActions } from 'vuex'; import { mapState, mapMutations, mapActions } from 'vuex';
export default { export default {
data() { data() {
return { title: 'Hello', height: '', scrollHeight: null }; return { title: 'Hello', height: '', scrollHeight: null, plugins: [] };
}, },
computed: { computed: {
@ -24,11 +24,11 @@ export default {
async onLoad(options) { async onLoad(options) {
console.log('options: ', options); console.log('options: ', options);
// this.openPage(); // this.openPage();
let TOKEN = uni.getStorageSync('anyringToken'); const TOKEN = uni.getStorageSync('anyringToken');
if (!TOKEN) { if (!TOKEN || !this.token) {
await this.getUserId('1217651354919636992'); await this.getUserId(options.u);
} }
const params = { projectId: '1235555' }; const params = { projectId: options.p };
// id // id
await this.getProjectById(params); await this.getProjectById(params);
// id // id
@ -37,6 +37,10 @@ export default {
// //
await this.getTasks(0); await this.getTasks(0);
await this.getTasks(1); await this.getTasks(1);
//
await this.getPermanent();
//
await this.getGlobal();
}, },
mounted() { mounted() {
@ -44,8 +48,15 @@ export default {
}, },
methods: { methods: {
...mapMutations('user', ['setToken', 'setUser']), ...mapMutations('home', [
...mapMutations('home', ['setProject', 'setInvisibleRoles', 'setVisibleRoles', 'setRoleId', 'setUpTasks', 'setDownTasks']), 'setProject',
'setInvisibleRoles',
'setVisibleRoles',
'setRoleId',
'setUpTasks',
'setDownTasks',
'setDailyTasks',
]),
...mapActions('user', ['getUserId']), ...mapActions('user', ['getUserId']),
...mapActions('home', ['getProjectById', 'getRoles', 'handleRegularTask']), ...mapActions('home', ['getProjectById', 'getRoles', 'handleRegularTask']),
@ -81,8 +92,43 @@ export default {
queryType, queryType,
}; };
const res = await this.handleRegularTask(params); const res = await this.handleRegularTask(params);
console.log('res: ', res);
queryType === 0 ? this.setUpTasks(res) : this.setDownTasks(res); queryType === 0 ? this.setUpTasks(res) : this.setDownTasks(res);
this.$refs.child.setDatumPoint();
} catch (error) {
console.log('error: ', error);
}
},
/**
* 根据角色查找永久的日常任务
* @param {string} roleId 角色id
*/
async getPermanent() {
try {
const res = await this.$u.api.getPermanent({ roleId: this.roleId });
console.log('res', res);
} catch (error) {
console.log('error: ', error);
}
},
/**
* 根据时间和角色查找日常任务
* @param {string} roleId 角色id
* @param {string} timeNode 时间基准点 默认当前
* @param {string} timeUnit 时间颗粒度 默认天
*/
async getGlobal() {
try {
const { roleId, timeNode, timeUnit } = this;
const params = { roleId, timeNode, timeUnit };
const res = await this.$u.api.getGlobal(params);
for (let task of res) {
for (let item of task.plugins) {
this.plugins.push(...item);
}
}
this.setDailyTasks(res);
} catch (error) { } catch (error) {
console.log('error: ', error); console.log('error: ', error);
} }

23
src/plugins/TaskDescription/TaskDescription.vue

@ -1,23 +0,0 @@
<template>
<div>{{ plugin.intro }}</div>
</template>
<script>
export default {
name: 'TaskDescription',
props: {},
data() {
return {
plugin: {
intro: '任务描述',
id: '222',
},
};
},
computed: {},
methods: {},
watch: {},
};
</script>
<style></style>

23
src/plugins/TaskDurationDelay/TaskDurationDelay.vue

@ -1,23 +0,0 @@
<template>
<div>{{ plugin.timeDifference }}</div>
</template>
<script>
export default {
name: 'TaskDurationDelay',
props: {},
data() {
return {
plugin: {
timeDifference: '+30',
id: '222',
},
};
},
computed: {},
methods: {},
watch: {},
};
</script>
<style></style>

23
src/plugins/TaskTitle copy/TaskTitle.vue

@ -1,23 +0,0 @@
<template>
<div class="task-title">{{ plugin.name }}</div>
</template>
<script>
export default {
name: 'TaskTitle',
props: {},
data() {
return {
plugin: {
name: '任务名',
id: '111',
},
};
},
computed: {},
methods: {},
watch: {},
};
</script>
<style></style>

26
src/plugins/TaskTitle/TaskTitle.vue

@ -1,26 +0,0 @@
<template>
<div class="task-title">{{ item.name }}</div>
</template>
<script>
export default {
name: 'TaskTitle',
props: { item: { type: Object, default: null } },
data() {
return {
plugin: {
name: '任务名',
id: '1',
},
};
},
mounted() {
console.log('item', this.item);
},
computed: {},
methods: {},
watch: {},
};
</script>
<style></style>

19
src/plugins/p-deliverable/p-deliverable.vue

@ -0,0 +1,19 @@
<template>
<div>交付物</div>
</template>
<script>
export default {
name: 'p-deliverable',
props: { item: { type: Object, default: null } },
data() {
return {};
},
computed: {},
methods: {},
watch: {},
};
</script>
<style></style>

19
src/plugins/p-subproject/p-subproject.vue

@ -0,0 +1,19 @@
<template>
<div>子项目插件显示子项目</div>
</template>
<script>
export default {
name: 'p-subproject',
props: { item: { type: Object, default: null } },
data() {
return {};
},
computed: {},
methods: {},
watch: {},
};
</script>
<style></style>

19
src/plugins/p-subtasks/p-subtasks.vue

@ -0,0 +1,19 @@
<template>
<div>子任务插件显示子任务</div>
</template>
<script>
export default {
name: 'p-subtasks',
props: { item: { type: Object, default: null } },
data() {
return {};
},
computed: {},
methods: {},
watch: {},
};
</script>
<style></style>

19
src/plugins/p-task-countdown/p-task-countdown.vue

@ -0,0 +1,19 @@
<template>
<div>任务倒计时插件</div>
</template>
<script>
export default {
name: 'p-task-countdown',
props: { item: { type: Object, default: null } },
data() {
return {};
},
computed: {},
methods: {},
watch: {},
};
</script>
<style></style>

19
src/plugins/p-task-description/p-task-description.vue

@ -0,0 +1,19 @@
<template>
<div>{{ item.description }}</div>
</template>
<script>
export default {
name: 'p-task-description',
props: { item: { type: Object, default: null } },
data() {
return {};
},
computed: {},
methods: {},
watch: {},
};
</script>
<style></style>

18
src/plugins/p-task-duration-delay/p-task-duration-delay.vue

@ -0,0 +1,18 @@
<template>
<div>任务时长延迟插件+-1min时间格式可设置</div>
</template>
<script>
export default {
name: 'p-task-duration-delay',
props: { item: { type: Object, default: null } },
data() {
return {};
},
computed: {},
methods: {},
watch: {},
};
</script>
<style></style>

19
src/plugins/p-task-start-time-delay/p-task-start-time-delay.vue

@ -0,0 +1,19 @@
<template>
<div>任务开始时间延迟插件+-1hour</div>
</template>
<script>
export default {
name: 'p-task-start-time-delay',
props: { item: { type: Object, default: null } },
data() {
return {};
},
computed: {},
methods: {},
watch: {},
};
</script>
<style></style>

19
src/plugins/p-task-title/p-task-title.vue

@ -0,0 +1,19 @@
<template>
<div>{{ item.name }}</div>
</template>
<script>
export default {
name: 'p-task-title',
props: { item: { type: Object, default: null } },
data() {
return {};
},
computed: {},
methods: {},
watch: {},
};
</script>
<style></style>

14
src/store/home/actions.js

@ -6,10 +6,9 @@ const actions = {
*/ */
async getProjectById({ commit }, params) { async getProjectById({ commit }, params) {
try { try {
uni.$u.api.findProjectById(params).then(res => { const res = await uni.$u.api.findProjectById(params);
commit('setProject', res); commit('setProject', res);
return res; return res;
});
} catch (error) { } catch (error) {
throw error || '获取项目信息失败'; throw error || '获取项目信息失败';
} }
@ -22,7 +21,7 @@ const actions = {
*/ */
async getRoles({ commit }, params) { async getRoles({ commit }, params) {
try { try {
const res = await uni.$u.api.findShowRoles(params); const res = await uni.$u.api.findShowRole(params);
commit('setInvisibleRoles', res.invisibleList); commit('setInvisibleRoles', res.invisibleList);
commit('setVisibleRoles', res.visibleList); commit('setVisibleRoles', res.visibleList);
return res; return res;
@ -37,9 +36,10 @@ const actions = {
* @param {string} timeNode 时间基准点 默认当前 * @param {string} timeNode 时间基准点 默认当前
* @param {string} timeUnit 时间颗粒度 默认天 * @param {string} timeUnit 时间颗粒度 默认天
*/ */
async handleRegularTask(params) { async handleRegularTask({ commit }, param) {
try { try {
return await uni.$u.api.getRegularTask(params); console.log('commit: ', commit);
return await uni.$u.api.getRegularTask(param);
} catch (error) { } catch (error) {
throw error || '获取定期任务失败'; throw error || '获取定期任务失败';
} }

18
src/store/home/mutations.js

@ -7,6 +7,7 @@ const mutations = {
setScrollTop(state, num) { setScrollTop(state, num) {
state.scrollTop = num; state.scrollTop = num;
}, },
/** /**
* 设置日常任务当前是否应该处于收缩状态 * 设置日常任务当前是否应该处于收缩状态
* @param { object } state * @param { object } state
@ -15,6 +16,7 @@ const mutations = {
setShrink(state, data) { setShrink(state, data) {
state.isShrink = data; state.isShrink = data;
}, },
/** /**
* 存储鼠标点击位置 * 存储鼠标点击位置
* @param { object } state * @param { object } state
@ -23,6 +25,7 @@ const mutations = {
setClient(state, data) { setClient(state, data) {
state.client = { ...data }; state.client = { ...data };
}, },
/** /**
* 是否显示tips * 是否显示tips
* @param { object } state * @param { object } state
@ -31,6 +34,7 @@ const mutations = {
setTips(state, data) { setTips(state, data) {
state.showTips = data; state.showTips = data;
}, },
/** /**
* 是否显示tips * 是否显示tips
* @param { object } state * @param { object } state
@ -39,6 +43,7 @@ const mutations = {
setStatus(state, data) { setStatus(state, data) {
state.status = data; state.status = data;
}, },
/** /**
* 是否显示tips * 是否显示tips
* @param { object } state * @param { object } state
@ -47,6 +52,7 @@ const mutations = {
setTipsContent(state, data) { setTipsContent(state, data) {
state.tipsContent = data; state.tipsContent = data;
}, },
/** /**
* 设置当前项目信息 * 设置当前项目信息
* @param { object } state * @param { object } state
@ -55,6 +61,7 @@ const mutations = {
setProject(state, data) { setProject(state, data) {
state.project = { ...data }; state.project = { ...data };
}, },
/** /**
* 设置不展示的角色信息 * 设置不展示的角色信息
* @param {Object} state * @param {Object} state
@ -106,7 +113,6 @@ const mutations = {
* @param {Array} data 服务端返回的模板数组 * @param {Array} data 服务端返回的模板数组
*/ */
setUpTasks(state, data) { setUpTasks(state, data) {
console.log('data: ', data);
state.tasks = [...data.concat(state.tasks)] || []; state.tasks = [...data.concat(state.tasks)] || [];
}, },
@ -116,9 +122,17 @@ const mutations = {
* @param {Array} data 服务端返回的模板数组 * @param {Array} data 服务端返回的模板数组
*/ */
setDownTasks(state, data) { setDownTasks(state, data) {
console.log('data: ', data);
state.tasks = [...state.tasks.concat(data)] || []; state.tasks = [...state.tasks.concat(data)] || [];
}, },
/**
* 设置日常任务数据
* @param {Object} state
* @param {Array} data 服务端返回的模板数组
*/
setDailyTasks(state, data) {
state.dailyTasks = data || [];
},
}; };
export default mutations; export default mutations;

1
src/store/home/state.js

@ -30,6 +30,7 @@ const state = {
{ id: 11, value: '千年' }, { id: 11, value: '千年' },
], ],
tasks: [], // 定期任务 tasks: [], // 定期任务
dailyTasks: [], // 日常任务
}; };
export default state; export default state;

9
src/store/user/actions.js

@ -6,11 +6,10 @@ const actions = {
*/ */
async getUserId({ commit }, userId) { async getUserId({ commit }, userId) {
try { try {
uni.$u.api.getToken(userId).then(res => { const res = await uni.$u.api.getToken(userId);
commit('setToken', res.token); commit('setToken', res.token);
commit('setUser', res); commit('setUser', res);
return res; return res;
});
} catch (error) { } catch (error) {
throw error || '获取个人信息失败'; throw error || '获取个人信息失败';
} }

1
src/utils/request.js

@ -12,7 +12,6 @@ const install = (Vue, vm) => {
// 请求拦截部分,如配置,每次请求前都会执行 // 请求拦截部分,如配置,每次请求前都会执行
Vue.prototype.$u.http.interceptor.request = config => { Vue.prototype.$u.http.interceptor.request = config => {
// TODO: 如果在白名单里 则不需要加token // TODO: 如果在白名单里 则不需要加token
if (vm.$store.state.user.token) { if (vm.$store.state.user.token) {
config.header.Authorization = `Bearer ${vm.$store.state.user.token}`; config.header.Authorization = `Bearer ${vm.$store.state.user.token}`;
} }

Loading…
Cancel
Save