[水感应客户端最新]
This commit is contained in:
140
pages/health/article/article.js
Normal file
140
pages/health/article/article.js
Normal file
@@ -0,0 +1,140 @@
|
||||
/*
|
||||
* 手太欠
|
||||
* 愿这世界都如故事里一样 美好而动人~
|
||||
*/
|
||||
Page({
|
||||
|
||||
/**
|
||||
* 页面的初始数据
|
||||
*/
|
||||
data: {
|
||||
articleId : '', //文章id
|
||||
indexShow : '', //内容
|
||||
mallContent : '', //简介
|
||||
favoritesSee : '', //收藏状态
|
||||
favoritesNumber : '', //收藏数量
|
||||
subscribesSee : '', //点赞状态
|
||||
subscribesNumber: '', //点赞数量
|
||||
isFixedTop : 0,
|
||||
barHeight : getApp().globalData.barHeight, // 状态栏高度
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
onLoad(options) {
|
||||
this.setData({
|
||||
articleId : options.id
|
||||
})
|
||||
|
||||
if(options.invite != undefined) {
|
||||
getApp().globalData.inviteText = options.invite
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面显示
|
||||
*/
|
||||
onShow() {
|
||||
// 获取详情数据
|
||||
this.indexInfo();
|
||||
},
|
||||
|
||||
/**
|
||||
* 详情数据
|
||||
*/
|
||||
indexInfo () {
|
||||
wx.$api.health.healthSee(this.data.articleId).then(res => {
|
||||
this.setData({
|
||||
indexShow : res.data,
|
||||
favoritesSee : res.data.isFavorite,
|
||||
subscribesSee : res.data.isSubscribed,
|
||||
favoritesNumber : res.data.favorites,
|
||||
subscribesNumber: res.data.subscribes,
|
||||
mallContent : res.data.content.replace(/\<img/gi, '<img style="max-width:100%;height:auto;display:block;"')
|
||||
})
|
||||
|
||||
}).catch(err => {})
|
||||
},
|
||||
|
||||
// 操作按钮
|
||||
toolTap(e) {
|
||||
let newName = e.currentTarget.dataset.name
|
||||
if(wx.getStorageSync("token") != ''){
|
||||
// 收藏
|
||||
if(newName == 'favorites') {
|
||||
wx.$api.health.favorite(this.data.articleId).then(res => {
|
||||
this.setData({
|
||||
favoritesSee : res.data.favorite,
|
||||
favoritesNumber: res.data.count
|
||||
})
|
||||
wx.showToast({
|
||||
title:'操作成功',
|
||||
icon:'none'
|
||||
})
|
||||
}).catch(err => {})
|
||||
return
|
||||
}
|
||||
|
||||
// 点赞
|
||||
wx.$api.health.subscribe(this.data.articleId).then(res => {
|
||||
this.setData({
|
||||
subscribesSee : res.data.subscribed,
|
||||
subscribesNumber: res.data.count
|
||||
})
|
||||
wx.showToast({
|
||||
title:'操作成功',
|
||||
icon:'none'
|
||||
})
|
||||
}).catch(err => {})
|
||||
}else{
|
||||
// 去登录
|
||||
wx.navigateTo({
|
||||
url: "/pages/login/index"
|
||||
})
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* 微信分享
|
||||
*/
|
||||
onShareAppMessage(){
|
||||
return {
|
||||
title : this.data.indexShow.title,
|
||||
imageUrl: this.data.indexShow.cover,
|
||||
path : "/pages/health/article/article?id=" + this.data.articleId + '&invite=' + wx.getStorageSync("invite")
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* 返回上一页
|
||||
*/
|
||||
returnGo() {
|
||||
wx.navigateBack({
|
||||
delta: 1,
|
||||
fail: () => {
|
||||
wx.switchTab({
|
||||
url: '/pages/index/index?invite=' + getApp().globalData.inviteText
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
/**
|
||||
* 回到首页
|
||||
*/
|
||||
returnHome() {
|
||||
wx.switchTab({
|
||||
url: '/pages/index/index?invite=' + getApp().globalData.inviteText
|
||||
})
|
||||
},
|
||||
|
||||
/**
|
||||
* 监听页面滑动事件
|
||||
*/
|
||||
onPageScroll(e) {
|
||||
this.setData({
|
||||
isFixedTop: parseInt(e.scrollTop)
|
||||
});
|
||||
},
|
||||
})
|
||||
5
pages/health/article/article.json
Normal file
5
pages/health/article/article.json
Normal file
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"usingComponents": {},
|
||||
"navigationStyle": "custom",
|
||||
"navigationBarTextStyle": "white"
|
||||
}
|
||||
40
pages/health/article/article.wxml
Normal file
40
pages/health/article/article.wxml
Normal file
@@ -0,0 +1,40 @@
|
||||
<view class="navigation {{isFixedTop > 0 ? 'active' : ''}}" style="padding-top:{{barHeight}}px;">
|
||||
<image bindtap="returnGo" class="navigation-arrow" src="{{isFixedTop > 0 ? '/static/icons/returnBlack.png' : '/static/icons/returnWrite.png'}}"></image>
|
||||
<image bindtap="returnHome" class="navigation-arrow" src="{{isFixedTop > 0 ? '/static/icons/homeBlack.png' : '/static/icons/homeWrite.png'}}"></image>
|
||||
</view>
|
||||
|
||||
<image class="articleImg" src="{{indexShow.cover}}" mode="widthFix"></image>
|
||||
<view class="articleCont">
|
||||
<view class="articleTop">
|
||||
<view class="articleName">
|
||||
<text>水感应 </text> | {{indexShow.title}}
|
||||
</view>
|
||||
<view class="articleTool">
|
||||
<text>{{indexShow.created_at}}</text>
|
||||
<text>浏览 {{indexShow.clicks}}</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="articleBanner">
|
||||
<image mode="widthFix" src="https://cdn.shuiganying.com/images/2023/05/19/e9b3e2f8c8ae59c4f4a469168d7fb43a.png"></image>
|
||||
</view>
|
||||
<view class="articleText">
|
||||
<rich-text nodes="{{mallContent}}"></rich-text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="tool">
|
||||
<view class="toolCont">
|
||||
<button class="toolCont-label" open-type="share" hover-class="none">
|
||||
<image class="toolCont-label-icon" src="https://cdn.shuiganying.com/images/2023/04/04/a56120fd3f3f4e8dc4be838ade54823f.png"></image>
|
||||
<text>转发</text>
|
||||
</button>
|
||||
<view class="toolCont-label" bindtap="toolTap" data-name="favorites">
|
||||
<image class="toolCont-label-icon" src="{{!favoritesSee ? 'https://cdn.shuiganying.com/images/2023/04/04/5923b8260fe53c9416f8689e2cfb3e97.png' : 'https://cdn.shuiganying.com/images/2023/04/04/1d4d36912f8c09c9d29596f210480ee7.png'}}"></image>
|
||||
<text>{{favoritesNumber}}</text>
|
||||
</view>
|
||||
<view class="toolCont-label" bindtap="toolTap" data-name="subscribes">
|
||||
<image class="toolCont-label-icon" src="{{!subscribesSee ? 'https://cdn.shuiganying.com/images/2023/04/04/e131a69d6ecb5d2e968b104e6ac27b06.png' : 'https://cdn.shuiganying.com/images/2023/04/04/606a29d9956e6caafeda3ed5ed1179d4.png'}}"></image>
|
||||
<text>{{subscribesNumber}}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
102
pages/health/article/article.wxss
Normal file
102
pages/health/article/article.wxss
Normal file
@@ -0,0 +1,102 @@
|
||||
page {
|
||||
background-color: #ffffff;
|
||||
}
|
||||
|
||||
.articleImg {
|
||||
width: 100%;
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
.articleCont {
|
||||
padding: 30rpx;
|
||||
box-sizing: border-box;
|
||||
border-bottom: 160rpx transparent solid;
|
||||
}
|
||||
|
||||
.articleName {
|
||||
font-size: 36rpx;
|
||||
margin-top: 20rpx;
|
||||
}
|
||||
|
||||
.articleName text {
|
||||
text-transform: uppercase;
|
||||
}
|
||||
|
||||
.articleTool {
|
||||
color: #666666;
|
||||
font-size: 26rpx;
|
||||
margin-top: 15rpx;
|
||||
}
|
||||
|
||||
.articleTool text {
|
||||
padding-right: 30rpx;
|
||||
font-weight: 200;
|
||||
}
|
||||
|
||||
.articleBanner {
|
||||
text-align: center;
|
||||
margin: 60rpx 0;
|
||||
}
|
||||
|
||||
.articleBanner image {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.tool {
|
||||
position: fixed;
|
||||
width: 100%;
|
||||
height: 90rpx;
|
||||
line-height: 90rpx;
|
||||
left: 0;
|
||||
bottom: 60rpx;
|
||||
z-index: 99;
|
||||
padding: 0 30rpx;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.toolCont {
|
||||
background-color: #ffffff;
|
||||
display: flex;
|
||||
box-shadow: 0 0 10rpx rgba(0, 0, 0, .1);
|
||||
border-radius: 80rpx;
|
||||
}
|
||||
|
||||
.toolCont-label {
|
||||
flex: 3;
|
||||
text-align: center;
|
||||
color: #999;
|
||||
font-size: 30rpx;
|
||||
background-color: transparent;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
line-height: 100rpx;
|
||||
font-weight: 200;
|
||||
}
|
||||
|
||||
.toolCont-label-icon {
|
||||
width: 36rpx;
|
||||
height: 36rpx;
|
||||
margin-right: 10rpx;
|
||||
vertical-align: -4rpx;
|
||||
}
|
||||
|
||||
.navigation{
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
z-index: 99;
|
||||
width: 100%;
|
||||
height: 90rpx;
|
||||
background-color: transparent;
|
||||
transition: .2s;
|
||||
}
|
||||
|
||||
.navigation.active {
|
||||
background-color: transparent;
|
||||
}
|
||||
|
||||
.navigation-arrow {
|
||||
width: 44rpx;
|
||||
height: 44rpx;
|
||||
margin: 20rpx 15rpx 0 20rpx;
|
||||
}
|
||||
71
pages/health/collect/collect.js
Normal file
71
pages/health/collect/collect.js
Normal file
@@ -0,0 +1,71 @@
|
||||
/*
|
||||
* 手太欠
|
||||
* 愿这世界都如故事里一样 美好而动人~
|
||||
*/
|
||||
Page({
|
||||
|
||||
/**
|
||||
* 页面的初始数据
|
||||
*/
|
||||
data: {
|
||||
categories : [], // 分类
|
||||
articlesArr : [], // 列表
|
||||
page : {}, // 分页信息
|
||||
lodingStats : false, // 加载状态
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
onLoad(options) {
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面显示
|
||||
*/
|
||||
onShow() {
|
||||
// 获取列表
|
||||
this.articlesInfo();
|
||||
},
|
||||
|
||||
// 列表
|
||||
articlesInfo(page){
|
||||
wx.$api.health.myFavorite({
|
||||
page : page || 1
|
||||
}).then(res => {
|
||||
let listArr = this.data.articlesArr,
|
||||
newData = []
|
||||
if(page == 1 || page == undefined) listArr = []
|
||||
newData = listArr.concat(res.data.favorites.data)
|
||||
this.setData({
|
||||
articlesArr : newData,
|
||||
page : res.data.favorites.page,
|
||||
lodingStats : false
|
||||
})
|
||||
wx.stopPullDownRefresh()
|
||||
}).catch(err => {})
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面相关事件处理函数--监听用户下拉动作
|
||||
*/
|
||||
onPullDownRefresh() {
|
||||
// 获取列表
|
||||
this.articlesInfo();
|
||||
},
|
||||
|
||||
/**
|
||||
* 上拉加载
|
||||
*/
|
||||
onReachBottom(){
|
||||
this.setData({
|
||||
lodingStats: true
|
||||
})
|
||||
let pageNumber = this.data.page.current
|
||||
if(this.data.page.has_more){
|
||||
pageNumber++
|
||||
// 获取列表
|
||||
this.articlesInfo(pageNumber);
|
||||
}
|
||||
}
|
||||
})
|
||||
4
pages/health/collect/collect.json
Normal file
4
pages/health/collect/collect.json
Normal file
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"usingComponents": {},
|
||||
"navigationBarTitleText": "我的收藏"
|
||||
}
|
||||
24
pages/health/collect/collect.wxml
Normal file
24
pages/health/collect/collect.wxml
Normal file
@@ -0,0 +1,24 @@
|
||||
<!-- 健康知识 -->
|
||||
<view class="article">
|
||||
<view class="wiki" wx:if="{{articlesArr.length > 0}}">
|
||||
<navigator hover-class="none" url="../article/article?id={{item.favoriteable.article_id}}" class="wiki-label" wx:for="{{articlesArr}}" wx:key="listsArr">
|
||||
<image class="wiki-label-img" mode="aspectFill" src="{{item.favoriteable.cover}}"></image>
|
||||
<view class="wiki-label-cont">
|
||||
<view class="nowrap wiki-label-name"><text>水感应</text> | {{item.favoriteable.title}}</view>
|
||||
<view class="nowrap-multi wiki-label-text">{{item.favoriteable.description}}</view>
|
||||
</view>
|
||||
</navigator>
|
||||
<view class="pagesLoding" wx:if="{{lodingStats}}">
|
||||
<block wx:if="{{page.has_more}}">
|
||||
<image class="pagesLoding-icon" src="/static/icons/refresh_loding.gif" mode="widthFix"></image>加载中...
|
||||
</block>
|
||||
<block wx:else>
|
||||
没有更多了~
|
||||
</block>
|
||||
</view>
|
||||
</view>
|
||||
<view class="pack-center pages-hint" wx:else>
|
||||
<image src="/static/imgs/text_null.png"></image>
|
||||
<view>暂无数据</view>
|
||||
</view>
|
||||
</view>
|
||||
62
pages/health/collect/collect.wxss
Normal file
62
pages/health/collect/collect.wxss
Normal file
@@ -0,0 +1,62 @@
|
||||
page {
|
||||
padding: 0 30rpx;
|
||||
box-sizing: border-box;
|
||||
background-color: #f6f6f6;
|
||||
}
|
||||
|
||||
/* 健康知识 */
|
||||
.article {
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.wiki {
|
||||
margin-top: 60rpx;
|
||||
}
|
||||
|
||||
.wiki-label {
|
||||
background-color: #fff;
|
||||
margin-bottom: 70rpx;
|
||||
position: relative;
|
||||
height: 200rpx;
|
||||
box-shadow: 0 4rpx 30rpx 2rpx rgba(0, 0, 0, .05);
|
||||
border-radius: 10rpx;
|
||||
}
|
||||
|
||||
.wiki-label:last-child {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
.wiki-label-img {
|
||||
width: 200rpx;
|
||||
height: 200rpx;
|
||||
position: absolute;
|
||||
top: -30rpx;
|
||||
left: 30rpx;
|
||||
border-radius: 10rpx;
|
||||
}
|
||||
|
||||
.wiki-label-cont {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 0;
|
||||
width: 100%;
|
||||
padding: 30rpx 25rpx 0 270rpx;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.wiki-label-name {
|
||||
font-size: 32rpx;
|
||||
color: #3b7cff;
|
||||
}
|
||||
|
||||
.wiki-label-name text {
|
||||
text-transform: uppercase;
|
||||
}
|
||||
|
||||
.wiki-label-text {
|
||||
color: #999999;
|
||||
font-size: 28rpx;
|
||||
margin-top: 20rpx;
|
||||
line-height: 40rpx;
|
||||
font-weight: 200;
|
||||
}
|
||||
87
pages/health/index.js
Normal file
87
pages/health/index.js
Normal file
@@ -0,0 +1,87 @@
|
||||
/*
|
||||
* 手太欠
|
||||
* 愿这世界都如故事里一样 美好而动人~
|
||||
*/
|
||||
Page({
|
||||
data: {
|
||||
categoriesArr : [], // 健康分类
|
||||
categoryId : '', // 分类id
|
||||
listsArr : [], // 列表
|
||||
page : {}, // 分页信息
|
||||
lodingStats : false,// 加载状态
|
||||
},
|
||||
|
||||
onLoad(options) {
|
||||
// 获取健康分类
|
||||
this.categoriesInfo();
|
||||
},
|
||||
|
||||
/**
|
||||
* 健康分类
|
||||
*/
|
||||
categoriesInfo() {
|
||||
wx.$api.health.healthNav().then(res => {
|
||||
this.setData({
|
||||
categoriesArr : res.data,
|
||||
categoryId : res.data[0].category_id
|
||||
})
|
||||
// 获取健康列表
|
||||
this.healthInfo();
|
||||
}).catch(err => {})
|
||||
},
|
||||
|
||||
/**
|
||||
* 分类选择
|
||||
*/
|
||||
tabsTap(e) {
|
||||
this.setData({
|
||||
categoryId: e.currentTarget.dataset.id
|
||||
})
|
||||
// 获取健康分类
|
||||
this.healthInfo();
|
||||
},
|
||||
|
||||
/**
|
||||
* 健康列表
|
||||
*/
|
||||
healthInfo(page) {
|
||||
wx.$api.health.healthList({
|
||||
category_id: this.data.categoryId,
|
||||
page : page || 1
|
||||
}).then(res => {
|
||||
let listArr = this.data.listsArr,
|
||||
newData = []
|
||||
if(page == 1 || page == undefined) listArr = []
|
||||
newData = listArr.concat(res.data.data)
|
||||
this.setData({
|
||||
listsArr : newData,
|
||||
page : res.data.page,
|
||||
lodingStats : false
|
||||
})
|
||||
wx.stopPullDownRefresh()
|
||||
}).catch(err => {})
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面相关事件处理函数--监听用户下拉动作
|
||||
*/
|
||||
onPullDownRefresh() {
|
||||
// 获取健康列表
|
||||
this.healthInfo();
|
||||
},
|
||||
|
||||
/**
|
||||
* 上拉加载
|
||||
*/
|
||||
onReachBottom(){
|
||||
this.setData({
|
||||
lodingStats: true
|
||||
})
|
||||
let pageNumber = this.data.page.current
|
||||
if(this.data.page.has_more){
|
||||
pageNumber++
|
||||
// 获取健康列表
|
||||
this.healthInfo(pageNumber);
|
||||
}
|
||||
}
|
||||
})
|
||||
4
pages/health/index.json
Normal file
4
pages/health/index.json
Normal file
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"usingComponents": {},
|
||||
"navigationBarTitleText": "健康知识"
|
||||
}
|
||||
33
pages/health/index.wxml
Normal file
33
pages/health/index.wxml
Normal file
@@ -0,0 +1,33 @@
|
||||
<!-- tabs -->
|
||||
<view class="tabs">
|
||||
<scroll-view class="tabs-scroll" scroll-x="true" scroll-with-animation>
|
||||
<block wx:for="{{categoriesArr}}" wx:key="categoriesData">
|
||||
<view class="tabs-scroll-name {{categoryId == item.category_id ? 'active' : ''}}" data-id="{{item.category_id}}" bindtap="tabsTap">{{item.title}}</view>
|
||||
</block>
|
||||
</scroll-view>
|
||||
</view>
|
||||
|
||||
<!-- 健康知识 -->
|
||||
<view class="article">
|
||||
<view class="wiki" wx:if="{{listsArr.length > 0}}">
|
||||
<navigator hover-class="none" url="./article/article?id={{item.article_id}}" class="wiki-label" wx:for="{{listsArr}}" wx:key="listsArr">
|
||||
<image class="wiki-label-img" mode="aspectFill" src="{{item.cover}}"></image>
|
||||
<view class="wiki-label-cont">
|
||||
<view class="nowrap wiki-label-name"><text>水感应</text> | {{item.title}}</view>
|
||||
<view class="nowrap-multi wiki-label-text">{{item.description}}</view>
|
||||
</view>
|
||||
</navigator>
|
||||
<view class="pagesLoding" wx:if="{{lodingStats}}">
|
||||
<block wx:if="{{page.has_more}}">
|
||||
<image class="pagesLoding-icon" src="/static/icons/refresh_loding.gif" mode="widthFix"></image>加载中...
|
||||
</block>
|
||||
<block wx:else>
|
||||
没有更多了~
|
||||
</block>
|
||||
</view>
|
||||
</view>
|
||||
<view class="pack-center pages-hint" wx:else>
|
||||
<image src="/static/imgs/text_null.png"></image>
|
||||
<view>暂无数据</view>
|
||||
</view>
|
||||
</view>
|
||||
101
pages/health/index.wxss
Normal file
101
pages/health/index.wxss
Normal file
@@ -0,0 +1,101 @@
|
||||
page {
|
||||
background-color: #fafafa;
|
||||
}
|
||||
|
||||
/* 分类 */
|
||||
.tabs {
|
||||
box-shadow: 0 4rpx 10rpx rgba(0, 0, 0, .05);
|
||||
background-color: #fff;
|
||||
}
|
||||
|
||||
.tabs-scroll {
|
||||
line-height: 88rpx;
|
||||
height: 110rpx;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.tabs-scroll-name {
|
||||
display: inline-block;
|
||||
padding: 0 32rpx;
|
||||
font-size: 30rpx;
|
||||
position: relative;
|
||||
color: rgb(85, 85, 85);
|
||||
}
|
||||
|
||||
.tabs-scroll-name::after {
|
||||
content: '';
|
||||
position: absolute;
|
||||
background-color: transparent;
|
||||
left: 32%;
|
||||
bottom: 0rpx;
|
||||
width: 36%;
|
||||
height: 8rpx;
|
||||
border-radius: 60rpx;
|
||||
}
|
||||
|
||||
.tabs-scroll-name.active {
|
||||
color: #3b7cff;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.tabs-scroll-name.active::after {
|
||||
background-color: #3b7cff;
|
||||
}
|
||||
|
||||
/* 健康知识 */
|
||||
.article {
|
||||
padding: 10rpx 30rpx;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.wiki {
|
||||
margin-top: 60rpx;
|
||||
}
|
||||
|
||||
.wiki-label {
|
||||
background-color: #fff;
|
||||
margin-bottom: 70rpx;
|
||||
position: relative;
|
||||
height: 200rpx;
|
||||
box-shadow: 0 4rpx 30rpx 2rpx rgba(0, 0, 0, .05);
|
||||
border-radius: 10rpx;
|
||||
}
|
||||
|
||||
.wiki-label:last-child {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
.wiki-label-img {
|
||||
width: 200rpx;
|
||||
height: 200rpx;
|
||||
position: absolute;
|
||||
top: -30rpx;
|
||||
left: 30rpx;
|
||||
border-radius: 10rpx;
|
||||
}
|
||||
|
||||
.wiki-label-cont {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 0;
|
||||
width: 100%;
|
||||
padding: 30rpx 25rpx 0 270rpx;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.wiki-label-name {
|
||||
font-size: 32rpx;
|
||||
color: #3b7cff;
|
||||
}
|
||||
|
||||
.wiki-label-name text {
|
||||
text-transform: uppercase;
|
||||
}
|
||||
|
||||
.wiki-label-text {
|
||||
color: #999999;
|
||||
font-size: 28rpx;
|
||||
margin-top: 20rpx;
|
||||
line-height: 40rpx;
|
||||
font-weight: 200;
|
||||
}
|
||||
71
pages/health/praise/praise.js
Normal file
71
pages/health/praise/praise.js
Normal file
@@ -0,0 +1,71 @@
|
||||
/*
|
||||
* 手太欠
|
||||
* 愿这世界都如故事里一样 美好而动人~
|
||||
*/
|
||||
Page({
|
||||
|
||||
/**
|
||||
* 页面的初始数据
|
||||
*/
|
||||
data: {
|
||||
categories : [], // 分类
|
||||
articlesArr : [], // 列表
|
||||
page : {}, // 分页信息
|
||||
lodingStats : false, // 加载状态
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
onLoad(options) {
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面显示
|
||||
*/
|
||||
onShow() {
|
||||
// 获取列表
|
||||
this.articlesInfo();
|
||||
},
|
||||
|
||||
// 列表
|
||||
articlesInfo(page){
|
||||
wx.$api.health.mySubscribe({
|
||||
page : page || 1
|
||||
}).then(res => {
|
||||
let listArr = this.data.articlesArr,
|
||||
newData = []
|
||||
if(page == 1 || page == undefined) listArr = []
|
||||
newData = listArr.concat(res.data.subscriptions.data)
|
||||
this.setData({
|
||||
articlesArr : newData,
|
||||
page : res.data.subscriptions.page,
|
||||
lodingStats : false
|
||||
})
|
||||
wx.stopPullDownRefresh()
|
||||
}).catch(err => {})
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面相关事件处理函数--监听用户下拉动作
|
||||
*/
|
||||
onPullDownRefresh() {
|
||||
// 获取列表
|
||||
this.articlesInfo();
|
||||
},
|
||||
|
||||
/**
|
||||
* 上拉加载
|
||||
*/
|
||||
onReachBottom(){
|
||||
this.setData({
|
||||
lodingStats: true
|
||||
})
|
||||
let pageNumber = this.data.page.current
|
||||
if(this.data.page.has_more){
|
||||
pageNumber++
|
||||
// 获取列表
|
||||
this.articlesInfo(pageNumber);
|
||||
}
|
||||
}
|
||||
})
|
||||
4
pages/health/praise/praise.json
Normal file
4
pages/health/praise/praise.json
Normal file
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"usingComponents": {},
|
||||
"navigationBarTitleText": "我的点赞"
|
||||
}
|
||||
24
pages/health/praise/praise.wxml
Normal file
24
pages/health/praise/praise.wxml
Normal file
@@ -0,0 +1,24 @@
|
||||
<!-- 健康知识 -->
|
||||
<view class="article">
|
||||
<view class="wiki" wx:if="{{articlesArr.length > 0}}">
|
||||
<navigator hover-class="none" url="../article/article?id={{item.subscribable.article_id}}" class="wiki-label" wx:for="{{articlesArr}}" wx:key="listsArr">
|
||||
<image class="wiki-label-img" mode="aspectFill" src="{{item.subscribable.cover}}"></image>
|
||||
<view class="wiki-label-cont">
|
||||
<view class="nowrap wiki-label-name"><text>水感应</text> | {{item.subscribable.title}}</view>
|
||||
<view class="nowrap-multi wiki-label-text">{{item.subscribable.description}}</view>
|
||||
</view>
|
||||
</navigator>
|
||||
<view class="pagesLoding" wx:if="{{lodingStats}}">
|
||||
<block wx:if="{{page.has_more}}">
|
||||
<image class="pagesLoding-icon" src="/static/icons/refresh_loding.gif" mode="widthFix"></image>加载中...
|
||||
</block>
|
||||
<block wx:else>
|
||||
没有更多了~
|
||||
</block>
|
||||
</view>
|
||||
</view>
|
||||
<view class="pack-center pages-hint" wx:else>
|
||||
<image src="/static/imgs/text_null.png"></image>
|
||||
<view>暂无数据</view>
|
||||
</view>
|
||||
</view>
|
||||
62
pages/health/praise/praise.wxss
Normal file
62
pages/health/praise/praise.wxss
Normal file
@@ -0,0 +1,62 @@
|
||||
page {
|
||||
padding: 0 30rpx;
|
||||
box-sizing: border-box;
|
||||
background-color: #f6f6f6;
|
||||
}
|
||||
|
||||
/* 健康知识 */
|
||||
.article {
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.wiki {
|
||||
margin-top: 60rpx;
|
||||
}
|
||||
|
||||
.wiki-label {
|
||||
background-color: #fff;
|
||||
margin-bottom: 70rpx;
|
||||
position: relative;
|
||||
height: 200rpx;
|
||||
box-shadow: 0 4rpx 30rpx 2rpx rgba(0, 0, 0, .05);
|
||||
border-radius: 10rpx;
|
||||
}
|
||||
|
||||
.wiki-label:last-child {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
.wiki-label-img {
|
||||
width: 200rpx;
|
||||
height: 200rpx;
|
||||
position: absolute;
|
||||
top: -30rpx;
|
||||
left: 30rpx;
|
||||
border-radius: 10rpx;
|
||||
}
|
||||
|
||||
.wiki-label-cont {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 0;
|
||||
width: 100%;
|
||||
padding: 30rpx 25rpx 0 270rpx;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.wiki-label-name {
|
||||
font-size: 32rpx;
|
||||
color: #3b7cff;
|
||||
}
|
||||
|
||||
.wiki-label-name text {
|
||||
text-transform: uppercase;
|
||||
}
|
||||
|
||||
.wiki-label-text {
|
||||
color: #999999;
|
||||
font-size: 28rpx;
|
||||
margin-top: 20rpx;
|
||||
line-height: 40rpx;
|
||||
font-weight: 200;
|
||||
}
|
||||
Reference in New Issue
Block a user