Commit 6a03d2ad authored by lvtz's avatar lvtz

fix

parent 9a225db7
// src/pages/websiteindex/businessinfolist.js
import {
websitehome,
websiteintros,
dataconsumer
} from '../../../service/customer/websiteindex.js';
import {
LocalStorage,
getFlatternDistance
} from '../../../utilities/index.js';
var app = getApp();
Page({
/**
* 页面的初始数据
*/
data: {
statusBarHeight: app.globalData.statusBarHeight,
titleBarHeight: app.globalData.titleBarHeight,
......@@ -21,24 +11,20 @@ Page({
imageVersion: app.globalData.imageVersion,
localImageRoot: '../../../images/',
bannerVideo:'mp4/clock-test/member/12351/2019-06-26/e37c019015a6c48cf58f74695f09ad30',
infoList: [],
infoTatol: '',
perPage: 10,
page: 1,
hasmore: true,
emptyPage: false,
listLoading: false,
schoolInfo:'',
schoolDetail:'',
curtab: 1,
tabbox: [
{tab: 1,title: '学校相册'},
{tab: 2,title: '学校视频'}
]
],
infoList1: [],
infoList2: [],
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
const {
sid
......@@ -49,59 +35,16 @@ Page({
this.getWebsiteIntrosList('init')
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
this.setData({
page: 1,
hasmore: true,
})
this.getWebsiteIntrosList('down')
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
this.getWebsiteIntrosList('up')
},
tabShift (e) {
const { tab } = e.currentTarget.dataset;
if(tab == this.data.curtab){
return
}
this.curtab = tab;
this.setData({
curtab: tab
})
},
getWebsiteIntrosList(type) {
getWebsiteIntrosList() {
if (!this.data.hasmore) {
return;
}
......@@ -113,9 +56,9 @@ Page({
})
websiteintros({
page: this.data.page,
perPage: this.data.perPage,
perPage: 90,
school_id: this.data.sid,
type:1,
type: 1,
}).then((res) => {
const {
code,
......@@ -130,71 +73,9 @@ Page({
} else {
if (data.total) {
this.setData({
infoTatol: data.total
})
}
switch (type) {
case 'init': //页面进来第一次加载
this.setData({
infoList: data.list || []
}, () => {
if (data.total > this.data.infoList.length) {
let page = this.data.page + 1;
this.setData({
page,
})
} else { // 没有更多了
this.setData({
hasmore: false
})
}
})
break;
case 'down': // 页面下拉刷新
this.setData({
infoList: data.list || []
}, () => {
if (this.data.infoTatol > this.data.infoList.length) {
let page = this.data.page + 1;
this.setData({
page,
})
} else { // 没有更多了
this.setData({
hasmore: false
})
}
})
wx.stopPullDownRefresh();
break;
case 'up': // 页面上拉刷新
let list = this.data.infoList;
let _list = list.concat(data.list);
this.setData({
infoList: _list
}, () => {
if (data.total > this.data.infoList.length) {
let page = this.data.page + 1;
this.setData({
page,
})
} else { // 没有更多了
this.setData({
hasmore: false
})
}
})
break;
default:
break;
}
if (this.data.infoList.length == 0) {
this.setData({
emptyPage: true
})
} else {
this.setData({
emptyPage: false,
infoTatol: data.total,
infoList1: data.list.filter(item=>item.type==1),
infoList2: data.list.filter(item=>item.type==2)
})
}
}
......@@ -204,18 +85,22 @@ Page({
})
})
},
tapCard(params) {
let item = params.detail;
tapCard(e) {
const { id } = e.currentTarget.dataset;
wx.navigateTo({
url: `/src/pages/websiteindex/infovideo?sid=${this.data.sid}&id=${item.cardId}`,
url: `/src/pages/websiteindex/infovideo?sid=${this.data.sid}&id=${id}`,
})
dataconsumer({
type: 3,
source_type: 2,
source_id: item.id,
source_id: id,
student_id: app.globalData.currentSchoolStudentId
}).then((res) => {
})
},
goback (){
wx.navigateBack({
delta: 1
})
}
})
\ No newline at end of file
......@@ -11,9 +11,18 @@
</view>
</view>
</view>
<view class="list-box" wx:if="{{curtab==1}}">
<view class="list-item" wx:for="{{infoList}}" wx:key="index">
<view class="list-box" wx:if="{{curtab==1}}" bindtap="tapCard" data-id="{{item.id}}">
<view class="list-item" wx:for="{{infoList1}}" wx:key="index">
<view class="cover-box">
<image class="cover" src="{{filter.imagify(item.content)}}" mode="aspectFill"></image>
</view>
<view class="title-box">
<view class="title">{{item.title}}</view>
</view>
</view>
</view>
<view class="list-box" wx:if="{{curtab==2}}">
<view class="list-item" wx:for="{{infoList2}}" wx:key="index" bindtap="tapCard" data-id="{{item.id}}">
<view class="cover-box">
<image class="cover" src="{{filter.gifvideoPoster(item.content)}}" mode="aspectFill"></image>
</view>
......@@ -22,7 +31,10 @@
</view>
</view>
</view>
<empty-content text="学校相册为空" emptyimg="common/empty/empty_c_sraech.png" wx:if="{{curtab==1 && infoList1.length==0}}"></empty-content>
<empty-content text="学校视频为空" emptyimg="common/empty/empty_c_sraech.png" wx:if="{{curtab==2 && infoList2.length==0}}"></empty-content>
<!-- <view class="info-box">
<view class="title-box">
{{schoolDetail.title}}
......
......@@ -59,7 +59,6 @@ page {
align-items: center;
flex-wrap: wrap;
padding: 0 24rpx;
overflow: hidden;
}
.list-box .list-item {
width: 338rpx;
......@@ -67,6 +66,7 @@ page {
border-radius: 20rpx;
background: #fff;
margin-bottom: 26rpx;
overflow: hidden;
}
.list-box .list-item:nth-child(2n-1) {
margin-right: 26rpx;
......
......@@ -438,6 +438,7 @@ Page({
this.setData({
currentSwiper: e.detail.current
});
console.log(this.data.currentSwiper,'currentSwiper')
},
goBannerVideoPlay() {
wx.navigateTo({
......@@ -967,6 +968,7 @@ Page({
schoolInfo: data ? data : '',
websitehomeEmpty: data && data.banner ? false : true
},()=>{
console.log(this.data.schoolInfo.banner,'banner')
if(that.data.schoolInfo.banner.type=='video'){
wxGetImageInfo({src: videoPoster(that.data.schoolInfo.banner.src[0])}).then((res)=>{
let w=750, initratio, bannerVideoH;
......@@ -1285,7 +1287,7 @@ Page({
school_id: this.data.sid,
type: 1,
page: 1,
perPage: 4
perPage: 99
}).then((res) => {
const {
data,
......
......@@ -26,9 +26,8 @@
<image src="{{filter.imagify(item)}}" class="slide-image" mode="widthFix"/>
</swiper-item>
</swiper>
<view class="banner-numbox" wx:if="{{schoolInfo.banner.type =='img'}}">
<image class="icon-imglabel" src="{{imageRoot}}2c/websiteindex/img_label.png?{{imageVersion}}"></image>
{{currentSwiper+1}}/{{schoolInfo.banner.src.length}}
<view class="banner-numbox" wx:if="{{schoolInfo.banner.type =='img' && schoolInfo.banner.src.length>1}}">
<view class="dot {{currentSwiper==index? 'active': ''}}" wx:for="{{schoolInfo.banner.src}}" wx:key="index"></view>
</view>
</block>
<block wx:else>
......
......@@ -59,24 +59,23 @@ page{
}
.banner-box .banner-numbox{
position: absolute;
bottom: 100rpx;
right: 24rpx;
padding: 0 22rpx;
height: 39rpx;
background:rgba(0,0,0,.7);
border-radius: 20rpx;
font-size: 24rpx;
color: #fff;
bottom: 140rpx;
left: 50%;
transform: translateX(-50%);
display: flex;
align-items: center;
line-height: 1;
}
.banner-box .banner-numbox .icon-imglabel{
width: 27rpx;
height: 24rpx;
.banner-box .banner-numbox .dot{
width: 8rpx;
height: 8rpx;
border-radius: 50%;
background: rgba(255,255,255,.4);
margin-right: 10rpx;
}
.banner-box .banner-numbox .dot.active{
background: #fff;
}
.banner-box .notice-box {
position: absolute;
left: 50%;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment