Browse Source

feat: 全局插件及默认插件位置修改

develop
aBin 4 years ago
parent
commit
6c80d087da
  1. 12
      CHANGELOG.md
  2. 1
      src/apis/plugin.js
  3. 14
      src/components/Globals/Globals.vue
  4. 31
      src/components/Plugin/Plugin.vue
  5. 2
      src/components/Roles/component/RoleList.vue
  6. 14
      src/mock/mock.js
  7. 35
      src/pages/project/project.vue

12
CHANGELOG.md

@ -1,4 +1,4 @@
# 0.1.0 (2021-07-22) # 0.1.0 (2021-07-23)
### 🌟 新功能 ### 🌟 新功能
范围|描述|commitId 范围|描述|commitId
@ -19,6 +19,7 @@
- | indexedDB | [687394e](https://dd.tall.wiki/gitea/wally/TALL-MUI-3/commits/687394e) - | indexedDB | [687394e](https://dd.tall.wiki/gitea/wally/TALL-MUI-3/commits/687394e)
- | post 封装 | [da52e94](https://dd.tall.wiki/gitea/wally/TALL-MUI-3/commits/da52e94) - | post 封装 | [da52e94](https://dd.tall.wiki/gitea/wally/TALL-MUI-3/commits/da52e94)
- | tall插件封装 | [1bcb920](https://dd.tall.wiki/gitea/wally/TALL-MUI-3/commits/1bcb920) - | tall插件封装 | [1bcb920](https://dd.tall.wiki/gitea/wally/TALL-MUI-3/commits/1bcb920)
- | ws storage | [21b3a06](https://dd.tall.wiki/gitea/wally/TALL-MUI-3/commits/21b3a06)
富文本插件 | 富文本插件demo测试 | [ed3d644](https://dd.tall.wiki/gitea/wally/TALL-MUI-3/commits/ed3d644) 富文本插件 | 富文本插件demo测试 | [ed3d644](https://dd.tall.wiki/gitea/wally/TALL-MUI-3/commits/ed3d644)
pinch | alloy finger实现图片的pinch放大缩小 | [de01343](https://dd.tall.wiki/gitea/wally/TALL-MUI-3/commits/de01343) pinch | alloy finger实现图片的pinch放大缩小 | [de01343](https://dd.tall.wiki/gitea/wally/TALL-MUI-3/commits/de01343)
@ -42,6 +43,7 @@
### 🐛 Bug 修复 ### 🐛 Bug 修复
范围|描述|commitId 范围|描述|commitId
--|--|-- --|--|--
- | 定期任务接口 | [aa4981c](https://dd.tall.wiki/gitea/wally/TALL-MUI-3/commits/aa4981c)
- | 骨架屏替换 | [e9fdd71](https://dd.tall.wiki/gitea/wally/TALL-MUI-3/commits/e9fdd71) - | 骨架屏替换 | [e9fdd71](https://dd.tall.wiki/gitea/wally/TALL-MUI-3/commits/e9fdd71)
- | 角色栏修改 | [19228d6](https://dd.tall.wiki/gitea/wally/TALL-MUI-3/commits/19228d6) - | 角色栏修改 | [19228d6](https://dd.tall.wiki/gitea/wally/TALL-MUI-3/commits/19228d6)
- | 上下滚动时间轴 | [d533a01](https://dd.tall.wiki/gitea/wally/TALL-MUI-3/commits/d533a01) - | 上下滚动时间轴 | [d533a01](https://dd.tall.wiki/gitea/wally/TALL-MUI-3/commits/d533a01)
@ -78,13 +80,6 @@
### chore ### chore
范围|描述|commitId 范围|描述|commitId
--|--|-- --|--|--
- | api 封装 | [8dcb8a2](http://gitea@dd.tall.wiki:wally/TALL-MUI-3/commits/8dcb8a2)
- | env host修改 | [a79a4a5](http://gitea@dd.tall.wiki:wally/TALL-MUI-3/commits/a79a4a5)
- | merge globals | [b0957cc](http://gitea@dd.tall.wiki:wally/TALL-MUI-3/commits/b0957cc)
- | mock | [51c24a5](http://gitea@dd.tall.wiki:wally/TALL-MUI-3/commits/51c24a5)
pwa 小程序 | 移除了pwa,alloyFinger添加平台判断 | [875fab4](http://gitea@dd.tall.wiki:wally/TALL-MUI-3/commits/875fab4)
- | uview-ui | [a9ea34b](http://gitea@dd.tall.wiki:wally/TALL-MUI-3/commits/a9ea34b)
信息配置 | 配置eslint等配置 | [7421443](http://gitea@dd.tall.wiki:wally/TALL-MUI-3/commits/7421443)
- | api 封装 | [8dcb8a2](https://dd.tall.wiki/gitea/wally/TALL-MUI-3/commits/8dcb8a2) - | api 封装 | [8dcb8a2](https://dd.tall.wiki/gitea/wally/TALL-MUI-3/commits/8dcb8a2)
- | env host修改 | [a79a4a5](https://dd.tall.wiki/gitea/wally/TALL-MUI-3/commits/a79a4a5) - | env host修改 | [a79a4a5](https://dd.tall.wiki/gitea/wally/TALL-MUI-3/commits/a79a4a5)
- | merge globals | [b0957cc](https://dd.tall.wiki/gitea/wally/TALL-MUI-3/commits/b0957cc) - | merge globals | [b0957cc](https://dd.tall.wiki/gitea/wally/TALL-MUI-3/commits/b0957cc)
@ -99,3 +94,4 @@
- | style:index | [978f272](https://dd.tall.wiki/gitea/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](https://dd.tall.wiki/gitea/wally/TALL-MUI-3/commits/f5e61dd) - | !2 基础模板v1.1.0 | [f5e61dd](https://dd.tall.wiki/gitea/wally/TALL-MUI-3/commits/f5e61dd)
- | init | [c0f1deb](https://dd.tall.wiki/gitea/wally/TALL-MUI-3/commits/c0f1deb) - | init | [c0f1deb](https://dd.tall.wiki/gitea/wally/TALL-MUI-3/commits/c0f1deb)

1
src/apis/plugin.js

@ -4,6 +4,7 @@ const mock = `${apiUrl}/defaultwbs`;
const install = (Vue, vm) => { const install = (Vue, vm) => {
vm.$u.api = { ...vm.$u.api } || {}; vm.$u.api = { ...vm.$u.api } || {};
vm.$u.api.getPlugin = param => vm.$u.post(`${mock}/plugin`, { param }); vm.$u.api.getPlugin = param => vm.$u.post(`${mock}/plugin`, { param });
vm.$u.api.getOtherPlugin = param => vm.$u.post(`/pluginshop/plugin/query`, { param });
}; };
export default { install }; export default { install };

14
src/components/Globals/Globals.vue

@ -3,14 +3,14 @@
<u-card :show-foot="false" :show-head="false" :style="{ height: isShrink ? '96rpx' : '300rpx' }" border-radius="25" margin="0"> <u-card :show-foot="false" :show-head="false" :style="{ height: isShrink ? '96rpx' : '300rpx' }" border-radius="25" margin="0">
<view slot="body"> <view slot="body">
<scroll-view :scrollY="true" :style="{ height: isShrink ? '40rpx' : '240rpx' }"> <scroll-view :scrollY="true" :style="{ height: isShrink ? '40rpx' : '240rpx' }">
<skeleton :banner="false" :loading="loading" :row="4" animate class="mt-2 u-line-2 skeleton"></skeleton> <skeleton :banner="false" :loading="!plugins.length" :row="4" animate class="mt-2 u-line-2 skeleton"></skeleton>
<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)" :class="getClass(plugin.col, plugin.row)"
:key="pluginIndex" :key="pluginIndex"
:pluginId="pluginId" :pluginId="plugin.pluginId"
:styleType="styleType" :styleType="plugin.styleType || 0"
v-for="(plugin, pluginIndex) in plugins" v-for="(plugin, pluginIndex) in plugins"
/> />
</view> </view>
@ -31,16 +31,16 @@ export default {
props: { plugins: { type: Array, default: () => [] } }, 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,
}; };
}, },
mounted() { // mounted() {
setTimeout(() => (this.loading = false), 2000); // setTimeout(() => (this.loading = false), 2000);
}, // },
computed: mapState('home', ['isShrink']), computed: mapState('home', ['isShrink']),
methods: { methods: {
getClass(col, row) { getClass(col, row) {

31
src/components/Plugin/Plugin.vue

@ -1,6 +1,16 @@
<template> <template>
<view v-if="pluginContent && pluginContent.html" style="height: 100%"> <view v-if="pluginContent && pluginContent.html" style="height: 100%">
<!-- <view> {{ pluginContent.html }} </view> --> <!-- <view> {{ pluginContent.html }} </view> -->
<view v-if="item && item.name">
<p-task-title :item="item" v-if="pluginId === '1'" />
<p-task-description :item="item" v-if="pluginId === '2'" />
<p-task-duration-delay :item="item" v-if="pluginId === '3'" />
<p-task-start-time-delay :item="item" v-if="pluginId === '4'" />
<p-deliverable :item="item" v-if="pluginId === '5'" />
<p-subtasks :item="item" v-if="pluginId === '6'" />
<p-subproject :item="item" v-if="pluginId === '7'" />
<p-task-countdown :item="item" v-if="pluginId === '8'" />
</view>
<view v-html="pluginContent.html" style="height: 100%"> </view> <view v-html="pluginContent.html" style="height: 100%"> </view>
<!-- <u-parse :html="pluginContent.html" ref="ht-box"></u-parse> --> <!-- <u-parse :html="pluginContent.html" ref="ht-box"></u-parse> -->
</view> </view>
@ -9,6 +19,20 @@
<script> <script>
export default { export default {
name: 'Plugin', name: 'Plugin',
props: {
item: {
default: () => {},
type: Object,
},
pluginId: {
default: '0',
type: String,
},
styleType: {
default: 0,
type: Number,
},
},
data() { data() {
return { pluginContent: null }; return { pluginContent: null };
}, },
@ -18,9 +42,10 @@ export default {
}, },
methods: { methods: {
async getPlugin() { async getPlugin() {
const res = await this.$u.api.getPlugin({ const { pluginId, styleType } = this;
pluginId: 0, const res = await this.$u.api.getOtherPlugin({
styleType: 0, pluginId,
styleType,
}); });
this.pluginContent = res; this.pluginContent = res;
}, },

2
src/components/Roles/component/RoleList.vue

@ -92,7 +92,7 @@ export default {
await this.$emit('getTasks', { queryType: 1 }); await this.$emit('getTasks', { queryType: 1 });
console.log('this.tasks && this.tasks.length: ', this.tasks && this.tasks.length); console.log('this.tasks && this.tasks.length: ', this.tasks && this.tasks.length);
if (this.tasks && this.tasks.length) { if (this.tasks && this.tasks.length) {
debugger; // debugger;
// //
const upQuery = { const upQuery = {
timeNode: +this.tasks[0].planStart, timeNode: +this.tasks[0].planStart,

14
src/mock/mock.js

@ -177,11 +177,11 @@ export default [
plugins: [ plugins: [
[ [
{ {
col: 123, col: 1,
colspan: 123, colspan: 123,
param: 123, param: 123,
pluginId: 123456789, pluginId: 13,
row: 123, row: 2,
rowspan: 123, rowspan: 123,
}, },
], ],
@ -226,11 +226,11 @@ export default [
plugins: [ plugins: [
[ [
{ {
col: 123, col: 1,
colspan: 123, colspan: 123,
param: 123, param: 123,
pluginId: 123456789, pluginId: 13,
row: 123, row: 1,
rowspan: 123, rowspan: 123,
}, },
], ],
@ -387,7 +387,7 @@ export default [
msg: 'ok', msg: 'ok',
success: true, success: true,
data: { data: {
html: 'string', html: '<div style="background:#0f0;height:100%"></div>',
id: 13, id: 13,
intro: 'string', intro: 'string',
js: 'string', js: 'string',

35
src/pages/project/project.vue

@ -3,7 +3,7 @@
<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 @getTasks="getTasks" /> <Roles @getTasks="getTasks" />
<Globals :plugins="plugins" /> <Globals :plugins="allPlugins.concat(timePlugins)" />
<TimeLine @getTasks="getTasks" class="flex-1 overflow-hidden" ref="child" /> <TimeLine @getTasks="getTasks" class="flex-1 overflow-hidden" ref="child" />
</view> </view>
</view> </view>
@ -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, plugins: [] }; return { title: 'Hello', height: '', scrollHeight: null, allPlugins: [], timePlugins: [] };
}, },
computed: { computed: {
@ -21,6 +21,29 @@ export default {
...mapState('home', ['visibleRoles', 'roleId', 'timeNode', 'timeUnit', 'tasks']), ...mapState('home', ['visibleRoles', 'roleId', 'timeNode', 'timeUnit', 'tasks']),
}, },
watch: {
/**
* 当时间基准点发生变化时
* 重新根据时间和角色查询普通日常任务
* 永久日常任务不发生改变
*/
async timeNode() {
//
await this.getGlobal();
},
/**
* 当角色发生变化时
* 重新查询永久日常任务和普通日常任务
*/
async roleId() {
this.setTimeNode(new Date().getTime());
//
await this.getPermanent();
//
await this.getGlobal();
},
},
async onLoad(options) { async onLoad(options) {
console.log('options: ', options); console.log('options: ', options);
// this.openPage(); // this.openPage();
@ -65,6 +88,7 @@ export default {
'setDownTasks', 'setDownTasks',
'setDailyTasks', 'setDailyTasks',
'setProjectName', 'setProjectName',
'setTimeNode',
]), ]),
...mapActions('user', ['getUserId']), ...mapActions('user', ['getUserId']),
...mapActions('home', ['getProjectById', 'getRoles', 'handleRegularTask']), ...mapActions('home', ['getProjectById', 'getRoles', 'handleRegularTask']),
@ -113,7 +137,11 @@ export default {
*/ */
async getPermanent() { async getPermanent() {
try { try {
this.allPlugins = [];
const res = await this.$u.api.getPermanent({ roleId: this.roleId }); const res = await this.$u.api.getPermanent({ roleId: this.roleId });
for (let item of res) {
this.allPlugins = this.allPlugins.concat(item.plugins);
}
console.log('res', res); console.log('res', res);
} catch (error) { } catch (error) {
console.log('error: ', error); console.log('error: ', error);
@ -128,12 +156,13 @@ export default {
*/ */
async getGlobal() { async getGlobal() {
try { try {
this.timePlugins = [];
const { roleId, timeNode, timeUnit } = this; const { roleId, timeNode, timeUnit } = this;
const params = { roleId, timeNode, timeUnit }; const params = { roleId, timeNode, timeUnit };
const res = await this.$u.api.getGlobal(params); const res = await this.$u.api.getGlobal(params);
for (let task of res) { for (let task of res) {
for (let item of task.plugins) { for (let item of task.plugins) {
this.plugins.push(...item); this.timePlugins.push(...item);
} }
} }
this.setDailyTasks(res); this.setDailyTasks(res);

Loading…
Cancel
Save