5 files added
2 files deleted
4 files modified
| | |
| | | .dark-gray{ |
| | | color: #666666; |
| | | } |
| | | .red{ |
| | | color:#DE5A5A; |
| | | } |
| | | .green{ |
| | | color:#1FB713; |
| | | } |
| | | .purple{ |
| | | color: #5A73DE; |
| | | } |
| | | .blueness{ |
| | | color: #58C4C0; |
| | | } |
| | | .orange{ |
| | | color: #E89D44; |
| | | } |
| | | .yellow{ |
| | | color: #E6E15F; |
| | | } |
| | | .font-dark{ |
| | | color: #111111; |
| | | } |
| | |
| | | .block{ |
| | | display: block; |
| | | } |
| | | |
| | | .placeholder{ |
| | | color: #999999; |
| | | } |
| | | .center{ |
| | | text-align: center; |
| | | } |
| | | .right{ |
| | | text-align: end; |
| | | } |
New file |
| | |
| | | <template> |
| | | <view class="_tab-box" :style="{fontSize: defaultConfig.fontSize + 'rpx', color: defaultConfig.color}"> |
| | | <scroll-view id="_scroll" :scroll-x="true" class="scroll-view-h" scroll-with-animation :scroll-left="slider.scrollLeft"> |
| | | <view class="_scroll-content"> |
| | | <view class="_tab-item-box" :class="[defaultConfig.itemWidth ? '_clamp' : '_flex']"> |
| | | <block v-for="(item, index) in tabList" :key="index" > |
| | | <view |
| | | class="_item" |
| | | :id="'_tab_'+index" |
| | | :class="{ '_active': tagIndex === index }" |
| | | :style="{color: tagIndex == index ? defaultConfig.activeColor : defaultConfig.color, 'width': defaultConfig.itemWidth ? defaultConfig.itemWidth + 'rpx' : ''}" |
| | | @click="tabClick(index)">{{ item[defaultConfig.key] || item }}</view> |
| | | </block> |
| | | </view> |
| | | <view class="_underline" :style="{ |
| | | transform: 'translateX(' + slider.left + 'px)', |
| | | width: slider.width + 'px', |
| | | height: defaultConfig.underLineHeight + 'rpx', |
| | | backgroundColor: defaultConfig.underLineColor, |
| | | }" /> |
| | | </view> |
| | | </scroll-view> |
| | | </view> |
| | | </template> |
| | | |
| | | <script> |
| | | export default { |
| | | name: 'liuyuno-tabs', |
| | | props: { |
| | | tabData: { |
| | | type: Array, |
| | | default: () => [] |
| | | }, |
| | | activeIndex: { |
| | | type: Number, |
| | | default: 0 |
| | | }, |
| | | config: { |
| | | type: Object, |
| | | default:() => { |
| | | return {} |
| | | } |
| | | }, |
| | | }, |
| | | data() { |
| | | return { |
| | | tabList: [], |
| | | tagIndex: 0, |
| | | slider: { |
| | | left: 0, |
| | | width: 0, |
| | | scrollLeft: 0 |
| | | }, |
| | | scorll: {}, |
| | | defaultConfig: { |
| | | // 要显示的key |
| | | key: 'name', |
| | | // 字体大小 rpx |
| | | fontSize: 26, |
| | | // 字体颜色 |
| | | color: '#313131', |
| | | // 激活字体颜色 |
| | | activeColor: '#e54d42', |
| | | // item宽度 0为自动 |
| | | itemWidth: 0, |
| | | // 下划线左右边距,文字宽度加边距 rpx |
| | | underLinePadding: 10, |
| | | // 下划线宽度 rpx 注意:设置了此值 underLinePadding 失效 |
| | | underLineWidth: 0, |
| | | // 下划线高度 rpx |
| | | underLineHeight: 4, |
| | | // 下划线颜色 |
| | | underLineHeight: '#e54d42', |
| | | }, |
| | | }; |
| | | }, |
| | | watch: { |
| | | tabData(value) { |
| | | this.updateData(); |
| | | setTimeout(() => { |
| | | this.updateTabWidth(); |
| | | }, 0); |
| | | }, |
| | | config(value) { |
| | | this.updateConfig(); |
| | | }, |
| | | }, |
| | | mounted() { |
| | | this.updateConfig(); |
| | | this.updateData(); |
| | | this.tagIndex = this.activeIndex; |
| | | |
| | | this.$nextTick(() => { |
| | | this.calcScrollPosition(); |
| | | }) |
| | | }, |
| | | methods: { |
| | | updateData() { |
| | | let data = []; |
| | | if (typeof(this.tabData[0])=='string') { |
| | | this.tabData.forEach((item, index) => { |
| | | data.push({ |
| | | name: item, |
| | | }) |
| | | }); |
| | | this.defaultConfig.key = 'name'; |
| | | } else { |
| | | data = JSON.parse(JSON.stringify(this.tabData)); |
| | | } |
| | | |
| | | this.tabList = data; |
| | | }, |
| | | updateConfig() { |
| | | this.defaultConfig = Object.assign(this.defaultConfig, this.config); |
| | | }, |
| | | calcScrollPosition() { |
| | | |
| | | const query = uni.createSelectorQuery().in(this); |
| | | |
| | | query.select('#_scroll').boundingClientRect((res) => { |
| | | this.scorll = res; |
| | | this.updateTabWidth(); |
| | | }).exec(); |
| | | }, |
| | | updateTabWidth(index = 0) { |
| | | let data = this.tabList; |
| | | |
| | | if (data.length == 0) return false; |
| | | |
| | | const query = uni.createSelectorQuery().in(this); |
| | | |
| | | query.select('#_tab_' + index).boundingClientRect((res) => { |
| | | |
| | | data[index]._slider = { |
| | | width: res.width, |
| | | left: res.left, |
| | | scrollLeft: res.left - (data[index - 1] ? data[index - 1]._slider.width : 0), |
| | | }; |
| | | |
| | | if (this.tagIndex == index) { |
| | | this.tabToIndex(this.tagIndex); |
| | | } |
| | | |
| | | index++; |
| | | if (data.length > index) { |
| | | this.updateTabWidth(index); |
| | | } |
| | | }).exec(); |
| | | }, |
| | | |
| | | tabToIndex(index) { |
| | | |
| | | let _slider = this.tabList[index]._slider; |
| | | |
| | | let width = uni.upx2px(this.defaultConfig.underLineWidth); |
| | | |
| | | if (!width) { |
| | | if (this.defaultConfig.itemWidth) { |
| | | width = uni.upx2px(this.defaultConfig.itemWidth); |
| | | } else { |
| | | width = this.tabList[index][this.defaultConfig.key].length * uni.upx2px(this.defaultConfig.fontSize); |
| | | } |
| | | width += uni.upx2px(this.defaultConfig.underLinePadding) * 2; |
| | | } |
| | | |
| | | let scorll_left = this.scorll.left || 0; |
| | | |
| | | this.slider = { |
| | | left: _slider.left - scorll_left + (_slider.width - width) / 2, |
| | | width: width, |
| | | scrollLeft: _slider.scrollLeft - scorll_left, |
| | | } |
| | | }, |
| | | |
| | | tabClick(index) { |
| | | this.tagIndex = index; |
| | | this.tabToIndex(index); |
| | | this.$emit('tabClick', index); |
| | | } |
| | | } |
| | | } |
| | | </script> |
| | | |
| | | <style lang="scss" scoped> |
| | | ._tab-box { |
| | | width: 100%; |
| | | display: flex; |
| | | font-size: 26rpx; |
| | | position: relative; |
| | | height: 90rpx; |
| | | line-height: 90rpx; |
| | | z-index: 10; |
| | | .scroll-view-h{ |
| | | white-space:nowrap; |
| | | width: 100%; |
| | | height: 100%; |
| | | box-sizing: border-box; |
| | | ._scroll-content { |
| | | width: 100%; |
| | | height: 100%; |
| | | position:relative; |
| | | |
| | | ._tab-item-box { |
| | | height: 100%; |
| | | &._flex { |
| | | display: flex; |
| | | ._item { |
| | | flex: 1; |
| | | } |
| | | } |
| | | &._clamp { |
| | | ._item { |
| | | overflow:hidden; |
| | | text-overflow:ellipsis; |
| | | white-space:nowrap; |
| | | } |
| | | } |
| | | |
| | | |
| | | ._item { |
| | | height: 100%; |
| | | display: inline-block; |
| | | text-align: center; |
| | | padding: 0 30rpx; |
| | | position: relative; |
| | | text-align: center; |
| | | |
| | | color: #333; |
| | | &._active { |
| | | color: #e54d42; |
| | | } |
| | | } |
| | | } |
| | | ._underline { |
| | | height: 4rpx; |
| | | background-color: #e54d42; |
| | | border-radius: 6rpx; |
| | | transition: .5s; |
| | | position: absolute; |
| | | bottom: 0; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | </style> |
| | |
| | | <template> |
| | | <view v-show="isShow"> |
| | | <view class="content"> |
| | | <slot></slot> |
| | | </view> |
| | | </template> |
| | | |
| | | <script> |
| | | export default{ |
| | | |
| | | data(){ |
| | | return{ |
| | | } |
| | | }, |
| | | methods:{ |
| | | } |
| | | } |
| | | </script> |
| | | |
| | | <style> |
| | | .content{ |
| | | background: #4c4c4c; |
| | | border-radius: 4px; |
| | | } |
| | | </style> |
| | |
| | | <template> |
| | | <!-- 我的 --> |
| | | <view class="container"> |
| | | <!-- #ifndef H5 --> |
| | | <view class="status_bar"></view> |
| | | <!-- #endif --> |
| | | <view class="header"> |
| | | <view class="icon white iconfont iconshezhi right"></view> |
| | | <view class="flex align-center"> |
| | | <image class="header-img ml-15" src="../../static/images/head-img.jpg"></image> |
| | | <view class="flex flex-v ml-20"> |
| | | <view> |
| | | <text class="font-18 white mr-5">222是个帅哥</text> |
| | | <text class="white icon iconfont iconxiugai"></text> |
| | | </view> |
| | | <view class="flex mt-10"> |
| | | <view class="mr-20"> |
| | | <text class="white mr-5 font-14">职位:</text> |
| | | <text class="white font-14">靓仔</text> |
| | | </view> |
| | | <view> |
| | | <text class="white mr-5 font-14">工号:</text> |
| | | <text class="white font-14">9527</text> |
| | | </view> |
| | | </view> |
| | | </view> |
| | | </view> |
| | | </view> |
| | | |
| | | <view class="content"> |
| | | <view class="flex align-center performance"> |
| | | <image class="title-img mr-10" src="../../static/images/mine1.png"></image> |
| | | <text class="font-18">我的业绩</text> |
| | | </view> |
| | | <view class="tab-box"> |
| | | <liuyuno-tabs |
| | | class="tab" |
| | | :tabData="tabs" |
| | | :config="{ |
| | | color: '#abb1cc', |
| | | activeColor: '#518EFF', |
| | | underLineColor: '#518EFF', |
| | | underLineHeight: 5, |
| | | fontSize: 30, |
| | | itemWidth: 70, |
| | | underLineWidth: 50, |
| | | }" |
| | | /> |
| | | <view class="performance-content"> |
| | | <view class="flex justify-around"> |
| | | <view class="flex flex-v align-center performance-item"> |
| | | <text class="font-16 red">600.00</text> |
| | | <text class="font-14 mt-5">总现金业绩</text> |
| | | </view> |
| | | <view class="flex flex-v align-center performance-item"> |
| | | <text class="font-16 green">600.00</text> |
| | | <text class="font-14 mt-5">售卡业绩</text> |
| | | </view> |
| | | <view class="flex flex-v align-center performance-item"> |
| | | <text class="font-16 purple">600.00</text> |
| | | <text class="font-14 mt-5">项目业绩</text> |
| | | </view> |
| | | </view> |
| | | <view class="flex justify-around mt-20"> |
| | | <view class="flex flex-v align-center performance-item"> |
| | | <text class="font-16 blueness">600.00</text> |
| | | <text class="font-14 mt-5">产品业绩</text> |
| | | </view> |
| | | <view class="flex flex-v align-center performance-item"> |
| | | <text class="font-16 orange">600.00</text> |
| | | <text class="font-14 mt-5">余额划扣业绩</text> |
| | | </view> |
| | | <view class="flex flex-v align-center performance-item"> |
| | | <text class="font-16 yellow">600.00</text> |
| | | <text class="font-14 mt-5">服务提成</text> |
| | | </view> |
| | | </view> |
| | | </view> |
| | | </view> |
| | | <view class="flex align-center justify-between repository mt-20"> |
| | | <view class="flex align-center"> |
| | | <image class="title-img mr-10" src="../../static/images/mine2.png"></image> |
| | | <text>知识库</text> |
| | | </view> |
| | | <text class="icon iconfont iconarrow-backimg gray"></text> |
| | | </view> |
| | | </view> |
| | | </view> |
| | | </template> |
| | | |
| | | <script> |
| | | import liuyunoTabs from "@/components/liuyuno-tabs/liuyuno-tabs.vue"; |
| | | export default { |
| | | components: { |
| | | liuyunoTabs |
| | | }, |
| | | data() { |
| | | return { |
| | | tabs:[ |
| | | { |
| | | state: 1, |
| | | name: '今日' |
| | | }, |
| | | { |
| | | state: 2, |
| | | name: '昨日' |
| | | }, |
| | | { |
| | | state: 3, |
| | | name: '本月' |
| | | }, |
| | | { |
| | | state: 4, |
| | | name: '上月' |
| | | }, |
| | | ], |
| | | } |
| | | }, |
| | | methods: { |
| | | |
| | | } |
| | | } |
| | | </script> |
| | | |
| | | <style> |
| | | .status_bar{ |
| | | background: #518EFF; |
| | | color: #FFFFFF; |
| | | } |
| | | .header{ |
| | | height: 100px; |
| | | background: #518EFF; |
| | | border-bottom-left-radius: 20px; |
| | | border-bottom-right-radius: 20px; |
| | | padding: 15px; |
| | | } |
| | | .icon { |
| | | font-size: 18px; |
| | | font-family: texticons; |
| | | } |
| | | .header-img{ |
| | | width: 64px; |
| | | height: 64px; |
| | | border-radius: 50%; |
| | | } |
| | | .content{ |
| | | padding: 0 10px; |
| | | } |
| | | .performance{ |
| | | padding: 0 3px; |
| | | margin: 15px 0px 10px; |
| | | } |
| | | .title-img{ |
| | | width: 18px; |
| | | height: 18px; |
| | | } |
| | | .tab-box{ |
| | | border: 1px solid #EDEAF4; |
| | | border-radius: 4px; |
| | | box-shadow:0 6px 6px rgba(237,234,244,0.5); |
| | | padding: 10px; |
| | | } |
| | | .tab{ |
| | | border-bottom: 1px solid #EDEAF4; |
| | | } |
| | | .performance-content{ |
| | | padding: 10px 0; |
| | | } |
| | | .performance-item{ |
| | | width: 33.3%; |
| | | } |
| | | .repository{ |
| | | border: 1px solid #EDEAF4; |
| | | border-radius: 4px; |
| | | padding: 10px 3px; |
| | | box-shadow:0 6px 6px rgba(237,234,244,0.5); |
| | | } |
| | | </style> |
| | |
| | | <text class="icon gray iconfont iconsousuo mr-15"></text> |
| | | <text class="icon gray iconfont iconjiahao" @click.stop="isShow=!isShow"></text> |
| | | </view> |
| | | <view class="popup-content" v-show="isShow"> |
| | | <view> |
| | | <text class="icon iconfont iconjiahao mr-5"></text> |
| | | <text>新增会员</text> |
| | | </view> |
| | | <view class="mt-10"> |
| | | <text class="icon iconfont iconsaomiao mr-5"></text> |
| | | <text>扫一扫</text> |
| | | <popover class="popup-content" v-show="isShow"> |
| | | <view class="triangle"></view> |
| | | <view class="popup-item flex align-center"> |
| | | <text class="icon white iconfont iconjiahao mr-5"></text> |
| | | <text class="white font-14 popup-content-text">新增会员</text> |
| | | </view> |
| | | <view class="popup-item flex align-center"> |
| | | <text class="icon white iconfont iconsaomiao mr-5"></text> |
| | | <text class="white font-14 popup-content-text">扫一扫</text> |
| | | </view> |
| | | </view> |
| | | </popover> |
| | | <view class="condition flex justify-between"> |
| | | <view class="flex flex-v align-center"> |
| | | <text class="font-17 white">0</text> |
| | |
| | | </template> |
| | | |
| | | <script> |
| | | import popover from "../../components/popover/index.vue" |
| | | export default{ |
| | | components:{ |
| | | popover |
| | | }, |
| | | data(){ |
| | | return{ |
| | | isShow:false |
| | |
| | | text-align: center; |
| | | font-family: texticons; |
| | | } |
| | | page{ |
| | | background: #F8F8F8; |
| | | } |
| | | .container{ |
| | | padding: 0 10px; |
| | | } |
| | |
| | | padding: 15px 0; |
| | | border-radius: 4px; |
| | | margin: 10px 0; |
| | | box-shadow:0 6px 6px rgba(237,234,244,0.5); |
| | | } |
| | | .title{ |
| | | font-size: 14px; |
| | |
| | | width: 25%; |
| | | } |
| | | .popup-content{ |
| | | background: #FFFFFF; |
| | | border: 1px solid #ABB1CC; |
| | | padding: 10px; |
| | | border-radius: 4px; |
| | | position: absolute; |
| | | right: 10px; |
| | | top: 35px; |
| | | right: 9px; |
| | | top: 48px; |
| | | padding-left: 10px; |
| | | } |
| | | .triangle{ |
| | | width: 0; |
| | | height: 0; |
| | | border-width: 0 10px 10px; |
| | | border-style: solid; |
| | | border-color: transparent transparent #4c4c4c; |
| | | position: absolute; |
| | | top:-8px; |
| | | right: 5px; |
| | | } |
| | | .popup-content-text{ |
| | | width: 100%; |
| | | border-bottom: 1px solid gray; |
| | | padding: 10px 10px 10px 0; |
| | | } |
| | | .popup-content .popup-item:nth-last-of-type(1) .popup-content-text{ |
| | | border-bottom: 0; |
| | | } |
| | | </style> |