Browse Source

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

master
ZhaoTongYao 4 years ago
parent
commit
a613de4cb1
  1. 2
      components/activity/activity.wxml
  2. 4
      components/activity/activity.wxss
  3. 63
      pages/heartNew/heartNew.js
  4. 8
      pages/heartNew/heartNew.wxss
  5. 14
      project.config.json
  6. 101
      utils/heartBehavior.js

2
components/activity/activity.wxml

@ -14,7 +14,7 @@
<view class="user-state" wx:if="{{item.actCurrentState=='5'}}">已取消</view>
</view>
<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">
<image class="imgsize" src="https://epdc-kongcun.elinkit.com.cn/epdcFile/M00/00/07/rBAB7165A6WAcS1lAAABQRNkl7Y828.png" />
<text >时间:{{item.actStartTime}}至</text>

4
components/activity/activity.wxss

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

63
pages/heartNew/heartNew.js

@ -1,13 +1,14 @@
// pages/heartNew/heartNew.js
const app = getApp()
var api = require("../../utils/activity.js")
var heartBehavior = require("../../utils/heartBehavior")
import {
getTimestamp
} from "../../utils/common"
import checkoutVersion from "../../utils/checkVersion"
Page({
behaviors: [heartBehavior],
/**
* 页面的初始数据
*/
@ -42,7 +43,6 @@ Page({
searchName: '',
infoCompleted: 0, //是否完善了用户信息
completeInfoDialogVisible: false,
tabRightList: [], //拼团购和顺道捎
volunteerTagId: '',//志愿者标签id
tagList: [
{
@ -61,8 +61,7 @@ Page({
detailId: '', // 通过分享进入 团购详情的id
scanBtn: {}, // 扫码签到改为可配置
shouye: {},
applyBtn: {}, // 申请发单改为可配置
tabLeftList: [],
// applyBtn: {}, // 申请发单改为可配置
},
/**
@ -72,11 +71,10 @@ Page({
this.indexNew(options)
},
onLoadConfig () {
this.getModuleList()
this.loadBehavior()
this.getVolunteerVerify()
this.bannerListV2()
this.getVolunteerTags()
this.getImgUrl()//获取配置图片
this.setData({
statusHeight: app.globalData.deviceInfo.statusHeight,
navigationHeight: app.globalData.deviceInfo.navigationHeight,
@ -372,37 +370,6 @@ Page({
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
})
}
})
})
},
/**
* 页面上拉触底事件的处理函数
*/
@ -775,28 +742,6 @@ Page({
console.log(err)
})
},
// 获取模块信息
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 () {
//如果是 详情样式,直接跳转详情页面

8
pages/heartNew/heartNew.wxss

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

14
project.config.json

@ -6,38 +6,42 @@
"setting": {
"urlCheck": false,
"es6": true,
"enhance": false,
"postcss": true,
"preloadBackgroundData": false,
"minified": true,
"newFeature": true,
"coverView": true,
"nodeModules": false,
"autoAudits": false,
"showShadowRootInWxmlPanel": true,
"scopeDataCheck": false,
"uglifyFileName": false,
"checkInvalidKey": true,
"checkSiteMap": true,
"uploadWithSourceMap": true,
"compileHotReLoad": false,
"useMultiFrameRuntime": false,
"useMultiFrameRuntime": true,
"useApiHook": true,
"useApiHostProcess": true,
"babelSetting": {
"ignore": [],
"disablePlugins": [],
"outputPath": ""
},
"bundle": false,
"enableEngineNative": false,
"useIsolateContext": true,
"useCompilerModule": true,
"userConfirmedUseCompilerModuleSwitch": false,
"userConfirmedBundleSwitch": false,
"packNpmManually": false,
"packNpmRelationList": [],
"userConfirmedBundleSwitch": false,
"minifyWXSS": true
},
"compileType": "miniprogram",
"libVersion": "2.8.2",
"libVersion": "2.9.2",
"appid": "wxc4fe0ea629aaa309",
"projectname": "e%E9%94%A6%E6%B0%B4-%E5%B1%85%E6%B0%91%E7%AB%AF",
"projectname": "e锦水-志愿者端",
"cloudfunctionTemplateRoot": "",
"watchOptions": {
"ignore": []

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