Browse Source

Merge remote-tracking branch 'origin/song' into temp

tall
wally 4 years ago
parent
commit
0aad507b9a
  1. 68
      CHANGELOG.md
  2. BIN
      src/__MACOSX/._components
  3. BIN
      src/__MACOSX/components/._J-skeleton
  4. 9
      src/apis/project.js
  5. 51
      src/components/Globals/Globals.vue
  6. 92
      src/components/Roles/component/RoleList.vue
  7. 183
      src/components/Roles/components/RoleList.vue
  8. 84
      src/components/Skeleton/READ_ME.md
  9. 186
      src/components/Skeleton/Skeleton.vue
  10. 45
      src/components/Skeleton/view.vue
  11. 37
      src/components/TimeLine/component/TimeBox.vue
  12. 4
      src/main.js
  13. 10
      src/mock/mock.js
  14. 12
      src/package.json
  15. 2
      src/pages.json
  16. 15
      src/pages/project/project.vue
  17. 19
      src/store/user/actions.js
  18. 24
      src/store/user/mutations.js
  19. 6
      src/store/user/state.js
  20. 6
      src/utils/request.js

68
CHANGELOG.md

@ -18,36 +18,53 @@
- | 角色栏实现 | [94cd671](http://gitea@dd.tall.wiki:wally/TALL-MUI-3/commits/94cd671)
pinch | alloy finger实现图片的pinch放大缩小 | [de01343](http://gitea@dd.tall.wiki:wally/TALL-MUI-3/commits/de01343)
富文本插件 | 富文本插件demo测试 | [ed3d644](http://gitea@dd.tall.wiki:wally/TALL-MUI-3/commits/ed3d644)
- | 标题栏变化 | [c0fcd9d](https://dd.tall.wiki/gitea/wally/TALL-MUI-3/commits/c0fcd9d)
- | 标题栏角色栏全局任务组件新建 | [0500cb4](https://dd.tall.wiki/gitea/wally/TALL-MUI-3/commits/0500cb4)
- | 角色栏实现 | [94cd671](https://dd.tall.wiki/gitea/wally/TALL-MUI-3/commits/94cd671)
- | 模拟接口测试 | [69e7931](https://dd.tall.wiki/gitea/wally/TALL-MUI-3/commits/69e7931)
- | 时间基准线,默认插件 | [a33ba1e](https://dd.tall.wiki/gitea/wally/TALL-MUI-3/commits/a33ba1e)
- | 时间轴界面 | [33927e9](https://dd.tall.wiki/gitea/wally/TALL-MUI-3/commits/33927e9)
- | 时间轴修改状态时提示框增加 | [e841392](https://dd.tall.wiki/gitea/wally/TALL-MUI-3/commits/e841392)
- | 提交到本地 | [9cbe411](https://dd.tall.wiki/gitea/wally/TALL-MUI-3/commits/9cbe411)
- | 添加时间轴上下滚动 | [2b81bbc](https://dd.tall.wiki/gitea/wally/TALL-MUI-3/commits/2b81bbc)
- | db store | [6414c4f](https://dd.tall.wiki/gitea/wally/TALL-MUI-3/commits/6414c4f)
- | indexedDB | [687394e](https://dd.tall.wiki/gitea/wally/TALL-MUI-3/commits/687394e)
富文本插件 | 富文本插件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)
### 🎨 代码样式
范围|描述|commitId
--|--|--
- | 代码格式细节调整 | [cb2532b](http://gitea@dd.tall.wiki:wally/TALL-MUI-3/commits/cb2532b)
- | 任务快捷方式图标增加 | [4aba872](http://gitea@dd.tall.wiki:wally/TALL-MUI-3/commits/4aba872)
- | 图标修改 | [54bca09](http://gitea@dd.tall.wiki:wally/TALL-MUI-3/commits/54bca09)
- | 无基本变化 | [21ac4bb](http://gitea@dd.tall.wiki:wally/TALL-MUI-3/commits/21ac4bb)
- | 日常任务修改 | [dfa7ee2](http://gitea@dd.tall.wiki:wally/TALL-MUI-3/commits/dfa7ee2)
- | 更新代码 | [8c27e68](http://gitea@dd.tall.wiki:wally/TALL-MUI-3/commits/8c27e68)
- | 更新代码 | [1f40a76](http://gitea@dd.tall.wiki:wally/TALL-MUI-3/commits/1f40a76)
- | 组件新建 | [89c0035](http://gitea@dd.tall.wiki:wally/TALL-MUI-3/commits/89c0035)
- | 代码格式细节调整 | [cb2532b](https://dd.tall.wiki/gitea/wally/TALL-MUI-3/commits/cb2532b)
- | 更新代码 | [8c27e68](https://dd.tall.wiki/gitea/wally/TALL-MUI-3/commits/8c27e68)
- | 更新代码 | [1f40a76](https://dd.tall.wiki/gitea/wally/TALL-MUI-3/commits/1f40a76)
- | 任务快捷方式图标增加 | [4aba872](https://dd.tall.wiki/gitea/wally/TALL-MUI-3/commits/4aba872)
- | 日常任务修改 | [dfa7ee2](https://dd.tall.wiki/gitea/wally/TALL-MUI-3/commits/dfa7ee2)
- | 图标修改 | [54bca09](https://dd.tall.wiki/gitea/wally/TALL-MUI-3/commits/54bca09)
- | 无基本变化 | [21ac4bb](https://dd.tall.wiki/gitea/wally/TALL-MUI-3/commits/21ac4bb)
- | 修改角色样式 | [73e268e](https://dd.tall.wiki/gitea/wally/TALL-MUI-3/commits/73e268e)
- | 组件新建 | [89c0035](https://dd.tall.wiki/gitea/wally/TALL-MUI-3/commits/89c0035)
### 🐛 Bug 修复
范围|描述|commitId
--|--|--
- | 上下滚动时间轴 | [d533a01](http://gitea@dd.tall.wiki:wally/TALL-MUI-3/commits/d533a01)
- | 修改main | [749ae9a](http://gitea@dd.tall.wiki:wally/TALL-MUI-3/commits/749ae9a)
- | 修改角色栏组件 | [a54c601](http://gitea@dd.tall.wiki:wally/TALL-MUI-3/commits/a54c601)
- | 提示信息显示bug及日常任务收缩问题 | [f2f06c5](http://gitea@dd.tall.wiki:wally/TALL-MUI-3/commits/f2f06c5)
- | 时间轴上下滑动 | [4d0ae46](http://gitea@dd.tall.wiki:wally/TALL-MUI-3/commits/4d0ae46)
- | 角色栏修改 | [19228d6](http://gitea@dd.tall.wiki:wally/TALL-MUI-3/commits/19228d6)
- | 骨架屏替换 | [e9fdd71](https://dd.tall.wiki/gitea/wally/TALL-MUI-3/commits/e9fdd71)
- | 角色栏修改 | [19228d6](https://dd.tall.wiki/gitea/wally/TALL-MUI-3/commits/19228d6)
- | 上下滚动时间轴 | [d533a01](https://dd.tall.wiki/gitea/wally/TALL-MUI-3/commits/d533a01)
- | 时间轴上下滚动数据加载bug修改 | [e82ede4](https://dd.tall.wiki/gitea/wally/TALL-MUI-3/commits/e82ede4)
- | 时间轴上下滑动 | [4d0ae46](https://dd.tall.wiki/gitea/wally/TALL-MUI-3/commits/4d0ae46)
- | 提示信息显示bug及日常任务收缩问题 | [f2f06c5](https://dd.tall.wiki/gitea/wally/TALL-MUI-3/commits/f2f06c5)
- | 修改角色栏组件 | [a54c601](https://dd.tall.wiki/gitea/wally/TALL-MUI-3/commits/a54c601)
- | 修改main | [749ae9a](https://dd.tall.wiki/gitea/wally/TALL-MUI-3/commits/749ae9a)
### 📝 文档
范围|描述|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)
### chore
@ -65,19 +82,30 @@
- | style:index | [978f272](http://gitea@dd.tall.wiki:wally/TALL-MUI-3/commits/978f272)
- | !2 基础模板v1.1.0 | [f5e61dd](http://gitea@dd.tall.wiki:wally/TALL-MUI-3/commits/f5e61dd)
- | init | [c0f1deb](http://gitea@dd.tall.wiki:wally/TALL-MUI-3/commits/c0f1deb)
- | api 封装 | [8dcb8a2](https://dd.tall.wiki/gitea/wally/TALL-MUI-3/commits/8dcb8a2)
- | mock | [51c24a5](https://dd.tall.wiki/gitea/wally/TALL-MUI-3/commits/51c24a5)
pwa 小程序 | 移除了pwa,alloyFinger添加平台判断 | [875fab4](https://dd.tall.wiki/gitea/wally/TALL-MUI-3/commits/875fab4)
- | 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
--|--|--
- | 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)
- | init | [c0f1deb](https://dd.tall.wiki/gitea/wally/TALL-MUI-3/commits/c0f1deb)
### 🔨 代码重构
范围|描述|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
--|--|--
- | 组件文件夹新建 | [22bfe7b](http://gitea@dd.tall.wiki:wally/TALL-MUI-3/commits/22bfe7b)
- | 组件文件夹新建 | [17bb8c9](http://gitea@dd.tall.wiki:wally/TALL-MUI-3/commits/17bb8c9)
- | 组件文件夹新建 | [1421504](http://gitea@dd.tall.wiki:wally/TALL-MUI-3/commits/1421504)
- | 角色栏文字颜色修改 | [215c6b3](http://gitea@dd.tall.wiki:wally/TALL-MUI-3/commits/215c6b3)
- | 角色栏文字颜色修改 | [215c6b3](https://dd.tall.wiki/gitea/wally/TALL-MUI-3/commits/215c6b3)
- | 组件文件夹新建 | [22bfe7b](https://dd.tall.wiki/gitea/wally/TALL-MUI-3/commits/22bfe7b)
- | 组件文件夹新建 | [17bb8c9](https://dd.tall.wiki/gitea/wally/TALL-MUI-3/commits/17bb8c9)
- | 组件文件夹新建 | [1421504](https://dd.tall.wiki/gitea/wally/TALL-MUI-3/commits/1421504)

BIN
src/__MACOSX/._components

Binary file not shown.

BIN
src/__MACOSX/components/._J-skeleton

Binary file not shown.

9
src/apis/project.js

@ -0,0 +1,9 @@
const apiUrl = process.env.VUE_APP_API_URL;
const tall = `${apiUrl}/defaultwbs`;
const install = (Vue, vm) => {
vm.$u.api = { ...vm.$u.api } || {};
vm.$u.api.findProjectById = params => vm.$u.post(`${tall}/project/findProjectById`, params);
};
export default { install };

51
src/components/Globals/Globals.vue

@ -1,29 +1,23 @@
<template>
<view class="m-2">
<u-card
class="u-skeleton"
margin="0"
:show-head="false"
:show-foot="false"
border-radius="25"
:style="{ height: isShrink ? '96rpx' : '300rpx' }"
>
<u-card :show-foot="false" :show-head="false" :style="{ height: isShrink ? '96rpx' : '300rpx' }" border-radius="25" margin="0">
<!-- <u-card margin="0" :show-head="false" :show-foot="false" border-radius="25" style="height: 300rpx"> -->
<view slot="body">
<scroll-view :scrollY="true" :style="{ height: isShrink ? '40rpx' : '240rpx' }">
<view class="p-0 u-col-between u-skeleton">
<view class="u-line-2 u-skeleton-rect"> 瓶身描绘的牡丹一如你初妆</view>
<view class="mt-2 u-line-2 u-skeleton-rect"> 瓶身描绘的牡丹一如你初妆</view>
<view class="mt-2 u-line-2 u-skeleton-rect"> 瓶身描绘的牡丹一如你初妆</view>
<view class="mt-2 u-line-2 u-skeleton-rect"> 瓶身描绘的牡丹一如你初妆</view>
<view class="mt-2 u-line-2 u-skeleton-rect"> 瓶身描绘的牡丹一如你初妆</view>
<view class="mt-2 u-line-2 u-skeleton-rect"> 瓶身描绘的牡丹一如你初妆</view>
<view class="mt-2 u-line-2 u-skeleton-rect"> 瓶身描绘的牡丹一如你初妆</view>
<view class="mt-2 u-line-2 u-skeleton-rect"> 瓶身描绘的牡丹一如你初妆</view>
<view class="mt-2 u-line-2 u-skeleton-rect"> 瓶身描绘的牡丹一如你初妆</view>
<view class="mt-2 u-line-2 u-skeleton-rect"> 瓶身描绘的牡丹一如你初妆</view>
<view class="mt-2 u-line-2 u-skeleton-rect"> 瓶身描绘的牡丹一如你初妆</view>
<view class="mt-2 u-line-2 u-skeleton-rect"> 瓶身描绘的牡丹一如你初妆222</view>
<skeleton :banner="false" :loading="loading" :row="4" animate class="u-line-2 mt-2 skeleton"></skeleton>
<view class="u-col-between p-0" v-if="!loading">
<view class="u-line-2">瓶身描绘的牡丹一如你初妆</view>
<view class="u-line-2 mt-2">瓶身描绘的牡丹一如你初妆</view>
<view class="u-line-2 mt-2">瓶身描绘的牡丹一如你初妆</view>
<view class="u-line-2 mt-2">瓶身描绘的牡丹一如你初妆</view>
<view class="u-line-2 mt-2">瓶身描绘的牡丹一如你初妆</view>
<view class="u-line-2 mt-2">瓶身描绘的牡丹一如你初妆</view>
<view class="u-line-2 mt-2">瓶身描绘的牡丹一如你初妆</view>
<view class="u-line-2 mt-2">瓶身描绘的牡丹一如你初妆</view>
<view class="u-line-2 mt-2">瓶身描绘的牡丹一如你初妆</view>
<view class="u-line-2 mt-2">瓶身描绘的牡丹一如你初妆</view>
<view class="u-line-2 mt-2">瓶身描绘的牡丹一如你初妆</view>
<view class="u-line-2 mt-2">瓶身描绘的牡丹一如你初妆222</view>
</view>
</scroll-view>
</view>
@ -36,16 +30,21 @@
<script>
import { mapState } from 'vuex';
import Skeleton from '@/components/Skeleton/Skeleton';
export default {
name: 'Global',
components: { Skeleton },
data() {
return { loading: true };
},
computed: mapState('home', ['isShrink']),
mounted() {
setTimeout(() => (this.loading = false), 5000);
setTimeout(() => {
this.loading = false;
console.log('this.loading: ', this.loading);
}, 5000);
},
computed: mapState('home', ['isShrink']),
};
</script>
@ -68,4 +67,8 @@ export default {
border-radius: 8rpx;
margin-left: 12rpx;
}
.skeleton:first-child {
margin-top: 0 !important;
}
</style>

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

@ -9,8 +9,6 @@
</view>
</scroll-view>
</view>
<!-- 骨架屏 -->
<u-skeleton :animation="true" :loading="loading" bg-color="#fff"></u-skeleton>
</view>
</template>
@ -24,16 +22,76 @@ export default {
tabList: [], //tab dom
scrollLeft: 0, //scrollview
roles: [
{ id: 1, name: '项目经理', mine: 0, pm: 1, sequence: 1 },
{ id: 2, name: '运维', mine: 0, pm: 0, sequence: 2 },
{ id: 3, name: '导师一', mine: 1, pm: 0, sequence: 3 },
{ id: 4, name: '导师二', mine: 1, pm: 0, sequence: 4 },
{ id: 5, name: '导师三', mine: 1, pm: 0, sequence: 5 },
{ id: 6, name: '导师四', mine: 1, pm: 0, sequence: 6 },
{ id: 7, name: '导师五', mine: 1, pm: 0, sequence: 7 },
{ id: 8, name: '导师六', mine: 1, pm: 0, sequence: 8 },
{ id: 9, name: '导师七', mine: 1, pm: 0, sequence: 9 },
{ id: 10, name: '导师八', mine: 1, pm: 0, sequence: 10 },
{
id: 1,
name: '项目经理',
mine: 0,
pm: 1,
sequence: 1,
},
{
id: 2,
name: '运维',
mine: 0,
pm: 0,
sequence: 2,
},
{
id: 3,
name: '导师一',
mine: 1,
pm: 0,
sequence: 3,
},
{
id: 4,
name: '导师二',
mine: 1,
pm: 0,
sequence: 4,
},
{
id: 5,
name: '导师三',
mine: 1,
pm: 0,
sequence: 5,
},
{
id: 6,
name: '导师四',
mine: 1,
pm: 0,
sequence: 6,
},
{
id: 7,
name: '导师五',
mine: 1,
pm: 0,
sequence: 7,
},
{
id: 8,
name: '导师六',
mine: 1,
pm: 0,
sequence: 8,
},
{
id: 9,
name: '导师七',
mine: 1,
pm: 0,
sequence: 9,
},
{
id: 10,
name: '导师八',
mine: 1,
pm: 0,
sequence: 10,
},
],
loading: true, //
};
@ -51,7 +109,10 @@ export default {
const data = document.getElementsByClassName('tab-children');
// TODO tabList
data.forEach(item => {
this.tabList.push({ width: item.clientWidth, left: item.offsetLeft });
this.tabList.push({
width: item.clientWidth,
left: item.offsetLeft,
});
});
},
@ -120,6 +181,7 @@ export default {
color: $roleChoiceColor;
font-weight: 600;
}
.default-tab-choice:before {
content: '';
position: absolute;
@ -171,4 +233,8 @@ scroll-view ::v-deep ::-webkit-scrollbar {
}
/* #endif */
.skeleton {
height: 44rpx;
}
</style>

183
src/components/Roles/components/RoleList.vue

@ -1,183 +0,0 @@
<template>
<view class="wrap">
<view class="homeBox">
<scroll-view :enable-flex="true" :scroll-left="scrollLeft" :throttle="false" scroll-with-animation scroll-x>
<view class="tabBox u-skeleton">
<view :key="index" @click="changeIndex(index)" class="tab-item" v-for="(item, index) in roles">
<view :class="setColor(item.isMine, tabIndex, index)" class="tab-children u-skeleton-rect">{{ item.value }}</view>
</view>
</view>
<u-skeleton :animation="true" :loading="loading" bgcolor="#fff"></u-skeleton>
</scroll-view>
</view>
</view>
</template>
<script>
export default {
name: 'RoleList',
data() {
return {
tabIndex: 0, //访 index 0
tabList: [], //tab dom
scrollLeft: 0, //scrollview
roles: [
{ id: 1, value: '项目经理', isMine: 0 },
{ id: 2, value: '运维', isMine: 0 },
{ id: 3, value: '导师一', isMine: 1 },
{ id: 4, value: '导师二', isMine: 1 },
{ id: 5, value: '导师三', isMine: 1 },
{ id: 6, value: '导师四', isMine: 1 },
{ id: 7, value: '导师五', isMine: 1 },
{ id: 8, value: '导师六', isMine: 1 },
{ id: 9, value: '导师七', isMine: 1 },
{ id: 10, value: '导师八', isMine: 1 },
],
loading: true, //
};
},
mounted() {
this.init();
setTimeout(() => {
this.loading = false;
console.log('this.loading: ', this.loading);
}, 5000);
},
methods: {
init() {
const data = document.getElementsByClassName('tab-children');
// TODO tabList
data.forEach(item => {
this.tabList.push({ width: item.clientWidth, left: item.offsetLeft });
});
},
changeIndex(index) {
//index
this.tabIndex = index;
//
let left = 0;
let screenWidth = window.screen.width;
for (let i = 0; i < index; i++) {
left += this.tabList[i].width + this.tabList[i].left * 2;
}
left += this.tabList[index].width;
this.scrollLeft = left - screenWidth / 2;
},
//
setColor(isMine, tabIndex, index) {
if (isMine === 1 && tabIndex === index) {
return 'default-tab-choice';
}
if (isMine === 1 && tabIndex !== index) {
return 'default-tab-item';
}
if (isMine === 0 && tabIndex === index) {
return 'tab-choice';
}
},
},
};
</script>
<style lang="scss" scoped>
$tabChoiceColor: #f40; //线
$max: 100%;
//
.wrap {
position: relative;
background: #f7f7f7;
}
.homeBox {
// sticky
position: sticky;
top: 0;
background: #fff; //
/* #ifdef H5 */
// h5 44px
top: 88rpx;
/* #endif */
.tabBox {
position: relative;
white-space: nowrap;
// height: 88rpx;
/* #ifdef MP-TOUTIAO */
/* #endif */
.tab-item {
padding: 15rpx 24rpx;
position: relative;
display: inline-block;
text-align: center;
font-size: 30rpx;
transition-property: background-color, width;
}
.default-tab-item {
color: $tabChoiceColor;
}
.default-tab-choice {
//
position: relative;
color: $tabChoiceColor;
font-weight: 600;
}
.default-tab-choice:before {
content: '';
position: absolute;
left: 0;
bottom: -14rpx;
width: 100%;
height: 6rpx;
border-radius: 2rpx;
background: $tabChoiceColor;
}
.tab-choice {
//
position: relative;
color: $uni-color-primary;
font-weight: 600;
}
.tab-choice:before {
content: '';
position: absolute;
left: 0;
bottom: -14rpx;
width: 100%;
height: 6rpx;
border-radius: 2rpx;
background: $uni-color-primary;
}
}
}
// //
/* #ifndef APP-NVUE */
::-webkit-scrollbar,
::-webkit-scrollbar,
::-webkit-scrollbar {
display: none;
width: 0 !important;
height: 0 !important;
-webkit-appearance: none;
background: transparent;
}
/* #endif */
/* #ifdef H5 */
// 穿H5scroll-view
scroll-view ::v-deep ::-webkit-scrollbar {
display: none;
}
/* #endif */
</style>

84
src/components/Skeleton/READ_ME.md

@ -0,0 +1,84 @@
# skeleton组件
### 1.描述
> 此组件用于加载数据时占位图显示,跟vant-ui骨架屏用法相似,但比vant-ui更灵活
### 2.用法
- 基本用法
代码:
```vue
//基本用法
<skeleton :row="3" animate :loading="loading" >
<view>
content
</view>
</skeleton>
```
- **显示 title ——通过 **title 属性显示title占位图
代码:
```vue
//显示 title——通过 title 属性显示title占位图
<skeleton :row="3" title animate :loading="loading">
<view>
content
</view>
</skeleton>
```
- 显示头像(上面)——通过avatar=‘top’让头像的占位图上面显示
代码:
```vue
<skeleton :avatar="top" avatarAlign="left" :row="3" animate :loading="loading" style="margin-top:24rpx;">
<view>
content
</view>
</skeleton>
```
- 显示头像(左边)——通过avatar=‘left’让头像的占位图左边显示
代码:
```vue
<skeleton title :avatar="left" :row="3" animate :loading="loading" style="margin-top:24rpx;">
<view>
content
</view>
</skeleton>
```
- 显示banner**——通过 **banner属性显示banner占位图(只显示banner,不显示内容占位图时设置row="0")
代码:
```vue
<skeleton banner :row="0" animate :loading="loading" style="margin-top:24rpx;">
<view>
content
</view>
</skeleton>
```
###
### 3. API
### Props
| **属性名** | **说明** | **类型** | **默认值** | 可取值 |
| --- | --- | --- | --- | --- |
| loading | 是否显示骨架屏 | Boolean | true | true/false |
| row | 段落行数 | Number | String | 3 | 0表示不展现 |
| rowWidth | 段落行宽度 | Boolean &#124; Number | '100%' | |
| title | 是否显示标题 | Boolean &#124; String | false | |
| banner | 是否显示banner | Boolean &#124; String | false | |
| animate | 是否开启动画 | Boolean &#124; String | false | |
| avatar | 头像位置 | Boolean &#124; String | ''空 | left/top |
| avatarSize | 头像大小 | String | - | |
| avatarShape | 头像形状 | String | circle | circle/round |

186
src/components/Skeleton/Skeleton.vue

@ -0,0 +1,186 @@
<template>
<view>
<view :class="[avatarClass, animationClass]" class="lx-skeleton" v-show="loading">
<view :class="[avatarShapeClass, bannerClass]" :style="{ width: avatarSize, height: avatarSize }" class="avatar-class"></view>
<view :style="{ width: rowWidth }" class="row">
<view class="row-class lx-skeleton_title" v-if="title"></view>
<view :key="index" class="row-class" v-for="(item, index) in row"></view>
</view>
</view>
<slot v-if="!loading"></slot>
</view>
</template>
<script>
/**
* skeleton 骨架屏
* @description 用于加载数据时占位图显示跟Vant-UI用法相似但比Vant-UI更灵活
* @property {Boolean} loading 是否显示骨架屏默认为true
* @property {Number | String} row 段落行数默认为3
* @property {Boolean | Number} rowWidth 段落行宽度默认为100%
* @property {Boolean | String} title 是否显示标题默认为false
* @property {Boolean | String} banner 是否显示banner默认为false
* @property {Boolean | String} animate 是否开启动画默认为false
* @property {Boolean | String} avatar 头像位置
* @property {String} avatarSize 头像大小
* @property {String} avatarShape 头像形状默认为circle
*
* */
export default {
props: {
loading: {
type: Boolean,
default: true,
},
row: {
type: Number,
default: 3,
},
title: {
type: String,
default: '',
},
avatar: {
type: String,
default: '',
},
animate: {
type: Boolean,
default: false,
},
avatarSize: { type: String },
rowWidth: {
type: String,
default: '100%',
},
avatarShape: {
type: String,
default: 'circle',
},
banner: {
type: Boolean,
default: false,
},
// avator-size:{
// type: String,
// defualt: '32px'
// }
},
computed: {
avatarClass() {
if (this.avatar == 'top') {
return ['lx-skeleton_avator__top'];
} else if (this.avatar == 'left') {
return ['lx-skeleton_avator__left'];
} else {
return '';
}
},
animationClass() {
return [this.animate ? 'lx-skeleton_animation' : ''];
},
slotClass() {
return [!this.loading ? 'show' : 'hide'];
},
avatarShapeClass() {
return [this.avatarShape == 'round' ? 'lx-skeleton_avator__round' : ''];
},
bannerClass() {
return [this.banner ? 'lx-skeleton_banner' : ''];
},
},
data() {
return {};
},
};
</script>
<style lang="scss" scoped>
.lx-skeleton {
background-color: #fff;
padding: 12px;
}
.lx-skeleton_avator__left {
display: flex;
width: 100%;
}
.lx-skeleton_avator__left .avatar-class,
.lx-skeleton_avator__top .avatar-class {
background-color: #f2f3f5;
border-radius: 50%;
width: 32px;
height: 32px;
}
.lx-skeleton_avator__left .avatar-class.lx-skeleton_avator__round,
.lx-skeleton_avator__top .avatar-class.lx-skeleton_avator__round {
border-radius: 0;
width: 32px;
height: 32px;
}
.lx-skeleton_avator__left .avatar-class {
margin-right: 16px;
}
.lx-skeleton_avator__top .avatar-class {
margin: 0 auto 12px auto;
}
.row-class {
width: 100%;
height: 16px;
background-color: #f2f3f5;
}
.row-class:not(:first-child) {
margin-top: 12px;
}
.row {
flex: 1;
}
.lx-skeleton_avator__left .row {
width: calc(100% - 48px);
}
.row-class:nth-last-child(1) {
width: 60%;
}
.lx-skeleton_animation .row-class {
animation-duration: 1.5s;
animation-name: blink;
animation-timing-function: ease-in-out;
animation-iteration-count: infinite;
}
@keyframes blink {
50% {
opacity: 0.6;
}
}
.lx-skeleton_title {
width: 40%;
}
.show {
display: block;
}
.hide {
display: none;
}
.lx-skeleton .lx-skeleton_banner {
width: 92%;
margin: 10px auto;
height: 64px;
border-radius: 0;
background-color: #f2f3f5;
}
</style>

45
src/components/Skeleton/view.vue

@ -0,0 +1,45 @@
<template>
<view>
<nav-bar title="骨架屏"></nav-bar>
<view class="content">
基础用法
<skeleton :row="3" animate :loading="loading">
<view> content1 </view>
</skeleton>
显示 title
<skeleton :row="3" title animate :loading="loading">
<view> content2 </view>
</skeleton>
显示头像上面)
<skeleton :avatar="avatarTop" :row="3" animate :loading="loading" style="margin-top: 24rpx">
<view> content3 </view>
</skeleton>
显示头像左面
<skeleton title :avatar="avatarLeft" :row="3" animate :loading="loading" style="margin-top: 24rpx">
<view> content4 </view>
</skeleton>
显示banner
<skeleton banner :row="0" animate :loading="loading" style="margin-top: 24rpx">
<view> content5 </view>
</skeleton>
</view>
</view>
</template>
<script>
export default {
data() {
return {
loading: true, //
avatarTop: 'top',
avatarLeft: 'left',
};
},
onLoad() {
//
setTimeout(() => {
this.loading = false;
}, 3000);
},
};
</script>

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

@ -89,46 +89,33 @@ export default {
TaskPanel: { height: '100' },
},
],
};
},
methods: {
addTopList() {
const item = [
addList: [
{
state: 0,
plugins: [[{ pluginId: '111' }], [{ pluginId: '222' }]],
TaskPanel: { height: '100' },
},
{
state: 0,
plugins: [[{ pluginId: '111' }], [{ pluginId: '222' }]],
TaskPanel: { height: '100' },
},
{
state: 0,
plugins: [[{ pluginId: '111' }], [{ pluginId: '333' }]],
TaskPanel: { height: '100' },
},
];
this.list = item.concat(this.list);
console.log('this.list: ', this.list);
],
};
},
methods: {
addTopList() {
this.list = this.addList.concat(this.list);
},
addBottomList() {
const item = [
{
state: 0,
plugins: [[{ pluginId: '111' }], [{ pluginId: '333' }]],
},
{
state: 0,
plugins: [[{ pluginId: '111' }], [{ pluginId: '333' }]],
},
{
state: 0,
plugins: [[{ pluginId: '111' }]],
},
];
this.list = this.list.concat(item);
console.log('this.list: ', this.list);
this.list = this.list.concat(this.addList);
},
},
};

4
src/main.js

@ -25,8 +25,12 @@ const app = new Vue({ ...App, store });
import request from '@/utils/request.js';
import user from '@/apis/user.js';
import project from '@/apis/project.js';
window.vm = app;
Vue.use(request, app);
Vue.use(user, app);
Vue.use(project, app);
app.$mount();

10
src/mock/mock.js

@ -67,7 +67,7 @@ export default [
msg: 'ok',
success: true,
data: {
name: 'string',
name: '默认项目',
projectId: 1235555,
},
});
@ -115,9 +115,7 @@ export default [
code: 200,
msg: 'ok',
success: true,
data: {
description: 'data数据',
},
data: { description: 'data数据' },
});
},
},
@ -271,9 +269,7 @@ export default [
code: 200,
msg: 'ok',
success: true,
data: {
description: 'data数据',
},
data: { description: 'data数据' },
});
},
},

12
src/package.json

@ -0,0 +1,12 @@
{
"id": "ls-skeleton",
"name": "skeleton骨架屏(可随意配置骨架内容结构)",
"version": "1.0.0",
"description": "可随意配置骨架内容结构的骨架屏插件,自由度高,复用性强,扩展性强",
"keywords": [
"动画效果",
"VUE",
"NVUE",
"微信小程序"
]
}

2
src/pages.json

@ -1,7 +1,7 @@
{
"pages": [
{
"path": "pages/index/index",
"path": "pages/project/project",
"style": {
"navigationStyle": "custom" ,
"navigationBarTextStyle": "white"

15
src/pages/index/index.vue → src/pages/project/project.vue

@ -10,16 +10,22 @@
</template>
<script>
import { mapState, mapMutations, mapActions } from 'vuex';
export default {
data() {
return { title: 'Hello', height: '', scrollHeight: null };
},
onLoad() {
computed: { ...mapState('user', ['user', 'token']) },
onLoad(options) {
console.log('options: ', options);
console.log(this.$u.config.v);
// this.openPage();
this.$u.api.getToken('1217651354919636992');
console.log(this.$t);
this.getUserId('1217651354919636992');
const params = { param: { projectId: '1235555' } };
this.$u.api.findProjectById(params);
},
mounted() {
@ -27,6 +33,9 @@ export default {
},
methods: {
...mapMutations('user', ['setToken', 'setUser']),
...mapActions('user', ['getUserId']),
openPage() {
console.log('open');
this.$u.route('/pages/pinch/pinch');

19
src/store/user/actions.js

@ -1,3 +1,20 @@
const actions = {};
const actions = {
/**
* 通过userId获取token
* @param {any} commit
* @param {string} userId 用户id
*/
async getUserId({ commit }, userId) {
try {
uni.$u.api.getToken(userId).then(res => {
commit('setToken', res.token);
commit('setUser', res);
return res;
});
} catch (error) {
throw error || '获取个人信息失败';
}
},
};
export default actions;

24
src/store/user/mutations.js

@ -1,3 +1,25 @@
const mutations = {};
const mutations = {
/**
* 设置存储token
* @param {object} state
* @param {string} token
*/
setToken(state, token) {
if (!token) return;
state.token = token;
uni.setStorageSync('anyringToken', token);
},
/**
* 设置user数据
* @param {object} state
* @param {object} user
*/
setUser(state, user) {
if (!user) return;
state.user = { ...user };
uni.setStorageSync('user', JSON.stringify(user));
},
};
export default mutations;

6
src/store/user/state.js

@ -1,3 +1,5 @@
const state = {};
const state = {
token: '',
user: null,
};
export default state;

6
src/utils/request.js

@ -13,9 +13,9 @@ const install = (Vue, vm) => {
Vue.prototype.$u.http.interceptor.request = config => {
// TODO: 如果在白名单里 则不需要加token
// if (vm.$store.state.user.token) {
// config.header.Authorization = `Bearer ${vm.$store.state.user.token}`;
// }
if (vm.$store.state.user.token) {
config.header.Authorization = `Bearer ${vm.$store.state.user.token}`;
}
return config;
};

Loading…
Cancel
Save