Browse Source

style: 合并代码

develop
lucky 4 years ago
parent
commit
7baaad53b1
  1. 1
      CHANGELOG.md
  2. 4
      src/apis/plugin.js
  3. 14
      src/components/Globals/Globals.vue
  4. 31
      src/components/Plugin/Plugin.vue
  5. 14
      src/mock/mock.js
  6. 38
      src/pages/project/project.vue

1
CHANGELOG.md

@ -8,6 +8,7 @@
- | 标题栏角色栏全局任务组件新建 | [0500cb4](https://dd.tall.wiki/gitea/wally/TALL-MUI-3/commits/0500cb4)
- | 插件数据获取 | [5b91bdc](https://dd.tall.wiki/gitea/wally/TALL-MUI-3/commits/5b91bdc)
- | 存token | [b8a178d](https://dd.tall.wiki/gitea/wally/TALL-MUI-3/commits/b8a178d)
- | 定期任务面板骨架屏添加 | [b2698c0](https://dd.tall.wiki/gitea/wally/TALL-MUI-3/commits/b2698c0)
- | 角色栏实现 | [94cd671](https://dd.tall.wiki/gitea/wally/TALL-MUI-3/commits/94cd671)
- | 模拟接口测试 | [69e7931](https://dd.tall.wiki/gitea/wally/TALL-MUI-3/commits/69e7931)
- | 配置默认插件接口 | [f0c177d](https://dd.tall.wiki/gitea/wally/TALL-MUI-3/commits/f0c177d)

4
src/apis/plugin.js

@ -1,9 +1,11 @@
const apiUrl = process.env.VUE_APP_API_URL;
const mock = `${apiUrl}/defaultwbs`;
const plugin = `${apiUrl}/pluginshop/plugin`;
const install = (Vue, vm) => {
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(`${plugin}/query`, param);
};
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">
<view slot="body">
<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="grid grid-cols-3 gap-2 h-36" v-if="plugins.length">
<Plugin
:class="getClass(plugin.col, plugin.row)"
:key="pluginIndex"
:pluginId="pluginId"
:styleType="styleType"
:pluginId="plugin.pluginId"
:styleType="plugin.styleType || 0"
v-for="(plugin, pluginIndex) in plugins"
/>
</view>
@ -31,16 +31,16 @@ export default {
props: { plugins: { type: Array, default: () => [] } },
data() {
return {
loading: true,
// loading: true,
pluginId: 0,
styleType: 0,
task: null,
};
},
mounted() {
setTimeout(() => (this.loading = false), 2000);
},
// mounted() {
// setTimeout(() => (this.loading = false), 2000);
// },
computed: mapState('home', ['isShrink']),
methods: {
getClass(col, row) {

31
src/components/Plugin/Plugin.vue

@ -1,6 +1,16 @@
<template>
<view v-if="pluginContent && pluginContent.html" style="height: 100%">
<!-- <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>
<!-- <u-parse :html="pluginContent.html" ref="ht-box"></u-parse> -->
</view>
@ -9,6 +19,20 @@
<script>
export default {
name: 'Plugin',
props: {
item: {
default: () => {},
type: Object,
},
pluginId: {
default: '0',
type: String,
},
styleType: {
default: 0,
type: Number,
},
},
data() {
return { pluginContent: null };
},
@ -18,9 +42,10 @@ export default {
},
methods: {
async getPlugin() {
const res = await this.$u.api.getPlugin({
pluginId: 0,
styleType: 0,
const { pluginId, styleType } = this;
const res = await this.$u.api.getOtherPlugin({
pluginId,
styleType,
});
this.pluginContent = res;
},

14
src/mock/mock.js

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

38
src/pages/project/project.vue

@ -3,7 +3,7 @@
<Title />
<view class="container flex flex-col flex-1 overflow-hidden bg-gray-100">
<Roles @getTasksByRole="getTasksByRole" />
<Globals :plugins="plugins" />
<Globals :plugins="allPlugins.concat(timePlugins)" />
<TimeLine @getTasks="getTasks" class="flex-1 overflow-hidden" ref="child" />
</view>
</view>
@ -13,7 +13,7 @@
import { mapState, mapMutations, mapActions } from 'vuex';
export default {
data() {
return { title: 'Hello', height: '', scrollHeight: null, plugins: [] };
return { title: 'Hello', height: '', scrollHeight: null, allPlugins: [], timePlugins: [] };
},
computed: {
@ -21,6 +21,29 @@ export default {
...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) {
console.log('options: ', options);
@ -64,6 +87,7 @@ export default {
'setDownTasks',
'setDailyTasks',
'setProjectName',
'setTimeNode',
]),
...mapActions('user', ['getUserId']),
...mapActions('home', ['getProjectById', 'getRoles', 'handleRegularTask']),
@ -110,7 +134,12 @@ export default {
*/
async getPermanent() {
try {
await this.$u.api.getPermanent({ roleId: this.roleId });
this.allPlugins = [];
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);
} catch (error) {
console.log('error: ', error);
}
@ -124,12 +153,13 @@ export default {
*/
async getGlobal() {
try {
this.timePlugins = [];
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.timePlugins.push(...item);
}
}
this.setDailyTasks(res);

Loading…
Cancel
Save