This commit is contained in:
A1300399510 2023-05-24 19:47:19 +08:00
parent 1f99616328
commit c30846a9de
27 changed files with 1583 additions and 1234 deletions

BIN
img/map-icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 978 B

View File

@ -470,4 +470,20 @@
</navigator>
</view>
</view>
</template>
<!-- 列表和搜索页面的 搜索框 -->
<template name="header-search">
<view class='header-search flexacenter'>
<form class="flexacenter" bindsubmit="submit" report-submit='true' data-types="confirm">
<image class="search-icon" src="../../img/search-icon.svg"></image>
<input disabled="{{ disabled }}" placeholder='搜索房源或输入房源ID' placeholder-class='placeholder' confirm-type='search' value='{{ kw }}' bindinput='input' bindconfirm='submit' focus="{{ focus }}"></input>
<view class="clear" bindtap="clearKW" hidden="{{ kw.length==0 }}">
<image class="clear-icon" src="/img/gray-cross.png"></image>
</view>
</form>
<view class="map-btn flexcenter">
<image class="map-btn-icon" mode="widthFix" src="/img/map-icon.png"></image>
</view>
</view>
</template>

View File

@ -609,4 +609,73 @@
color: #555555;
font-size: 27rpx;
margin-bottom: 24rpx;
}
.header-search {
padding: 20rpx 30rpx 48rpx;
font-size: 0;
}
.header-search form {
background: #fff;
width: 588rpx;
height: 84rpx;
padding: 0 30rpx;
box-sizing: border-box;
vertical-align: middle;
color: #333;
position: relative;
border-radius: 306rpx;
box-shadow: 0 0 12rpx rgba(0, 0, 0, 0.0784313725490196);
}
.header-search .search-icon {
width: 30rpx;
height: 30rpx;
vertical-align: sub;
}
.header-search input {
display: inline-flex;
height: 84rpx;
font-size: 28rpx;
padding: 0 10rpx;
box-sizing: border-box;
background-color: #fff;
text-align: left;
}
.header-search .clear {
position: absolute;
right: 0;
top: 50%;
padding: 30rpx;
transform: translateY(-50%);
}
.header-search .clear .clear-icon {
width: 30rpx;
height: 30rpx;
}
.header-search navigator {
font-size: 30rpx;
display: inline-block;
width: 80rpx;
text-align: right;
vertical-align: middle;
}
.header-search .map-btn {
width: 84rpx;
height: 84rpx;
border-radius: 232.5rpx;
background-color: #fff;
box-shadow: 0 0 12rpx rgba(0, 0, 0, 0.0784313725490196);
margin-left: 19.5rpx;
}
.header-search .map-btn .map-btn-icon {
width: 42rpx;
height: 42rpx;
}

View File

