diff --git a/pages/index/index.js b/pages/index/index.js
index b3d7d59..65187cb 100644
--- a/pages/index/index.js
+++ b/pages/index/index.js
@@ -44,8 +44,6 @@ Page({
*/
timer: null,
onLoad: function (options) {
- console.log("articles", this.data.articles);
-
this.getLocationData()
wx.showLoading()
@@ -86,6 +84,8 @@ Page({
})
this.getTopTitle()
+ this.ratio = app.globalData.screen_data['windowWidth'] / 750
+
} else {
setTimeout(function () {
that.get_config()
@@ -407,20 +407,101 @@ Page({
listData: data
})
- this.calculate()
+ this.query = wx.createSelectorQuery();
+ this.calculateProcessingCenter()
})
},
+ listDataIndex: 0,
+ leftHeight: 0, // px 单位
+ rightHeight: 0,
+ ratio: 0,
+ query: null,
// 计算
calculateProcessingCenter() {
- // let
+ if (this.listDataIndex >= this.data.listData.length) {
+
+ this.setData({
+ listDataLeft: this.data.listDataLeft,
+ listDataRight: this.data.listDataRight
+ })
+ return
+ }
+
+
+ let ratio = this.ratio
+
+ if (this.ratio) this.ratio = this.data.screen_data['windowWidth'] / 750
+ let targetData = this.data.listData[this.listDataIndex]
+ let type = targetData['type']
+ if (type == 'adv') {
+ this.getPictureHeight(targetData.image).then(res => {
+ this.whichSide(res, targetData)
+ })
+ } else {
+ let altitude = 0 // rpx
+
+ if (type == 'apartment') {
+ altitude = 105
+ if (targetData['specifications'].length > 2) altitude += 100
+ else altitude += 64 * targetData['specifications'].length
+ } else {
+ altitude = 141
+ }
+
+ altitude = altitude * ratio // 转 px
+
+ this.setData({
+ targetData
+ })
+
+ this.getPictureHeight(targetData.image).then(res => {
+ altitude += res
+ let select = type == 'apartment' ? '#apartment' : '#general'
+
+ this.query.select(select).boundingClientRect(rect => {
+ let height = rect.height;
+ altitude += height
+ this.whichSide(altitude, targetData)
+ }).exec();
+
+ })
+ }
+
+ console.log(this.data.listDataLeft, this.data.listDataRight);
+ },
+
+ // 判断在哪边的
+ whichSide(res, targetData) {
+ console.log(this.leftHeight <= this.rightHeight, this.leftHeight, this.rightHeight);
+ if (this.leftHeight <= this.rightHeight) {
+ this.leftHeight = this.leftHeight + res
+ this.data.listDataLeft.push(targetData)
+ } else {
+ this.rightHeight = this.rightHeight + res
+ this.data.listDataRight.push(targetData)
+ }
+
+ this.setData({
+ targetData: null
+ })
+ this.listDataIndex++
+ this.calculateProcessingCenter()
},
// 获取图片高度
- getPictureHeight() {
- new Promise((resolve, reject) => {
+ getPictureHeight(src) {
+ return new Promise((resolve, reject) => {
wx.getImageInfo({
- src: '',
+ src,
+ success: res => {
+ let {
+ width,
+ height
+ } = res
+ let actual = height / width * 337 * this.ratio
+ resolve(actual)
+ }
})
})
}
diff --git a/pages/index/index.wxml b/pages/index/index.wxml
index 2d1b6e5..be81788 100644
--- a/pages/index/index.wxml
+++ b/pages/index/index.wxml
@@ -1,4 +1,13 @@
+
+
+
+
+ {{ targetData['title'] }}
+ {{ targetData['propaganda'] }}
+
+ {{ targetData['title'] }}
+
{{ topTitle }}
@@ -146,57 +155,33 @@
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
- {{ item.title }}
- {{ item.propaganda }}
-
-
-
- {{ it.title }}
-
- HK$
- {{ it.value }}
- /月
-
-
-
-
- 更多
-
-
-
-
- {{ item.gptype }}
-
-
- {{ item.leaseterm }}
- {{ item.title }}
-
-
-
- {{ item.housingtype }}
- {{ item.gender }}
- {{ item.leaseterm }}
-
-
-
- HK$
- {{ item.rent }}
- /月
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -378,4 +363,59 @@
-
\ No newline at end of file
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{ item.title }}
+ {{ item.propaganda }}
+
+
+
+ {{ it.title }}
+
+ HK$
+ {{ it.value }}
+ /月
+
+
+
+
+ 更多
+
+
+
+
+
+
+ {{ item.gptype }}
+
+
+ {{ item.leaseterm }}
+ {{ item.title }}
+
+
+
+ {{ item.housingtype }}
+ {{ item.gender }}
+ {{ item.leaseterm }}
+
+
+
+ HK$
+ {{ item.rent }}
+ /月
+
+
+
\ No newline at end of file
diff --git a/pages/index/index.wxss b/pages/index/index.wxss
index 99ce70c..cd4a0cb 100644
--- a/pages/index/index.wxss
+++ b/pages/index/index.wxss
@@ -824,6 +824,13 @@
color: #000000;
line-height: 48rpx;
padding: 0 15rpx;
+ display: -webkit-box;
+ display: -ms-flexbox;
+ /* display: flex; */
+ -webkit-box-orient: vertical;
+ -webkit-line-clamp: 3;
+ overflow: hidden;
+ text-overflow: ellipsis;
}
.pinterest-list .pinterest-list-item.general .general-tag {
@@ -943,4 +950,31 @@
.waterfall-item {
width: 300rpx;
- }
\ No newline at end of file
+}
+
+.apartment1-name {
+ font-size: 27rpx;
+ color: #000000;
+ font-weight: 650;
+ padding: 13.5rpx 15rpx;
+}
+
+.apartment1-introduce {
+ color: #aaaaaa;
+ font-size: 21rpx;
+ padding: 0 15rpx;
+}
+
+.general-name1 {
+ font-size: 27rpx;
+ color: #000000;
+ line-height: 48rpx;
+ padding: 0 15rpx;
+ display: -webkit-box;
+ display: -ms-flexbox;
+ /* display: flex; */
+ -webkit-box-orient: vertical;
+ -webkit-line-clamp: 3;
+ overflow: hidden;
+ text-overflow: ellipsis;
+}
\ No newline at end of file
diff --git a/pages/personList/personList.js b/pages/personList/personList.js
index b2c2ce5..9bfbb4b 100644
--- a/pages/personList/personList.js
+++ b/pages/personList/personList.js
@@ -373,6 +373,7 @@ Page({
}
}
}
+
if (ishere) {
searchindex = i;
this.setData({