From a613de4cb184eebc631ff3db28ffe418631322d5 Mon Sep 17 00:00:00 2001 From: ZhaoTongYao <531131322@qq.com> Date: Thu, 20 May 2021 09:30:59 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BF=97=E6=84=BF=E8=80=85=E5=8E=BB=E5=93=AA?= =?UTF-8?q?=E5=B7=A6=E5=8F=B3=E8=8F=9C=E5=8D=95=E6=8E=92=E5=BA=8F=EF=BC=9B?= =?UTF-8?q?=E6=B4=BB=E5=8A=A8=E5=88=97=E8=A1=A8=E5=A2=9E=E5=8A=A0=E7=BD=AE?= =?UTF-8?q?=E9=A1=B6=E9=A1=B9=EF=BC=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/activity/activity.wxml | 2 +- components/activity/activity.wxss | 4 ++ pages/heartNew/heartNew.js | 63 ++----------------- pages/heartNew/heartNew.wxss | 8 +-- project.config.json | 14 +++-- utils/heartBehavior.js | 101 ++++++++++++++++++++++++++++++ 6 files changed, 123 insertions(+), 69 deletions(-) create mode 100644 utils/heartBehavior.js diff --git a/components/activity/activity.wxml b/components/activity/activity.wxml index a477f2d..f4c8c57 100644 --- a/components/activity/activity.wxml +++ b/components/activity/activity.wxml @@ -14,7 +14,7 @@ 已取消 - {{item.title}} + 置顶 {{item.title}} 时间:{{item.actStartTime}}至 diff --git a/components/activity/activity.wxss b/components/activity/activity.wxss index 9dc234c..67167f0 100644 --- a/components/activity/activity.wxss +++ b/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; diff --git a/pages/heartNew/heartNew.js b/pages/heartNew/heartNew.js index 08fe0de..644b290 100644 --- a/pages/heartNew/heartNew.js +++ b/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 () { //如果是 详情样式,直接跳转详情页面 diff --git a/pages/heartNew/heartNew.wxss b/pages/heartNew/heartNew.wxss index ece2d4e..36ff3b7 100644 --- a/pages/heartNew/heartNew.wxss +++ b/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 { diff --git a/project.config.json b/project.config.json index 65e78cd..00c7f69 100644 --- a/project.config.json +++ b/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": [] diff --git a/utils/heartBehavior.js b/utils/heartBehavior.js new file mode 100644 index 0000000..1d55407 --- /dev/null +++ b/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() + }) + }) + } + } +}) \ No newline at end of file