Browse Source

no message

featrue/v4.5
xpz2018 4 years ago
parent
commit
7d9ac63125
2 changed files with 19 additions and 10 deletions
  1. 14
      pages/moment/fragment/index.js
  2. 15
      pages/moment/fragment/index.wxml

14
pages/moment/fragment/index.js

@ -4,6 +4,7 @@ const event = require('../../../utils/event')
const util = require('../../../utils/util') const util = require('../../../utils/util')
const math = require('../../../utils/math') const math = require('../../../utils/math')
const app = getApp() const app = getApp()
const list = [ '推荐', '关注', '全部' , '行情']
var params = {byQueryType: 2, pageNum: 1} var params = {byQueryType: 2, pageNum: 1}
Component({ Component({
@ -27,6 +28,7 @@ Component({
noticeList: [], noticeList: [],
tabList: [ '推荐', '关注', '全部' , '行情'], tabList: [ '推荐', '关注', '全部' , '行情'],
tabIndex: 0, tabIndex: 0,
mHeight: 0,
}, },
lifetimes: { lifetimes: {
attached: function () { attached: function () {
@ -39,7 +41,9 @@ Component({
methods: { methods: {
onRestart: function () { onRestart: function () {
if(!this.data.firstShow){ if(!this.data.firstShow){
setTimeout(() => { this.setData({ tabIndex: this.data.tabIndex, tabList: [ '推荐', '关注', '全部' , '行情'] }) }, 100)
setTimeout(() => {
this.setData({ tabIndex: this.data.tabIndex, tabList: list, mHeight: this.data.height - 87 - this.data.customHeight })
}, 100)
params.date = util.formatDate(new Date(), 'Y-M-D') params.date = util.formatDate(new Date(), 'Y-M-D')
} }
this.data.firstShow = true this.data.firstShow = true
@ -112,9 +116,15 @@ Component({
for (let index = 0; index < result.data.records.length; index++) { for (let index = 0; index < result.data.records.length; index++) {
this.handResult(result.data.records[index]) this.handResult(result.data.records[index])
} }
this.setData({noticeList: this.data.noticeList})
if(this.data.noticeList.length > 0){
this.data.mHeight = this.data.height - 167 - this.data.customHeight
} else {
this.data.mHeight = this.data.height - 87 - this.data.customHeight
}
this.setData({noticeList: this.data.noticeList, mHeight: this.data.mHeight})
} }
}).catch(err => { }).catch(err => {
this.setData({noticeList: this.data.noticeList, mHeight: this.data.height - 87 - this.data.customHeight})
this.data.loopRequesting = false this.data.loopRequesting = false
}) })
}, },

15
pages/moment/fragment/index.wxml

@ -1,4 +1,3 @@
<!--pages/message/index.wxml-->
<wxs module="formate" src="../../../pages/formate.wxs"></wxs> <wxs module="formate" src="../../../pages/formate.wxs"></wxs>
<view class="cu-custom top-bg" style="height:{{customHeight}}rpx;z-index: 99;"> <view class="cu-custom top-bg" style="height:{{customHeight}}rpx;z-index: 99;">
<view class="cu-bar fixed " style="height:{{customHeight}}rpx;padding-top:{{StatusBar}}rpx;border-bottom:none;padding-right: 0px;width: {{customWidth}}px"> <view class="cu-bar fixed " style="height:{{customHeight}}rpx;padding-top:{{StatusBar}}rpx;border-bottom:none;padding-right: 0px;width: {{customWidth}}px">
@ -16,8 +15,8 @@
</view> </view>
</view> </view>
<view class="bg-white flex flex-center" style="height:80rpx;padding:16rpx 24rpx;background-color: #FFFBE8">
<image src="/assets/image/icon-notice.png" style="height: 24rpx;width: 32rpx;" wx:if="{{noticeList.length}}"></image>
<view class="bg-white flex flex-center" style="height:80rpx;padding:16rpx 24rpx;background-color: #FFFBE8" wx:if="{{noticeList.length}}">
<image src="/assets/image/icon-notice.png" style="height: 24rpx;width: 32rpx;"></image>
<swiper vertical="{{true}}" autoplay="{{true}}" circular="{{true}}" interval="3000" class="tui-swiper"> <swiper vertical="{{true}}" autoplay="{{true}}" circular="{{true}}" interval="3000" class="tui-swiper">
<swiper-item wx:for="{{noticeList}}" wx:key="index" class="flex flex-center" catchtouchmove="stopTouchMove" style="justify-content: flex-start"> <swiper-item wx:for="{{noticeList}}" wx:key="index" class="flex flex-center" catchtouchmove="stopTouchMove" style="justify-content: flex-start">
<view class="flex flex-justify" style="width: 100%;height: 100%;" data-index="{{index}}" bindtap="toNotice"> <view class="flex flex-justify" style="width: 100%;height: 100%;" data-index="{{index}}" bindtap="toNotice">
@ -31,18 +30,18 @@
<wux-tabi tab-data="{{tabList}}" tab-index="{{tabIndex}}" line-height="{{4}}" scroll="{{false}}" bind:change="onTabChange"></wux-tabi> <wux-tabi tab-data="{{tabList}}" tab-index="{{tabIndex}}" line-height="{{4}}" scroll="{{false}}" bind:change="onTabChange"></wux-tabi>
</view> </view>
<swiper current="{{tabIndex}}" duration="0" style="height:{{height - 167 - customHeight}}rpx">
<swiper current="{{tabIndex}}" duration="0" style="height:{{mHeight}}rpx">
<swiper-item catchtouchmove="stopTouchMove"> <swiper-item catchtouchmove="stopTouchMove">
<recommend id="recommend" height="{{height - 167 - customHeight}}"/>
<recommend id="recommend" height="{{mHeight}}"/>
</swiper-item> </swiper-item>
<swiper-item catchtouchmove="stopTouchMove"> <swiper-item catchtouchmove="stopTouchMove">
<attention id="attention" height="{{height - 167 - customHeight}}"/>
<attention id="attention" height="{{mHeight}}"/>
</swiper-item> </swiper-item>
<swiper-item catchtouchmove="stopTouchMove"> <swiper-item catchtouchmove="stopTouchMove">
<theall id="theall" height="{{height - 167 - customHeight}}"/>
<theall id="theall" height="{{mHeight}}"/>
</swiper-item> </swiper-item>
<swiper-item catchtouchmove="stopTouchMove"> <swiper-item catchtouchmove="stopTouchMove">
<information id="information" height="{{height - 167 - customHeight}}"/>
<information id="information" height="{{mHeight}}"/>
</swiper-item> </swiper-item>
</swiper> </swiper>

Loading…
Cancel
Save