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 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;

63
pages/heartNew/heartNew.js

@ -1,13 +1,14 @@
// 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"
import checkoutVersion from "../../utils/checkVersion" import checkoutVersion from "../../utils/checkVersion"
Page({ Page({
behaviors: [heartBehavior],
/** /**
* 页面的初始数据 * 页面的初始数据
*/ */
@ -42,7 +43,6 @@ Page({
searchName: '', searchName: '',
infoCompleted: 0, //是否完善了用户信息 infoCompleted: 0, //是否完善了用户信息
completeInfoDialogVisible: false, completeInfoDialogVisible: false,
tabRightList: [], //拼团购和顺道捎
volunteerTagId: '',//志愿者标签id volunteerTagId: '',//志愿者标签id
tagList: [ tagList: [
{ {
@ -61,8 +61,7 @@ Page({
detailId: '', // 通过分享进入 团购详情的id detailId: '', // 通过分享进入 团购详情的id
scanBtn: {}, // 扫码签到改为可配置 scanBtn: {}, // 扫码签到改为可配置
shouye: {}, shouye: {},
applyBtn: {}, // 申请发单改为可配置 // applyBtn: {}, // 申请发单改为可配置
tabLeftList: [],
}, },
/** /**
@ -72,11 +71,10 @@ Page({
this.indexNew(options) this.indexNew(options)
}, },
onLoadConfig () { onLoadConfig () {
this.getModuleList() this.loadBehavior()
this.getVolunteerVerify() this.getVolunteerVerify()
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,
@ -372,37 +370,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
})
}
})
})
},
/** /**
* 页面上拉触底事件的处理函数 * 页面上拉触底事件的处理函数
*/ */
@ -775,28 +742,6 @@ Page({
console.log(err) 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 () { 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
project.config.json

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