Browse Source

志愿者增加标签分类;

release
ZhaoTongYao 5 years ago
parent
commit
49f451d63b
  1. 62
      pages/heartNew/heartNew.js
  2. 9
      pages/heartNew/heartNew.wxml
  3. 58
      pages/heartNew/heartNew.wxss
  4. 2
      pages/toRegister/toRegister.js
  5. 42
      subpages/heart/pages/volunteer/volunteer.js
  6. 14
      subpages/heart/pages/volunteer/volunteer.wxml
  7. 5
      subpages/heart/pages/volunteer/volunteer.wxss
  8. 7
      utils/activity.js
  9. 7
      utils/api.js

62
pages/heartNew/heartNew.js

@ -41,6 +41,14 @@ Page({
infoCompleted: 0, //是否完善了用户信息
completeInfoDialogVisible: false,
tabRightList: [], //拼团购和顺道捎
volunteerTagId: '',//志愿者标签id
tagList: [
{
tagName: '全部',
id: ''
}
],
isLoading: false, //防止标签切换加载数据时点击切换标签
},
/**
@ -48,6 +56,7 @@ Page({
*/
onLoad: function () {
this.bannerListV2()
this.getVolunteerTags()
this.getImgUrl()//获取配置图片
this.setData({
statusHeight: app.globalData.deviceInfo.statusHeight,
@ -96,7 +105,8 @@ Page({
let parms = {
pageIndex: this.data.indexPage,
pageSize: this.data.pageSize,
nickname: this.data.searchName
nickname: this.data.searchName,
volunteerTagId: this.data.volunteerTagId
}
this.volunteerlist(parms)
}
@ -157,7 +167,8 @@ Page({
let parms = {
pageIndex: this.data.indexPage,
pageSize: this.data.pageSize,
nickname: this.data.searchName
nickname: this.data.searchName,
volunteerTagId: this.data.volunteerTagId
}
this.volunteerlist(parms)
} else if (e.currentTarget.dataset.tab == "tab2") {
@ -229,7 +240,8 @@ Page({
that.setData({
listLength:res.data.volunteerList.length,
volunteerlist:that.data.volunteerlist.concat(res.data.volunteerList),
volunteerCount: res.data.volunteerCount
volunteerCount: res.data.volunteerCount,
isLoading: false
})
})
},
@ -288,7 +300,8 @@ Page({
let parms = {
pageIndex: this.data.indexPage,
pageSize: this.data.pageSize,
nickname: this.data.searchName
nickname: this.data.searchName,
volunteerTagId: this.data.volunteerTagId
}
this.volunteerlist(parms)
},
@ -324,6 +337,20 @@ Page({
wx.stopPullDownRefresh();
})
},
// 获取志愿者标签列表
getVolunteerTags () {
api.getVolunteerTags().then(res => {
if (res.code == 0 && res.msg == 'success') {
const tagList = this.data.tagList.concat(res.data)
console.log('志愿者标签列表: ', tagList)
this.setData({
tagList
})
}
}).catch(err => {
console.log(err)
})
},
// 获取配置图片
getImgUrl:function (){//0:咨询热线
let that = this
@ -372,7 +399,8 @@ Page({
let parms = {
pageIndex: this.data.indexPage,
pageSize: this.data.pageSize,
nickname: this.data.searchName
nickname: this.data.searchName,
volunteerTagId: this.data.volunteerTagId
}
this.volunteerlist(parms)
} else if (this.data.selectedTab == "tab2") {
@ -475,4 +503,28 @@ Page({
})
}
},
//选择志愿者标签筛选
changeTag (e) {
if (this.data.isLoading) {
wx.showToast({
title: '正在加载...',
icon: 'loading',
})
return
}
const id = e.currentTarget.dataset.id
this.setData({
volunteerTagId: id,
volunteerlist: [],
indexPage: 1,
isLoading: true
})
let parms = {
pageIndex: this.data.indexPage,
pageSize: this.data.pageSize,
nickname: this.data.searchName,
volunteerTagId: this.data.volunteerTagId
}
this.volunteerlist(parms)
}
})

9
pages/heartNew/heartNew.wxml

@ -83,6 +83,8 @@
<!-- 志友朵朵 -->
<block wx:if="{{ selectedTab == 'tab1' }}">
<view class="details-top">
<view class="top-box">
<view class="reg-count">志愿者注册数:{{volunteerCount}}</view>
<view class="search">
<view class="item-all">
<view class="item-left">
@ -92,7 +94,12 @@
<button class="item-right" bindtap="searchName" hover-class="none">搜索</button>
</view>
</view>
<view class="reg-count">志愿者注册数:{{volunteerCount}}</view>
<scroll-view scroll-x="{{true}}" class="scroll-tag">
<view class="volunteer-tag">
<view class="tag {{volunteerTagId == item.id ? 'sel' : ''}}" wx:for="{{tagList}}" wx:key="index" data-id="{{item.id}}" bindtap="changeTag">{{item.tagName}}</view>
</view>
</scroll-view>
</view>
<view class="volunteer-box">
<volunteer-list bind:clickImage="clickImage" wx:for="{{volunteerlist}}" volunteerItemObj="{{item}}" wx:for-index="index" wx:for-item="item" wx:key="index"></volunteer-list>
</view>

58
pages/heartNew/heartNew.wxss

@ -393,13 +393,54 @@ button:last-child {
.details-top {
margin-top: 385rpx;
}
.top-box {
width: 100%;
display: flex;
flex-wrap: wrap;
justify-content: center;
align-items: center;
background-color: #fff;
padding: 0 20rpx;
box-sizing: border-box;
}
.reg-count {
font-size: 22rpx;
color: #999;
line-height: 22rpx;
padding-left: 40rpx;
font-size: 28rpx;
color: #666;
line-height: 28rpx;
width: 270rpx;
margin-top: 26rpx;
}
.scroll-tag {
height: 100rpx;
display: flex;
align-items: center;
}
.volunteer-tag {
background: rgba(255, 255, 255, 1);
display: flex;
white-space: nowrap;
flex-direction: row;
align-items: center;
margin: 10rpx 0rpx;
height: 80rpx;
}
.volunteer-tag .tag {
border: 1px solid #999999;
border-radius: 32rpx;
padding: 10rpx;
margin: 0 10rpx;
font-size: 28rpx;
font-family: PingFang SC;
font-weight: 500;
color: #333333;
min-width: 140rpx;
text-align: center;
}
.volunteer-tag .sel {
border: 1px solid #da433d;
background-color: #da433d;
color: #fff;
}
.volunteer-box {
display: flex;
align-items: center;
@ -420,12 +461,13 @@ button:last-child {
.search {
/* margin-top: 17rpx; */
height: 66rpx;
background: rgba(255, 255, 255, 1);
width: 410rpx;
background: #f7f7f7;
border-radius: 33rpx;
display: flex;
align-items: center;
justify-content: center;
margin: 10rpx 40rpx;
margin-top: 26rpx;
}
.search .item-all {
@ -469,7 +511,7 @@ button:last-child {
font-size: 28rpx;
font-weight: 500;
color: rgba(51, 51, 51, 1);
background-color: #fff;
background-color: #f7f7f7;
}
.search button {
width: 100rpx;

2
pages/toRegister/toRegister.js

@ -21,7 +21,7 @@ Page({
// }
// })
let that = this
const versionNum = "1.6.19"
const versionNum = "1.6.20"
api.getScanSwitch(versionNum).then(function (res) {
console.log(res.data)
let state = res.data.scanFlag

42
subpages/heart/pages/volunteer/volunteer.js

@ -39,6 +39,12 @@ Page({
uploadImageList: [],
disabled:false,
lock: false, //锁定提交状态,防止连击
volunteerTag: {}, //志愿者标签id
tagList: [{
tagName: '请选择',
id: '0'
}],
tagIndex: 0,
},
onLoad: function () {
this.setData({
@ -48,6 +54,7 @@ Page({
this.getImgUrl()
this.getPrepareComplete().then(() => {
this.getGridList()
this.getVolunteerTags()
})
this.checkWxUnionId()
this.getWxCode()
@ -112,6 +119,26 @@ Page({
volunteerSignature: e.detail.value
})
},
// 获取志愿者标签列表
getVolunteerTags () {
api.getVolunteerTags().then(res => {
if (res.code == 0 && res.msg == 'success') {
this.setData({
tagList: this.data.tagList.concat(res.data)
})
res.data.forEach((item, key) => {
if (item.id == this.data.volunteerTag.id) {
this.setData({
'volunteerTag.tag': item.tagName,
tagIndex: parseInt(key)+1
})
}
})
}
}).catch(err => {
console.log(err)
})
},
// 获取配置图片
getImgUrl:function (){//0:咨询热线
let that = this
@ -180,6 +207,7 @@ Page({
volunteerNickname:res.data.volunteerNickname,
volunteerSignature:res.data.volunteerSignature,
volunteerFaceImg:res.data.volunteerFaceImg,
'volunteerTag.id': res.data.volunteerTagId || '0'
// introduce:res.data.introduce
})
resolve(true)
@ -256,6 +284,10 @@ Page({
this.showToast("请输入昵称")
return false
}
if (this.data.volunteerTag.id == '0') {
this.showToast("请选择小组")
return false
}
// if(!this.data.volunteerSignature){
// this.showToast("请输入格言")
// return false
@ -290,6 +322,7 @@ Page({
volunteerFaceImg:this.data.volunteerFaceImg,
volunteerNickname:this.data.volunteerNickname,
volunteerSignature:this.data.volunteerSignature,
volunteerTagId: this.data.volunteerTag.id,
wxCode: this.data.unionIdStatus === "1" ? "" : this.data.wxCode,
encryptedData: this.data.unionIdStatus === "1" ? "" : this.data.encryptedData,
iv: this.data.unionIdStatus === "1" ? "" : this.data.iv
@ -527,4 +560,13 @@ Page({
destructiveButtonClicked () {},
})
},
//
choosePicker (e) {
let index = e.detail.value
this.setData({
tagIndex: index,
'volunteerTag.id': this.data.tagList[index].id,
'volunteerTag.tag': this.data.tagList[index].tagName
})
},
})

14
subpages/heart/pages/volunteer/volunteer.wxml

@ -77,19 +77,27 @@
<!-- 头像 -->
<view class="my-info magin-top">
<view class="head-portrait">
<view class="head-portrait-name">头像</view>
<view class="head-portrait-name"><text class="must">*</text>头像</view>
<view class="head-portrait-image" bindtap="chooseImage">
<image class="photo" src="{{volunteerFaceImg}}"></image>
<image class="photo-right" src="../../images/ic_jinruxiayiye@2x.png"></image>
</view>
</view>
<view class="head-portrait">
<view class="head-portrait-name">昵称</view>
<view class="head-portrait-name"><text class="must">*</text>昵称</view>
<view class="nickname">
<input class="nicknameinput" bindblur="nickname" bindinput="nickname" value="{{volunteerNickname}}" placeholder-class="placeholder-style" placeholder="请输入您的昵称" />
</view>
</view>
<view class="head-portrait">
<view class="head-portrait-name"><text class="must">*</text>选择小组</view>
<!-- <view class="time">{{volunteerTag.tag}}</view> -->
<picker bindchange="choosePicker" value="{{tagIndex}}" range="{{tagList}}" range-key="tagName">
<view class="picker">
{{tagList[tagIndex].tagName}}
</view>
</picker>
</view>
<view class="head-portrait-last">
<view class="head-portrait-name-last">格言</view>
</view>

5
subpages/heart/pages/volunteer/volunteer.wxss

@ -380,6 +380,11 @@ button::after {
color: rgba(51, 51, 51, 1);
}
.head-portrait .head-portrait-name .must {
color: #F61616;
font-size: 30rpx;
}
.head-portrait .head-portrait-image {
width: 95rpx;
height: 100%;

7
utils/activity.js

@ -6,7 +6,8 @@ module.exports = {
volunteerlist,
volunteerV2list,
getImgUrl,
getBannerDetail
getBannerDetail,
getVolunteerTags
}
function getActivityList (params) {
@ -37,3 +38,7 @@ function getImgUrl (imgType) {
function getBannerDetail (id) {
return fly.get(`heart/act/banner/detail/${id}`)
}
//志愿者标签列表
function getVolunteerTags () {
return fly.get(`app-user/volunteer/tags`)
}

7
utils/api.js

@ -64,7 +64,8 @@ module.exports = {
moduleCategory: moduleCategory,
reportIssue: reportIssue,
reportIssueList: reportIssueList,
reportIssueDetail: reportIssueDetail
reportIssueDetail: reportIssueDetail,
getVolunteerTags: getVolunteerTags
}
function getToken (wxCode) {
@ -581,3 +582,7 @@ function reportIssueList(para) {
function reportIssueDetail (id) {
return fly.get(`custom/reportissue/detail/${id}`)
}
//志愿者标签列表
function getVolunteerTags () {
return fly.get(`app-user/volunteer/tags`)
}
Loading…
Cancel
Save