22 changed files with 300 additions and 182 deletions
@ -0,0 +1,7 @@ |
|||
const request = require('../utils/request') |
|||
/** |
|||
* 获取欢迎页信息 |
|||
*/ |
|||
export function getStartupPage () { |
|||
return request.get('startup/getStartupPage') |
|||
} |
@ -1,109 +1,78 @@ |
|||
// pages/start/start.js
|
|||
Page({ |
|||
const app = getApp() |
|||
import { getStartupPage } from '../../api/index' |
|||
|
|||
/** |
|||
* 页面的初始数据 |
|||
*/ |
|||
Page({ |
|||
data: { |
|||
countDownNum: 5, |
|||
close: false |
|||
deviceHeight: 0, |
|||
countdownNum: 0, |
|||
bgImage: '', |
|||
timer: '', |
|||
scene: '' |
|||
}, |
|||
|
|||
/** |
|||
* 生命周期函数--监听页面加载 |
|||
*/ |
|||
onLoad: function(options) { |
|||
this.settime() |
|||
this.countDown() |
|||
}, |
|||
|
|||
countDown: function() { |
|||
let that = this; |
|||
let countDownNum = that.data.countDownNum; //获取倒计时初始值
|
|||
//如果将定时器设置在外面,那么用户就看不到countDownNum的数值动态变化,所以要把定时器存进data里面
|
|||
that.setData({ |
|||
timer: setInterval(function() { //这里把setInterval赋值给变量名为timer的变量
|
|||
//每隔一秒countDownNum就减一,实现同步
|
|||
countDownNum--; |
|||
//然后把countDownNum存进data,好让用户知道时间在倒计着
|
|||
that.setData({ |
|||
countDownNum: countDownNum |
|||
}) |
|||
//在倒计时还未到0时,这中间可以做其他的事情,按项目需求来
|
|||
if (countDownNum == 0) { |
|||
//这里特别要注意,计时器是始终一直在走的,如果你的时间为0,那么就要关掉定时器!不然相当耗性能
|
|||
//因为timer是存在data里面的,所以在关掉时,也要在data里取出后再关闭
|
|||
clearInterval(that.data.timer); |
|||
//关闭定时器之后,可作其他处理codes go here
|
|||
} |
|||
}, 1000) |
|||
onLoad (options) { |
|||
if (options.scene) { |
|||
this.data.scene = options.scene |
|||
} |
|||
this.setData({ |
|||
deviceHeight: app.globalData.height |
|||
}) |
|||
this.getStartupPage() |
|||
}, |
|||
|
|||
settime: function() { |
|||
let that = this |
|||
setTimeout(function() { |
|||
if (!that.data.close) { |
|||
wx.redirectTo({ |
|||
url: `../indexNew/indexNew` |
|||
// 倒计时进入
|
|||
countDown () { |
|||
this.data.timer = setInterval(() => { |
|||
if (this.data.countdownNum > 1) { |
|||
this.data.countdownNum-- |
|||
this.setData({ |
|||
countdownNum: this.data.countdownNum |
|||
}) |
|||
} else { |
|||
clearInterval(this.data.timer) |
|||
if (this.data.scene) { |
|||
wx.reLaunch({ |
|||
url: `/pages/indexNew/indexNew?scene=${this.data.scene}` |
|||
}) |
|||
} else { |
|||
wx.reLaunch({ |
|||
url: '/pages/indexNew/indexNew' |
|||
}) |
|||
} |
|||
} |
|||
}, 5000) |
|||
}, 1000) |
|||
}, |
|||
bindGetUserInfo: function(e) { |
|||
this.setData({ |
|||
close: true |
|||
// 立即进入
|
|||
immeEnter () { |
|||
clearInterval(this.data.timer) |
|||
if (this.data.scene) { |
|||
wx.reLaunch({ |
|||
url: `/pages/indexNew/indexNew?scene=${this.data.scene}` |
|||
}) |
|||
} else { |
|||
wx.reLaunch({ |
|||
url: '/pages/indexNew/indexNew' |
|||
}) |
|||
} |
|||
}, |
|||
// 获取启动页信息
|
|||
getStartupPage () { |
|||
wx.showLoading({ |
|||
title: '获取中...' |
|||
}) |
|||
wx.redirectTo({ |
|||
url: `../indexNew/indexNew` |
|||
getStartupPage().then(res => { |
|||
wx.hideLoading() |
|||
console.log('获取启动页信息', res) |
|||
if (res.data.imgUrl) { |
|||
this.setData({ |
|||
bgImage: res.data.imgUrl, |
|||
countdownNum: res.data.duration |
|||
}) |
|||
this.countDown() |
|||
} else { |
|||
this.immeEnter() |
|||
} |
|||
}).catch(err => { |
|||
wx.hideLoading() |
|||
this.immeEnter() |
|||
}) |
|||
}, |
|||
/** |
|||
* 生命周期函数--监听页面初次渲染完成 |
|||
*/ |
|||
onReady: function() { |
|||
|
|||
}, |
|||
|
|||
/** |
|||
* 生命周期函数--监听页面显示 |
|||
*/ |
|||
onShow: function() { |
|||
|
|||
}, |
|||
|
|||
/** |
|||
* 生命周期函数--监听页面隐藏 |
|||
*/ |
|||
onHide: function() { |
|||
|
|||
}, |
|||
|
|||
/** |
|||
* 生命周期函数--监听页面卸载 |
|||
*/ |
|||
onUnload: function() { |
|||
|
|||
}, |
|||
|
|||
/** |
|||
* 页面相关事件处理函数--监听用户下拉动作 |
|||
*/ |
|||
onPullDownRefresh: function() { |
|||
|
|||
}, |
|||
|
|||
/** |
|||
* 页面上拉触底事件的处理函数 |
|||
*/ |
|||
onReachBottom: function() { |
|||
|
|||
}, |
|||
|
|||
/** |
|||
* 用户点击右上角分享 |
|||
*/ |
|||
onShareAppMessage: function() { |
|||
|
|||
} |
|||
}) |
@ -1,6 +1,4 @@ |
|||
{ |
|||
"navigationBarTitleText": "e锦水", |
|||
"navigationStyle": "custom", |
|||
"navigationBarTextStyle": "black", |
|||
"usingComponents": {} |
|||
"navigationBarTitleText": "欢迎页", |
|||
"navigationStyle": "custom" |
|||
} |
@ -1,17 +1,16 @@ |
|||
<view class="page"> |
|||
<image class="image-one" src="https://epdc-kongcun.elinkit.com.cn/epdcFile/M00/00/05/rBAB716njY2ADRNbAAX8Nk6dBkI229.png" mode="scaleToFill"></image> |
|||
<view class="logo-style"> |
|||
<image class="image-two" src="https://epdc-kongcun.elinkit.com.cn/epdcFile/M00/00/05/rBAB716njbGAMRwZAAFzEo6DMTQ932.png" mode="scaleToFill"></image> |
|||
<view class="welcome"> |
|||
<view class="bg-img"> |
|||
<image class="bgimg" src="{{bgImage}}"/> |
|||
</view> |
|||
|
|||
<view class="time"> |
|||
<view class="time-info" bindtap="bindGetUserInfo"> |
|||
<view class="left"> |
|||
{{countDownNum}}s |
|||
</view> |
|||
<view class="right"> |
|||
跳过 |
|||
</view> |
|||
<view class="content" style="height: calc(100vh - {{deviceHeight}}px - 100rpx); top: calc({{deviceHeight}}px + 100rpx)"> |
|||
|
|||
<view class="countdown" wx:if="countdownNum > 0"> |
|||
<view bindtap="immeEnter" hover-class="hover-skip" class="time">{{countdownNum}}s | 跳过</view> |
|||
</view> |
|||
|
|||
<!-- <view class="imme-enter"> |
|||
<button hover-class="hover-btn" bindtap="immeEnter">立即进入</button> |
|||
</view> --> |
|||
|
|||
</view> |
|||
</view> |
@ -1,65 +1,81 @@ |
|||
.page { |
|||
page { |
|||
width: 100%; |
|||
height: 100%; |
|||
position: relative; |
|||
top: 0; |
|||
left: 0; |
|||
z-index: 1000; |
|||
height: 100vh; |
|||
} |
|||
|
|||
.image-one { |
|||
position: absolute; |
|||
.welcome { |
|||
width: 100%; |
|||
height: 100%; |
|||
height: 100vh; |
|||
background: #fff; |
|||
position: relative; |
|||
overflow: hidden; |
|||
} |
|||
|
|||
.logo-style { |
|||
.welcome .bg-img { |
|||
width: 100%; |
|||
height: 220rpx; |
|||
margin-top: 455rpx; |
|||
height: 100vh; |
|||
position: absolute; |
|||
display: flex; |
|||
justify-content: center; |
|||
left: 0; |
|||
top: 0; |
|||
} |
|||
|
|||
.logo-style .image-two { |
|||
height: 220rpx; |
|||
width: 500rpx; |
|||
.welcome .bg-img image { |
|||
width: 100%; |
|||
height:100%; |
|||
} |
|||
|
|||
.time { |
|||
margin-top: 170rpx; |
|||
position: absolute; |
|||
width: calc(100% - 28rpx); |
|||
height: 60rpx; |
|||
.welcome .content { |
|||
width: 100%; |
|||
position: relative; |
|||
z-index: 10; |
|||
display: flex; |
|||
flex-direction: row-reverse; |
|||
flex-direction: column; |
|||
justify-content: space-between; |
|||
align-items: center; |
|||
box-sizing: border-box; |
|||
padding-bottom: 100rpx; |
|||
} |
|||
|
|||
.time .time-info { |
|||
width: 150rpx; |
|||
height: 60rpx; |
|||
border-radius: 30rpx; |
|||
background: #fff; |
|||
opacity: 0.6; |
|||
.welcome .content .countdown { |
|||
width: 100%; |
|||
height: 50rpx; |
|||
display: flex; |
|||
align-items: center; |
|||
align-items: flex-start; |
|||
justify-content: flex-end; |
|||
box-sizing: border-box; |
|||
padding: 0 20rpx; |
|||
} |
|||
|
|||
.time .time-info .left { |
|||
width: 50%; |
|||
height: 40rpx; |
|||
line-height: 40rpx; |
|||
font-size: 30rpx; |
|||
.welcome .content .countdown .time { |
|||
font-size: 28rpx; |
|||
color: #333; |
|||
width: 150rpx; |
|||
height: 50rpx; |
|||
line-height: 50rpx; |
|||
text-align: center; |
|||
border-right: 1rpx solid black; |
|||
background: rgba(255,255,255,0.5); |
|||
border-radius: 30rpx; |
|||
} |
|||
.welcome .content .countdown .hover-skip { |
|||
background: rgba(255,255,255,0.2); |
|||
} |
|||
|
|||
.time .time-info .right { |
|||
width: 50%; |
|||
height: 40rpx; |
|||
line-height: 40rpx; |
|||
font-size: 25rpx; |
|||
text-align: center; |
|||
.imme-enter { |
|||
width: 100%; |
|||
height: 84rpx; |
|||
display: flex; |
|||
align-items: center; |
|||
justify-content: center; |
|||
} |
|||
.imme-enter button { |
|||
background-image: linear-gradient(to right , #ff2d29, #ff4e4e); |
|||
height:84rpx; |
|||
line-height: 84rpx; |
|||
text-align:center; |
|||
color: #fff; |
|||
font-size: 36rpx; |
|||
border-radius: 16rpx; |
|||
padding: 0; |
|||
margin: 0; |
|||
outline: 0; |
|||
font-weight: normal; |
|||
width: 560rpx; |
|||
} |
|||
.imme-enter .hover-btn { |
|||
background: red; |
|||
} |
@ -0,0 +1,43 @@ |
|||
const api = require('../../../../utils/api') |
|||
import { getTimestamp } from '../../../../utils/common' |
|||
Page({ |
|||
data: { |
|||
loadMoreType: 'none', |
|||
loadMoreVisible: false, |
|||
newsList: [], |
|||
pageNo: 1, |
|||
pageSize: 10, |
|||
}, |
|||
onLoad () { |
|||
this.getNewsList() |
|||
}, |
|||
onReachBottom () { |
|||
this.setData({ |
|||
loadMoreVisible: true |
|||
}) |
|||
if (this.data.loadMoreType === 'loading') { |
|||
this.data.pageNo += 1 |
|||
this.getNewsList() |
|||
} |
|||
}, |
|||
getNewsList: function() { |
|||
let that = this |
|||
let para = { |
|||
pageIndex: this.data.pageNo, |
|||
pageSize: this.data.pageSize, |
|||
timestamp: getTimestamp() |
|||
} |
|||
api.newsList(para).then(function(res) { |
|||
that.setData({ |
|||
first: false, |
|||
newsList: that.data.newsList.concat(res.data), |
|||
loadMoreType: res.data.length === that.data.pageSize ? 'loading' : 'none', |
|||
}) |
|||
}).catch(() => { |
|||
that.setData({ |
|||
loadMoreType: 'none', |
|||
newsList: [] |
|||
}) |
|||
}) |
|||
}, |
|||
}) |
@ -0,0 +1,6 @@ |
|||
{ |
|||
"navigationBarTitleText": "新闻列表", |
|||
"usingComponents": { |
|||
"load-more": "../../../../components/loadMore/loadMore" |
|||
} |
|||
} |
@ -0,0 +1,16 @@ |
|||
<view class="list-all"> |
|||
<view class="list-item" wx:for-index="index" wx:for-item="item" wx:key="index" wx:for="{{newsList}}" data-id="{{item.id}}" bindtap="toDetail"> |
|||
<view class="item-info"> |
|||
<view class="item-info-name">{{item.newsTitle}} |
|||
</view> |
|||
<view class="item-info-time"> |
|||
<text>{{item.deptName}}-{{item.newsCategoryName}}</text> |
|||
<text>{{filter.formatTime(item.newsStartTime, 'yyyy-MM-dd')}}</text> |
|||
</view> |
|||
</view> |
|||
<image src="{{item.newsImageUrl}}"></image> |
|||
</view> |
|||
</view> |
|||
|
|||
<load-more loadMoreType="{{loadMoreType}}" loadMoreVisible="{{loadMoreVisible}}"></load-more> |
|||
|
@ -0,0 +1,64 @@ |
|||
page { |
|||
width: 100%; |
|||
height: auto; |
|||
background: #fff; |
|||
min-height: 100vh; |
|||
overflow-y: auto; |
|||
} |
|||
/* 列表样式 */ |
|||
.list-all { |
|||
width: calc(100% - 48rpx); |
|||
margin-left: 21rpx; |
|||
} |
|||
|
|||
.list-all .list-item { |
|||
border-bottom: 1rpx solid #eaeaea; |
|||
padding: 41rpx 18rpx 31rpx 15rpx; |
|||
display: flex; |
|||
align-items: center; |
|||
} |
|||
|
|||
.list-all .list-item:last-child { |
|||
border: none; |
|||
} |
|||
|
|||
.list-all .list-item .item-info { |
|||
width: calc(100% - 220rpx); |
|||
height: 146rpx; |
|||
position: relative; |
|||
} |
|||
|
|||
.list-all .list-item .item-info .item-info-name { |
|||
width: calc(100% - 47rpx); |
|||
font-size: 32rpx; |
|||
font-weight: 500; |
|||
color: rgba(63, 63, 63, 1); |
|||
line-height: 50rpx; |
|||
display: -webkit-box; |
|||
-webkit-box-orient: vertical; |
|||
-webkit-line-clamp: 2; |
|||
overflow: hidden; |
|||
} |
|||
|
|||
.list-all .list-item .item-info .item-info-time { |
|||
width: calc(100% - 23rpx); |
|||
height: 22rpx; |
|||
position: absolute; |
|||
bottom: 5rpx; |
|||
display: flex; |
|||
flex-direction: row; |
|||
justify-content: space-between; |
|||
} |
|||
|
|||
.list-all .list-item .item-info .item-info-time text { |
|||
font-size: 22rpx; |
|||
font-weight: 500; |
|||
color: rgba(170, 170, 170, 1); |
|||
line-height: 22rpx; |
|||
} |
|||
|
|||
.list-all .list-item image { |
|||
width: 220rpx; |
|||
height: 146rpx; |
|||
border-radius: 10rpx; |
|||
} |
Loading…
Reference in new issue