Browse Source

no message

featrue/v4.5
xpz2018 4 years ago
parent
commit
95dc639371
8 changed files with 63 additions and 47 deletions
  1. 14
      components/tabi/index.js
  2. 18
      components/tabi/index.wxml
  3. 15
      components/tabi/index.wxss
  4. 4
      pages/agent/factory/index.js
  5. 6
      pages/agent/fragment/index.js
  6. 6
      pages/agent/fragment/index.wxml
  7. 43
      pages/moment/theall/index.js
  8. 4
      pages/moment/theall/index.wxml

14
components/tabi/index.js

@ -19,7 +19,7 @@ Component({
},
lineHeight: {
type: Number,
value: 4,
value: 3,
},
// view宽度
padding: {
@ -36,6 +36,14 @@ Component({
color: {
type: String,
value: ""
},
lineType: {
type: Number,
value: 0,
},
disable: {
type: Boolean,
value: false
}
},
data: {
@ -53,6 +61,9 @@ Component({
* 切换菜单
*/
toggleTab(e) {
if(this.data.disable){
return
}
this.triggerEvent('change', {index: e.currentTarget.dataset.index});
this.scrollByIndex(e.currentTarget.dataset.index);
},
@ -78,6 +89,7 @@ Component({
} else { // 不超出滚动的情况
this.setData({ tabIndex: tabIndex, translateX: itemLeft, lineWidth: itemWidth })
}
},
/**
* 监听数据变化, 如果改变重新初始化参数

18
components/tabi/index.wxml

@ -1,10 +1,20 @@
<scroll-view class="scroll-view" style="height: {{size}}rpx;" scroll-x="{{scrolling}}" scroll-with-animation="{{scrolling}}" scroll-left="{{scrollLeft}}">
<view class="tabs-wrap">
<view class="tabs {{scroll ? 'tabs--scroll' : ''}}" style="height: {{size}}rpx">
<view class="tabs__item {{index === tabIndex ? 'tabs__item--cur': ''}}" style="height: {{size}}rpx;line-height: {{size}}rpx" wx:for="{{tabData}}" wx:key="*this" bindtap="toggleTab" data-index="{{index}}">
<view class="tabs__item-child">{{item}}</view>
<view class="tabs__item {{index === tabIndex ? 'tabs__item--cur': ''}}" style="height: {{size}}rpx;line-height: {{size}}rpx;padding: 0 {{lineType == 1?4: 30}}rpx;" wx:for="{{tabData}}" wx:key="*this" bindtap="toggleTab" data-index="{{index}}">
<view class="tabs__item-child {{lineType == 1?'tabs-type': ''}} {{typeActive(lineType, tabIndex, index)}}">{{item}}</view>
</view>
<view class="tabs__line {{needTransition ? 'transition' : ''}}" style="background: {{color}};width: {{lineWidth}}px;transform: translateX({{translateX}}px);height: {{lineHeight}}px"></view>
<view class="tabs__line {{needTransition ? 'transition' : ''}}" style="background: {{color}};width: {{lineWidth}}px;transform: translateX({{translateX}}px);height: {{lineHeight}}px" wx:if="{{lineType == 0}}"></view>
</view>
</view>
</scroll-view>
</scroll-view>
<wxs module="typeActive">
function typeActive(lineType, tabIndex, index) {
if (lineType == 0) {
return ''
}
return tabIndex == index ? 'type--cur' : ''
}
module.exports = typeActive
</wxs>

15
components/tabi/index.wxss

@ -42,6 +42,21 @@
.tabs__item-child {
display: inline-block;
}
.tabs-type {
background-color: #F3f3f3;
line-height: 60rpx;
height: 56rpx;
font-size: 26rpx;
text-align: center;
margin: 16rpx 8rpx;
padding: 0rpx 36rpx;
text-align: center;
border-radius: 56rpx;
}
.type--cur{
background: #007AFF24;
color: #007AFF;
}
.tabs__line {
position: absolute;
left: 0;

4
pages/agent/factory/index.js

@ -90,9 +90,7 @@ Page({
stopTouchMove: function (e) {
return false
},
onTabChange: function ({
detail
}) {
onTabChange: function ({ detail }) {
if (this.data.tabIndex == Number(detail.index)) {
return
}

6
pages/agent/fragment/index.js

@ -111,11 +111,7 @@ Component({
if (this.data.requesting || this.data.finished) {
return
}
if (this.data.loading) {
this.data.requesting = true
} else {
this.setData({ requesting: true })
}
this.setData({ requesting: true })
getFactoryPrice(this.data.form).then(result => {
if (result.data.records.length) {
var respList = result.data.records

6
pages/agent/fragment/index.wxml

@ -9,11 +9,11 @@
</view>
</view>
<view class="bg-white" style="height: 90rpx;">
<wux-tabi scroll="{{scrolled}}" tab-data="{{tabList}}" tab-index="{{tabIndex}}" bind:change="onTabChange"></wux-tabi>
<view class="bg-white" style="height: 90rpx;border-bottom: 1rpx solid #f3f3f3">
<wux-tabi scroll="{{scrolled}}" tab-data="{{tabList}}" disable="{{requesting}}" tab-index="{{tabIndex}}" bind:change="onTabChange"></wux-tabi>
</view>
<refresh-view bind:refresh="onRefreshList" height="{{height}}" triggered="{{requesting}}" scrollTop="{{top}}" bind:scrolltolower="fetchPapersList">
<refresh-view bind:refresh="onRefreshList" height="{{height}}" scrollTop="{{top}}" bind:scrolltolower="fetchPapersList">
<view class="bg-white list-empty" style="height:{{height}}rpx" wx:if="{{!orderList.length}}">
<view class="load-spinner text-gray" style="margin-bottom:24px" wx:if="{{loading}}" />
<image class="img-empty" src="/assets/image/list_empty.png" wx:else></image>

43
pages/moment/theall/index.js

@ -13,35 +13,8 @@ Component({
data: {
tabList: [ '全部', '华中', '华南', '华东', '北部', '西部'],
tabIndex: 0,
navData:[
{
text: '首页'
},
{
text: '健康'
},
{
text: '情感'
},
{
text: '职场'
},
{
text: '育儿'
},
{
text: '纠纷'
},
{
text: '青葱'
},
{
text: '上课'
},
{
text: '下课'
}
],
proviceList: ['全部', '华中', '华南', '华东', '北部', '西部', '全部', '华中', '华南', '华东', '北部', '西部'],
pIndex: 0, //tab标题的滚动条位置
orderList: []
},
methods: {
@ -50,6 +23,18 @@ Component({
setTimeout(() => { this.setData({ tabIndex: 0, firstShow: true }) }, 100)
}
},
onTabChange: function({ detail }){
if (this.data.tabIndex == Number(detail.index)) {
return
}
},
onProviceChange: function(){
if (this.data.pIndex == Number(detail.index)) {
return
}
},
fetchList: function(){
}

4
pages/moment/theall/index.wxml

@ -2,8 +2,8 @@
<view class="bg-white" style="height:90rpx;border-bottom:2rpx solid #f3f3f3" wx:if="{{firstShow}}">
<wux-tabi tab-data="{{tabList}}" tab-index="{{tabIndex}}" line-height="{{3}}" scroll="{{false}}" bind:change="onTabChange"></wux-tabi>
</view>
<view class="bg-white" style="height:90rpx;border-bottom:2rpx solid #f3f3f3" wx:if="{{firstShow}}">
<wux-tabi tab-data="{{tabList}}" tab-index="{{tabIndex}}" typing="{{2}}" scroll="{{true}}" bind:change="onTabChange"></wux-tabi>
<view class="bg-white" style="height:100rpx;border-bottom:2rpx solid #f3f3f3;padding: 6rpx 0rpx;" wx:if="{{firstShow}}">
<wux-tabi tab-data="{{proviceList}}" tab-index="{{pIndex}}" line-type="{{1}}" scroll="{{true}}" bind:change="onProviceChange"></wux-tabi>
</view>
<scroll-view scroll-y style="height: {{height - 190}}rpx;" bind:scrolltolower="fetchList">

Loading…
Cancel
Save