655 lines
13 KiB
Vue
655 lines
13 KiB
Vue
<template>
|
|
<view class="page">
|
|
<view class="content">
|
|
<view class="title-box"></view>
|
|
<view class="state-bar">
|
|
<image src="../../static/images/ic_arrow_left.png" mode="aspectFill" @click="closePage()"></image>
|
|
<view class="tab">
|
|
<view @click="tabChange(1)">{{pageName}}</view>
|
|
</view>
|
|
<view class="btn" @click="doReport">上报</view>
|
|
</view>
|
|
<view class="box">
|
|
<image class="title-img" src="../../static/images/ic_activity_title_bg.png" mode="aspectFill"></image>
|
|
<view class="title-text">
|
|
<text>播撒一片绿色让世界更美</text>
|
|
<text>爱护万千树木让你我同行</text>
|
|
</view>
|
|
<view class="container-box">
|
|
<!-- 搜索框 -->
|
|
<view class="search" v-if="currentIndex==1">
|
|
<view class="search-content">
|
|
<image src="../../static/images/ic_search.png" class="icon" mode="aspectFill"></image>
|
|
<input @input="onSearchInput" placeholder="请输入关键字搜索" />
|
|
</view>
|
|
<view class="btn" @click="doSearch">搜索</view>
|
|
</view>
|
|
<!-- 列表 -->
|
|
<view class="content-scroller">
|
|
<scroller v-if="currentIndex==1" @init="initScroller" @down="refreshData" @up="getData"
|
|
style="height: 70%;" :up="optUp" @scroll="navFloatShow(scroller)" :fixed="false">
|
|
<!-- 列表 -->
|
|
<view class="list-box">
|
|
<view class="item" v-for="(item,index) in list" :key="index"
|
|
@click="openDetail(item.activityReportId)">
|
|
<view class="activity-item">
|
|
<view class="activity-item-box" v-if="item.img != ''">
|
|
<image :src="imgUrl+item.img" mode="scaleToFill" class="img"></image>
|
|
</view>
|
|
<view class="activity-content">
|
|
<rich-text class="activity-name" :nodes="item.title"></rich-text>
|
|
<view class="item-type">
|
|
<view class="type-type">{{item.typeName}}</view>
|
|
</view>
|
|
<view class="activity-time">{{item.address}}</view>
|
|
<rich-text class="activity-desc" :nodes="item.content"></rich-text>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</scroller>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</template>
|
|
|
|
<script>
|
|
import {
|
|
mapState,
|
|
mapMutations
|
|
} from 'vuex';
|
|
import scroller from '@/components/scroller/scroller.vue';
|
|
export default {
|
|
components: {
|
|
scroller
|
|
},
|
|
|
|
data() {
|
|
return {
|
|
currentIndex: 1,
|
|
list: [],
|
|
list2: [],
|
|
scroller: {},
|
|
scroller2: {},
|
|
optUp: {
|
|
auto: true,
|
|
onScroll: true,
|
|
page: {
|
|
num: 0, //当前页 默认0,回调之前会加1; 即callback(page)会从1开始
|
|
size: 10 //每页数据条数,默认10
|
|
},
|
|
empty: {
|
|
tip: '暂无数据~'
|
|
}
|
|
},
|
|
optUp2: {
|
|
auto: true,
|
|
onScroll: true,
|
|
page: {
|
|
num: 0, //当前页 默认0,回调之前会加1; 即callback(page)会从1开始
|
|
size: 10 //每页数据条数,默认10
|
|
},
|
|
empty: {
|
|
tip: '暂无数据~'
|
|
}
|
|
},
|
|
token: "",
|
|
imgUrl: this.$api.common.imgUrl,
|
|
searchContent: "",
|
|
pageName: '',
|
|
id: '',
|
|
isRefresh: false
|
|
}
|
|
},
|
|
onLoad(res) {
|
|
if (res.name) {
|
|
this.pageName = res.name
|
|
}
|
|
this.token = getApp().globalData.token
|
|
this.id = res.id
|
|
},
|
|
onShow(res) {
|
|
if (this.isRefresh) {
|
|
this.isRefresh = false
|
|
this.refreshData()
|
|
}
|
|
},
|
|
methods: {
|
|
...mapMutations(['login']),
|
|
tabChange(i) {
|
|
this.currentIndex = i;
|
|
if (i == 1) {
|
|
this.bg = this.bg1
|
|
} else {
|
|
this.bg = this.bg2
|
|
}
|
|
},
|
|
closePage() {
|
|
uni.navigateBack()
|
|
},
|
|
/*收搜*/
|
|
doSearch() {
|
|
uni.hideKeyboard()
|
|
if (this.searchContent == "") {
|
|
this.$alert("请输入关键字");
|
|
}
|
|
this.refreshData()
|
|
},
|
|
/*初始化滚动*/
|
|
initScroller(scroller) {
|
|
this.scroller = scroller;
|
|
this.loadData();
|
|
},
|
|
|
|
/*刷新数据*/
|
|
refreshData() {
|
|
uni.showLoading({
|
|
title: '刷新中'
|
|
});
|
|
this.scroller.resetUpScroll();
|
|
},
|
|
onSearchInput: function(event) {
|
|
this.searchContent = event.target.value
|
|
},
|
|
/*加载数据*/
|
|
loadData() {
|
|
this.list = [];
|
|
this.scroller.resetUpScroll();
|
|
},
|
|
/*滚动时导航栏浮动*/
|
|
navFloatShow(scroller) {
|
|
|
|
},
|
|
//获取列表数据
|
|
getData() {
|
|
this.$app.request({
|
|
url: this.$api.duty.getMineReportList,
|
|
method: 'GET',
|
|
header: {
|
|
token: this.token
|
|
},
|
|
data: {
|
|
'rows': this.scroller.size,
|
|
'page': this.scroller.num,
|
|
'activityTypeId': this.id,
|
|
'keywords': this.searchContent
|
|
},
|
|
dataType: 'json',
|
|
success: res => {
|
|
if (res.rows != undefined) {
|
|
if (this.scroller.num == 1) {
|
|
this.list = [];
|
|
}
|
|
var tempList = []
|
|
tempList = res.rows
|
|
if (tempList.length > 0) {
|
|
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.split(',')[0]
|
|
} else {
|
|
tempList[i].img = tempList[i].photo
|
|
}
|
|
} else {
|
|
tempList[i].img = ''
|
|
}
|
|
}
|
|
this.list = this.list.concat(tempList);
|
|
console.log(this.list)
|
|
}
|
|
this.scroller.endBySize(res.rows.length, res.rows.total);
|
|
this.showPageLoading = false;
|
|
} else {
|
|
this.scroller.endSuccess();
|
|
this.$alert(res.msg);
|
|
}
|
|
},
|
|
fail: res => {
|
|
this.scroller.endErr();
|
|
},
|
|
complete: res => {
|
|
uni.stopPullDownRefresh();
|
|
uni.hideLoading();
|
|
}
|
|
});
|
|
},
|
|
|
|
|
|
openDetail(id) {
|
|
uni.navigateTo({
|
|
url: '/pages/duty/casereportdetail?id=' + id
|
|
})
|
|
},
|
|
openDetailType(id, ss) {
|
|
uni.navigateTo({
|
|
url: "/pages/duty/activitydetail?id=" + id + "&type=" + 2 + "&itemId=" + ss
|
|
})
|
|
},
|
|
//跳转上报页面
|
|
doReport() {
|
|
var _self = this;
|
|
console.log(_self.id)
|
|
uni.navigateTo({
|
|
url: '/pages/duty/casereport?id=' + _self.id
|
|
})
|
|
}
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style lang="scss">
|
|
page {
|
|
height: 100%;
|
|
|
|
}
|
|
|
|
.page {
|
|
display: flex;
|
|
flex: 1;
|
|
flex-direction: column;
|
|
overflow: hidden;
|
|
height: 100%;
|
|
}
|
|
|
|
.content-scroller {
|
|
flex: 1;
|
|
width: 100%;
|
|
height: 100%;
|
|
}
|
|
|
|
.content {
|
|
width: 100%;
|
|
position: relative;
|
|
height: 100%;
|
|
}
|
|
|
|
.box {
|
|
display: flex;
|
|
flex-direction: column;
|
|
justify-content: flex-start;
|
|
height: 100%;
|
|
width: 98%;
|
|
position: absolute;
|
|
top: 170rpx;
|
|
left: 50%;
|
|
transform: translate(-50%, 0);
|
|
-webkit-transform: translate(-50%, 0);
|
|
box-shadow: 0rpx 7rpx 33rpx 16rpx rgba(188, 226, 204, 0.15);
|
|
border-radius: 30rpx;
|
|
|
|
.title-img {
|
|
width: 443rpx;
|
|
height: 203rpx;
|
|
align-self: center;
|
|
}
|
|
|
|
.title-text {
|
|
color: white;
|
|
text-align: center;
|
|
align-self: center;
|
|
display: flex;
|
|
flex-direction: column;
|
|
font-size: 30rpx;
|
|
font-weight: 400;
|
|
}
|
|
}
|
|
|
|
.tab-bar {
|
|
width: 100%;
|
|
display: flex;
|
|
flex-direction: row;
|
|
justify-content: space-around;
|
|
padding-top: 15rpx;
|
|
|
|
.tab-active {
|
|
text-align: center;
|
|
font-size: 40rpx;
|
|
font-weight: bold;
|
|
color: #00821E;
|
|
}
|
|
|
|
.tab-default {
|
|
text-align: center;
|
|
font-size: 40rpx;
|
|
font-weight: 200;
|
|
color: #00821E;
|
|
}
|
|
}
|
|
|
|
.title-box {
|
|
width: 100%;
|
|
height: 800rpx;
|
|
background-image: url('../../static/images/ic_activity_bg.png');
|
|
background-size: 100% 100%;
|
|
background-repeat: no-repeat;
|
|
}
|
|
|
|
.state-bar {
|
|
position: absolute;
|
|
top: 0%;
|
|
left: 0%;
|
|
width: 100%;
|
|
margin: 45rpx 0rpx;
|
|
height: 100rpx;
|
|
display: flex;
|
|
flex-direction: row;
|
|
justify-content: space-between;
|
|
align-items: center;
|
|
|
|
image {
|
|
width: 50rpx;
|
|
height: 50rpx;
|
|
margin-left: 20rpx;
|
|
}
|
|
|
|
.btn {
|
|
color: white;
|
|
font-size: 32rpx;
|
|
margin-right: 20rpx;
|
|
}
|
|
|
|
.tab {
|
|
display: flex;
|
|
flex-direction: row;
|
|
color: white;
|
|
justify-content: center;
|
|
font-size: 40rpx;
|
|
align-self: center;
|
|
text-align: center;
|
|
|
|
|
|
.tab-1 {
|
|
border-bottom-width: 8rpx;
|
|
border-bottom-style: solid;
|
|
border-bottom-color: white;
|
|
}
|
|
}
|
|
}
|
|
|
|
.container-box {
|
|
display: flex;
|
|
flex-direction: column;
|
|
background-color: white;
|
|
justify-content: center;
|
|
align-items: flex-start;
|
|
margin: 20rpx;
|
|
padding: 30rpx 0rpx;
|
|
border-top-left-radius: 30rpx;
|
|
border-top-right-radius: 30rpx;
|
|
height: 100%;
|
|
|
|
.area-box {
|
|
display: flex;
|
|
flex-direction: row;
|
|
align-items: center;
|
|
justify-content: flex-start;
|
|
margin: 30rpx;
|
|
|
|
.area-title {
|
|
font-size: 30rpx;
|
|
color: #747474;
|
|
}
|
|
|
|
.area-picker {
|
|
background-color: #E8F6EE;
|
|
margin-left: 20rpx;
|
|
color: #b3b3b3;
|
|
padding: 10rpx 30rpx;
|
|
}
|
|
}
|
|
}
|
|
|
|
/*搜索*/
|
|
.search {
|
|
padding: 10rpx 24rpx 10rpx 24rpx;
|
|
display: flex;
|
|
justify-content: space-between;
|
|
align-items: center;
|
|
width: 90%;
|
|
margin-top: 25rpx;
|
|
align-self: center;
|
|
|
|
.search-content {
|
|
background: #f2f2f2;
|
|
border-radius: 15px;
|
|
padding: 10rpx 24rpx 10rpx 24rpx;
|
|
margin-right: 15rpx;
|
|
flex: 1;
|
|
display: flex;
|
|
align-items: center;
|
|
}
|
|
|
|
/deep/.input {
|
|
color: #8cc7b5;
|
|
}
|
|
|
|
.icon {
|
|
width: 30rpx;
|
|
height: 30rpx;
|
|
margin-right: 15rpx;
|
|
}
|
|
|
|
.btn {
|
|
color: #b3b3b3;
|
|
}
|
|
}
|
|
|
|
.list-box {
|
|
display: flex;
|
|
flex-direction: column;
|
|
justify-content: flex-start;
|
|
align-items: flex-start;
|
|
padding: 20rpx;
|
|
width: 95%;
|
|
height: 100%;
|
|
|
|
.item {
|
|
display: flex;
|
|
flex-direction: column;
|
|
background: white;
|
|
border-radius: 10rpx;
|
|
margin: 20rpx 0rpx;
|
|
width: 100%;
|
|
box-shadow: 0rpx 7rpx 33rpx 16rpx rgba(188, 226, 204, 0.15);
|
|
|
|
.item-content {
|
|
display: flex;
|
|
flex-direction: row;
|
|
align-items: center;
|
|
padding: 10rpx;
|
|
|
|
image {
|
|
width: 200rpx;
|
|
height: 130rpx;
|
|
}
|
|
|
|
.item-box {
|
|
display: flex;
|
|
flex-direction: column;
|
|
justify-content: center;
|
|
align-items: flex-start;
|
|
width: 100%;
|
|
margin-left: 20rpx;
|
|
|
|
.item-title {
|
|
color: #747474;
|
|
|
|
}
|
|
|
|
.item-person {
|
|
color: #747474;
|
|
}
|
|
|
|
.item-bottom {
|
|
display: flex;
|
|
flex-direction: row;
|
|
width: 95%;
|
|
justify-content: space-between;
|
|
color: #747474;
|
|
|
|
.item-status {
|
|
color: #00821E;
|
|
border: 1rpx #8cc7b5 solid;
|
|
font-size: 20rpx;
|
|
text-align: center;
|
|
padding: 0rpx 10rpx;
|
|
align-self: center;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
.title {
|
|
font-size: 30rpx;
|
|
display: -webkit-box;
|
|
text-overflow: ellipsis;
|
|
-webkit-line-clamp: 1;
|
|
-webkit-box-orient: vertical;
|
|
overflow: hidden;
|
|
padding: 10rpx;
|
|
color: #000;
|
|
}
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
.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 {
|
|
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;
|
|
}
|
|
|
|
.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;
|
|
}
|
|
}
|
|
|
|
.report-btn {
|
|
color: white;
|
|
font-size: 32rpx;
|
|
width: fit-content;
|
|
}
|
|
</style>
|