Browse Source

志愿者去哪左右菜单排序;活动列表增加置顶项;

release
ZhaoTongYao 4 years ago
parent
commit
dd84224a20
  1. 2
      components/activity/activity.wxml
  2. 4
      components/activity/activity.wxss
  3. 116
      pages/heartNew/heartNew.js
  4. 8
      pages/heartNew/heartNew.wxss
  5. 14
      pages/indexNew/indexNew.js
  6. 2
      pages/indexNew/indexNew.wxss
  7. 2
      pages/toRegister/toRegister.js
  8. 2
      project.config.json
  9. 101
      utils/heartBehavior.js

2
components/activity/activity.wxml

@ -14,7 +14,7 @@
<view class="user-state" wx:if="{{item.actCurrentState=='5'}}">已取消</view> <view class="user-state" wx:if="{{item.actCurrentState=='5'}}">已取消</view>
</view> </view>
<view class="infos"><view class="infos-flex"> <view class="infos"><view class="infos-flex">
<view class="infos_title">{{item.title}}</view> <view class="infos_title"><text class="top" wx:if="{{item.topFlag == '1'}}">置顶</text> {{item.title}}</view>
<view class="infos_times"> <view class="infos_times">
<image class="imgsize" src="https://epdc-kongcun.elinkit.com.cn/epdcFile/M00/00/07/rBAB7165A6WAcS1lAAABQRNkl7Y828.png" /> <image class="imgsize" src="https://epdc-kongcun.elinkit.com.cn/epdcFile/M00/00/07/rBAB7165A6WAcS1lAAABQRNkl7Y828.png" />
<text >时间:{{item.actStartTime}}至</text> <text >时间:{{item.actStartTime}}至</text>

4
components/activity/activity.wxss

