<template>
<div class="page no-toolbar" data-name="disNearby">
<div class="mystatusbar"></div>
<div class="navbar transparent">
<div class="navbar-inner sliding nearBar justify-content-space-between" style="height: 60px">
<div class="left">
<a href="#" class="back color-white"><i class="iconfont icon-return"></i></a>
</div>
<div class="title">
<h1 style="color:#fff">{{$root.locRes.square_nearby}}</h1>
</div>
<div class="right">
<i class="filter-icon dynamic-popup"></i>
</div>
</div>
</div>
<div class="page-content gradient-color-left-top no-padding-bottom">
<div class="filter-main">
<!-- <div class="holder-left"></div>
<div class="holder-right"></div> -->
<div class="stack-wrapper">
<div class="stack-con">
<ul class="stack"></ul>
<div class="nearBottom">
<div class="app-icon"></div>
</div>
</div>
</div>
</div>
</div>
</div>
</template>
<script>
return {
data: function () {
var nearHtml =
`{{#each data}}
<li class="stack-item" data-id="{{id}}" data-value="{{value}}" data-headImg="{{avatarLarge}}">
<div class="stackMove">
<div class="stack-photo lazy lazy-fade-in" data-background="{{avatarLarge}}" style="background-size:cover"></div>
<div class="stack-content margin-horizontal margin-top margin-bottom" style="height:30%">
<div class="item-title" style="font-weight:600;font-size:24px;overflow: hidden;text-overflow: ellipsis;white-space: nowrap;">{{name}}</div>
<div class="item-inner display-flex align-items-center">
<div class="item-subtitle display-inline-block">{{regionName}}</div>
{{#js_if "this.gender == 0"}}
<div class="chip item-grends grendsMan">
<i class="iconfont icon-gender-male fontSize14"></i>
<span class="fontSize14">{{age}}</span>
</div>
{{else}}
{{#js_if "this.gender == 1"}}
<div class="chip item-grends grendsWonman">
<i class="iconfont icon-gender-female fontSize14"></i>
<span class="fontSize14">{{age}}</span>
</div>
{{else}}
{{#js_if "this.gender == 2"}}
<div class="chip item-grends grendsAll">
<i class="iconfont icon-gendersecret fontSize14"></i>
<span class="fontSize14">{{age}}</span>
</div>
{{/js_if}}
{{/js_if}}
{{/js_if}}
</div>
{{#js_if "this.signature != null"}}
<div class="item-text text-align-center margin-top">
<div class="item-title">{{this.signature}}</div>
</div>
{{/js_if}}
</div>
<div class="controls">
<div class="nearNoLike text-align-center">
<div style="max-height:70px;"><img style="width:70%;" src="img/dis/nearNoLike.png"></div>
<span style="color:#9b9b9b">{{js "app.data.locRes.square_nearNoLike"}}</span>
</div>
<div class="nearLike text-align-center dynamic-popover">
<div style="max-height:70px;"><img style="width:70%;" src="img/dis/nearLike.png"></div>
<span style="color:#9b9b9b">{{js "app.data.locRes.square_nearLike"}}</span>
</div>
</div>
</div>
</li>
{{/each}}`
var compiledNearHtml = Template7.compile(nearHtml);
return {
limit: 10,
page: 1,
compiledNearHtml: compiledNearHtml,
exceptList: []
}
},
methods: {
},
on: {
pageInit: function (e, page) {
var self = this;
self.$el.find('.nearBar .back').click(function () {
app.views.current.router.back();
})
var exceptList1 = []
if(localStorage.getItem("notLike")){
exceptList1 = localStorage.getItem("notLike")
self.exceptList = JSON.parse(exceptList1);
}
var getPeopleObj = {
linkUrl: 'social/getpeoplenearby',
lng: '121.33',
lat: '30.744',
radius: '1000',
gender: '2',
ageMax: '30',
ageMin: '18',
exceptList: self.exceptList,
page: self.page,
limit: self.limit
}
app.methods.methodsPostAll(getPeopleObj, function (data) {
self.$el.find('.nearBottom').show();
self.$el.find('.stacNoData').hide();
//数据添加 拼接html
var tempData = [];
for (var i = 0; i < data.length; i++) {
var item = data[i];
var age = moment().diff(item.birthday, 'years');
var temp = {
id: item.id,
value: i,
name: item.name,
regionName: item.region.l10ns[lang].name,
gender: item.gender,
age: age,
signature: item.signature,
avatarLarge: app.methods.getUserHugeAvatar(item.id)
}
tempData.push(temp);
}
self.$el.find('.stack-con .stack').append(self.compiledNearHtml({
data: tempData
}));
app.lazy.create(self.$el.find('.stack-photo'));
var x,y,end_x,end_y;
self.$el.find('.stack-item .stackMove').touchstart(function (e) {
var touch=e.touches[0];
x = parseInt(touch.pageX),
y = parseInt(touch.pageY);
end_x=x,
end_y=y;
})
//滑动时 移除(==>不喜欢)
self.$el.find('.stack-item .stackMove').touchmove(function (e) {
var touch=e.touches[0];
end_x=parseInt(touch.pageX),
end_y=parseInt(touch.pageY);
})
self.$el.find('.stack-item .stackMove').touchend(function (e) {
var stack_this = $(this).parents('.s