app_tree_planting/pages/duty/index.vue

643 lines
14 KiB
Vue
Raw Normal View History

2023-01-11 19:31:59 +08:00
<template>
2023-02-05 20:52:34 +08:00
<view class="page">
2023-02-17 18:13:06 +08:00
<view class="status-bar"></view>
<view class="content">
<scroller @init="initScroller" @down="refreshData" @up="getList" :up="optUp"
@scroll="navFloatShow(scroller)" :fixed="false">
2023-02-09 17:47:52 +08:00
<!-- 轮播图 -->
<swiper v-if="slider.length > 0" class="swiper" :indicator-dots="false" :autoplay="true"
:circular="true">
<swiper-item v-for="(item, index) in slider" :key="index">
<navigator class="item" hover-class="none" :url="'/pages/duty/list'">
<image :lazy-load="true" :src="item.imageUrl" mode="scaleToFill"></image>
</navigator>
</swiper-item>
</swiper>
<view class="func-box">
<view class="item" @click="openActivity()">
<image src="../../static/images/ic_labour_pious_icon.png" mode="scaleToFill"></image>
<text>劳动尽责</text>
</view>
<view class="item" @click="openCertificate">
<image src="../../static/images/ic_certify_search_icon.png" mode="scaleToFill"></image>
<text>证书查询</text>
</view>
<view class="item" @click="openExplain">
<image src="../../static/images/ic_duty_answer_icon.png" mode="scaleToFill"></image>
<text>尽责说明</text>
</view>
2023-02-05 20:52:34 +08:00
</view>
2023-02-17 18:13:06 +08:00
<view @click="openList" class="title-item">
<view class="title-item-line">
<view class="line-green"></view>
<view class="title-item-title">最新活动</view>
</view>
<view class="title-item-content">更多></view>
</view>
2023-02-09 17:47:52 +08:00
<!-- 劳动尽责内容 -->
<view class="duty-box">
<view class="duty-content" v-if="list.length>0">
2023-02-17 18:13:06 +08:00
<block v-for="(item,index) in list" :key="index">
<view class="activity-item" @click="openDetail(item.activityId)">
<view class="activity-item-box">
<view class="activity-item-num">
{{item.joinedCount}}/{{item.joinCount}}
</view>
<image :src="imgUrl+item.img" mode="aspectFill" class="img"></image>
2023-02-09 17:47:52 +08:00
</view>
2023-02-17 18:13:06 +08:00
<view class="activity-content">
<rich-text class="activity-name" :nodes="item.name"></rich-text>
<view class="item-type">
<view class="type-type">{{item.activityType}}</view>
<view class="type-theme">{{item.theme}}</view>
</view>
<view class="activity-time">{{item.startTime}}</view>
<rich-text class="activity-desc" :nodes="item.content"></rich-text>
2023-02-09 17:47:52 +08:00
</view>
</view>
2023-02-17 18:13:06 +08:00
</block>
2023-02-09 17:47:52 +08:00
</view>
<view v-else>
<emptyView></emptyView>
</view>
2023-02-05 20:52:34 +08:00
</view>
2023-02-17 18:13:06 +08:00
</scroller>
</view>
2023-02-09 17:47:52 +08:00
<pageLoading v-if="showPageLoading"></pageLoading>
2023-01-11 19:31:59 +08:00
</view>
</template>
<script>
2023-02-01 19:25:51 +08:00
import pageLoading from '@/components/loading/pageLoading.vue';
export default {
components: {
pageLoading
},
data() {
return {
2023-02-05 20:52:34 +08:00
showPageLoading: true,
slider: [{
2023-02-09 17:47:52 +08:00
imageUrl: "/static/images/ic_duty_title_bg.png"
2023-02-05 20:52:34 +08:00
}], //轮播图
2023-02-09 17:47:52 +08:00
list: [],
scroller: {},
optUp: {
isLock: true,
auto: true,
onScroll: true,
page: {
num: 0, //当前页 默认0,回调之前会加1; 即callback(page)会从1开始
size: 3 //每页数据条数,默认10
},
empty: {
tip: '暂无数据~'
}
},
2023-02-17 18:13:06 +08:00
imgUrl: this.$api.common.imgUrl,
2023-02-09 17:47:52 +08:00
2023-02-01 19:25:51 +08:00
};
},
2023-02-09 17:47:52 +08:00
onLoad(res) {
this.getList()
},
2023-02-01 19:25:51 +08:00
methods: {
2023-02-05 20:52:34 +08:00
doSearch() {
2023-02-01 19:25:51 +08:00
2023-02-05 20:52:34 +08:00
},
onSearchInput(event) {
},
openActivity() {
uni.navigateTo({
url: "/pages/duty/activitylist"
})
2023-02-17 18:13:06 +08:00
// uni.navigateTo({
// url: '/pages/duty/activitynewlist'
// })
},
openExplain() {
uni.navigateTo({
url: "/pages/duty/dutyexplain"
})
},
openCertificate() {
uni.navigateTo({
url: "/pages/user/mine_certif_search"
})
2023-02-09 17:47:52 +08:00
},
2023-02-17 18:13:06 +08:00
openDetail(id) {
uni.navigateTo({
url: "/pages/duty/activitydetail?id=" + id + "&type=" + 1
})
},
openList() {
uni.navigateTo({
url: "/pages/duty/activitylist"
})
},
2023-02-09 17:47:52 +08:00
/*初始化滚动*/
initScroller(scroller) {
this.scroller = scroller;
this.loadData();
},
/*刷新数据*/
refreshData() {
uni.showLoading({
title: '刷新中'
});
this.scroller.resetUpScroll();
},
onSearchInput: function(event) {
this.searchContent = event.target.value
console.log(event.target.value)
if (event.target.value == "") {
this.refreshData()
}
},
/*加载数据*/
loadData() {
this.list = [];
this.scroller.resetUpScroll();
},
/*滚动时导航栏浮动*/
navFloatShow(scroller) {
},
getList() {
2023-02-17 18:13:06 +08:00
var _self = this;
_self.$app.request({
url: _self.$api.duty.getActivityList,
2023-02-09 17:47:52 +08:00
method: 'GET',
data: {
2023-02-17 18:13:06 +08:00
'rows': '10',
2023-02-09 17:47:52 +08:00
'page': '1',
},
dataType: 'json',
success: res => {
2023-02-17 18:13:06 +08:00
uni.hideLoading()
2023-02-09 17:47:52 +08:00
if (res.rows != undefined) {
2023-02-17 18:13:06 +08:00
var tempList = []
tempList = res.rows
for (var i = 0; i < tempList.length; i++) {
if (tempList[i].photo) {
var index = tempList[i].photo.indexOf(",")
if (index != -1) {
tempList[i].img = tempList[i].photo.substring(0, index)
}
tempList[i].img = tempList[i].photo
}
}
_self.list = tempList
_self.showPageLoading = false;
_self.scroller.endBySize(res.rows.length, 3);
2023-02-09 17:47:52 +08:00
} else {
2023-02-17 18:13:06 +08:00
_self.scroller.endSuccess();
_self.$alert(res.msg);
2023-02-09 17:47:52 +08:00
}
},
fail: res => {
2023-02-17 18:13:06 +08:00
uni.hideLoading()
_self.scroller.endErr();
2023-02-09 17:47:52 +08:00
},
complete: res => {
2023-02-17 18:13:06 +08:00
uni.hideLoading()
2023-02-09 17:47:52 +08:00
uni.stopPullDownRefresh();
2023-02-17 18:13:06 +08:00
_self.showPageLoading = false;
2023-02-09 17:47:52 +08:00
}
});
2023-02-05 20:52:34 +08:00
}
2023-02-01 19:25:51 +08:00
}
};
2023-01-11 19:31:59 +08:00
</script>
<style scoped lang="scss">
2023-02-05 20:52:34 +08:00
page {
height: 100%;
}
2023-02-01 19:25:51 +08:00
2023-02-05 20:52:34 +08:00
.page {
display: flex;
flex: 1;
flex-direction: column;
2023-02-17 18:13:06 +08:00
overflow: auto;
2023-02-05 20:52:34 +08:00
height: 100%;
background: #fff;
2023-02-01 19:25:51 +08:00
}
2023-02-05 20:52:34 +08:00
.content {
flex: 1;
width: 100%;
height: 100rpx;
display: flex;
flex-direction: column;
justify-content: flex-start;
2023-02-09 17:47:52 +08:00
margin-top: 20rpx;
2023-02-05 20:52:34 +08:00
}
/*幻灯片广告 */
.swiper {
2023-02-09 17:47:52 +08:00
height: 420rpx;
2023-02-05 20:52:34 +08:00
margin: 14rpx 24rpx 0;
image {
2023-02-09 17:47:52 +08:00
height: 420rpx;
2023-02-05 20:52:34 +08:00
width: 100%;
border-radius: 15rpx;
//box-shadow: 0 0 12px #dddee1;
2023-01-11 19:31:59 +08:00
}
2023-02-01 19:25:51 +08:00
2023-02-05 20:52:34 +08:00
.current {
width: 98%;
height: 350rpx;
margin: 1.0% 1.0%;
transition: all 0.2s ease-in 0s;
}
2023-02-01 19:25:51 +08:00
2023-02-05 20:52:34 +08:00
.item {
position: relative;
2023-02-01 19:25:51 +08:00
2023-02-05 20:52:34 +08:00
.title {
position: absolute;
left: 0;
bottom: 0;
2023-01-11 19:31:59 +08:00
display: flex;
2023-02-01 19:25:51 +08:00
justify-content: center;
2023-02-05 20:52:34 +08:00
width: 100%;
2023-02-01 19:25:51 +08:00
2023-02-05 20:52:34 +08:00
text {
margin: 7% 6%;
2023-02-01 19:25:51 +08:00
display: flex;
align-items: center;
2023-01-11 19:31:59 +08:00
color: #fff;
2023-02-05 20:52:34 +08:00
display: -webkit-box;
text-overflow: ellipsis;
word-break: break-all;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
overflow: hidden;
font-size: 34rpx;
padding: 14rpx 20rpx;
max-width: 610rpx;
line-height: 1.3;
border-radius: 5rpx;
2023-02-01 19:25:51 +08:00
}
}
2023-02-05 20:52:34 +08:00
}
}
2023-02-01 19:25:51 +08:00
2023-02-05 20:52:34 +08:00
.func-box {
display: flex;
flex-direction: row;
align-items: center;
justify-content: space-around;
padding: 20rpx 10rpx;
2023-02-01 19:25:51 +08:00
2023-02-05 20:52:34 +08:00
.item {
display: flex;
flex-direction: column;
align-items: center;
2023-02-01 19:25:51 +08:00
2023-02-05 20:52:34 +08:00
image {
width: 80rpx;
height: 80rpx;
}
text {
color: black;
font-size: 30rpx;
margin-top: 10rpx;
2023-01-11 19:31:59 +08:00
}
}
}
2023-02-01 19:25:51 +08:00
2023-02-09 17:47:52 +08:00
.divider-img {
2023-02-17 18:13:06 +08:00
width: 94%;
height: 120rpx;
2023-02-05 20:52:34 +08:00
align-self: center;
2023-02-17 18:13:06 +08:00
margin: 10rpx 20rpx;
2023-02-05 20:52:34 +08:00
}
2023-02-01 19:25:51 +08:00
2023-02-05 20:52:34 +08:00
/*搜索*/
.search {
padding: 10rpx 24rpx 10rpx 24rpx;
display: flex;
justify-content: space-between;
align-items: center;
.search-content {
background: #f2f2f2;
border-radius: 15px;
padding: 10rpx 24rpx 10rpx 24rpx;
margin-right: 15rpx;
flex: 1;
display: flex;
align-items: center;
}
2023-02-01 19:25:51 +08:00
2023-02-05 20:52:34 +08:00
/deep/.input {
color: #8cc7b5;
}
2023-01-11 19:31:59 +08:00
2023-02-05 20:52:34 +08:00
.icon {
width: 30rpx;
height: 30rpx;
margin-right: 15rpx;
2023-01-11 19:31:59 +08:00
}
2023-02-01 19:25:51 +08:00
2023-02-05 20:52:34 +08:00
.btn {
color: #b3b3b3;
}
2023-02-01 19:25:51 +08:00
}
2023-02-09 17:47:52 +08:00
.duty-box {
display: flex;
flex-direction: row;
height: 100%;
width: 100%;
.duty-content {
display: flex;
2023-02-17 18:13:06 +08:00
flex-direction: column;
2023-02-09 17:47:52 +08:00
width: 100%;
.content-left {
display: flex;
flex-direction: column;
background-image: url('/static/images/ic_duty_index_item_1.png');
width: 48%;
2023-02-17 18:13:06 +08:00
height: 120%;
min-height: 100%;
2023-02-09 17:47:52 +08:00
background-size: 100% 100%;
background-repeat: no-repeat;
margin: 10rpx;
padding: 15rpx;
.title {
display: -webkit-box;
text-overflow: ellipsis;
word-break: break-all;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
overflow: hidden;
font-size: 32rpx;
}
.btn {
background: #169302;
border-radius: 15rpx;
padding: 10rpx 15rpx;
width: 140rpx;
color: white;
text-align: center;
font-size: 25rpx;
margin-top: 20rpx;
align-self: flex-end;
}
.time {
margin-top: 20rpx;
font-size: 25rpx;
}
}
.content-right {
display: flex;
flex-direction: column;
width: 48%;
2023-02-17 18:13:06 +08:00
height: 120%;
2023-02-09 17:47:52 +08:00
margin: 10rpx;
.right-item-top {
display: flex;
flex-direction: column;
background-image: url('/static/images/ic_duty_index_item_2.png');
width: 100%;
height: 50%;
2023-02-17 18:13:06 +08:00
min-height: 53%;
2023-02-09 17:47:52 +08:00
background-size: 100% 100%;
background-repeat: no-repeat;
.title {
display: -webkit-box;
text-overflow: ellipsis;
word-break: break-all;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
overflow: hidden;
font-size: 32rpx;
padding: 15rpx;
}
.btn {
background: #169302;
border-radius: 15rpx;
padding: 10rpx 15rpx;
width: 140rpx;
color: white;
text-align: center;
font-size: 25rpx;
margin-top: 20rpx;
margin-left: 10rpx;
align-self: flex-start;
}
}
.right-item-bottom {
display: flex;
flex-direction: column;
margin-top: 10rpx;
background-image: url('/static/images/ic_duty_index_item_3.png');
width: 100%;
height: 50%;
2023-02-17 18:13:06 +08:00
min-height: 50%;
2023-02-09 17:47:52 +08:00
background-size: 100% 100%;
background-repeat: no-repeat;
.title {
display: -webkit-box;
text-overflow: ellipsis;
word-break: break-all;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
overflow: hidden;
font-size: 32rpx;
padding: 15rpx;
}
.btn {
background: #169302;
border-radius: 15rpx;
padding: 10rpx 15rpx;
width: 140rpx;
color: white;
text-align: center;
margin-left: 10rpx;
font-size: 25rpx;
margin-top: 20rpx;
align-self: flex-start;
}
}
}
}
}
2023-02-17 18:13:06 +08:00
.title-item {
display: flex;
flex-direction: row;
justify-content: space-between;
padding: 20rpx 30rpx;
.title-item-line {
display: flex;
flex-direction: row;
justify-content: flex-start;
align-items: center;
}
.title-item-title {
color: black;
font-size: 32rpx;
display: flex;
flex-direction: row;
margin-left: 10rpx;
}
.title-item-content {
color: #3A3B3E;
font-size: 28rpx;
margin-right: 10rpx;
}
}
.line-green {
width: 10rpx;
background: #0DB77E;
height: 30rpx;
}
.activity-item {
display: flex;
flex-direction: row;
justify-content: flex-start;
align-items: flex-start;
padding: 20rpx 40rpx;
.activity-img {
width: 163rpx;
height: 163rpx;
min-width: 163rpx;
min-height: 163rpx;
}
}
.activity-item-box {
width: 192rpx;
height: 192rpx;
position: relative;
.activity-item-num {
color: white;
background: #0DB77E;
width: fit-content;
max-width: fit-content;
padding: 0rpx 10rpx;
border-top-right-radius: 20rpx;
border-bottom-right-radius: 20rpx;
position: absolute;
top: 15rpx;
font-size: 18rpx;
left: 0;
z-index: 2;
}
.img {
width: 192rpx;
height: 192rpx;
position: relative;
top: 0;
}
}
.activity-content {
display: flex;
flex-direction: column;
justify-content: flex-start;
align-items: flex-start;
margin-left: 10rpx;
.activity-name {
display: -webkit-box;
font-size: 32rpx;
color: black;
font-weight: bold;
text-overflow: ellipsis;
word-break: break-all;
-webkit-line-clamp: 1;
-webkit-box-orient: vertical;
overflow: hidden;
}
.activity-time {
font-size: 28rpx;
color: gray;
}
.activity-desc {
display: -webkit-box;
font-size: 28rpx;
color: gray;
text-overflow: ellipsis;
word-break: break-all;
-webkit-line-clamp: 1;
-webkit-box-orient: vertical;
overflow: hidden;
}
}
.empty-data {
align-items: center;
align-self: center;
}
.item-type {
display: flex;
flex-direction: row;
.type-theme {
display: -webkit-box;
background: #E9F7FF;
font-size: 28rpx;
padding: 0rpx 15rpx;
margin-left: 10rpx;
text-overflow: ellipsis;
word-break: break-all;
text-align: center;
color: #12D577;
-webkit-line-clamp: 1;
-webkit-box-orient: vertical;
overflow: hidden;
}
.type-type {
display: -webkit-box;
background: #ECFFF9;
font-size: 28rpx;
text-overflow: ellipsis;
word-break: break-all;
color: #009FFF;
text-align: center;
-webkit-line-clamp: 1;
-webkit-box-orient: vertical;
overflow: hidden;
padding: 0rpx 15rpx;
}
}
2023-02-01 19:25:51 +08:00
</style>