@ -228,18 +228,9 @@ Page({
wx.navigateTo({
url,
})
},
// 新 轮播图 自动滑动事件,修改下标
bindchangeSwiper(e) {
let current = e.detail.current
this.setData({
swiperCurrent: current
})
},
// 新 轮播图 点击事件
// 新 瀑布流 点击事件
handleSwiper(e) {
let {
appid,
@ -252,13 +243,12 @@ Page({
advtype,
} = e.currentTarget.dataset
let requestUrl = advertisingtype == 'lazyloading' ? `${app.globalData.baseURL}/tenement/v2/api/ad/click` : app.globalData.config.FormidInsert
let requestUrl = `${app.globalData.baseURL}/tenement/v2/api/ad/click`
miucms.request(requestUrl, {
statid
}).then(res => {})
// 跳转视频号
console.log(type,advtype);
if ((type == 5) || (type == 'adv' && advtype == "videofeed_5")) {
wx.openChannelsActivity({
finderUserName: finderusername,
@ -644,20 +634,5 @@ Page({
}
},
// 轮播图的加载事件
loadHeadSwiper(e) {
let ratio = app.globalData.screen_data['windowWidth'] / 750
let originalWidth = e.detail.width;
let originalHeight = e.detail.height;
let height = originalHeight / originalWidth * 690 * ratio
if (height > this.data.HeadSwiperHeight) {
this.setData({
HeadSwiperHeight: height
})
}
},
})

View File

@ -1,14 +1,15 @@
{
"navigationBarTitleText": "寄托租房",
"enablePullDownRefresh": false,
"usingComponents": {
"header-nav": "../../template/headerNav/index",
"filtrate-box": "../../template/filtrate/filtrate",
"go-login": "../../template/goLogin/goLogin",
"head-swiper": "../../template/headSwiper/headSwiper",
"form-id": "../../template/formId/formId",
"fix-footer": "../../template/fixFooter/fixFooter",
"announcement-popup": "../../template/announcementPopup/announcementPopup",
"to-top": "/template/toTop/toTop"
}
"navigationBarTitleText": "寄托租房",
"enablePullDownRefresh": false,
"usingComponents": {
"header-nav": "../../template/headerNav/index",
"filtrate-box": "../../template/filtrate/filtrate",
"go-login": "../../template/goLogin/goLogin",
"head-swiper": "../../template/headSwiper/headSwiper",
"xin-head-swiper": "/template/xinHeadSwiper/xinHeadSwiper",
"form-id": "../../template/formId/formId",
"fix-footer": "../../template/fixFooter/fixFooter",
"announcement-popup": "../../template/announcementPopup/announcementPopup",
"to-top": "/template/toTop/toTop"
}
}

View File

@ -25,21 +25,11 @@
<input class="search-input flex1" disabled confirm-type="search" bindconfirm="search" placeholder="{{ search.placeholder }}" />
</view>
</navigator>
<view class="headSwiper">
<swiper class='headSwiper-swiper' current="{{ swiperCurrent }}" autoplay="{{ true }}" circular interval="{{ 3000 }}" duration="{{ 500 }}" bindanimationfinish="bindchangeSwiper" style="height: {{ HeadSwiperHeight + 5 }}px;">
<block wx:for="{{ banner }}" wx:key="index">
<swiper-item>
<image class="headSwiper-img" mode="widthFix" bindtap="handleSwiper" data-type="{{ item.type }}" data-appid="{{ item.appid }}" data-url="{{ item.url }}" data-finderUserName="{{ item.finderUserName }}" data-feedId="{{ item.feedId }}" src="{{ item.imageurl }}" bindload="loadHeadSwiper"></image>
</swiper-item>
</block>
</swiper>
<view class="indication-point flexacenter">
<block wx:for="{{ banner }}" wx:key="index">
<view class="indication-point-item {{ index == swiperCurrent ? 'pitch' : '' }}"></view>
</block>
</view>
<view style="margin-bottom: 30rpx;">
<xin-head-swiper data="{{ banner }}"></xin-head-swiper>
</view>
</block>
<block wx:else>
<head-swiper attachment="{{ banner }}" isInner="1"></head-swiper>
@ -211,7 +201,7 @@
</view>
</view>
<fix-footer unreadMessages="{{ unreadMessages }}" bottomLift="{{ bottomLift }}"></fix-footer>
<view class='video-box' wx:if="{{ video }}">
<!-- <image src="../../img/close.png" class='close' bindtap='close_video'></image> -->
@ -271,7 +261,7 @@
<!-- 广告 -->
<template name="adv">
<image class="pinterest-list-item" mode="widthFix" bindload="pinterestImgLoad" lazy-load="{{ true }}" src="{{ item.imageLocal || item.image }}" bindtap="handleSwiper" data-type="{{ item.type }}" data-advtype="{{ item.advtype }}" data-appid="{{ item.appid }}" data-finderUserName="{{ item.finderUserName }}" data-feedId="{{ item.feedId }}" data-advertisingtype="{{ 'lazyloading' }}" data-statid="{{ item.statid }}" data-id="{{ item.id }}" data-url="{{ item.path || item.url }}"></image>
<image class="pinterest-list-item" mode="widthFix" bindload="pinterestImgLoad" lazy-load="{{ true }}" src="{{ item.imageLocal || item.image }}" bindtap="handleSwiper" data-type="{{ item.type }}" data-advtype="{{ item.advtype }}" data-appid="{{ item.appid }}" data-finderUserName="{{ item.finderUserName }}" data-feedId="{{ item.feedId }}" data-advertisingtype="{{ 'lazyloading' }}" data-statid="{{ item.statid }}" data-id="{{ item.id }}" data-url="{{ item.path || item.url }}"></image>
</template>
<!-- 公寓 -->

View File

@ -986,56 +986,12 @@ page {
background-color: #fff;
}
.headSwiper-swiper {
position: relative;
}
.headSwiper {
width: 690rpx;
margin: 32rpx auto 30rpx;
position: relative;
border-radius: 20rpx;
}
.headSwiper .headSwiper-img {
width: 690rpx;
height: 292.5rpx;
border-radius: 20rpx;
}
.headSwiper .indication-point {
position: absolute;
bottom: 20rpx;
right: 15rpx;
height: 18rpx;
border-radius: 45rpx;
background-color: rgba(255, 255, 255, 0.501960784313725);
padding: 0 9rpx;
}
.headSwiper .indication-point .indication-point-item {
width: 12rpx;
height: 12rpx;
border-radius: 50%;
border: 1rpx solid #aaaaaa;
background-color: transparent;
}
.headSwiper .indication-point .indication-point-item:not(:last-of-type) {
margin-right: 4rpx;
}
.headSwiper .indication-point .indication-point-item.pitch {
border: none;
background-color: #000000;
}
.search-box {
width: 690rpx;
height: 72rpx;
border-radius: 345rpx;
border: 1rpx solid rgba(235, 235, 235, 1);
margin: 12rpx auto 0;
margin: 12rpx auto 32rpx;
background-color: #fff;
}

View File

@ -120,10 +120,22 @@ Page({
initState: false,
langs: {}, // 语言包数据
isNewVersions: false,
operationsTop: false, // 操作栏 是否在顶部
isNewVersions: true,
},
onPageScroll(e) {
if (e.scrollTop > this.operationsHeight && !this.data.operationsTop) {
this.setData({
operationsTop: true
})
} else if (e.scrollTop <= this.operationsHeight && this.data.operationsTop) {
this.setData({
operationsTop: false
})
}
if (e.scrollTop > 1000 && !this.data.showTOTOP) {
this.setData({
showTOTOP: true
@ -149,7 +161,6 @@ Page({
title: '加载中',
})
this.getDtailsLangs() // 先全局吧
let that = this;
var location = [];
@ -194,8 +205,12 @@ Page({
StudentapartmentNew: app.globalData.StudentapartmentNew,
listTab: app.globalData.listTab,
initState: true,
isloding: false
isloding: false,
langs: app.globalData.langs,
})
app.globalData['langs'] ? '' : this.getDtailsLangs() // 先全局吧
this.getgroupSearch();
this.get_list();
this.getAd();
@ -224,44 +239,50 @@ Page({
this.setData({
langs: data
})
console.log(this.data.langs);
app.globalData['langs'] = data
})
},
// 专门梳理v4出现的 语音包 及 不同房源值的处理
handleDetailData(item) {
console.log("item", item);
let tabList = []
handleDetailData(data) {
let langs = this.data.langs || {}
if (Object.keys(langs).length == 0) {
setTimeout(() => {
this.handleDetailData()
this.handleDetailData(data)
}, 300)
} else {
data.forEach(ele => {
// 这个是将 详情键 替换语言包里的值
let list = ['type', 'rentalduration', 'intermediary', "property", "elevator", "sunshinearea", "gender"]
if (Array.isArray(ele['floor'])) list.push('floor') // 判断 楼层是否需要 替换值, 因为在求房源里是多个值
let differentNames = { // 需要替换的 键名
"intermediary": "intermediary_text"
}
list.forEach(element => {
if (ele[element] == -1) {} else if (ele[element] == 0) ele[differentNames[element] ? differentNames[element] : element] = '不限' // 当 值为 [0] 时为不限
else ele[differentNames[element] ? differentNames[element] : element] = langs[element][ele[element]]
})
let tabArr = ["gptype", "property", "elevator", "sunshinearea", "gender"]
let tabList = []
tabArr.forEach(el => {
if (ele[el] && ele[el] != -1) tabList.push(ele[el])
})
let judgeArr = ['acreage', 'rent']
judgeArr.forEach(element => {
if (Array.isArray(item[element])) item[element] = item[element][0] + ' ~ ' + item[element][1]
ele['tabList'] = tabList
let location = langs.location // 遍历替换区域的值 所有房源
let pendingData = ele['location']
ele['location'] = `${location[Math.trunc(pendingData)]} > ${location[pendingData]}`
})
// 这个是将 详情键 替换语言包里的值
let list = ['type', 'rentalduration', 'intermediary']
if (Array.isArray(item['floor'])) list.push('floor') // 判断 楼层是否需要 替换值, 因为在求房源里是多个值
let differentNames = { // 需要替换的 键名
"intermediary": "intermediary_text"
}
list.forEach(element => {
if (item[element] == 0) item[differentNames[element] ? differentNames[element] : element] = '不限' // 当 值为 [0] 时为不限
else item[differentNames[element] ? differentNames[element] : element] = langs[element][item[element]]
let lists = this.data.lists
lists = lists.concat(data)
this.setData({
lists
})
let location = langs.location // 遍历替换区域的值 所有房源
let pendingData = item['location']
item['location'] = `${location[Math.trunc(pendingData)]} > ${location[pendingData]}`
return item
}
},
@ -445,6 +466,7 @@ Page({
'type': this.data.types.value,
location: that.data.location.value,
school: that.data.school.value,
// school: 309,
page: this.data.page,
// intermediarytype: 2,
intermediary: 0
@ -463,16 +485,18 @@ Page({
}
data = data.data
if (isNewVersions) {
data.data.forEach(element => {
element = this.handleDetailData(element)
this.handleDetailData(data.data)
}
if (!isNewVersions) {
that.data.lists = that.data.lists.concat(data.data)
this.setData({
lists: that.data.lists,
})
}
console.log("data123", data);
that.data.lists = that.data.lists.concat(data.data)
that.setData({
lists: that.data.lists,
// lists: that.data.lists,
page: data.page * data.limit >= data.count ? 0 : data.page + 1,
user: data.user,
loading: false,
@ -795,7 +819,6 @@ Page({
gender: obj.gender,
leaseterm: obj.leaseterm,
publish: obj.publish,
}
this.setData({
selectGroupIndex: index,
@ -823,11 +846,11 @@ Page({
miucms.closeAD(e.detail.id)
},
// 新筛选 的 整合中转
submitOperations(e) {
let {
type
} = e.detail
console.log(type);
if (type == "rent") this.submitMoney(e)
if (type == "orderby") this.submitOrderby(e)
if (type == "types") this.submittype(e)
@ -835,4 +858,23 @@ Page({
},
// 记录 轮播图的高度 // 随便计算 筛选的高度
// 筛选到顶部的高度
recordSwiperHeight(e) {
let swiperHeight = e.detail
let screen_data = this.data.screen_data
wx.createSelectorQuery().select("#list-operations").boundingClientRect((rect) => {
if (!rect) return
let top = rect.top - screen_data['totalTopHeight']
this.operationsHeight = top
}).exec()
},
// 公共跳转
publicJumps(e) {
let url = e.currentTarget.dataset.url
wx.navigateTo({
url,
})
},
})

View File

@ -16,6 +16,9 @@
"tab": "./tab/tab",
"announcement-popup": "/template/announcementPopup/announcementPopup",
"common-list": "/template/commonList/commonList",
"list-operations": "/template/listOperations/listOperations"
}
"list-operations": "/template/listOperations/listOperations",
"xin-head-swiper": "/template/xinHeadSwiper/xinHeadSwiper"
},
"navigationBarTextStyle": "black"
}

View File

@ -3,25 +3,35 @@
<view class="container" wx:if="{{ !isloding }}">
<to-top wx:if="{{ showTOTOP }}"></to-top>
<header-nav haveSearch="true">{{ topTitle }}</header-nav>
<head-swiper attachment="{{ attachment }}"></head-swiper>
<tab StudentapartmentNew="{{ StudentapartmentNew}}" page="personList" listTab="{{ listTab }}"></tab>
<block wx:if="{{ isNewVersions }}">
<view class="bj" wx:if="{{ isNewVersions }}"></view>
<header-nav bgcolor="{{ operationsTop ? '#fff' : 'transparent' }}">{{ topTitle }}</header-nav>
<view bindtap="getLocationList" bindtap="publicJumps" data-url="/pages/search/search">
<template is="header-search" data="{{ kw:'',disabled: true }}"></template>
</view>
<xin-head-swiper bindrecordSwiperHeight="recordSwiperHeight" data="{{ attachment }}"></xin-head-swiper>
</block>
<block wx:else>
<header-nav haveSearch="true">{{ topTitle }}</header-nav>
<head-swiper attachment="{{ attachment }}"></head-swiper>
</block>
<!-- 临时隔断用的 -->
<view wx:if="{{ isNewVersions }}" style="height: 48rpx; width: 100rpx;"></view>
<tab isNewVersions="{{ isNewVersions }}" StudentapartmentNew="{{ StudentapartmentNew}}" page="personList" listTab="{{ listTab }}"></tab>
<!-- 热词 -->
<view class="hot-text-box">
<view class="hot-text-box" wx:if="{{ !isNewVersions }}">
<view class="hot-text" wx:if="{{ groupSearch.length>0 }}">
<view class="{{ index===selectGroupIndex ? 'active item' :'item'}}" bindtap="selectGroup" data-index="{{ index }}" wx:for="{{ groupSearch }}" wx:key="index">{{ item['keyword'] }}</view>
</view>
</view>
<!-- 新的 -->
<block wx:if="{{ isNewVersions }}">
<view id="list-operations" class="list-operations {{ operationsTop ? 'list-operations-top' : '' }}" wx:if="{{ isNewVersions }}" style="top: {{ screen_data.totalTopHeight }}px;">
<list-operations tabTitle="个人房源" property="{{ property }}" school="{{ school }}" types="{{ types }}" location="{{ location }}" operationstype="housing" money="{{ money }}" brands="{{ brands }}" screen_data="{{ screen_data }}" roomtype="{{ roomtype }}" roomlistings="{{ roomlistings }}" bindsubmit="submitOperations" bindsubmit="submitarea"></list-operations>
</block>
</view>
<!-- 条件框 -->
<view class="condition-box" style="top:{{screen_data.totalTopHeight}}px">
<view wx:else class="condition-box" style="top:{{screen_data.totalTopHeight}}px">
<view class="tab">
<area-select title="区域" verifiedList="{{ verifiedList }}" school="{{ school.list }}" locationValue="{{ location.value }}" schoolValue="{{ school.value}}" img="tobottom" list="{{ location.data }}" bindsubmit="submitarea">
<view></view>
@ -53,10 +63,7 @@
</view>
<!--合租 -->
<view class='list'>
<view class='list {{ isNewVersions ? "new-list" : "" }}'>
<block wx:for="{{ lists }}" wx:key="index">
<block wx:if="{{ isNewVersions }}">

View File

@ -1,4 +1,6 @@
/**index.wxss**/
@import '/pages/common/common.wxss';
.bold {
font-weight: bold
}
@ -463,4 +465,34 @@
.list {
/* background-color: rgba(246, 246, 246, 1); */
}
.new-list {
padding-top: 36rpx;
background-color: rgba(246, 246, 246, 1);
box-shadow: 0 0 12rpx rgba(0, 0, 0, 0.156862745098039);
border-radius: 60rpx 60rpx 0 0;
margin-top: 8rpx;
min-height: 600rpx;
}
.bj {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 900rpx;
background: linear-gradient(0deg, rgba(255, 255, 255, 1) 2%, rgba(176, 216, 255, 1) 115%);
z-index: -1;
}
.list-operations {
position: sticky;
z-index: 1000;
}
.list-operations.list-operations-top{
background-color: #fff;
border-bottom: 1rpx solid #ebebeb;
}

View File

@ -7,13 +7,14 @@ Component({
StudentapartmentNew: Boolean,
page: String,
listTab: Object,
isNewVersions: Boolean
},
/**
* 组件的初始数据
*/
data: {
isNewVersions: true,
// isNewVersions: true,
tabList: [{
name: "个人房源",
value: "personList",

View File

@ -1,23 +1,23 @@
<view class="tab-list flexacenter" wx:if="{{ false }}">
<view class="tab-item flexcenter {{ page == item.value ? 'pitch' : '' }}" wx:for="{{ tabList }}" wx:key="index" bindtap="toPage" data-page="{{ item.value }}">{{ item.name }}</view>
<view class="tab-list flexacenter" wx:if="{{ isNewVersions }}">
<view class="tab-item flexcenter {{ page == item.value ? 'pitch' : '' }}" wx:for="{{ tabList }}" wx:key="index" bindtap="toPage" data-page="{{ item.value }}">{{ item.name }}</view>
</view>
<view class='irent-tab-box tab-box'>
<view class="{{ page=='personList'? 'tab active' :'tab'}}" data-page="personList" bindtap="toPage">
<view class="text">个人房源</view>
</view>
<view class='irent-tab-box tab-box' wx:else>
<view class="{{ page=='personList'? 'tab active' :'tab'}}" data-page="personList" bindtap="toPage">
<view class="text">个人房源</view>
</view>
<view class="{{ page=='quarantineLists'? 'tab active' :'tab'}}" bindtap="toIntermediaryPage">
<view class="text">{{ '中介房源' }}</view>
</view>
<!-- <block wx:else>
<view class="{{ page=='quarantineLists'? 'tab active' :'tab'}}" bindtap="toIntermediaryPage">
<view class="text">{{ '中介房源' }}</view>
</view>
<!-- <block wx:else>
<view class="{{ page=='quarantineLists'? 'tab active' :'tab'}}" wx:if="{{ listTab.quarantineLists }}" data-page="quarantineLists" bindtap="toPage">
<view class="text">{{ listTab.quarantineLists }}</view>
</view>
</block> -->
<view class="{{ page=='irentList'? 'tab active' :'tab'}}" data-page="irentList" bindtap="toPage">
<view class="text">学生公寓</view>
<image src="/img/new.png" wx:if="{{ StudentapartmentNew }}" class='new'></image>
</view>
<view class="{{ page=='irentList'? 'tab active' :'tab'}}" data-page="irentList" bindtap="toPage">
<view class="text">学生公寓</view>
<image src="/img/new.png" wx:if="{{ StudentapartmentNew }}" class='new'></image>
</view>
</view>

View File

@ -110,6 +110,7 @@
justify-content: space-between;
font-size: 30rpx;
color: #000000;
margin-bottom: 15rpx;
}

View File

@ -3,427 +3,562 @@ var app = getApp()
var config = {};
var miucms = require('../../utils/miucms.js');
Page({
/**
* 页面的初始数据
*/
data: {
isloding: true,
showTOTOP: false,
kw: '',
log: [],
hot: [],
focus: false,
list: [],
search: false,
loading: false,
complete: false,
status: 0,
q: '',
options: {},
tab: 'hongkongrental',
otherrental: {
page: {
next_page: 1
},
list: [],
loading: false
},
hongkongrental: {
page: {
next_page: 1
},
list: [],
loading: false
},
studentapartment: {
page: {
next_page: 1
},
list: [],
loading: false
}
},
onPageScroll(e) {
if (e.scrollTop > 1000 && !this.data.showTOTOP) {
this.setData({
showTOTOP: true
})
} else if (e.scrollTop < 1000 && this.data.showTOTOP) {
this.setData({
showTOTOP: false
})
}
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
var that = this;
this.setData({
focus: options.kw ? false : true,
kw: options.kw || '',
tab: options.tab || 'hongkongrental'
})
this.get_config()
wx.getStorage({
key: 'searchHistoryList',
success: function (res) {
that.setData({
log: res.data || []
})
},
})
},
get_config() {
var that = this;
if (app.globalData.config.lists) {
config = app.globalData.config;
that.setData({
status: app.globalData.status
})
that.get_content()
if (that.data.kw.trim().length > 0) {
that.submit()
}
} else {
setTimeout(function () {
that.get_config()
}, 200)
}
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
if (!app.globalData.config.lists) {
return false
}
this.getDatas()
},
cancle() {
var pages = getCurrentPages();
if (pages.length == 1) {
wx.reLaunch({
url: `/pages/index/index`
});
} else {
wx.navigateBack(); //返回上一页
}
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
const that = this;
let url = `/pages/search/search?kw=${that.data.kw}&tab=${that.data.tab}`;
return {
path: url,
title: '寄托香港租房',
}
},
input: function (e) {
this.setData({
kw: e.detail.value
})
},
// 提交
submit: function () {
// this.data.kw = this.data.kw.trim();
if (this.data.kw == '') {
wx.showToast({
title: '请输入内容~',
icon: 'none'
})
return false
}
if (this.data.log.indexOf(this.data.kw) == -1) {
// 未存在历史记录列表中
this.data.log.unshift(this.data.kw)
// 最多存10条内容
if (this.data.log.length > 10) {
this.data.log.length = 10
}
this.setData({
log: this.data.log
})
wx.setStorage({
key: 'searchHistoryList',
data: this.data.log,
})
}
this.clearAllData()
this.clear_list()
},
// 清空历史记录
clear_keywords: function () {
let that = this;
wx.showModal({
title: '提示',
content: '确定删除全部记录?',
confirmColor: '#bc322f',
success: function (res) {
if (res.confirm === true) {
if (!app.globalData.config || !app.globalData.config.lists) {
return false
}
miucms.request(app.globalData.config.lists.removesearchlog, {}).then(data => {
if (data.extraparam.mode == 'right') {
that.setData({
log: []
})
wx.setStorage({
key: 'searchHistoryList',
data: [],
})
}
})
}
}
})
},
// 获取热词
get_content: function () {
var that = this;
var sendData = Object.assign({}, this.data.options, {
session: wx.getStorageSync('session'),
})
miucms.request(app.globalData.config.lists.search, {}).then(data => {
that.setData({
hot: data.hot,
isloding: false
})
}).catch(res => {})
},
// 点击热词或者历史记录item
select_kw: function (e) {
wx.pageScrollTo({
scrollTop: 0,
duration: 200,
})
var kw = e.currentTarget.dataset.kw;
this.setData({
kw: kw
})
this.clearAllData()
app.globalData.kw = kw;
this.clear_list()
},
clearAllData() {
// 清空所有数据
this.setData({
otherrental: {
page: {
next_page: 1
},
/**
* 页面的初始数据
*/
data: {
isloding: true,
showTOTOP: false,
kw: '',
log: [],
hot: [],
focus: false,
list: [],
loading: false
},
hongkongrental: {
page: {
next_page: 1
},
list: [],
loading: false
},
studentapartment: {
page: {
next_page: 1
},
list: [],
loading: false
}
})
},
// 清空list
clear_list: function () {
let tab = this.data.tab;
this.data[tab] = {
page: {
next_page: 1
},
list: [],
loading: false
}
this.setTabData()
this.searchKW()
},
// setData
setTabData() {
let tab = this.data.tab;
switch (tab) {
case 'otherrental':
this.setData({
otherrental: this.data.otherrental
})
break;
case 'studentapartment':
this.setData({
studentapartment: this.data.studentapartment
})
break;
case 'hongkongrental':
this.setData({
hongkongrental: this.data.hongkongrental
})
break;
}
},
searchdata: '',
// 搜索关键词
searchKW: function () {
var that = this;
if (!app.globalData.config.search) {
return false
}
this.setData({
loading: true
})
console.log("this.data.kw", this.data.kw);
miucms.request(app.globalData.config.search.global, {
// miucms.request(`${app.globalData.baseURL}/tenement/housingresources/lists`, {
'keyword': this.data.kw
}).then(data => {
// console.log("data", data);
if (data.code != 200) {
wx.showToast({
title: data.message,
icon: 'none'
})
that.setData({
loading: false,
otherrental: {
page: {
next_page: 0
},
list: [],
loading: false
},
hongkongrental: {
page: {
next_page: 0
},
list: [],
loading: false
},
studentapartment: {
page: {
next_page: 0
},
list: [],
loading: false
}
})
return false
}
let count = data.data.count;
this.searchdata = data.data.searchdata;
for (let i in data.data.count) {
if (data.data.count[i] == 0) {
this.data[i].page.next_page = 0;
} else {
this.data[i].page.next_page = 1;
}
}
this.setData({
search: true,
otherrental: this.data.otherrental,
studentapartment: this.data.studentapartment,
hongkongrental: this.data.hongkongrental,
search: false,
loading: false,
kw: data.data.keyword
})
this.getDatas()
}).catch(res => {})
complete: false,
status: 0,
q: '',
options: {},
// tab: 'hongkongrental',
tab: 'personal',
tabList: {
personal: "个人房源",
intermediary: "中介房源",
studentapartment: "学生公寓",
},
otherrental: {
page: {
next_page: 1
},
list: [],
loading: false
},
hongkongrental: {
page: {
next_page: 1
},
list: [],
loading: false
},
studentapartment: {
page: {
next_page: 1
},
list: [],
loading: false
},
screen_data: {},
},
// 清空
clearKW() {
this.setData({
kw: '',
focus: true
})
},
// 更换tab
changeTab(e) {
this.setData({
tab: e.currentTarget.dataset.tab
})
let tab = this.data.tab;
if (!this.data[tab].page.next_page || this.data[tab].list.length > 0) {
// 如果当前tab下数量为0 ,则不再加载
return false;
}
this.getKWdata()
},
// 搜索相关tab关键词
getDatas() {
let tab = this.data.tab;
if (!this.data[tab].page.next_page) {
// 如果当前tab下数量为0 ,则不再加载
return false;
}
this.getKWdata()
},
getKWdata() {
personal: {
data: [],
page: 1,
count: 0,
searchid: ""
},
intermediary: {
data: [],
page: 1,
count: 0,
searchid: ""
},
studentapartment: {
data: [],
page: 1,
count: 0,
searchid: ""
},
langs: {}, // 语言包数据
let urlObj = {
otherrental: app.globalData.config.search.otherrental,
// hongkongrental: app.globalData.config.search.hongkongrental,
hongkongrental: `${app.globalData.baseURL}/tenement/housingresources/lists`,
studentapartment: app.globalData.config.search.studentapartment,
}
let tab = this.data.tab;
let url = urlObj[tab];
this.data[tab].loading = true;
this.setTabData()
miucms.request(url, {
'searchdata': this.searchdata,
page: this.data[tab].page.next_page
}).then(data => {
// console.log(data);
this.data[tab].list = this.data[tab].list.concat(data.data.data);
this.data[tab].loading = false;
isNewVersions: true,
if (data.data.data.length > 0) {
this.data[tab].page.next_page += 1;
} else {
this.data[tab].page.next_page = 0;
}
this.setTabData()
}).catch(res => {})
},
// 点击广告
clickAD(e) {
miucms.clickAD(e.detail.id)
},
// 关闭广告
closeAD(e) {
let index = e.currentTarget.dataset.index;
let tab = e.currentTarget.dataset.tab;
},
onPageScroll(e) {
if (e.scrollTop > 1000 && !this.data.showTOTOP) {
this.setData({
showTOTOP: true
})
} else if (e.scrollTop < 1000 && this.data.showTOTOP) {
this.setData({
showTOTOP: false
})
}
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
var that = this;
this.setData({
focus: options.kw ? false : true,
kw: options.kw || '',
// tab: options.tab || 'hongkongrental'
tab: options.tab || 'personal'
})
this.get_config()
wx.getStorage({
key: 'searchHistoryList',
success: function (res) {
that.setData({
log: res.data || []
})
},
})
this.data[tab].list.splice(index, 1)
if (tab == 'hongkongrental') {
this.setData({
hongkongrental: this.data.hongkongrental
})
} else {
this.setData({
otherrental: this.data.otherrental
})
}
},
get_config() {
var that = this;
if (app.globalData.config.lists) {
config = app.globalData.config;
that.setData({
status: app.globalData.status,
screen_data: app.globalData.screen_data,
langs: app.globalData.langs,
})
that.get_content()
app.globalData['langs'] ? '' : this.getDtailsLangs()
if (that.data.kw.trim().length > 0) that.submit()
} else {
setTimeout(function () {
that.get_config()
}, 200)
}
},
// 获取语言包 保存全局
getDtailsLangs() {
miucms.request(`${app.globalData.baseURL}/tenement/v2/api/details/langs`).then(res => {
if (res.code != 200) return
let data = res.data
this.setData({
langs: data
})
app.globalData['langs'] = data
})
},
// 专门梳理v4出现的 语音包 及 不同房源值的处理
handleDetailData(data) {
let langs = this.data.langs || {}
if (Object.keys(langs).length == 0) {
setTimeout(() => {
this.handleDetailData(data)
}, 300)
} else {
let tab = this.data.tab
data.forEach(ele => {
// 这个是将 详情键 替换语言包里的值
let list = ['type', 'rentalduration', 'intermediary', "property", "elevator", "sunshinearea", "gender"]
if (Array.isArray(ele['floor'])) list.push('floor') // 判断 楼层是否需要 替换值, 因为在求房源里是多个值
let differentNames = { // 需要替换的 键名
"intermediary": "intermediary_text"
}
list.forEach(element => {
if (ele[element] == -1) {} else if (ele[element] == 0) ele[differentNames[element] ? differentNames[element] : element] = '不限' // 当 值为 [0] 时为不限
else ele[differentNames[element] ? differentNames[element] : element] = langs[element][ele[element]]
})
let tabArr = ["gptype", "property", "elevator", "sunshinearea", "gender"]
let tabList = []
tabArr.forEach(el => {
if (ele[el] && ele[el] != -1) tabList.push(ele[el])
})
ele['tabList'] = tabList
let location = langs.location // 遍历替换区域的值 所有房源
let pendingData = ele['location']
ele['location'] = `${location[Math.trunc(pendingData)]} > ${location[pendingData]}`
})
let tabData = this.data[tab]["list"] || []
tabData = tabData.concat(data)
this.setData({
[`${tab}.list`]: tabData,
})
}
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
if (!app.globalData.config.lists) return false
this.getResultList()
},
cancle() {
var pages = getCurrentPages();
if (pages.length == 1) {
wx.reLaunch({
url: `/pages/index/index`
});
} else wx.navigateBack(); //返回上一页
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
const that = this;
let url = `/pages/search/search?kw=${that.data.kw}&tab=${that.data.tab}`;
return {
path: url,
title: app.globalData.topTitle,
}
},
input: function (e) {
this.setData({
kw: e.detail.value
})
},
// 提交
submit: function () {
// this.data.kw = this.data.kw.trim();
if (this.data.kw == '') {
wx.showToast({
title: '请输入内容~',
icon: 'none'
})
return false
}
if (this.data.log.indexOf(this.data.kw) == -1) {
// 未存在历史记录列表中
this.data.log.unshift(this.data.kw)
// 最多存10条内容
if (this.data.log.length > 10) {
this.data.log.length = 10
}
this.setData({
log: this.data.log
})
wx.setStorage({
key: 'searchHistoryList',
data: this.data.log,
})
}
this.clearAllData()
this.clear_list()
},
// 清空历史记录
clear_keywords: function () {
let that = this;
wx.showModal({
title: '提示',
content: '确定删除全部记录?',
confirmColor: '#bc322f',
success: function (res) {
if (res.confirm === true) {
if (!app.globalData.config || !app.globalData.config.lists) {
return false
}
miucms.request(app.globalData.config.lists.removesearchlog, {}).then(data => {
if (data.extraparam.mode == 'right') {
that.setData({
log: []
})
wx.setStorage({
key: 'searchHistoryList',
data: [],
})
}
})
}
}
})
},
// 获取热词
get_content: function () {
var that = this;
var sendData = Object.assign({}, this.data.options, {
session: wx.getStorageSync('session'),
})
miucms.request(app.globalData.config.lists.search, {}).then(data => {
that.setData({
hot: data.hot,
isloding: false
})
}).catch(res => {})
},
// 点击热词或者历史记录item
select_kw: function (e) {
wx.pageScrollTo({
scrollTop: 0,
duration: 200,
})
var kw = e.currentTarget.dataset.kw;
this.setData({
kw
})
this.clearAllData()
app.globalData.kw = kw;
this.clear_list()
},
clearAllData() {
// 清空所有数据
this.setData({
otherrental: {
page: {
next_page: 1
},
list: [],
loading: false
},
hongkongrental: {
page: {
next_page: 1
},
list: [],
loading: false
},
studentapartment: {
page: {
next_page: 1
},
list: [],
loading: false
}
})
},
// 清空list
clear_list: function () {
let tab = this.data.tab;
this.data[tab] = {
page: {
next_page: 1
},
list: [],
loading: false
}
this.setTabData()
this.searchKW()
},
setTabData() {
let tab = this.data.tab;
switch (tab) {
case 'otherrental':
this.setData({
otherrental: this.data.otherrental
})
break;
case 'studentapartment':
this.setData({
studentapartment: this.data.studentapartment
})
break;
case 'hongkongrental':
this.setData({
hongkongrental: this.data.hongkongrental
})
break;
}
},
searchdata: '',
// 搜索关键词
searchKW: function () {
var that = this;
if (!app.globalData.config.search) {
return false
}
this.setData({
loading: true
})
miucms.request(app.globalData.config.search.global, {
// miucms.request(`${app.globalData.baseURL}/tenement/housingresources/lists`, {
'keyword': this.data.kw
}).then(data => {
// console.log("data", data);
if (data.code != 200) {
wx.showToast({
title: data.message,
icon: 'none'
})
that.setData({
loading: false,
otherrental: {
page: {
next_page: 0
},
list: [],
loading: false
},
hongkongrental: {
page: {
next_page: 0
},
list: [],
loading: false
},
studentapartment: {
page: {
next_page: 0
},
list: [],
loading: false
}
})
return false
}
let count = data.data.count;
this.searchdata = data.data.searchdata;
for (let i in data.data.count) {
if (data.data.count[i] == 0) {
this.data[i].page.next_page = 0;
} else {
this.data[i].page.next_page = 1;
}
}
this.setData({
search: true,
otherrental: this.data.otherrental,
studentapartment: this.data.studentapartment,
hongkongrental: this.data.hongkongrental,
loading: false,
kw: data.data.keyword
})
this.getDatas()
}).catch(res => {})
},
// 搜索初始化 新的 自动覆盖上面的
searchKW() {
miucms.wxget(`${app.globalData.baseURL}/tenement/v2/api/search`, {
'keyword': this.data.kw
}).then(res => {
if (res.code != 200) return
let data = res.data
let {
personal,
intermediary,
studentapartment
} = data
this.setData({
...data
})
console.log();
this.getResultList()
})
},
// 请求结果列表
getResultList() {
let tab = this.data.tab
let tabData = this.data[tab]
if (tabData['page'] == 0) return // 需要加一个请求中
console.log(tabData);
let searchid = tabData['searchid']
let url = tab == 'studentapartment' ? `${ app.globalData.baseURL }/tenement/apartment/filterConditions` : `${ app.globalData.baseURL }/tenement/v2/api/lists`
let requestData = {
searchid,
page: tabData['page'] || 1,
intermediary: 6
}
miucms.request(url, requestData).then(res => {
if (res.code != 200) return
let data = res.data
let concreteData = data.data
this.handleDetailData(concreteData)
// if (!tabData['list']) tabData['list'] = []
// tabData['list'].push(...concreteData)
tabData['page'] = data.page * data.limit >= data.count ? 0 : data.page + 1
this.setData({
search: true,
[tab]: tabData,
})
})
},
// 清空
clearKW() {
this.setData({
kw: '',
focus: true
})
},
// 更换tab
changeTab(e) {
console.log(e.currentTarget.dataset.tab, 0);
this.setData({
tab: e.currentTarget.dataset.tab
})
let tab = this.data.tab;
// 如果当前tab下数量为0 ,则不再加载
if (this.data[tab].page == 0 || this.data[tab].list) return false;
// this.getKWdata()
this.getResultList()
},
// 搜索相关tab关键词
getDatas() {
let tab = this.data.tab;
if (!this.data[tab].page.next_page) {
// 如果当前tab下数量为0 ,则不再加载
return false;
}
this.getKWdata()
},
getKWdata() {
let urlObj = {
otherrental: app.globalData.config.search.otherrental,
// hongkongrental: app.globalData.config.search.hongkongrental,
hongkongrental: `${app.globalData.baseURL}/tenement/housingresources/lists`,
studentapartment: app.globalData.config.search.studentapartment,
}
let tab = this.data.tab;
let url = urlObj[tab];
this.data[tab].loading = true;
this.setTabData()
miucms.request(url, {
'searchdata': this.searchdata,
page: this.data[tab].page.next_page
}).then(data => {
// console.log(data);
this.data[tab].list = this.data[tab].list.concat(data.data.data);
this.data[tab].loading = false;
if (data.data.data.length > 0) {
this.data[tab].page.next_page += 1;
} else {
this.data[tab].page.next_page = 0;
}
this.setTabData()
}).catch(res => {})
},
// 点击广告
clickAD(e) {
miucms.clickAD(e.detail.id)
},
// 关闭广告
closeAD(e) {
let index = e.currentTarget.dataset.index;
let tab = e.currentTarget.dataset.tab;
this.data[tab].list.splice(index, 1)
if (tab == 'hongkongrental') {
this.setData({
hongkongrental: this.data.hongkongrental
})
} else {
this.setData({
otherrental: this.data.otherrental
})
}
miucms.closeAD(e.detail.id)
},
miucms.closeAD(e.detail.id)
}
})

View File

@ -1,11 +1,13 @@
{
"navigationBarTitleText": "搜索",
"enablePullDownRefresh": false,
"usingComponents": {
"header-nav": "../../template/headerNav/index",
"brands-item":"../irentList/listItem/listItem",
"to-top": "../../template/toTop/toTop",
"ads": "../show/ads/ads",
"house-item": "../restOfWorld/houseItem/houseItem"
}
"navigationBarTitleText": "搜索",
"enablePullDownRefresh": false,
"usingComponents": {
"header-nav": "../../template/headerNav/index",
"brands-item": "../irentList/listItem/listItem",
"to-top": "../../template/toTop/toTop",
"ads": "../show/ads/ads",
"house-item": "../restOfWorld/houseItem/houseItem",
"list-operations": "/template/listOperations/listOperations",
"common-list": "/template/commonList/commonList"
}
}

View File

@ -1,91 +1,107 @@
<import src="../common/common.wxml"/>
<import src="../common/common.wxml" />
<view class="container" wx:if="{{ !isloding }}">
<to-top wx:if="{{ showTOTOP }}"></to-top>
<header-nav inner-text="Some text">搜索</header-nav>
<view class='header'>
<form bindsubmit="submit" report-submit='true'data-types="confirm">
<image class="search-btn" src="../../img/search-6.png"></image>
<input placeholder='试试输入地段、学校等关键词' placeholder-class='placeholder' confirm-type='search' value='{{kw}}' bindinput='input' bindconfirm='submit' focus="{{focus}}"></input>
<view class="clear" bindtap="clearKW" hidden="{{ kw.length==0 }}">
<view class="close"><image src="/img/close-f.png"></image></view>
</view>
</form>
<view wx:if="{{ search }}" bindtap='cancle' class='navigator'>取消</view>
<view class="navigator color-red" bindtap='submit' wx:if="{{ !search }}" >搜索</view>
</view>
<view class="border-top20" wx:if="{{ !search }}">
<view class='keywords history' wx:if="{{ log.length>0 }}" >
<view class='name'>
历史搜索
<view class="del" bindtap='clear_keywords'><image src="/img/del-6.png"></image></view>
</view>
<view class='box' >
<view wx:for="{{ log }}" wx:key="index" bindtap='select_kw' data-kw="{{ item }}" class='label'>{{ item }}</view>
</view>
<to-top wx:if="{{ showTOTOP }}"></to-top>
<header-nav bgcolor="rgba(246, 246, 246, 1)" notShowIndex="{{ true }}" inner-text="Some text">搜索</header-nav>
<template is="header-search" data="{{ focus,kw }}"></template>
<view class="search-initial" wx:if="{{ !search }}">
<view class='keywords history' wx:if="{{ log.length>0 }}">
<view class='name'>
历史搜索
<view class="del" bindtap='clear_keywords'>
<image src="/img/del-6.png"></image>
</view>
</view>
<view class='box'>
<view wx:for="{{ log }}" wx:key="index" bindtap='select_kw' data-kw="{{ item }}" class='label'>{{ item }}</view>
</view>
</view>
<view class='keywords' wx:if="{{ hot.length>0}}">
<view class='name'>热门搜索</view>
<view class='box'>
<view wx:for="{{ hot }}" wx:key="index" bindtap='select_kw' data-kw="{{ item }}" class='label'>{{ item }}</view>
</view>
</view>
</view>
<view class='keywords' wx:if="{{ hot.length>0}}" >
<view class='name'>
热门搜索
</view>
<view class='box'>
<view wx:for="{{ hot }}" wx:key="index" bindtap='select_kw' data-kw="{{ item }}" class='label'>{{ item }}</view>
</view>
</view>
</view>
<block wx:if="{{ search }}">
<view class="tab-box">
<view class="{{tab =='hongkongrental' ? 'tab active' :'tab'}}" bindtap="changeTab" data-tab="hongkongrental"><view class="text">个人房源</view></view>
<view class="{{tab =='studentapartment' ? 'tab active' :'tab'}}" bindtap="changeTab" data-tab="studentapartment"><view class="text">品牌公寓</view></view>
<!-- <view class="{{tab =='otherrental' ? 'tab active' :'tab'}}" bindtap="changeTab" data-tab="otherrental"><view class="text">世界各地房源</view></view> -->
<!-- <view class="{{tab =='otherrental' ? 'tab active' :'tab'}}" bindtap="changeTab" data-tab="otherrental"><view class="text">其他地区房源</view></view> -->
<view class="{{tab =='otherrental' ? 'tab active' :'tab'}}" bindtap="changeTab" data-tab="otherrental"><view class="text">求房源</view></view>
</view>
<template is="loading" wx:if="{{ loading }}"></template>
<view hidden="{{ tab !='hongkongrental'}}" class="hongkongrental">
<view class='list list2'>
<block wx:for="{{ hongkongrental.list }}" wx:key="index">
<template is="personalList" wx:if="{{ !item.isad }}" data="{{ item:item }}"/>
<ads isList="true" wx:if="{{ item.isad }}" data-tab="hongkongrental" data-index="{{ index }}" bindclickAD="clickAD" bindcloseAD="closeAD" item="{{ item }}"></ads>
<block wx:if="{{ search }}">
<view class="tab-box">
<view class="{{tab =='personal' ? 'tab active' :'tab'}}" bindtap="changeTab" data-tab="personal">
<view class="text">个人房源 {{ personal['count'] }}</view>
</view>
<view class="{{tab =='intermediary' ? 'tab active' :'tab'}}" bindtap="changeTab" data-tab="intermediary">
<view class="text">中介房源 {{ intermediary['count'] == 0 ? '' : intermediary['count'] }}</view>
</view>
<view class="{{tab =='studentapartment' ? 'tab active' :'tab'}}" bindtap="changeTab" data-tab="studentapartment">
<view class="text">品牌公寓 {{ studentapartment['count'] == 0 ? '' : studentapartment['count'] }}</view>
</view>
</view>
<list-operations tabTitle="个人房源" property="{{ property }}" school="{{ school }}" types="{{ types }}" location="{{ location }}" operationstype="housing" money="{{ money }}" brands="{{ brands }}" screen_data="{{ screen_data }}" roomtype="{{ roomtype }}" roomlistings="{{ roomlistings }}" bindsubmit="submitOperations" bindsubmit="submitarea"></list-operations>
<block wx:if="{{ tab == 'personal' }}">
<block wx:for="{{ personal.list }}" wx:key="index">
<common-list item="{{ item }}"></common-list>
</block>
</block>
</view>
<template is="loading" wx:if="{{ hongkongrental.loading }}"></template>
<template is="nocontent" wx:if="{{ !hongkongrental.loading && hongkongrental.list.length==0}}"></template>
</view>
<view class="studentapartment" hidden="{{ tab !='studentapartment'}}">
<block wx:for="{{ studentapartment.list }}" wx:key="index">
<brands-item item="{{ item }}"></brands-item>
</block>
<template is="loading" wx:if="{{ studentapartment.loading }}"></template>
<template is="nocontent" wx:if="{{ !studentapartment.loading && studentapartment.list.length==0}}"></template>
</view>
<view class="otherrental {{ !otherrental.loading && otherrental.list.length==0 ?'otherrental-empty':''}}" hidden="{{ tab !='otherrental'}}">
<block wx:for="{{ otherrental.list }}" wx:key="index" >
<navigator wx:if="{{ !item.isad }}" url="/pages/show/show?tid={{ item.tid }}&uniqid={{ item.uniqid }}">
<house-item item="{{ item }}" isSearchPage="true"></house-item>
</navigator>
<ads isList="true" wx:if="{{ item.isad }}" data-index="{{ index }}" bindclickAD="clickAD" data-tab="otherrental" bindcloseAD="closeAD" item="{{ item }}"></ads>
</block>
<template is="loading" wx:if="{{ otherrental.loading }}"></template>
<template is="nocontent" wx:if="{{ !otherrental.loading && otherrental.list.length==0}}"></template>
</view>
</block>
<block wx:if="{{ tab == 'intermediary' }}">
<block wx:for="{{ intermediary.list }}" wx:key="index">
<common-list item="{{ item }}"></common-list>
</block>
</block>
<block wx:if="{{ tab == 'studentapartment' }}">
<block wx:for="{{ studentapartment.list }}" wx:key="index">
<common-list item="{{ item }}"></common-list>
</block>
</block>
<template is="loading" wx:if="{{ loading }}"></template>
<block wx:if="{{ false }}">
<view hidden="{{ tab !='hongkongrental'}}" class="hongkongrental">
<view class='list list2'>
<block wx:for="{{ hongkongrental.list }}" wx:key="index">
<template is="personalList" wx:if="{{ !item.isad }}" data="{{ item:item }}" />
<ads isList="true" wx:if="{{ item.isad }}" data-tab="hongkongrental" data-index="{{ index }}" bindclickAD="clickAD" bindcloseAD="closeAD" item="{{ item }}"></ads>
</block>
</view>
<template is="loading" wx:if="{{ hongkongrental.loading }}"></template>
<template is="nocontent" wx:if="{{ !hongkongrental.loading && hongkongrental.list.length==0}}"></template>
</view>
<view class="studentapartment" hidden="{{ tab !='studentapartment'}}">
<block wx:for="{{ studentapartment.list }}" wx:key="index">
<brands-item item="{{ item }}"></brands-item>
</block>
<template is="loading" wx:if="{{ studentapartment.loading }}"></template>
<template is="nocontent" wx:if="{{ !studentapartment.loading && studentapartment.list.length==0}}"></template>
</view>
<view class="otherrental {{ !otherrental.loading && otherrental.list.length==0 ?'otherrental-empty':''}}" hidden="{{ tab !='otherrental'}}">
<block wx:for="{{ otherrental.list }}" wx:key="index">
<navigator wx:if="{{ !item.isad }}" url="/pages/show/show?tid={{ item.tid }}&uniqid={{ item.uniqid }}">
<house-item item="{{ item }}" isSearchPage="true"></house-item>
</navigator>
<ads isList="true" wx:if="{{ item.isad }}" data-index="{{ index }}" bindclickAD="clickAD" data-tab="otherrental" bindcloseAD="closeAD" item="{{ item }}"></ads>
</block>
<template is="loading" wx:if="{{ otherrental.loading }}"></template>
<template is="nocontent" wx:if="{{ !otherrental.loading && otherrental.list.length==0}}"></template>
</view>
</block>
</block>
</view>
<template name="loading">
<view class="loading" >
<view></view>
<view></view>
<view></view>
<view></view>
<view></view>
</view>
<view class="loading">
<view></view>
<view></view>
<view></view>
<view></view>
<view></view>
</view>
</template>
<template name="nocontent">
<view class='nocontent'>
<image src="/img/nocontent.png" class='file'></image>
没有找到相关信息
</view>
<view class='nocontent'>
<image src="/img/nocontent.png" class='file'></image>
没有找到相关信息
</view>
</template>

View File

@ -1,428 +1,361 @@
/* pages/search/search.wxss */
.header {
border-bottom: 1px solid #f2f2f2;
padding: 20rpx 20rpx;
font-size: 0;
}
@import '/pages/common/common.wxss';
.border-top20 {
border-top: 10rpx solid #f2f2f2;
}
.header form {
display: inline-block;
background: #f2f2f2;
width: calc(100% - 80rpx);
height: 92rpx;
line-height: 40rpx;
padding: 25rpx 30rpx;
border-radius: 8rpx;
box-sizing: border-box;
vertical-align: middle;
color: #666;
position: relative;
}
.header .search-btn {
width: 32rpx;
height: 32rpx;
display: inline-block;
vertical-align: middle;
}
.header input {
display: inline-block;
width: calc(100% - 82rpx);
height: 40rpx;
font-size: 28rpx;
vertical-align: middle;
padding: 0 10rpx;
box-sizing: border-box;
}
.header .clear {
position: absolute;
right: 0;
top: 50%;
padding: 30rpx;
transform: translateY(-50%);
}
.header .clear .close {
width: 28rpx;
height: 28rpx;
border-radius: 50%;
background: #c2c2c2;
padding: 7rpx;
text-align: center;
display: flex;
justify-content: center;
align-items: center;
}
.header .clear .close image {
width: 12rpx;
height: 12rpx;
}
.header navigator {
font-size: 30rpx;
display: inline-block;
width: 80rpx;
text-align: right;
vertical-align: middle;
}
.header .navigator {
font-size: 30rpx;
display: inline-block;
width: 80rpx;
text-align: right;
vertical-align: middle;
.container {
background-color: rgba(245, 245, 245, 1);
}
.keywords {
padding: 40rpx 0rpx 0rpx;
padding: 40rpx 0rpx 0rpx;
}
.keywords .name {
color: #ccc;
padding-left: 20rpx;
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 30rpx;
font-size: 24rpx;
color: #7F7F7F;
padding-left: 20rpx;
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 30rpx;
}
.keywords .label {
margin: 0 20rpx 20rpx 0;
background: #f2f2f2;
line-height: 72rpx;
border-radius: 10rpx;
display: inline-block;
padding: 0 36rpx;
font-size: 26rpx;
color: #666;
word-break: break-word;
margin: 0 20rpx 20rpx 0;
background: #f2f2f2;
line-height: 72rpx;
border-radius: 10rpx;
display: inline-block;
padding: 0 36rpx;
font-size: 26rpx;
color: #000000;
word-break: break-word;
}
.history {
padding-left: 0;
border-bottom: 1px solid #e8e8e8;
padding-bottom: 20rpx;
padding-top: 28rpx;
padding-left: 0;
/* border-bottom: 1px solid #e8e8e8; */
padding-bottom: 20rpx;
padding-top: 28rpx;
}
.history .name {
margin-bottom: 10rpx;
margin-bottom: 10rpx;
}
.history.keywords .label {
/* background: transparent;
/* background: transparent;
padding: 0 20rpx;
line-height: 40rpx; */
}
.keywords .box {
/* margin-right: -20rpx; */
text-align: justify;
font-size: 0;
padding-left: 20rpx;
/* margin-right: -20rpx; */
text-align: justify;
font-size: 0;
padding-left: 20rpx;
}
.history.keywords .box {
/* padding-left: 0; */
/* padding-left: 0; */
}
.keywords .del {
display: inline-flex;
padding: 20rpx;
display: inline-flex;
padding: 20rpx;
}
.keywords .del image {
width: 26rpx;
height: 26rpx;
width: 26rpx;
height: 26rpx;
}
.nocontent {
text-align: center;
font-size: 28rpx;
color: #ccc;
line-height: 60rpx;
text-align: center;
font-size: 28rpx;
color: #ccc;
line-height: 60rpx;
}
button {
background: transparent;
border: none;
position: absolute;
width: 32rpx;
height: 32rpx;
left: 30rpx;
top: 25rpx;
z-index: 100000;
padding: 0;
background: transparent;
border: none;
position: absolute;
width: 32rpx;
height: 32rpx;
left: 30rpx;
top: 25rpx;
z-index: 100000;
padding: 0;
}
button::after {
border: none;
padding: 0;
background: transparent;
border: none;
padding: 0;
background: transparent;
}
button:hover {
background: transparent
background: transparent
}
.nocontent {
text-align: center;
font-size: 28rpx;
color: #999;
background: #f3f4f5;
height: 640rpx;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
text-align: center;
font-size: 28rpx;
color: #999;
background: #f3f4f5;
height: 640rpx;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
}
.file {
width: 158rpx;
height: 110rpx;
display: block;
margin: 0 auto 8rpx;
width: 158rpx;
height: 110rpx;
display: block;
margin: 0 auto 8rpx;
}
.color-red {
color: #C63E3A;
color: #C63E3A;
}
.getuserbtn {
height: 100%;
background: transparent;
z-index: 1000;
width: 100%;
margin: 0;
position: static;
height: 100%;
background: transparent;
z-index: 1000;
width: 100%;
margin: 0;
position: static;
}
.tab-box {
display: flex;
border-bottom: 1px solid #e8e8e8;
display: flex;
border-bottom: 1px solid #e8e8e8;
background-color: rgba(245, 245, 245, 1);
}
.tab-box .tab {
display: inline-flex;
flex: 1;
justify-content: center;
display: inline-flex;
/* flex: 1; */
justify-content: center;
font-size: 30rpx;
padding: 0 30rpx;
}
.tab-box .text {
position: relative;
height: 106rpx;
display: inline-flex;
align-items: center;
position: relative;
/* height: 106rpx; */
display: inline-flex;
align-items: center;
padding: 12rpx 0;
}
.tab-box .active {
font-weight: 650;
}
.tab-box .active .text::after {
content: "";
display: block;
position: absolute;
left: 0;
bottom: -4rpx;
background-color: rgb(255, 192, 95);
width: 100%;
height: 7rpx;
border-radius: 7rpx;
content: "";
display: block;
position: absolute;
left: 0;
bottom: -4rpx;
background-color: rgb(255, 192, 95);
width: 100%;
height: 7.5rpx;
border-radius: 7rpx;
}
.studentapartment {
background: #f3f4f5;
padding: 16rpx 30rpx;
min-height: calc(100vh - 300rpx);
box-sizing: border-box;
background: #f3f4f5;
padding: 16rpx 30rpx;
min-height: calc(100vh - 300rpx);
box-sizing: border-box;
}
.otherrental {
background: #f3f4f5;
padding: 16rpx 0rpx;
min-height: calc(100vh - 300rpx);
box-sizing: border-box;
background: #f3f4f5;
padding: 16rpx 0rpx;
min-height: calc(100vh - 300rpx);
box-sizing: border-box;
}
.otherrental-empty {
background: #f3f4f5;
background: #f3f4f5;
}
.hongkongrental {
background: #f3f4f5;
padding: 16rpx 0rpx;
min-height: calc(100vh - 300rpx);
box-sizing: border-box;
background: #f3f4f5;
padding: 16rpx 0rpx;
min-height: calc(100vh - 300rpx);
box-sizing: border-box;
}
.hongkongrental .list {
background: #fff;
background: #fff;
}
.personalList .region {
height: 44rpx;
padding: 0 18rpx;
border-radius: 18rpx;
background-color: #f2f2f2;
display: inline-flex;
align-items: center;
justify-content: center;
font-size: 22rpx;
color: #555555;
height: 44rpx;
padding: 0 18rpx;
border-radius: 18rpx;
background-color: #f2f2f2;
display: inline-flex;
align-items: center;
justify-content: center;
font-size: 22rpx;
color: #555555;
}
.personalList .tips {
margin-top: 28rpx;
color: #555555;
font-size: 22rpx;
margin-top: 28rpx;
color: #555555;
font-size: 22rpx;
}
.personalList .footer {
color: #343434;
color: #343434;
}
.personalList .money {
margin-top: 32rpx;
font-size: 26rpx;
line-height: 26rpx;
margin-top: 32rpx;
font-size: 26rpx;
line-height: 26rpx;
}
.personalList {
border-bottom: 15rpx solid #eee;
border-bottom: 15rpx solid #eee;
}
.personalList .footer {
height: 90rpx;
line-height: 90rpx;
border-top: 2rpx dashed #d0d0d0;
padding-left: 30rpx;
padding-right: 30rpx;
margin-top: 40rpx;
align-items: center;
height: 90rpx;
line-height: 90rpx;
border-top: 2rpx dashed #d0d0d0;
padding-left: 30rpx;
padding-right: 30rpx;
margin-top: 40rpx;
align-items: center;
}
.personalList .submit-form {
padding-left: 0;
padding-right: 0;
padding-bottom: 0;
padding-top: 38rpx;
padding-left: 0;
padding-right: 0;
padding-bottom: 0;
padding-top: 38rpx;
}
.personalList .personalList-top {
padding: 0 30rpx;
padding: 0 30rpx;
}
.personalList .personalList-avatar {
width: 34rpx;
height: 34rpx;
border-radius: 50rpx;
width: 34rpx;
height: 34rpx;
border-radius: 50rpx;
}
.personalList .l {
display: flex;
align-items: center;
height: 90rpx;
line-height: 90rpx;
display: flex;
align-items: center;
height: 90rpx;
line-height: 90rpx;
}
.personalList .personalList-name {
font-size: 28rpx;
padding: 0 24rpx 0 20rpx;
font-size: 28rpx;
padding: 0 24rpx 0 20rpx;
}
.personalList .authentication-icon {
width: 125rpx;
height: 34rpx;
}
.personalList .agent {
color: #343434;
background-color: #fff;
border: 2rpx solid #d3d3d3;
display: flex;
align-content: center;
color: #343434;
background-color: #fff;
border: 2rpx solid #d3d3d3;
display: flex;
align-content: center;
}
.personalList .footer-right {
height: 36rpx;
line-height: 36rpx;
display: flex;
align-items: center;
padding: 0 18rpx;
border-radius: 8rpx;
background-color: #e8f4ff;
color: #5eb1ff;
height: 36rpx;
line-height: 36rpx;
display: flex;
align-items: center;
padding: 0 18rpx;
border-radius: 8rpx;
background-color: #e8f4ff;
color: #5eb1ff;
}
.personalList .housingInfo {
display: flex;
align-items: center;
justify-content: space-between;
display: flex;
align-items: center;
justify-content: space-between;
}
.personalList .housingSite {
flex: 1;
flex: 1;
}
.personalList .housingMedia {
width: 200rpx;
height: 150rpx;
margin-left: 10rpx;
position: relative;
width: 200rpx;
height: 150rpx;
margin-left: 10rpx;
position: relative;
}
.personalList .housingMedia image {
width: 200rpx;
height: 150rpx;
border-radius: 15rpx;
width: 200rpx;
height: 150rpx;
border-radius: 15rpx;
}
.personalList .orientation {
width: 35rpx;
height: 35rpx;
margin-right: 10rpx;
width: 35rpx;
height: 35rpx;
margin-right: 10rpx;
}
.personalList .tips .i:not(:last-child):after {
background-color: #555555;
background-color: #555555;
}
.personalList .title {
font-weight: bold;
line-height: 38rpx;
font-weight: bold;
line-height: 38rpx;
}
.personalList .housingVideo {
width: 200rpx;
height: 150rpx;
margin-left: 10rpx;
border-radius: 15rpx;
display: flex;
align-items: center;
justify-content: center;
overflow: hidden;
width: 200rpx;
height: 150rpx;
margin-left: 10rpx;
border-radius: 15rpx;
display: flex;
align-items: center;
justify-content: center;
overflow: hidden;
}
.personalList .housingVideo .playBtn-bj {
position: absolute;
display: flex;
align-items: center;
justify-content: center;
width: 200rpx;
height: 150rpx;
background: rgba(0, 0, 0, 0.5);
position: absolute;
display: flex;
align-items: center;
justify-content: center;
width: 200rpx;
height: 150rpx;
background: rgba(0, 0, 0, 0.5);
}
.personalList .housingVideo .playBtn {
width: 46rpx;
height: 46rpx;
border-radius: 50rpx;
width: 46rpx;
height: 46rpx;
border-radius: 50rpx;
}
.search-initial {
background-color: #fff;
min-height: 100vh;
}

View File

@ -12,7 +12,7 @@
<view class="information flexacenter">
<view class="left">
<view class="tab-list flexflex">
<view class="tab-item flexcenter" wx:for="{{ 5 }}" wx:key="index">合租</view>
<view class="tab-item flexcenter" wx:for="{{ item.tabList }}" wx:key="index">{{ item }}</view>
</view>
<view class="area-list flexflex">
<view class="area-item flexacenter">

View File

@ -1,303 +1,302 @@
// template/headSwiper/headSwiper.js
var app = getApp()
Component({
/**
* 组件的属性列表
*/
properties: {
attachment: Array,
isInner: Number,
pages: String
},
observers: {
attachment(e) {
this.setHeightArr();
this.calculateimgLength();
}
},
/**
* 组件的初始数据
*/
data: {
swiperHeight: 0,
isIndexPage: true,
indicatorDots: true,
autoplay: false,
interval: 3000,
duration: 500,
circular: true,
current: 0,
swiperCurrent: 0,
windowWidth: 0,
imgUrl: [],
heightArr: [],
tab: 'live', // live video img
liveLength: 0,
videoLength: 0,
imgLength: 0,
imgIndex: 0,
videoIndex: 0,
liveIndex: 0,
video: '',
screen_data: {}
},
lifetimes: {
attached: function () {
this.attachedIn()
// this.setHeightArr()
/**
* 组件的属性列表
*/
properties: {
attachment: Array,
isInner: Number,
pages: String
},
},
attached: function () {
this.attachedIn()
},
/**
* 组件的方法列表
*/
methods: {
attachedIn() {
let that = this;
wx.getSystemInfo({
success: function (res) {
that.setData({
windowWidth: res.windowWidth,
screen_data: app.globalData.screen_data,
})
observers: {
attachment(e) {
this.setHeightArr();
this.calculateimgLength();
}
})
},
setHeightArr() {
this.setData({
heightArr: Array.from({
length: this.properties.attachment.length
}, item => {
return 120
})
})
},
previewImg(e) {
let that = this;
let url = e.currentTarget.dataset.url;
let appid = e.currentTarget.dataset.appid;
let finderusername = e.currentTarget.dataset.finderusername;
let feedid = e.currentTarget.dataset.feedid;
let type = e.currentTarget.dataset.type;
// 跳转视频号
if (type == 5) {
wx.openChannelsActivity({
finderUserName: finderusername,
feedId: feedid
})
return false
}
// 跳转直播
if (type == 4) {
wx.openChannelsLive({
finderUserName: finderusername
})
return false
}
// 判断跳转小程序
if (appid) {
wx.navigateToMiniProgram({
appId: appid,
path: url
})
return false;
}
// 判断是否是h5页面的
if (url && url.indexOf('http') != -1) {
wx.navigateTo({
url: `/pages/webViewwebweb/index?url=${ url }`,
})
return false;
}
if (url) {
wx.navigateTo({
url: '/' + url,
})
return false;
}
if (this.properties.pages == 'apartmentDetail') {
wx.setStorageSync('attachment', this.properties.attachment)
wx.navigateTo({
url: `/pages/video_show/video_show?frompage=apartment&current=${this.data.current}`
});
return false
}
if (this.data.imgUrl.length == 0) {
let imgUrl = [];
that.properties.attachment.map(item => {
imgUrl.push(item.image)
})
that.setData({
imgUrl: imgUrl
})
}
wx.previewImage({
current: that.data.imgUrl[that.data.current], // 当前显示图片的http链接
urls: that.data.imgUrl // 需要预览的图片http链接列表
})
},
load(e) {
if (this.data.swiperHeight > 0) {
return false
}
let index = e.currentTarget.dataset.index;
this.setData({
swiperHeight: this.data.windowWidth * e.detail.height / e.detail.width
})
return false;
this.data.heightArr[index] = this.data.windowWidth * e.detail.height / e.detail.width
this.setData({
heightArr: this.data.heightArr
})
// console.log(this.data.heightArr)
},
send_form_id: function (e) {
let {
statid,
url,
type
} = e.currentTarget.dataset;
this.previewImg(e)
// return false;
wx.request({
url: app.globalData.config.FormidInsert,
data: {
session: wx.getStorageSync('session'),
formid: e.detail.formId,
statid
},
method: 'POST', // OPTIONS, GET, HEAD, POST, PUT, DELETE, TRACE, CONNECT
header: app.globalData.header,
success: function (res) {
var data = app.return_data(res);
}
})
},
// 切换图片或视频
changeTab(e) {
let tab = e.currentTarget.dataset.tab;
if (this.data.tab == tab) return false
let swiperCurrent = 0
if (tab == 'img') swiperCurrent = this.data.liveLength + this.data.videoLength
else if (tab == 'video') swiperCurrent = this.data.liveLength
this.setData({
// swiperCurrent: tab == 'img' ? this.data.videoLength : 0,
swiperCurrent,
current: tab == 'img' ? this.data.videoLength : 0,
/**
* 组件的初始数据
*/
data: {
swiperHeight: 0,
isIndexPage: true,
indicatorDots: true,
autoplay: false,
interval: 3000,
duration: 500,
circular: true,
current: 0,
swiperCurrent: 0,
windowWidth: 0,
imgUrl: [],
heightArr: [],
tab: 'live', // live video img
liveLength: 0,
videoLength: 0,
imgLength: 0,
imgIndex: 0,
videoIndex: 0,
tab
})
},
// 计算视频个数
calculateimgLength() {
let that = this;
this.data.attachment.forEach(item => {
if (item.islive) that.data.liveLength++;
else if (item.isvideo) that.data.videoLength++;
else that.data.imgLength++;
})
this.setData({
liveLength: this.data.liveLength,
videoLength: this.data.videoLength,
imgLength: this.data.imgLength
})
if (this.data.current >= this.data.videoLength) {
this.setData({
tab: 'img',
imgIndex: this.data.current + this.data.videoLength + this.data.liveLength
})
} else if (this.data.current >= this.data.liveLength) {
this.setData({
tab: 'video',
videoIndex: this.data.current + this.data.liveLength
})
} else {
this.setData({
tab: 'live',
liveIndex: this.data.current
})
}
liveIndex: 0,
video: '',
screen_data: {}
},
bindchangeSwiper(e) {
let current = e.detail.current;
let videoLength = this.data.videoLength
let liveLength = this.data.liveLength
lifetimes: {
attached: function () {
this.attachedIn()
// this.setHeightArr()
},
},
attached: function () {
this.attachedIn()
},
/**
* 组件的方法列表
*/
methods: {
attachedIn() {
let that = this;
wx.getSystemInfo({
success: function (res) {
that.setData({
windowWidth: res.windowWidth,
screen_data: app.globalData.screen_data,
})
}
})
},
setHeightArr() {
this.setData({
heightArr: Array.from({
length: this.properties.attachment.length
}, item => {
return 120
})
})
},
let tab = "img"
if (current >= liveLength + videoLength) tab = "img"
else if (current >= liveLength) tab = "video"
else tab = "live"
previewImg(e) {
let that = this;
let url = e.currentTarget.dataset.url;
let appid = e.currentTarget.dataset.appid;
let finderusername = e.currentTarget.dataset.finderusername;
let feedid = e.currentTarget.dataset.feedid;
let type = e.currentTarget.dataset.type;
this.setData({
tab,
current,
})
// 跳转视频号
if (type == 5) {
wx.openChannelsActivity({
finderUserName: finderusername,
feedId: feedid
})
return false
}
// 跳转直播
if (type == 4) {
wx.openChannelsLive({
finderUserName: finderusername
})
return false
}
// 判断跳转小程序
if (appid) {
wx.navigateToMiniProgram({
appId: appid,
path: url
})
return false;
}
// 判断是否是h5页面的
if (url && url.indexOf('http') != -1) {
wx.navigateTo({
url: `/pages/webViewwebweb/index?url=${ url }`,
})
return false;
}
if (url) {
wx.navigateTo({
url: '/' + url,
})
return false;
}
if (this.properties.pages == 'apartmentDetail') {
wx.setStorageSync('attachment', this.properties.attachment)
wx.navigateTo({
url: `/pages/video_show/video_show?frompage=apartment&current=${this.data.current}`
});
return false
}
if (this.data.imgUrl.length == 0) {
let imgUrl = [];
that.properties.attachment.map(item => {
imgUrl.push(item.image)
})
that.setData({
imgUrl: imgUrl
})
}
wx.previewImage({
current: that.data.imgUrl[that.data.current], // 当前显示图片的http链接
urls: that.data.imgUrl // 需要预览的图片http链接列表
})
},
load(e) {
if (this.data.swiperHeight > 0) return false
let index = e.currentTarget.dataset.index;
let swiperHeight = this.data.windowWidth * e.detail.height / e.detail.width
this.setData({
swiperHeight
})
this.triggerEvent("recordSwiperHeight", swiperHeight)
return false;
this.data.heightArr[index] = this.data.windowWidth * e.detail.height / e.detail.width
this.setData({
heightArr: this.data.heightArr
})
// console.log(this.data.heightArr)
},
send_form_id: function (e) {
let {
statid,
url,
type
} = e.currentTarget.dataset;
this.previewImg(e)
wx.request({
url: app.globalData.config.FormidInsert,
data: {
session: wx.getStorageSync('session'),
formid: e.detail.formId,
statid
},
method: 'POST', // OPTIONS, GET, HEAD, POST, PUT, DELETE, TRACE, CONNECT
header: app.globalData.header,
success: function (res) {
var data = app.return_data(res);
}
})
},
// 切换图片或视频
changeTab(e) {
let tab = e.currentTarget.dataset.tab;
if (this.data.tab == tab) return false
let swiperCurrent = 0
if (tab == 'img') swiperCurrent = this.data.liveLength + this.data.videoLength
else if (tab == 'video') swiperCurrent = this.data.liveLength
this.setData({
// swiperCurrent: tab == 'img' ? this.data.videoLength : 0,
swiperCurrent,
current: tab == 'img' ? this.data.videoLength : 0,
imgIndex: 0,
videoIndex: 0,
tab
})
},
// 计算视频个数
calculateimgLength() {
let that = this;
this.data.attachment.forEach(item => {
if (item.islive) that.data.liveLength++;
else if (item.isvideo) that.data.videoLength++;
else that.data.imgLength++;
})
this.setData({
liveLength: this.data.liveLength,
videoLength: this.data.videoLength,
imgLength: this.data.imgLength
})
if (this.data.current >= this.data.videoLength) {
this.setData({
tab: 'img',
imgIndex: this.data.current + this.data.videoLength + this.data.liveLength
})
} else if (this.data.current >= this.data.liveLength) {
this.setData({
tab: 'video',
videoIndex: this.data.current + this.data.liveLength
})
} else {
this.setData({
tab: 'live',
liveIndex: this.data.current
})
}
},
bindchangeSwiper(e) {
let current = e.detail.current;
let videoLength = this.data.videoLength
let liveLength = this.data.liveLength
let tab = "img"
if (current >= liveLength + videoLength) tab = "img"
else if (current >= liveLength) tab = "video"
else tab = "live"
this.setData({
tab,
current,
})
return
if (current <= this.data.liveLength - 1) {
console.log("ffff");
} else if (e.detail.current >= this.data.videoLength) {
// 显示视频
if (this.data.tab == 'video') {
this.setData({
tab: 'img',
imgIndex: 0,
})
} else {
this.setData({
imgIndex: current - this.data.videoLength
})
return
if (current <= this.data.liveLength - 1) {
console.log("ffff");
} else if (e.detail.current >= this.data.videoLength) {
// 显示视频
if (this.data.tab == 'video') {
this.setData({
tab: 'img',
imgIndex: 0,
})
} else {
this.setData({
imgIndex: current - this.data.videoLength
})
}
} else {
// 显示图片
if (this.data.tab == 'img') {
this.setData({
tab: 'video',
videoIndex: 0,
})
} else {
this.setData({
videoIndex: current
})
}
}
this.setData({
current: e.detail.current,
})
},
play(e) {
// this.setData({
// video:e.currentTarget.dataset.video
// })
wx.navigateTo({
url: '/pages/video_show/video_show?src=' + e.currentTarget.dataset.video,
})
},
closePage() {
this.setData({
video: ''
})
this.triggerEvent('close', {})
}
} else {
// 显示图片
if (this.data.tab == 'img') {
this.setData({
tab: 'video',
videoIndex: 0,
})
} else {
this.setData({
videoIndex: current
})
}
}
this.setData({
current: e.detail.current,
})
},
play(e) {
// this.setData({
// video:e.currentTarget.dataset.video
// })
wx.navigateTo({
url: '/pages/video_show/video_show?src=' + e.currentTarget.dataset.video,
})
},
closePage() {
this.setData({
video: ''
})
this.triggerEvent('close', {})
}
}
})

View File

@ -29,7 +29,7 @@
</view>
</view>
<view class="page-action-bar flexacenter">
<view class="page-action-bar flexacenter" style="border-bottom: 1rpx solid #ebebeb;">
<view class="page-action-item flex1 flexcenter" bindtap="setValue" data-key="conditionState" data-value="{{ index }}" wx:for="{{ conditionObj }}" wx:key="index">
{{ item.name }}
<block wx:if="{{ conditionState == index }}">

View File

@ -1,7 +1,6 @@
<view>
<view class="texttitle" bindtap="showAlert" data-show="1">
<slot></slot>
</view>
<view class="alert" hidden="{{ !show }}" catchtouchmove="catchmove">
<view class="block-back" bindtap="showAlert" data-show="0"></view>

View File

@ -97,7 +97,7 @@
margin: 0 30rpx;
}
input{
.alert input{
display: inline-flex;
justify-content: center;
border-radius: 10rpx;

View File

@ -0,0 +1,104 @@
// template/xinHeadSwiper/xinHeadSwiper.js
let app = getApp()
var miucms = require('../../utils/miucms.js');
Component({
/**
* 组件的属性列表
*/
properties: {
data: Array,
},
/**
* 组件的初始数据
*/
data: {
swiperCurrent: 0
},
/**
* 组件的方法列表
*/
methods: {
// 轮播图的加载事件
loadHeadSwiper(e) {
let ratio = app.globalData.screen_data['windowWidth'] / 750
let originalWidth = e.detail.width;
let originalHeight = e.detail.height;
let height = originalHeight / originalWidth * 690 * ratio
if (height > this.data.HeadSwiperHeight) {
this.setData({
HeadSwiperHeight: height
})
}
},
// 新 轮播图 自动滑动事件,修改下标
bindchangeSwiper(e) {
let current = e.detail.current
this.setData({
swiperCurrent: current
})
},
// 新 轮播图 点击事件
handleSwiper(e) {
let {
appid,
url,
statid,
finderusername,
feedid,
type,
advertisingtype,
advtype,
} = e.currentTarget.dataset
let requestUrl = app.globalData.config.FormidInsert
miucms.request(requestUrl, {
statid
}).then(res => {})
// 跳转视频号
if ((type == 5) || (type == 'adv' && advtype == "videofeed_5")) {
wx.openChannelsActivity({
finderUserName: finderusername,
feedId: feedid
})
return false
}
// 跳转直播
if ((type == 4) || (type == 'adv' && advtype == "videofeed_4")) {
wx.openChannelsLive({
finderUserName: finderusername
})
return false
}
// 判断跳转小程序
if (appid) {
wx.navigateToMiniProgram({
appId: appid,
path: url
})
return false;
}
// 判断是否是h5页面的
if (url && url.indexOf('http') != -1) {
wx.navigateTo({
url: `/pages/webViewwebweb/index?url=${ url }`,
})
return false;
}
if (url) {
wx.navigateTo({
url: '/' + url,
})
return false;
}
},
}
})

View File

@ -0,0 +1,4 @@
{
"component": true,
"usingComponents": {}
}

View File

@ -0,0 +1,17 @@
<!--template/xinHeadSwiper/xinHeadSwiper.wxml-->
<!-- <text>template/xinHeadSwiper/xinHeadSwiper.wxml</text> -->
<view class="headSwiper">
<swiper class='headSwiper-swiper' current="{{ swiperCurrent }}" autoplay="{{ true }}" circular interval="{{ 3000 }}" duration="{{ 500 }}" bindanimationfinish="bindchangeSwiper" style="height: {{ HeadSwiperHeight + 5 }}px;">
<block wx:for="{{ data }}" wx:key="index">
<swiper-item>
<image class="headSwiper-img" mode="widthFix" bindtap="handleSwiper" data-type="{{ item.type }}" data-appid="{{ item.appid }}" data-url="{{ item.url }}" data-finderUserName="{{ item.finderUserName }}" data-feedId="{{ item.feedId }}" src="{{ item.imageurl }}" bindload="loadHeadSwiper"></image>
</swiper-item>
</block>
</swiper>
<view class="indication-point flexacenter">
<block wx:for="{{ data }}" wx:key="index">
<view class="indication-point-item {{ index == swiperCurrent ? 'pitch' : '' }}"></view>
</block>
</view>
</view>

View File

@ -0,0 +1,47 @@
/* template/xinHeadSwiper/xinHeadSwiper.wxss */
@import '/app.wxss';
.headSwiper-swiper {
position: relative;
}
.headSwiper {
width: 690rpx;
/* margin: 32rpx auto 30rpx; */
margin: 0 auto;
position: relative;
border-radius: 20rpx;
}
.headSwiper .headSwiper-img {
width: 690rpx;
height: 292.5rpx;
border-radius: 20rpx;
}
.headSwiper .indication-point {
position: absolute;
bottom: 20rpx;
right: 15rpx;
height: 18rpx;
border-radius: 45rpx;
background-color: rgba(255, 255, 255, 0.501960784313725);
padding: 0 9rpx;
}
.headSwiper .indication-point .indication-point-item {
width: 12rpx;
height: 12rpx;
border-radius: 50%;
border: 1rpx solid #aaaaaa;
background-color: transparent;
}
.headSwiper .indication-point .indication-point-item:not(:last-of-type) {
margin-right: 4rpx;
}
.headSwiper .indication-point .indication-point-item.pitch {
border: none;
background-color: #000000;
}