forked from ccsens_fe/tall-mui-3
26 changed files with 535 additions and 153 deletions
@ -0,0 +1,58 @@ |
|||||
|
<template> |
||||
|
<view class="m-2"> |
||||
|
<u-card margin="0" :show-head="false" :show-foot="false" border-radius="25" :style="{ height: isShrink ? '96rpx' : '300rpx' }"> |
||||
|
<!-- <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="u-col-between p-0 u-skeleton"> |
||||
|
<view class="u-line-2 u-skeleton-rect"> 瓶身描绘的牡丹一如你初妆</view> |
||||
|
<view class="u-line-2 u-skeleton-rect mt-2"> 瓶身描绘的牡丹一如你初妆</view> |
||||
|
<view class="u-line-2 u-skeleton-rect mt-2"> 瓶身描绘的牡丹一如你初妆</view> |
||||
|
<view class="u-line-2 u-skeleton-rect mt-2"> 瓶身描绘的牡丹一如你初妆</view> |
||||
|
<view class="u-line-2 u-skeleton-rect mt-2"> 瓶身描绘的牡丹一如你初妆</view> |
||||
|
<view class="u-line-2 u-skeleton-rect mt-2"> 瓶身描绘的牡丹一如你初妆</view> |
||||
|
<view class="u-line-2 u-skeleton-rect mt-2"> 瓶身描绘的牡丹一如你初妆</view> |
||||
|
<view class="u-line-2 u-skeleton-rect mt-2"> 瓶身描绘的牡丹一如你初妆</view> |
||||
|
<view class="u-line-2 u-skeleton-rect mt-2"> 瓶身描绘的牡丹一如你初妆</view> |
||||
|
<view class="u-line-2 u-skeleton-rect mt-2"> 瓶身描绘的牡丹一如你初妆</view> |
||||
|
<view class="u-line-2 u-skeleton-rect mt-2"> 瓶身描绘的牡丹一如你初妆</view> |
||||
|
<view class="u-line-2 u-skeleton-rect mt-2"> 瓶身描绘的牡丹一如你初妆222</view> |
||||
|
</view> |
||||
|
</scroll-view> |
||||
|
</view> |
||||
|
</u-card> |
||||
|
<!-- <u-skeleton :animation="true" :loading="true" bgcolor="#fff"></u-skeleton> --> |
||||
|
</view> |
||||
|
</template> |
||||
|
|
||||
|
<script> |
||||
|
import { mapState } from 'vuex'; |
||||
|
export default { |
||||
|
name: 'Global', |
||||
|
data() { |
||||
|
return {}; |
||||
|
}, |
||||
|
computed: mapState('home', ['isShrink']), |
||||
|
}; |
||||
|
</script> |
||||
|
|
||||
|
<style scoped lang="scss"> |
||||
|
.u-card-wrap { |
||||
|
background-color: $u-bg-color; |
||||
|
padding: 1px; |
||||
|
} |
||||
|
|
||||
|
.u-body-item { |
||||
|
font-size: 32rpx; |
||||
|
color: #333; |
||||
|
padding: 20rpx 10rpx; |
||||
|
} |
||||
|
|
||||
|
.u-body-item image { |
||||
|
width: 120rpx; |
||||
|
flex: 0 0 120rpx; |
||||
|
height: 120rpx; |
||||
|
border-radius: 8rpx; |
||||
|
margin-left: 12rpx; |
||||
|
} |
||||
|
</style> |
@ -1,51 +0,0 @@ |
|||||
<!-- |
|
||||
* @Author: aBin |
|
||||
* @email: binbin0314@126.com |
|
||||
* @Date: 2021-07-19 10:52:05 |
|
||||
* @LastEditors: aBin |
|
||||
* @LastEditTime: 2021-07-20 14:20:46 |
|
||||
--> |
|
||||
<template> |
|
||||
<view class="p-2"> |
|
||||
<u-card :show-foot="false" :show-head="false" border-radius="25" margin="0"> |
|
||||
<view slot="body"> |
|
||||
<view class="u-col-between p-0 u-skeleton"> |
|
||||
<view class="u-line-2 u-skeleton-rect">瓶身描绘的牡丹一如你初妆</view> |
|
||||
<view class="u-line-2 u-skeleton-rect mt-2">瓶身描绘的牡丹一如你初妆</view> |
|
||||
<view class="u-line-2 u-skeleton-rect mt-2">瓶身描绘的牡丹一如你初妆</view> |
|
||||
</view> |
|
||||
</view> |
|
||||
</u-card> |
|
||||
<u-skeleton :animation="true" :loading="true" bgcolor="#fff"></u-skeleton> |
|
||||
</view> |
|
||||
</template> |
|
||||
|
|
||||
<script> |
|
||||
export default { |
|
||||
name: 'Global', |
|
||||
data() { |
|
||||
return {}; |
|
||||
}, |
|
||||
}; |
|
||||
</script> |
|
||||
|
|
||||
<style scoped lang="scss"> |
|
||||
.u-card-wrap { |
|
||||
background-color: $u-bg-color; |
|
||||
padding: 1px; |
|
||||
} |
|
||||
|
|
||||
.u-body-item { |
|
||||
font-size: 32rpx; |
|
||||
color: #333; |
|
||||
padding: 20rpx 10rpx; |
|
||||
} |
|
||||
|
|
||||
.u-body-item image { |
|
||||
width: 120rpx; |
|
||||
flex: 0 0 120rpx; |
|
||||
height: 120rpx; |
|
||||
border-radius: 8rpx; |
|
||||
margin-left: 12rpx; |
|
||||
} |
|
||||
</style> |
|
@ -0,0 +1,180 @@ |
|||||
|
<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"> |
||||
|
<view :key="index" @click="changeIndex(index)" class="tab-item" v-for="(item, index) in roles"> |
||||
|
<view :class="setColor(item.mine, tabIndex, index)" class="tab-children u-skeleton-rect">{{ item.name }}</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, 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, // 是否显示骨架屏组件 |
||||
|
}; |
||||
|
}, |
||||
|
|
||||
|
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(mine, tabIndex, index) { |
||||
|
if (mine === 1 && tabIndex === index) { |
||||
|
return 'default-tab-choice'; |
||||
|
} |
||||
|
if (mine === 1 && tabIndex !== index) { |
||||
|
return 'default-tab-item'; |
||||
|
} |
||||
|
if (mine === 0 && tabIndex === index) { |
||||
|
return 'tab-choice'; |
||||
|
} |
||||
|
}, |
||||
|
}, |
||||
|
}; |
||||
|
</script> |
||||
|
|
||||
|
<style lang="scss" scoped> |
||||
|
// 这是最外层盒子 |
||||
|
.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: 20rpx 24rpx; |
||||
|
position: relative; |
||||
|
display: inline-block; |
||||
|
text-align: center; |
||||
|
font-size: 30rpx; |
||||
|
transition-property: background-color, width; |
||||
|
} |
||||
|
|
||||
|
.default-tab-item { |
||||
|
color: $roleChoiceColor; |
||||
|
} |
||||
|
|
||||
|
.default-tab-choice { |
||||
|
//当前选中 基于此类名给与底部选中框 |
||||
|
position: relative; |
||||
|
color: $roleChoiceColor; |
||||
|
font-weight: 600; |
||||
|
} |
||||
|
.default-tab-choice:before { |
||||
|
content: ''; |
||||
|
position: absolute; |
||||
|
left: 0; |
||||
|
bottom: -20rpx; |
||||
|
width: 100%; |
||||
|
height: 6rpx; |
||||
|
border-radius: 2rpx; |
||||
|
background: $roleChoiceColor; |
||||
|
} |
||||
|
|
||||
|
.tab-choice { |
||||
|
//当前选中 基于此类名给与底部选中框 |
||||
|
position: relative; |
||||
|
color: $uni-color-primary; |
||||
|
font-weight: 600; |
||||
|
} |
||||
|
|
||||
|
.tab-choice:before { |
||||
|
content: ''; |
||||
|
position: absolute; |
||||
|
left: 0; |
||||
|
bottom: -20rpx; |
||||
|
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 */ |
||||
|
// 通过样式穿透,隐藏H5下,scroll-view下的滚动条 |
||||
|
scroll-view ::v-deep ::-webkit-scrollbar { |
||||
|
display: none; |
||||
|
} |
||||
|
|
||||
|
/* #endif */ |
||||
|
</style> |
@ -0,0 +1,73 @@ |
|||||
|
<template> |
||||
|
<view |
||||
|
class="absolute shadow-2xl shadow-2xl" |
||||
|
style="z-index: 1000" |
||||
|
:style="{ |
||||
|
left: client.left + 'px', |
||||
|
top: height - client.top > 110 ? client.top + 'px' : '', |
||||
|
bottom: height - client.top > 110 ? '' : '10px', |
||||
|
}" |
||||
|
id="u-icard" |
||||
|
> |
||||
|
<u-card |
||||
|
:title="title" |
||||
|
style="width: 500rpx; margin: 0 !important" |
||||
|
v-if="showTips" |
||||
|
titleSize="28" |
||||
|
:headStyle="headStyle" |
||||
|
:footStyle="footStyle" |
||||
|
> |
||||
|
<view class="" slot="body"> {{ tipsContent }} </view> |
||||
|
<view class="flex ustify-between" slot="foot"> |
||||
|
<u-button size="mini" @tap="clickCancel">取消</u-button> |
||||
|
<u-button v-if="status === 1" size="mini" @tap="clickCancel">暂停</u-button> |
||||
|
<u-button v-if="status === 2" size="mini" @tap="clickCancel">继续</u-button> |
||||
|
<u-button v-if="status === 1 || status === 2" size="mini" @tap="clickCancel">重新开始</u-button> |
||||
|
<u-button v-if="status === 1 || status === 2" type="primary" size="mini" @tap="clickCancel">结束</u-button> |
||||
|
<u-button v-if="status === 0 || status === 3" type="primary" size="mini" @tap="clickOk">确定</u-button> |
||||
|
</view> |
||||
|
</u-card> |
||||
|
<u-toast ref="uToast" /> |
||||
|
</view> |
||||
|
</template> |
||||
|
|
||||
|
<script> |
||||
|
import { mapState, mapMutations } from 'vuex'; |
||||
|
export default { |
||||
|
name: 'Tips', |
||||
|
props: { |
||||
|
title: { |
||||
|
default: '提示', |
||||
|
type: String, |
||||
|
}, |
||||
|
}, |
||||
|
computed: mapState('home', ['client', 'showTips', 'status', 'tipsContent']), |
||||
|
data() { |
||||
|
return { |
||||
|
footStyle: { padding: '4px 15px' }, |
||||
|
headStyle: { paddingTop: '8px', paddingBottom: '8px' }, |
||||
|
height: 0, |
||||
|
}; |
||||
|
}, |
||||
|
mounted() { |
||||
|
this.height = window.screen.height; |
||||
|
}, |
||||
|
methods: { |
||||
|
...mapMutations('home', ['setTips']), |
||||
|
clickOk() { |
||||
|
this.$refs.uToast.show({ |
||||
|
title: '点击了确定', |
||||
|
type: 'success', |
||||
|
}); |
||||
|
this.setTips(false); |
||||
|
}, |
||||
|
clickCancel() { |
||||
|
this.$refs.uToast.show({ |
||||
|
title: '点击了取消', |
||||
|
type: 'error', |
||||
|
}); |
||||
|
this.setTips(false); |
||||
|
}, |
||||
|
}, |
||||
|
}; |
||||
|
</script> |
@ -0,0 +1,3 @@ |
|||||
|
const actions = {}; |
||||
|
|
||||
|
export default actions; |
@ -0,0 +1,3 @@ |
|||||
|
const getters = {}; |
||||
|
|
||||
|
export default getters; |
@ -0,0 +1,12 @@ |
|||||
|
import state from './state'; |
||||
|
import getters from './getters'; |
||||
|
import mutations from './mutations'; |
||||
|
import actions from './actions'; |
||||
|
|
||||
|
export default { |
||||
|
namespaced: true, |
||||
|
state, |
||||
|
getters, |
||||
|
mutations, |
||||
|
actions, |
||||
|
}; |
@ -0,0 +1,52 @@ |
|||||
|
const mutations = { |
||||
|
/** |
||||
|
* 记录时间轴向上滚动的距离 |
||||
|
* @param { object } state |
||||
|
* @param { number } num |
||||
|
*/ |
||||
|
setScrollTop(state, num) { |
||||
|
state.scrollTop = num; |
||||
|
}, |
||||
|
/** |
||||
|
* 设置日常任务当前是否应该处于收缩状态 |
||||
|
* @param { object } state |
||||
|
* @param { boolean } data |
||||
|
*/ |
||||
|
setShrink(state, data) { |
||||
|
state.isShrink = data; |
||||
|
}, |
||||
|
/** |
||||
|
* 存储鼠标点击位置 |
||||
|
* @param { object } state |
||||
|
* @param { object } data |
||||
|
*/ |
||||
|
setClient(state, data) { |
||||
|
state.client = { ...data }; |
||||
|
}, |
||||
|
/** |
||||
|
* 是否显示tips |
||||
|
* @param { object } state |
||||
|
* @param { boolean } data |
||||
|
*/ |
||||
|
setTips(state, data) { |
||||
|
state.showTips = data; |
||||
|
}, |
||||
|
/** |
||||
|
* 是否显示tips |
||||
|
* @param { object } state |
||||
|
* @param { number } data |
||||
|
*/ |
||||
|
setStatus(state, data) { |
||||
|
state.status = data; |
||||
|
}, |
||||
|
/** |
||||
|
* 是否显示tips |
||||
|
* @param { object } state |
||||
|
* @param { string } data |
||||
|
*/ |
||||
|
setTipsContent(state, data) { |
||||
|
state.tipsContent = data; |
||||
|
}, |
||||
|
}; |
||||
|
|
||||
|
export default mutations; |
@ -0,0 +1,13 @@ |
|||||
|
const state = { |
||||
|
scrollTop: 0, |
||||
|
isShrink: false, // true: 收起, false:展开
|
||||
|
client: { |
||||
|
left: 0, // 鼠标点击位置距离左边的距离
|
||||
|
top: 0, // 鼠标点击位置距离上边的距离
|
||||
|
}, |
||||
|
showTips: false, |
||||
|
status: 0, // 点击了时间轴上的哪种样式,默认点击了开始
|
||||
|
tipsContent: '', // 提示框内的内容,需要传入
|
||||
|
}; |
||||
|
|
||||
|
export default state; |
@ -0,0 +1,8 @@ |
|||||
|
import Vue from 'vue'; |
||||
|
import Vuex from 'vuex'; |
||||
|
import home from './home/index'; |
||||
|
import db from './db/index'; |
||||
|
import user from './user/index'; |
||||
|
|
||||
|
Vue.use(Vuex); |
||||
|
export default new Vuex.Store({ modules: { home, db, user } }); |
Loading…
Reference in new issue