@ -84,6 +84,10 @@
-webkit-box-orient: vertical; -webkit-box-orient: vertical;
-webkit-line-clamp: 2; -webkit-line-clamp: 2;
} }
.infos .infos_title .top {
color: #ff0000;
font-size: 28rpx;
}
.infos .infos-flex { .infos .infos-flex {
height: 100%; height: 100%;
display: flex; display: flex;

116
pages/heartNew/heartNew.js

@ -1,11 +1,12 @@
// pages/heartNew/heartNew.js // pages/heartNew/heartNew.js
const app = getApp() const app = getApp()
var api = require("../../utils/activity.js") var api = require("../../utils/activity.js")
var heartBehavior = require("../../utils/heartBehavior")
import { import {
getTimestamp getTimestamp
} from "../../utils/common" } from "../../utils/common"
Page({ Page({
behaviors: [heartBehavior],
/** /**
* 页面的初始数据 * 页面的初始数据
*/ */
@ -15,32 +16,31 @@ Page({
selectedTab: "tab0", selectedTab: "tab0",
// banner 相关 // banner 相关
banner: [], banner: [],
indicatorDots: false, //指示点 indicatorDots: false, // 指示点
autoplay: true, //true false,//自动播放 autoplay: true, // true false,//自动播放
circular: true, //衔接滑动 circular: true, // 衔接滑动
interval: 4000, //自动播放间隔时长(ms) interval: 4000, // 自动播放间隔时长(ms)
duration: 500, //幻灯片切换时长(ms) duration: 500, // 幻灯片切换时长(ms)
currentSwiper: 0, currentSwiper: 0,
// banner 相关end // banner 相关end
// 列表相关 // 列表相关
loadMoreVisible: false, //false loadMoreVisible: false, // false
loadMoreType: "none", //loading none loadMoreType: "none", // loading none
dingdan: false,//判断订单列表隐藏 dingdan: false, // 判断订单列表隐藏
jingcai: true,//判断精彩列表隐藏 jingcai: true, // 判断精彩列表隐藏
indexPage: 1, indexPage: 1,
pageSize: 10, pageSize: 10,
qkdat: false,//判断是否清空数据 qkdat: false, // 判断是否清空数据
actId: "",//判断返回以后是否需要刷新列表 actId: "", // 判断返回以后是否需要刷新列表
volunteerlist:[],//志愿者列表 volunteerlist:[],// 志愿者列表
volunteerCount: 0, //志愿者注册数 volunteerCount: 0, // 志愿者注册数
listLength:0,//数据长度判断是否需要加载 listLength:0, // 数据长度判断是否需要加载
getImgUrl:"", getImgUrl:"", // 顶部咨询电话图片
ifClickImage:false,//因为志友多多点击图片查看大图,会出现列表刷新的bug,所以加这个字段进行控制 ifClickImage:false,//因为志友多多点击图片查看大图,会出现列表刷新的bug,所以加这个字段进行控制
tabFixed: false, tabFixed: false,
searchName: '', searchName: '',
infoCompleted: 0, //是否完善了用户信息 infoCompleted: 0, //是否完善了用户信息
completeInfoDialogVisible: false, completeInfoDialogVisible: false,
tabRightList: [], //拼团购和顺道捎
volunteerTagId: '',//志愿者标签id volunteerTagId: '',//志愿者标签id
tagList: [ tagList: [
{ {
@ -53,18 +53,17 @@ Page({
btnLeft: 0, btnLeft: 0,
shouye: {}, shouye: {},
scanBtn: {}, // 扫码签到改为可配置 scanBtn: {}, // 扫码签到改为可配置
applyBtn: {}, // 申请发单按钮改为可配置 // applyBtn: {}, // 申请发单按钮改为可配置,
tabLeftList: [], // 首页配置按钮+申请发单按钮
}, },
/** /**
* 生命周期函数--监听页面加载 * 生命周期函数--监听页面加载
*/ */
onLoad: function () { onLoad: function () {
this.getModuleList() this.loadBehavior()
this.bannerListV2() this.bannerListV2()
this.getVolunteerTags() this.getVolunteerTags()
this.getImgUrl()//获取配置图片
this.setData({ this.setData({
statusHeight: app.globalData.deviceInfo.statusHeight, statusHeight: app.globalData.deviceInfo.statusHeight,
navigationHeight: app.globalData.deviceInfo.navigationHeight, navigationHeight: app.globalData.deviceInfo.navigationHeight,
@ -367,59 +366,6 @@ Page({
console.log(err) console.log(err)
}) })
}, },
// 获取配置图片
getImgUrl:function (){//0:咨询热线
let params = {
imageTypes: '0, 5, 8, 9'
}
api.getImgUrlList(params).then(res => {
console.log(res.data)
this.data.tabRightList = []
res.data.forEach( item => {
if (item.imgType == '0') {
this.setData({
getImgUrl: item
})
} else if (item.imgType == '5') {
this.data.tabRightList.push(item)
this.setData({
tabRightList: this.data.tabRightList
})
} else if (item.imgType == '8') {
this.setData({
scanBtn: item
})
} else if (item.imgType == '9') {
this.data.tabLeftList[0] = item
this.setData({
tabLeftList: this.data.tabLeftList
})
}
})
})
return
let that = this
api.getImgUrl("0").then(function (res) {
that.setData({
getImgUrl: res.data[0]
})
})
// 2021.03.31 拼团购顺道捎移至首页
// 2021.04.28 拼团购顺道捎移回...
api.getImgUrl("5").then(function (res) {
that.setData({
tabRightList: res.data
})
})
api.getImgUrl("8").then(function (res) {
console.log(res.data)
if (res.data.length > 0) {
that.setData({
scanBtn: res.data[0]
})
}
})
},
/** /**
* 页面上拉触底事件的处理函数 * 页面上拉触底事件的处理函数
*/ */
@ -634,28 +580,6 @@ Page({
} }
}) })
}, },
// 获取模块信息
getModuleList: function () {
let params = {
pageIndex: 1,
pageSize: 10,
pid: '0'
}
api.moduleCategory(params).then(res => {
console.log('获取模块列表',res.data)
res.data.forEach( item => {
if (item.categoryCode == 'shouye') {
this.data.tabLeftList[1] = item
this.setData({
shouye: item,
tabLeftList: this.data.tabLeftList
})
}
})
}).catch(err => {
console.log(err)
})
},
//跳转到 页面 //跳转到 页面
toShouye () { toShouye () {
//如果是 详情样式,直接跳转详情页面 //如果是 详情样式,直接跳转详情页面

8
pages/heartNew/heartNew.wxss

@ -300,8 +300,8 @@ button:last-child {
flex-direction: column; flex-direction: column;
} }
.tab-left image { .tab-left image {
width: 200rpx; width: 186rpx;
height: 88rpx; height: 102rpx;
} }
.tab-left .tab { .tab-left .tab {
position: relative; position: relative;
@ -318,12 +318,12 @@ button:last-child {
position: fixed; position: fixed;
right: 0; right: 0;
z-index: 997; z-index: 997;
margin-top: 20rpx; margin-top: 36rpx;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
} }
.tab-right image { .tab-right image {
width: 160rpx; width: 186rpx;
height: 102rpx; height: 102rpx;
} }
.tab-right .tab { .tab-right .tab {

14
pages/indexNew/indexNew.js

@ -165,8 +165,14 @@ Page({
} }
}) })
api.getImgUrl("5").then(res => { api.getImgUrl("5").then(res => {
this.setData({ this.data.tabRightList = []
tabRightList: res.data res.data.forEach(item => {
if (item.imgCode == 'ptg-sy' || item.imgCode == 'sds-sy') {
this.data.tabRightList.push(item)
this.setData({
tabRightList: this.data.tabRightList
})
}
}) })
}) })
}, },
@ -803,11 +809,11 @@ Page({
}, },
//拼团购/顺道捎 跳转 2021.03.31 //拼团购/顺道捎 跳转 2021.03.31
toJumpPage (e) { toJumpPage (e) {
if (e.currentTarget.dataset.code == 'ptg') { if (e.currentTarget.dataset.code == 'ptg-sy') {
wx.navigateTo({ wx.navigateTo({
url: `/subpages/heart/pages/groupBuyList/groupBuyList?title=${e.currentTarget.dataset.title}` url: `/subpages/heart/pages/groupBuyList/groupBuyList?title=${e.currentTarget.dataset.title}`
}) })
} else if (e.currentTarget.dataset.code == 'sds') { } else if (e.currentTarget.dataset.code == 'sds-sy') {
wx.navigateTo({ wx.navigateTo({
url: `/subpages/heart/pages/dropByList/dropByList?title=${e.currentTarget.dataset.title}` url: `/subpages/heart/pages/dropByList/dropByList?title=${e.currentTarget.dataset.title}`
}) })

2
pages/indexNew/indexNew.wxss

@ -673,7 +673,7 @@ page {
flex-direction: column; flex-direction: column;
} }
.tab-right image { .tab-right image {
width: 160rpx; width: 186rpx;
height: 102rpx; height: 102rpx;
} }
.tab-right .tab { .tab-right .tab {

2
pages/toRegister/toRegister.js

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

2
project.config.json

@ -35,7 +35,7 @@
"minifyWXSS": true "minifyWXSS": true
}, },
"compileType": "miniprogram", "compileType": "miniprogram",
"libVersion": "2.8.2", "libVersion": "2.9.2",
"appid": "wx6dcf544cdae7d4ec", "appid": "wx6dcf544cdae7d4ec",
"projectname": "e%E9%94%A6%E6%B0%B4-%E5%B1%85%E6%B0%91%E7%AB%AF", "projectname": "e%E9%94%A6%E6%B0%B4-%E5%B1%85%E6%B0%91%E7%AB%AF",
"cloudfunctionTemplateRoot": "", "cloudfunctionTemplateRoot": "",

101
utils/heartBehavior.js

@ -0,0 +1,101 @@
// heartBehavior.js 用于更改e锦水小程序和志愿者小程序共同行为
// 数组排序 按照 sort 属性
function compare(property) {
return function (a, b) {
var value1 = a[property]
var value2 = b[property]
return value1 - value2
}
}
// 拆分数组
function group(array, subGroupLength) {
let index = 0
let newArray = []
while(index < array.length) {
newArray.push(array.slice(index, index += subGroupLength))
}
return newArray
}
var api = require("activity.js")
module.exports = Behavior ({
data: {
tabList: [],
tabRightList: [], //拼团购和顺道捎
tabLeftList: [], // 首页配置按钮+申请发单按钮
},
methods: {
// beheaviors 加载成功 基础库2.9.2
loadBehavior () {
console.log('load heartBehavior')
Promise.all([this.getModuleList(), this.getImgUrl()]).then( () => {
let newArr = group(this.data.tabList.sort(compare('sort')), 2)
this.setData({
tabLeftList: newArr[0],
tabRightList: newArr[1]
})
})
},
// 获取模块信息
getModuleList: function () {
return new Promise((resolve, reject) => {
let params = {
pageIndex: 1,
pageSize: 10,
pid: '0'
}
api.moduleCategory(params).then(res => {
console.log('获取模块列表',res.data)
res.data.forEach( item => {
if (item.categoryCode == 'shouye') {
this.data.tabList.push(item)
this.setData({
shouye: item,
tabList: this.data.tabList
})
}
})
resolve()
}).catch(err => {
console.log(err)
reject()
})
})
},
// 获取配置图片
getImgUrl:function (){
return new Promise((resolve, reject) => {
let params = {
imageTypes: '0, 5, 8, 9'
}
api.getImgUrlList(params).then(res => {
res.data.forEach( item => {
if (item.imgType == '0') {
this.setData({
getImgUrl: item
})
} else if (item.imgType == '5' && (item.imgCode == 'ptg' || item.imgCode == 'sds')) {
this.data.tabList.push(item)
this.setData({
tabList: this.data.tabList
})
} else if (item.imgType == '8') {
this.setData({
scanBtn: item
})
} else if (item.imgType == '9') {
this.data.tabList.push(item)
this.setData({
tabList: this.data.tabList
})
}
})
resolve()
}).catch(err => {
console.log(err)
reject()
})
})
}
}
})
Loading…
Cancel
Save