Browse Source

共建联盟改版;

master
ZhaoTongYao 4 years ago
parent
commit
9f2bdf4c7d
  1. 3
      app.json
  2. 48
      subpages/heart/pages/allianceActDetail/allianceActDetail.js
  3. 6
      subpages/heart/pages/allianceActDetail/allianceActDetail.json
  4. 14
      subpages/heart/pages/allianceActDetail/allianceActDetail.wxml
  5. 42
      subpages/heart/pages/allianceActDetail/allianceActDetail.wxss
  6. 76
      subpages/heart/pages/allianceDetail/allianceDetail.js
  7. 1
      subpages/heart/pages/allianceDetail/allianceDetail.json
  8. 39
      subpages/heart/pages/allianceDetail/allianceDetail.wxml
  9. 101
      subpages/heart/pages/allianceDetail/allianceDetail.wxss
  10. 3
      subpages/heart/pages/allianceList/allianceList.js
  11. 8
      subpages/heart/pages/allianceList/allianceList.wxml
  12. 21
      subpages/heart/pages/allianceList/allianceList.wxss
  13. 17
      subpages/heart/utils/api.js
  14. 12
      utils/util.js

3
app.json

@ -68,7 +68,8 @@
"pages/volunteerTeam/volunteerTeam", "pages/volunteerTeam/volunteerTeam",
"pages/teamIntroduction/teamIntroduction", "pages/teamIntroduction/teamIntroduction",
"pages/allianceDetail/allianceDetail", "pages/allianceDetail/allianceDetail",
"pages/leaderboardDetail/leaderboardDetail" "pages/leaderboardDetail/leaderboardDetail",
"pages/allianceActDetail/allianceActDetail"
] ]
}, },
{ {

48
subpages/heart/pages/allianceActDetail/allianceActDetail.js

@ -0,0 +1,48 @@
const api = require("../../utils/api")
import util from "../../../../utils/util"
Page({
data: {
activeDetail: {},
activeDetailContent: '',
id: '',
actStartTime: '',
actEndTime: '',
imageList: [], // 精彩瞬间
},
onLoad: function (options) {
if (options.id) {
this.setData({
id: options.id
})
this.getVolunteerUnionActDetail(options.id)
}
},
// 获取
getVolunteerUnionActDetail (id) {
api.getVolunteerUnionActDetail(id).then(res => {
let startTime = res.data.actStartTime.replace(/-/g, '.')
let endTime = res.data.actEndTime.replace(/-/g, '.')
// let arr = res.data.images.sort(util.compare('imgSort'))
// console.log(arr)
let imageList = []
res.data.images.forEach(item => {
imageList.push(item.url)
})
this.setData({
activeDetail: res.data,
actStartTime: startTime.substring(0, startTime.length - 3),
actEndTime: endTime.substring(0, endTime.length - 3),
activeDetailContent: util.formatRichText(res.data.content),
imageList
})
}).catch(err => {
console.log(err)
})
},
preViewImage (e) {
wx.previewImage({
urls: this.data.imageList,
current: e.currentTarget.dataset.src
})
},
})

6
subpages/heart/pages/allianceActDetail/allianceActDetail.json

@ -0,0 +1,6 @@
{
"navigationBarTitleText": "活动详情",
"usingComponents": {
"parser": "../../../../components/parser/parser"
}
}

14
subpages/heart/pages/allianceActDetail/allianceActDetail.wxml

@ -0,0 +1,14 @@
<view class="alliance-act-detail">
<view class="alliance-act">
<view class="title">{{activeDetail.title}}</view>
<view class="time">活动时间: {{actStartTime}}-{{actEndTime}}</view>
<view class="intro">活动简介: </view>
<parser html="{{activeDetailContent}}"></parser>
</view>
<block wx:if="{{imageList.length > 0}}">
<view class="wonderful-title">精彩瞬间</view>
<view class="wonderful-list">
<image class="wonderful-image" src="{{item}}" wx:for="{{imageList}}" bindtap="preViewImage" data-src="{{item}}" />
</view>
</block>
</view>

42
subpages/heart/pages/allianceActDetail/allianceActDetail.wxss

@ -0,0 +1,42 @@
page {
background-color: #f7f7f7;
}
.alliance-act-detail {
width: 100%;
overflow: hidden;
background: #fff;
padding: 20rpx;
box-sizing: border-box;
}
.alliance-act {
width: 100%;
margin-bottom: 100rpx;
}
.alliance-act .title{
font-size: 40rpx;
margin-bottom: 30rpx;
text-align: center;
}
.alliance-act .time{
font-size: 32rpx;
margin-bottom: 30rpx;
}
.alliance-act .intro{
font-size: 32rpx;
margin-bottom: 30rpx;
}
.wonderful-title {
font-size: 32rpx;
margin-bottom: 30rpx;
}
.wonderful-list {
display: flex;
flex-wrap: wrap;
justify-content: flex-start;
}
.wonderful-list .wonderful-image {
width: 320rpx;
height: 240rpx;
margin: 0 15rpx;
margin-bottom: 20rpx;
}

76
subpages/heart/pages/allianceDetail/allianceDetail.js

@ -3,21 +3,95 @@ import util from "../../../../utils/util"
Page({ Page({
data: { data: {
noticeObj: '', noticeObj: '',
noticeObjContent: '' noticeObjContent: '<p style="text-indent: 21pt; margin: 0pt 0pt 0.0001pt; text-align: justify; font-family: Calibri; font-size: 10.5pt;"><span style="font-family: 宋体; font-size: 14.0000pt;"><span style="font-family: 宋体;">项目位于合作社院内,紧邻</span>220国道,距离济菏高速平阴县出入口不到2公里, 交通方便、地理位置优越。</span></p>↵<p style="margin: 0pt 0pt 0.0001pt; text-align: justify; font-family: Calibri; font-size: 10.5pt;"><span style="font-family: 宋体; font-size: 14.0000pt;"><span style="font-family: 宋体;">项目位于平阴县城西部前阮二村盆三津区内,西临龙桥洼区,东临博士注区。<img src="https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fimg.jj20.com%2Fup%2Fallimg%2Ftp05%2F19100120461512E-0-lp.jpg&refer=http%3A%2F%2Fimg.jj20.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=jpeg?sec=1640768653&t=7db6abc17756c233533936be29211370" />三个洼区都属于黄河淤积平原,土地肥沃,是平阴县主要小麦、玉米、大豆等粮食主产区,项目资源丰富。</span></span></p><p style="text-indent: 21pt; margin: 0pt 0pt 0.0001pt; text-align: justify; font-family: Calibri; font-size: 10.5pt;"><span style="font-family: 宋体; font-size: 14.0000pt;"><span style="font-family: 宋体;">项目位于合作社院内,紧邻</span>220国道,距离济菏高速平阴县出入口不到2公里, 交通方便、地理位置优越。</span></p>↵<p style="margin: 0pt 0pt 0.0001pt; text-align: justify; font-family: Calibri; font-size: 10.5pt;"><span style="font-family: 宋体; font-size: 14.0000pt;"><span style="font-family: 宋体;">项目位于平阴县城西部前阮二村盆三津区内,西临龙桥洼区,东临博士注区。三个洼区都属于黄河淤积平原,土地肥沃,是平阴县主要小麦、玉米、大豆等粮食主产区,项目资源丰富。</span></span></p><p style="text-indent: 21pt; margin: 0pt 0pt 0.0001pt; text-align: justify; font-family: Calibri; font-size: 10.5pt;"><span style="font-family: 宋体; font-size: 14.0000pt;"><span style="font-family: 宋体;">项目位于合作社院内,紧邻</span>220国道,距离济菏高速平阴县出入口不到2公里, 交通方便、地理位置优越。</span></p>↵<p style="margin: 0pt 0pt 0.0001pt; text-align: justify; font-family: Calibri; font-size: 10.5pt;"><span style="font-family: 宋体; font-size: 14.0000pt;"><span style="font-family: 宋体;">项目位于平阴县城西部前阮二村盆三津区内,西临龙桥洼区,东临博士注区。三个洼区都属于黄河淤积平原,土地肥沃,是平阴县主要小麦、玉米、大豆等粮食主产区,项目资源丰富。</span></span></p><p style="text-indent: 21pt; margin: 0pt 0pt 0.0001pt; text-align: justify; font-family: Calibri; font-size: 10.5pt;"><span style="font-family: 宋体; font-size: 14.0000pt;"><span style="font-family: 宋体;">项目位于合作社院内,紧邻</span>220国道,距离济菏高速平阴县出入口不到2公里, 交通方便、地理位置优越。</span></p>↵<p style="margin: 0pt 0pt 0.0001pt; text-align: justify; font-family: Calibri; font-size: 10.5pt;"><span style="font-family: 宋体; font-size: 14.0000pt;"><span style="font-family: 宋体;">项目位于平阴县城西部前阮二村盆三津区内,西临龙桥洼区,东临博士注区。三个洼区都属于黄河淤积平原,土地肥沃,是平阴县主要小麦、玉米、大豆等粮食主产区,项目资源丰富。</span></span></p>',
isShow: false,
isShowBtn: false, // 是否显示 展开-收起
pageIndex: 1,
pageSize: 10,
loadMoreType: 'none',
loadMoreVisible: false,
activeList: [],
id: '',
}, },
onLoad: function (options) { onLoad: function (options) {
if (options.id) { if (options.id) {
this.setData({
id: options.id
})
this.getVolunteerUnionDetail(options.id) this.getVolunteerUnionDetail(options.id)
this.getVolunteerUnionActiveList()
}
},
onReachBottom: function () {
this.setData({
loadMoreVisible: true
})
if (this.data.loadMoreType === "loading") {
this.setData({
pageIndex: this.data.pageIndex + 1
})
this.getVolunteerUnionActiveList()
} }
}, },
// 获取
getVolunteerUnionDetail (id) { getVolunteerUnionDetail (id) {
api.getVolunteerUnionDetail({ id }).then(res => { api.getVolunteerUnionDetail({ id }).then(res => {
this.setData({ this.setData({
noticeObj: res.data, noticeObj: res.data,
noticeObjContent: util.formatRichText(res.data.content) noticeObjContent: util.formatRichText(res.data.content)
}) })
let query = wx.createSelectorQuery().in(this)
query.select('.alliance-introduce').boundingClientRect()
query.exec(res => {
console.log(res[0].height)
if (res[0].height > 100) {
this.setData({
isShowBtn: true
})
}
})
}).catch(err => { }).catch(err => {
console.log(err) console.log(err)
}) })
},
getVolunteerUnionActiveList () {
const para = {
pageIndex: this.data.pageIndex,
pageSize: this.data.pageSize,
unionActId: this.data.id
}
api.getVolunteerUnionActList(para).then(res => {
console.log(res)
this.setData({
activeList: [...this.data.activeList,...res.data],
loadMoreType: res.data.length === this.data.pageSize ? 'loading' : 'none',
loadMoreVisible: res.data.length === this.data.pageSize ? false : true
})
if (this.data.activeList.length == 0) {
this.setData({
loadMoreType: 'none',
loadMoreVisible: false,
})
}
}).catch(err => {
this.setData({
activeList: [],
loadMoreType: 'none',
loadMoreVisible: false,
})
console.log(err)
})
},
// 展开和收起 富文本内容
isShowOrHide () {
this.setData({
isShow: !this.data.isShow
})
},
// 前往活动详情
navigateToActDetail (e) {
wx.navigateTo({
url: `../allianceActDetail/allianceActDetail?id=${e.currentTarget.dataset.id}`
})
} }
}) })

1
subpages/heart/pages/allianceDetail/allianceDetail.json

@ -1,6 +1,7 @@
{ {
"navigationBarTitleText": "详情", "navigationBarTitleText": "详情",
"usingComponents": { "usingComponents": {
"load-more": "/components/loadMore/loadMore",
"parser": "../../../../components/parser/parser" "parser": "../../../../components/parser/parser"
} }
} }

39
subpages/heart/pages/allianceDetail/allianceDetail.wxml

@ -1,3 +1,40 @@
<view class="alliance-detail"> <!-- <view class="alliance-detail">
<parser html="{{noticeObjContent}}"></parser> <parser html="{{noticeObjContent}}"></parser>
</view> -->
<view class="alliance-detail-card">
<view class="alliance-info">
<view class="info-head-img"><image src="{{noticeObj.headPic}}" /></view>
<view class="info-content">
<view class="unionName">{{noticeObj.unionName}}</view>
<view class="contacts">{{noticeObj.contacts}}</view>
<view class="phone">{{noticeObj.phone}}</view>
</view>
</view>
<view class="alliance-introduce {{ isShow ? 'intro-show' : 'intro-hide' }}">
<view class="title">联盟简介</view>
<parser html="{{noticeObjContent}}"></parser>
<view class="bottom" bindtap="isShowOrHide" wx:if="{{isShowBtn}}">{{isShow ? '收起' : '展开'}}</view>
</view>
</view>
<view class="alliance-detail-card" wx:if="{{activeList.length > 0}}">
<view class="active-list">
<view class="title">共建活动</view>
<block wx:for="{{activeList}}" wx:key="index">
<view class="active-item" bindtap="navigateToActDetail" data-id="{{item.id}}">
<view class="active-img"><image src="{{item.headPic}}" /></view>
<view class="active-content">
<view class="active-contacts">{{item.title}}</view>
<view class="time-box">
<view class="time-label">时间: </view>
<view class="time-content">
<view class="active-time">{{item.actStartTime}} 至</view>
<view class="active-time">{{item.actEndTime}}</view>
</view>
</view>
</view>
</view>
<view class="active-line" wx:if="{{index < activeList.length - 1}}"></view>
</block>
</view>
</view> </view>
<load-more loadMoreType="{{loadMoreType}}" loadMoreVisible="{{loadMoreVisible}}"></load-more>

101
subpages/heart/pages/allianceDetail/allianceDetail.wxss

@ -1,4 +1,105 @@
page {
background-color: #f7f7f7;
}
.alliance-detail { .alliance-detail {
padding: 20rpx; padding: 20rpx;
box-sizing: border-box; box-sizing: border-box;
} }
.alliance-detail-card {
width: 690rpx;
overflow: hidden;
margin: 20rpx auto;
background: #fff;
box-shadow: 0rpx 5rpx 32rpx 0rpx hsla(0,0%,78%,.56);
border-radius: 14rpx;
padding: 20rpx 20rpx 0 20rpx;
box-sizing: border-box;
}
.alliance-info {
display: flex;
align-items: center;
justify-content: space-around;
margin-bottom: 40rpx;
}
.alliance-info .info-head-img {
width: 180rpx;
height: 180rpx;
}
.alliance-info .info-head-img image{
width: 100%;
height: 100%;
}
.alliance-info .info-content {
width: 400rpx;
}
.alliance-introduce {
width: 100%;
position: relative;
padding-bottom: 84rpx;
}
.intro-show {
height: auto;
padding-bottom: 80rpx;
}
.intro-hide {
max-height: 350rpx;
}
.alliance-introduce .title{
font-size: 34rpx;
margin-bottom: 20rpx;
}
.alliance-introduce .bottom {
position: absolute;
bottom: 0;
background: rgba(255, 255, 255, 1);
color: royalblue;
width: 100%;
text-align: center;
padding: 20rpx;
box-sizing: border-box;
}
.alliance-detail-card .active-list {
}
.active-list .title {
font-size: 34rpx;
margin-bottom: 20rpx;
}
.active-list .active-item {
display: flex;
align-items: center;
margin: 20rpx;
}
.active-list .active-item .active-img {
width: 150rpx;
height: 120rpx;
margin-right: 20rpx;
}
.active-img image {
width: 100%;
height: 100%;
}
.active-list .active-item .active-content {
}
.active-list .active-item .active-content .active-contacts {
margin-bottom: 10rpx;
}
.time-box {
display: flex;
}
.time-box .time-label {
font-size: 24rpx;
color: silver;
margin-right: 10rpx;
}
.active-list .active-item .active-content .active-time {
font-size: 24rpx;
color: silver;
}
.active-list .active-line {
width: 95%;
height: 1px;
background: #eeeeee;
margin: 20rpx auto;
}

3
subpages/heart/pages/allianceList/allianceList.js

@ -10,8 +10,7 @@ Page({
}, },
onLoad: function (options) { onLoad: function (options) {
this.setData({ this.setData({
pageIndex: 1, pageIndex: 1
dropbylist: []
}) })
this.getVolunteerUnionList() this.getVolunteerUnionList()
}, },

8
subpages/heart/pages/allianceList/allianceList.wxml

@ -1,8 +1,12 @@
<view class="alliance-list"> <view class="alliance-list">
<block wx:for="{{allianceList}}" wx:key="index"> <block wx:for="{{allianceList}}" wx:key="index">
<view class="alliance-item" bindtap="toAllianceDetail" data-id="{{item.id}}"> <view class="alliance-item" bindtap="toAllianceDetail" data-id="{{item.id}}">
<view class="alliance-title">{{item.unionName}}</view> <image class="headpic" src="{{item.headPic}}" />
<image class="alliance-icon" src="../../images/ic_jinruxiayiye@2x.png"/> <view class="alliance-info">
<view class="title">名称: {{item.unionName}}</view>
<view class="title">联系人: {{item.contacts}}</view>
<view class="title">电话: {{item.phone}}</view>
</view>
</view> </view>
<view class="list-line" wx:if="{{index < allianceList.length - 1}}"></view> <view class="list-line" wx:if="{{index < allianceList.length - 1}}"></view>
</block> </block>

21
subpages/heart/pages/allianceList/allianceList.wxss

@ -11,23 +11,28 @@ page {
} }
.alliance-list .alliance-item { .alliance-list .alliance-item {
width: 690rpx; width: 690rpx;
height: 110rpx;
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: space-between; justify-content: space-around;
padding: 20rpx 0;
box-sizing: border-box;
} }
.alliance-list .alliance-item .alliance-title { .alliance-item .headpic {
width: 650rpx; width: 180rpx;
height: 180rpx;
}
.alliance-item .alliance-info {
}
.alliance-list .alliance-item .title {
width: 450rpx;
margin: 10rpx 0;
font-size: 34rpx; font-size: 34rpx;
color: #333333; color: #333333;
overflow: hidden; overflow: hidden;
text-overflow:ellipsis; text-overflow:ellipsis;
white-space: nowrap; white-space: nowrap;
} }
.alliance-list .alliance-item .alliance-icon {
width: 22rpx;
height: 22rpx;
}
.alliance-list .list-line { .alliance-list .list-line {
width: 690rpx; width: 690rpx;
height: 1px; height: 1px;

17
subpages/heart/utils/api.js

@ -29,7 +29,9 @@ module.exports = {
getAppTeamListByType, getAppTeamListByType,
getAppTeamDetail, getAppTeamDetail,
getTeamVolunteerList, getTeamVolunteerList,
joinTeam joinTeam,
getVolunteerUnionActList,
getVolunteerUnionActDetail
} }
//顺道捎-首页列表 //顺道捎-首页列表
@ -179,6 +181,19 @@ function getVolunteerUnionDetail ({ id }) {
id id
}) })
} }
// 共建联盟-下属活动-列表
function getVolunteerUnionActList ({ pageIndex, pageSize, unionActId }) {
return fly.get("heart/volunteer/getVolunteerUnionActList", {
pageIndex,
pageSize,
unionActId
})
}
// 共建联盟-下属活动-详情
function getVolunteerUnionActDetail (id) {
return fly.get(`heart/volunteer/getVolunteerUnionActDetail/${id}`)
}
// 志愿团队类别-列表 // 志愿团队类别-列表
function getTeamTypeList ({ pageIndex, pageSize, teamId }) { function getTeamTypeList ({ pageIndex, pageSize, teamId }) {
return fly.get("heart/volunteer/getTeamTypeList", { return fly.get("heart/volunteer/getTeamTypeList", {

12
utils/util.js

@ -18,8 +18,16 @@ const formatRichText = html => {
let newContent= html.replace(/<img/gi, "<img style=\"width:100%;height:auto;display:block;\""); let newContent= html.replace(/<img/gi, "<img style=\"width:100%;height:auto;display:block;\"");
return newContent return newContent
} }
// 数组排序 按照 sort 属性
const compare = (property) => {
return function (a, b) {
var value1 = a[property]
var value2 = b[property]
return value1 - value2
}
}
module.exports = { module.exports = {
formatTime: formatTime, formatTime: formatTime,
formatRichText: formatRichText formatRichText: formatRichText,
compare
} }

Loading…
Cancel
Save