|
|
@@ -2,58 +2,682 @@ var app = new Vue({
|
|
|
'el': '#app',
|
|
|
'data': {
|
|
|
// 当前导航
|
|
|
- curNav: 'member',
|
|
|
+ curNav: 'match',
|
|
|
+ slideIndex: 0,
|
|
|
+ // 数据请求参数
|
|
|
+ params: {
|
|
|
+ page: 1,
|
|
|
+ historyPage: 0,
|
|
|
+ loadHistory: 0,
|
|
|
+ age: '',
|
|
|
+ height: '',
|
|
|
+ education: 0,
|
|
|
+ married: 0,
|
|
|
+ pageSize: 3,
|
|
|
+ type: 1,
|
|
|
+ lat: '',
|
|
|
+ lng: '',
|
|
|
+ },
|
|
|
+ hasFollow: 0,
|
|
|
+ // 数据列表
|
|
|
+ dataList: [],
|
|
|
+ matchList: [],
|
|
|
+ // 条件参数
|
|
|
+ ages: [],
|
|
|
+ // 身高
|
|
|
+ heights: [],
|
|
|
+ // 收入
|
|
|
+ salarys: ['不限'],
|
|
|
+ // 学历
|
|
|
+ educations: ['不限','大专','本科','硕士及以上'],
|
|
|
+ // 婚姻状态
|
|
|
+ marrieds: [],
|
|
|
+ // 设置的条件
|
|
|
+ conditions: {
|
|
|
+ age: '',
|
|
|
+ year: '',
|
|
|
+ age_txt: '',
|
|
|
+ city: 0,
|
|
|
+ education: 0,
|
|
|
+ height: '',
|
|
|
+ height_txt: '',
|
|
|
+ home_province: 0,
|
|
|
+ salary: 0,
|
|
|
+ salary_txt: '不限',
|
|
|
+ weight: 0,
|
|
|
+ weight_txt: '不限',
|
|
|
+ married: 0,
|
|
|
+ married_txt: '未婚',
|
|
|
+ },
|
|
|
+ // 记录数
|
|
|
+ total: 1,
|
|
|
+ type: 1,
|
|
|
+ loadSlide: false,
|
|
|
+ // 是否已经推荐过
|
|
|
+ redommended: false,
|
|
|
+ showFilterBox: false,
|
|
|
// 用户信息
|
|
|
memberInfo: {},
|
|
|
- selects: ['A','B','C','D','E','F','G','H','I'],
|
|
|
- selects1: ['A','B','C','D','E','F','G','H','I'],
|
|
|
- results: [],
|
|
|
+ // 加载状态
|
|
|
+ status: {
|
|
|
+ locading: false,
|
|
|
+ loaded: false,
|
|
|
+ },
|
|
|
+ switchStatus: false,
|
|
|
+ rSwiper: null,
|
|
|
+ timerId: null,
|
|
|
+ tipsTimerId: null,
|
|
|
+ tipsLoadTimerId: null,
|
|
|
+ loadedCount: 0,
|
|
|
+ locaded: false,
|
|
|
+ tipsArr: [],
|
|
|
+ tips: {
|
|
|
+ content: '',
|
|
|
+ left: -95,
|
|
|
+ },
|
|
|
+ tipParams: {
|
|
|
+ page: 1,
|
|
|
+ pageSize: 30
|
|
|
+ },
|
|
|
},
|
|
|
- created: function(){
|
|
|
+ created: function () {
|
|
|
+ var reset = getParam('rs');
|
|
|
+ var slideIndex = sessionStorage.getItem('slideIndex');
|
|
|
+ var total = sessionStorage.getItem('total');
|
|
|
+ var dataList = sessionStorage.getItem('dataList')
|
|
|
+ dataList = typeof (dataList) != 'undefined' && dataList != null? JSON.parse(dataList) : []
|
|
|
+ if(dataList && dataList.length>0 && !reset){
|
|
|
+ this.slideIndex = typeof (slideIndex) != 'undefined' && slideIndex>0? slideIndex : 0
|
|
|
+ this.slideIndex = this.slideIndex <= dataList.length? this.slideIndex : 0
|
|
|
+ this.total = typeof (total) != 'undefined' && total>0? total : dataList.length
|
|
|
+ this.params.page = Math.ceil(dataList.length/this.params.pageSize);
|
|
|
+ this.dataList = dataList;
|
|
|
+ }else{
|
|
|
+ this.slideIndex = 0;
|
|
|
+ this.getDataList(false);
|
|
|
+ }
|
|
|
+ this.getInfo();
|
|
|
+ this.getParams();
|
|
|
+ this.initShare();
|
|
|
+
|
|
|
+
|
|
|
+ },
|
|
|
+ updated: function () {
|
|
|
+ var _this = this;
|
|
|
+ _this.initData();
|
|
|
+
|
|
|
+ this.initSwiper()
|
|
|
+
|
|
|
+ // 选项选中
|
|
|
+ $(".choose-item h1").click(function(){
|
|
|
+ $(this).addClass('active').siblings().removeClass('active');
|
|
|
+ });
|
|
|
},
|
|
|
- mounted: function(){
|
|
|
+ // 渲染数据
|
|
|
+ mounted: function () {
|
|
|
+ var _this = this;
|
|
|
+
|
|
|
+ _this.timeLockTips();
|
|
|
+
|
|
|
+ // 分类导航切换
|
|
|
+ $(".top_lieb li").click(function () {
|
|
|
+ var type = $(this).index() + 1;
|
|
|
+ $(this).addClass('active').siblings().removeClass('active');
|
|
|
+ _this.type = type;
|
|
|
+ if (_this.type == 2 ) {
|
|
|
+ // _this.hasFollow=1
|
|
|
+ }else{
|
|
|
+ $.hideLoading();
|
|
|
+ }
|
|
|
+ });
|
|
|
|
|
|
},
|
|
|
methods: {
|
|
|
- doMatch: function(){
|
|
|
- var _this = this;
|
|
|
- var params = [];
|
|
|
- var count = 0;
|
|
|
- $(".list").each(function(){
|
|
|
- var $this = $(this);
|
|
|
- var uid =$this.find('span').text();
|
|
|
- var data = {'uid': uid};
|
|
|
- data.heart_uids = [];
|
|
|
- console.log(data);
|
|
|
- $this.find('input').each(function(){
|
|
|
- var num = $(this).val();
|
|
|
- if(num != ''){
|
|
|
- data.heart_uids.push(num);
|
|
|
+ // 获取用户信息
|
|
|
+ getInfo: function () {
|
|
|
+ var _this = this;
|
|
|
+ $.post('/api/member/getInfo', {type: 1,uncheck: true}, function (res) {
|
|
|
+ if (res.code == 'success') {
|
|
|
+ _this.memberInfo = res.data
|
|
|
+ _this.hasFollow = typeof(_this.memberInfo.is_follow) != 'undefined'? _this.memberInfo.is_follow : 0;
|
|
|
+ /*if (_this.memberInfo.user_status != 1) {
|
|
|
+ _this.matchList = [];
|
|
|
+ $.showLoading('账号已被冻结,请联系客服', 'text');
|
|
|
+ setTimeout(function () {
|
|
|
+ // $.hideLoading();
|
|
|
+ location.href = '/weixin/page/custom';
|
|
|
+ }, 500)
|
|
|
+ }*/
|
|
|
+ } else if (res.code == 'exception') {
|
|
|
+ var url = res.data.url;
|
|
|
+ $.showLoading(res.message, 'text');
|
|
|
+ if (url) {
|
|
|
+ setTimeout(function () {
|
|
|
+ $.hideLoading();
|
|
|
+ location.href = url;
|
|
|
+ }, 500)
|
|
|
}
|
|
|
- });
|
|
|
+ } else {
|
|
|
+ $.toast(res.message, 'text');
|
|
|
+ }
|
|
|
+ }, "json");
|
|
|
+ },
|
|
|
+ // 初始化参数
|
|
|
+ getParams: function(){
|
|
|
+ var _this = this;
|
|
|
+ $.post('/api/index/params', {}, function (res) {
|
|
|
+ if (res.code == 'success'){
|
|
|
+ var paramDatas = res.data;
|
|
|
+ _this.marrieds = typeof (paramDatas.marrieds) != 'undefined'? paramDatas.marrieds : ["未婚"];
|
|
|
+ _this.initData();
|
|
|
+ }else{
|
|
|
+ $.toast(res.message, 'text');
|
|
|
+ }
|
|
|
+ }, "json");
|
|
|
+ },
|
|
|
+ // 获取举报用户
|
|
|
+ getTips: function(){
|
|
|
+ var _this = this
|
|
|
+ $.post('/api/member/complainList', _this.tipParams, function (res) {
|
|
|
+ if (res.code == 'success'){
|
|
|
+ var dataList = typeof(res.data.data) != 'undefined'? res.data.data : [];
|
|
|
+ if(dataList.length>0 && res.data.total>0 && _this.tipsArr.length<res.data.total){
|
|
|
+ if(dataList.length<_this.tipParams.pageSize){
|
|
|
+ _this.tipsArr = _this.tipsArr.concat(dataList)
|
|
|
+ }else{
|
|
|
+ _this.tipsArr = dataList
|
|
|
+ }
|
|
|
|
|
|
- if(data.heart_uids.length>0){
|
|
|
- params.push(data);
|
|
|
- count++;
|
|
|
+ _this.initTips(0)
|
|
|
+ }else{
|
|
|
+ clearInterval(_this.tipsLoadTimerId)
|
|
|
+ }
|
|
|
}
|
|
|
- })
|
|
|
+ }, "json");
|
|
|
+ },
|
|
|
+ timeLockTips(){
|
|
|
+ var _this = this;
|
|
|
+ clearInterval(_this.tipsLoadTimerId)
|
|
|
+ _this.getTips()
|
|
|
+ },
|
|
|
+ // 初始化提示
|
|
|
+ initTips: function(index){
|
|
|
+ var _this = this
|
|
|
+ var num = _this.tipsArr.length
|
|
|
+ if(num>0){
|
|
|
+ var data = typeof(_this.tipsArr[index]) != 'undefined'? _this.tipsArr[index] : {};
|
|
|
+ if(!data){
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ clearInterval(_this.tipsTimerId)
|
|
|
+ var width = 280;
|
|
|
+ var left = -100;
|
|
|
+ var content = '提示:用户<em>'+data.user_nickname+'</em>因被举报核实已拉黑,点击查看'
|
|
|
+ // _this.tips.content = '提示:用户<em>'+data.user_nickname+'</em>因被举报核实已拉黑,点击查看'
|
|
|
+ var strs = content? content.split('') : [];
|
|
|
+ if(strs.length>9){
|
|
|
+ width = (strs.length-9)*13.5
|
|
|
+ }
|
|
|
+
|
|
|
+ $(".tips").show();
|
|
|
+ $(".tips").css({width:width+'px'});
|
|
|
+ $(".tips a span").html(content);
|
|
|
+ _this.tipsTimerId = setInterval(function(){
|
|
|
+ //console.log(left+'++'+index)
|
|
|
+ if(left>=100){
|
|
|
+ left = -100;
|
|
|
+ content = '';
|
|
|
+ index = index+1>=num? 0 : index+1;
|
|
|
+ $(".tips").hide();
|
|
|
+ $(".tips").css({right:left+'%'});
|
|
|
+ $(".tips a span ").html(content);
|
|
|
+ _this.initTips(index)
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ left += 0.25;
|
|
|
+ $(".tips").css({width:width+'px'});
|
|
|
+ $(".tips").css({right:left+'%'});
|
|
|
+ $(".tips a span ").html(content);
|
|
|
+ $(".tips").show();
|
|
|
+ }, 20);
|
|
|
+ }
|
|
|
+
|
|
|
+ },
|
|
|
+ // 初始化筛选数据
|
|
|
+ initData: function(){
|
|
|
+ var _this = this;
|
|
|
+ var ages = [];
|
|
|
+ for(var i=0;i<=72;i++){
|
|
|
+ ages.push(18+i);
|
|
|
+ }
|
|
|
|
|
|
- console.log(params)
|
|
|
- console.log(params.length)
|
|
|
- if(count<=0){
|
|
|
- $.toast('请填写数据', 'text');
|
|
|
+ var conditions = sessionStorage.getItem('conditions');
|
|
|
+ conditions = typeof (conditions) != 'undefined' && conditions != null? JSON.parse(conditions) : {}
|
|
|
+ if(conditions){
|
|
|
+ _this.conditions = conditions
|
|
|
+ }
|
|
|
+
|
|
|
+ var data = _this.conditions.age? _this.conditions.age.toString() : '';
|
|
|
+ data = data? data.split('~'): [];
|
|
|
+ var data1 = typeof(data[0]) != 'undefined'? data[0] : '';
|
|
|
+ var data2 = typeof(data[1]) != 'undefined'? data[1] : '';
|
|
|
+ data2 = data2>data1?data2 : 0;
|
|
|
+ if(data1==0 && data2>0){
|
|
|
+ code = data2+'以下';
|
|
|
+ }else if(data1>0 && data2==0){
|
|
|
+ code = data1+'以上';
|
|
|
+ }else if(data1 && data2 && data2>data1){
|
|
|
+ code = data1+'~'+data2+'岁';
|
|
|
+ }
|
|
|
+
|
|
|
+ $("#age").val(code);
|
|
|
+ $("#age_btn").val(_this.conditions.age);
|
|
|
+ $("#age_btn").picker({
|
|
|
+ title: "请选择年龄",
|
|
|
+ cols: [
|
|
|
+ {
|
|
|
+ textAlign: 'center',
|
|
|
+ values: ages,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ textAlign: 'center',
|
|
|
+ values: ages,
|
|
|
+ }
|
|
|
+ ],
|
|
|
+ onChange: function(data){
|
|
|
+ var code = '';
|
|
|
+ var data1 = data.cols[0].value;
|
|
|
+ var data2 = data.cols[1].value;
|
|
|
+ data1 = data1 =='不限'? 0 : data1;
|
|
|
+ data2 = data2 =='不限'? 0 : data2;
|
|
|
+ data2 = data2>data1?data2 : 0;
|
|
|
+ if(data1==0 && data2>0){
|
|
|
+ code = data2+'以下';
|
|
|
+ }else if(data1>0 && data2==0){
|
|
|
+ code = data1+'以上';
|
|
|
+ }else if(data1 && data2 && data2>data1){
|
|
|
+ code = data1+'~'+data2+'岁';
|
|
|
+ }
|
|
|
+ $("#age").attr('data-code', data1+'~'+data2);
|
|
|
+ $("#age").val(code);
|
|
|
+ // $("#age").val(data1 || data2 && (data2>data1)? data1+'~'+data2 : '');
|
|
|
+ },
|
|
|
+ onConfirm: function(data){
|
|
|
+ console.log(data)
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ for (var i = 1; i <= 70; i++) {
|
|
|
+ _this.heights.push((145 + i));
|
|
|
+ }
|
|
|
+
|
|
|
+ var data = _this.conditions.height? _this.conditions.height.toString() : '';
|
|
|
+ data = data? data.split('~'): [];
|
|
|
+ var data1 = typeof(data[0]) != 'undefined'? data[0] : '';
|
|
|
+ var data2 = typeof(data[1]) != 'undefined'? data[1] : '';
|
|
|
+ var code = '';
|
|
|
+ data1 = data1 =='不限' || !data1? 0 : data1;
|
|
|
+ data2 = data2 =='不限' || !data2? 0 : data2;
|
|
|
+ data2 = data2>data1?data2 : 0;
|
|
|
+ if(data1==0 && data2>0){
|
|
|
+ code = data2+'以下';
|
|
|
+ }else if(data1>0 && data2==0){
|
|
|
+ code = data1+'以上';
|
|
|
+ }else if(data1 && data2 && data2>data1){
|
|
|
+ code = data1+'~'+data2+'cm';
|
|
|
+ }
|
|
|
+ $("#height_btn").attr('data-code', _this.conditions.height);
|
|
|
+ $("#height").val(code);
|
|
|
+ $("#height_btn").picker({
|
|
|
+ title: "请选择身高",
|
|
|
+ cols: [
|
|
|
+ {
|
|
|
+ textAlign: 'center',
|
|
|
+ values: _this.heights,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ textAlign: 'center',
|
|
|
+ values: _this.heights,
|
|
|
+ }
|
|
|
+ ],
|
|
|
+ onChange: function(data){
|
|
|
+ var code = '';
|
|
|
+ var data1 = data.cols[0].value;
|
|
|
+ var data2 = data.cols[1].value;
|
|
|
+ data1 = data1 =='不限' || !data1? 0 : data1;
|
|
|
+ data2 = data2 =='不限' || !data2? 0 : data2;
|
|
|
+ data2 = data2>data1?data2 : 0;
|
|
|
+ if(data1==0 && data2>0){
|
|
|
+ code = data2+'以下';
|
|
|
+ }else if(data1>0 && data2==0){
|
|
|
+ code = data1+'以上';
|
|
|
+ }else if(data1 && data2 && data2>data1){
|
|
|
+ code = data1+'~'+data2+'cm';
|
|
|
+ }
|
|
|
+ $("#height").attr('data-code', data1+'~'+data2);
|
|
|
+ $("#height").val(code);
|
|
|
+ },
|
|
|
+ onConfirm: function(data){
|
|
|
+
|
|
|
+ },
|
|
|
+ });
|
|
|
+ },
|
|
|
+ // 加载更多
|
|
|
+ loadMore: function(){
|
|
|
+ var _this = this;
|
|
|
+ var slideIndex = _this.dataList.length;
|
|
|
+ _this.status.loaded = false;
|
|
|
+ _this.status.total = 1;
|
|
|
+ _this.params.page++;
|
|
|
+ _this.slideIndex = slideIndex>0? slideIndex : 0
|
|
|
+ _this.getDataList(true);
|
|
|
+ },
|
|
|
+ // 获取列表数据
|
|
|
+ getDataList: function (more) {
|
|
|
+ var _this = this;
|
|
|
+ if(_this.status.loading){
|
|
|
return false;
|
|
|
}
|
|
|
-console.log(params);
|
|
|
- $.showLoading("数据加载中...");
|
|
|
- $.post('/api/test/matchUser', {params: params}, function (res) {
|
|
|
+ _this.status.loading = true;
|
|
|
+ if (_this.params.page == 1 ) {
|
|
|
+ _this.dataList = [];
|
|
|
+ }
|
|
|
+ if(_this.params.loadHistory<=0){
|
|
|
+ $.showLoading("数据加载中...");
|
|
|
+ }
|
|
|
+
|
|
|
+ $.post('/api/member/getRecommendList', _this.params, function (res) {
|
|
|
+ _this.status.loading = false;
|
|
|
+ _this.loadSlide = false;
|
|
|
$.hideLoading();
|
|
|
- if (res.code == 'success'){
|
|
|
- _this.results = res.data
|
|
|
- }else{
|
|
|
+ if (res.code == 'success') {
|
|
|
+ if (res.data === true) {
|
|
|
+ _this.total = 0;
|
|
|
+ _this.redommended = true;
|
|
|
+ _this.status.loaded = false;
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ _this.total = res.data.total;
|
|
|
+ var dataList = res.data.data;
|
|
|
+ if (dataList.length <= 0 && _this.params.page > 1) {
|
|
|
+ _this.showMessage('已加载完全部...', 1500)
|
|
|
+ _this.status.loaded = true;
|
|
|
+ return false;
|
|
|
+ }else if(dataList.length <= 0 && _this.params.page <= 1){
|
|
|
+ sessionStorage.setItem('page', 0);
|
|
|
+ sessionStorage.setItem('dataList', null);
|
|
|
+ }else{
|
|
|
+ sessionStorage.setItem('page', _this.params.page);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (more>0) {
|
|
|
+ $.each(dataList, function (k, item) {
|
|
|
+ _this.dataList.push(item);
|
|
|
+ });
|
|
|
+
|
|
|
+ }else {
|
|
|
+ _this.dataList = dataList
|
|
|
+ }
|
|
|
+
|
|
|
+ sessionStorage.setItem('dataList', JSON.stringify(_this.dataList));
|
|
|
+ sessionStorage.setItem('total', _this.total);
|
|
|
+ } else {
|
|
|
$.toast(res.message, 'text');
|
|
|
}
|
|
|
}, "json");
|
|
|
+ },
|
|
|
+ initSwiper: function(){
|
|
|
+ var _this = this;
|
|
|
+ this.$nextTick(()=>{
|
|
|
+ console.log(65)
|
|
|
+ console.log(_this.dataList)
|
|
|
+ if(_this.swiper || _this.dataList.length<=0){
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ console.log(_this.slideIndex+'+dd+')
|
|
|
+ // 单身推荐列表
|
|
|
+ _this.swiper = new Swiper('.hearts', {
|
|
|
+ loop: false, // 循环模式选项
|
|
|
+ autoplay: false,
|
|
|
+ speed: 200,
|
|
|
+ direction : 'vertical',
|
|
|
+ initialSlide: _this.slideIndex,// 默认显示
|
|
|
+ // freeMode : true,//是否滑动
|
|
|
+ observer: true,//修改swiper自己或子元素时,自动初始化swiper
|
|
|
+ observeParents: true,//修改swiper的父元素时,自动初始化swiper
|
|
|
+ slidesPerView: 'auto',
|
|
|
+ on: {
|
|
|
+ slideChange:function(event){
|
|
|
+ if(_this.switchStatus){
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ _this.switchStatus = true;
|
|
|
+ let count = _this.dataList.length-1
|
|
|
+ let swipeDirection = typeof(this.swipeDirection) != 'undefined'? this.swipeDirection : '';
|
|
|
+ if(!swipeDirection){
|
|
|
+ console.log('未触发'+this.swipeDirection)
|
|
|
+ _this.switchStatus = false;
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ if(swipeDirection == 'next'){
|
|
|
+ console.log(_this.total+'++'+count+'++'+_this.slideIndex)
|
|
|
+ if(this.realIndex >= count || _this.slideIndex>=count){
|
|
|
+ if(_this.total >= (_this.params.page+1*_this.params.pageSize) && !_this.loadSlide){
|
|
|
+ _this.switchStatus = false;
|
|
|
+ _this.loadSlide = true;
|
|
|
+ _this.slideIndex++;
|
|
|
+ console.log(_this.slideIndex+'+++')
|
|
|
+ sessionStorage.setItem('slideIndex', _this.slideIndex);
|
|
|
+ sessionStorage.setItem('dataList', null);
|
|
|
+
|
|
|
+ _this.params.page++;
|
|
|
+ console.log(_this.dataList)
|
|
|
+ _this.getDataList(true)
|
|
|
+ }
|
|
|
+ _this.switchStatus = false;
|
|
|
+ return false;
|
|
|
+ }else if(count>0){
|
|
|
+ _this.slideIndex++;
|
|
|
+ sessionStorage.setItem('slideIndex', _this.slideIndex);
|
|
|
+ this.slideTo(_this.slideIndex)
|
|
|
+ _this.switchStatus = false;
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ if(this.realIndex <=0 || _this.slideIndex<=0){
|
|
|
+ _this.slideIndex = 0;
|
|
|
+ }else{
|
|
|
+ _this.slideIndex = _this.slideIndex-1<=0? 0 : _this.slideIndex-1;
|
|
|
+ }
|
|
|
+ console.log('记录')
|
|
|
+ _this.slideIndex = this.realIndex
|
|
|
+ sessionStorage.setItem('slideIndex', _this.slideIndex);
|
|
|
+ this.slideTo(_this.slideIndex)
|
|
|
+ _this.switchStatus = false;
|
|
|
+ }
|
|
|
+ console.log('触摸停止');
|
|
|
+ console.log(this.swipeDirection)
|
|
|
+ },
|
|
|
+ },
|
|
|
+ })
|
|
|
+
|
|
|
+ if(_this.slideIndex>0){
|
|
|
+ _this.swiper.slideTo(_this.slideIndex)
|
|
|
+ }
|
|
|
+ })
|
|
|
+
|
|
|
+ // 懒加载
|
|
|
+ //this.lazyload();
|
|
|
+
|
|
|
+ },
|
|
|
+ // 提示消息
|
|
|
+ showMessage: function(msg, time){
|
|
|
+ $.showLoading(msg);
|
|
|
+ setTimeout(function(){
|
|
|
+ $.hideLoading();
|
|
|
+ }, time)
|
|
|
+ },
|
|
|
+ // 详情主页
|
|
|
+ goDetail: function (id) {
|
|
|
+ location.href = '/weixin/member/home?id=' + id;
|
|
|
+ },
|
|
|
+ // 筛选
|
|
|
+ filterSubmit: function(){
|
|
|
+ var _this = this;
|
|
|
+ _this.params.age = _this.conditions.age = $("#age").attr('data-code');
|
|
|
+ _this.params.height = _this.conditions.height = $("#height").attr('data-code');
|
|
|
+ _this.params.education = _this.conditions.education = $("#education h1.active").attr('data-code');
|
|
|
+ _this.params.married = _this.conditions.married = $("#married h1.active").attr('data-code');
|
|
|
+ _this.params.page = 1;
|
|
|
+ _this.loaded = false;
|
|
|
+ _this.total = 1;
|
|
|
+ _this.slideIndex = 0;
|
|
|
+ _this.showFilterBox = false;
|
|
|
+ sessionStorage.setItem('conditions', JSON.stringify(_this.conditions));
|
|
|
+ _this.getDataList(0);
|
|
|
+ },
|
|
|
+ showAuth: function(data){
|
|
|
+ $.closeModal();
|
|
|
+ var idcard = data.idcard_check==2? 'idcard active' : 'idcard';
|
|
|
+ var position = data.position_check==2? 'position active' : 'position';
|
|
|
+ var education = data.education_check==2? 'education active' : 'education';
|
|
|
+ var vip = data.vip_auth==1? "<img class='vip' src='/themes/default/weixin/public/assets/img/auth/vip.png'>" : '';
|
|
|
+ $.modal({
|
|
|
+ id: "autnInfo",
|
|
|
+ close: true,
|
|
|
+ title: "认证信息",
|
|
|
+ text: "<div class='authInfo'><span class='close'>x</span><p class='avatar'><img src='"+data.avatar+"' alt=''>"+vip+"</p>" +
|
|
|
+ "<p class='info'>" +
|
|
|
+ "<span class='"+idcard+"'><span class='icon'><img src='/themes/default/weixin/public/assets/img/auth/idcard.png' alt=''></span><span>实名</span></span>" +
|
|
|
+ "<span class='"+position+"'><span class='icon'><img src='/themes/default/weixin/public/assets/img/auth/position.png' alt=''></span><span>工作</span></span>" +
|
|
|
+ "<span class='"+education+"'><span class='icon'><img src='/themes/default/weixin/public/assets/img/auth/education.png' alt=''></span><span>学历</span></span>" +
|
|
|
+ "</p>" +
|
|
|
+ "</div>",
|
|
|
+ buttons: [
|
|
|
+ {
|
|
|
+ text: "关闭", className: "default", onClick: function () {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ },
|
|
|
+ {
|
|
|
+ text: "我也要认证", className: "warning", onClick: function () {
|
|
|
+ location.href = '/weixin/auth/index/'
|
|
|
+ }
|
|
|
+ }
|
|
|
+ ]
|
|
|
+ });
|
|
|
+
|
|
|
+ $(".authInfo .close").click(function(){
|
|
|
+ $.closeModal();
|
|
|
+ })
|
|
|
+ },
|
|
|
+ showFollow: function(){
|
|
|
+ $.modal({
|
|
|
+ id: "follow",
|
|
|
+ title: "长按关注拾光公众号",
|
|
|
+ text: "<div class='follow'><p><img src='/static/images/qrcode.jpg'></p><p>每天免费为你心动匹配1位优质单身</p></div>",
|
|
|
+ buttons: [
|
|
|
+ {
|
|
|
+ text: "取消", className: "default", onClick: function () {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ ]
|
|
|
+ });
|
|
|
+ },
|
|
|
+ // 延迟加载
|
|
|
+ lazyload: function(){
|
|
|
+ var _this = this;
|
|
|
+ var num = $(".tuod_ne .thumb").length; //可见区域高度
|
|
|
+ var seeHeight = document.documentElement.clientHeight; //可见区域高度
|
|
|
+ var scrollTop = document.documentElement.scrollTop || document.body.scrollTop; //滚动条距离顶部高度
|
|
|
+ for (var i = _this.loadedCount; i < num; i++) {
|
|
|
+ var _img = $(".tuod_ne .thumb").eq(i);
|
|
|
+ var src = _img.attr('src');
|
|
|
+ var dataSrc = _img.attr('data-src');
|
|
|
+ var offsetTop = _img.offset().top;
|
|
|
+ if (dataSrc && offsetTop < (seeHeight + scrollTop)) {
|
|
|
+ if ( dataSrc != src) {
|
|
|
+ _img.attr('src', dataSrc)
|
|
|
+ }
|
|
|
+ _this.loadedCount = i + 1;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 初始化分享
|
|
|
+ initShare: function(){
|
|
|
+ var _this = this;
|
|
|
+ var url = 'http://'+document.domain+'/weixin/match/index';
|
|
|
+ var logo = 'http://'+document.domain+'/themes/default/weixin/public/assets/img/logo.jpg';
|
|
|
+ var sid = getParam('sid');
|
|
|
+ if(sid){
|
|
|
+ url = location.href;
|
|
|
+ }
|
|
|
+ $.post('/api/index/getJssdkParams', {url: url}, function (res) {
|
|
|
+ var params = res.data;
|
|
|
+
|
|
|
+ // 微信JSSDK
|
|
|
+ wx.config({
|
|
|
+ debug: false, // 是否调试模式
|
|
|
+ appId: params.appId, // 必填,公众号的唯一标识
|
|
|
+ timestamp: params.timestamp, // 必填,生成签名的时间戳
|
|
|
+ nonceStr: params.nonceStr, // 必填,生成签名的随机串
|
|
|
+ signature: params.signature,// 必填,签名
|
|
|
+ jsApiList: ['updateAppMessageShareData', 'updateTimelineShareData','getLocation','openLocation'] // 必填,需要使用的JS接口列表
|
|
|
+ });
|
|
|
+
|
|
|
+ // 初始化处理
|
|
|
+ wx.ready(function () {
|
|
|
+ // 获取定位数据
|
|
|
+ wx.getLocation({
|
|
|
+ success: function (res) {
|
|
|
+ $.post('/api/member/getLocationAddress',{type: 2,lat: res.latitude,lng: res.longitude},function(res){
|
|
|
+ if(res.code == 'success'){
|
|
|
+ var location = res.data.location;
|
|
|
+ var lat = typeof(location.location.lat)!='undefined'? location.location.lat : 0;
|
|
|
+ var lng = typeof(location.location.lng)!='undefined'? location.location.lng : 0;
|
|
|
+ if(lat && lng){
|
|
|
+ _this.params.lng = lng
|
|
|
+ _this.params.lat = lat
|
|
|
+ //_this.getDataList(false);
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },'json');
|
|
|
+ },
|
|
|
+ cancel: function (res) {
|
|
|
+ $.toast('用户拒绝了授权位置信息', 'text');
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ // 好友
|
|
|
+ wx.updateAppMessageShareData({
|
|
|
+ title: '每一位真诚走心的单身,都值得被推荐~', // 分享标题
|
|
|
+ // desc: '邀请你认识Ta', // 分享描述
|
|
|
+ desc: '汇聚南宁8090后优质单身青年,本硕博及海占比78%,脱单来这里就够了!', // 分享描述
|
|
|
+ link: location.href+'&sid='+_this.memberInfo.id, // 分享链接,该链接域名或路径必须与当前页面对应的公众号JS安全域名一致
|
|
|
+ imgUrl: logo, // 分享图标
|
|
|
+ success: function () {
|
|
|
+ }
|
|
|
+ });
|
|
|
+ // 朋友圈
|
|
|
+ wx.updateTimelineShareData({
|
|
|
+ title: '每一位真诚走心的单身,都值得被推荐~', // 分享标题
|
|
|
+
|
|
|
+ link: location.href+'&sid='+_this.memberInfo.id, // 分享链接,该链接域名或路径必须与当前页面对应的公众号JS安全域名一致
|
|
|
+ //desc: '邀请你一起参加这个有趣的活动,每期都有脱单的哦!', // 分享描述
|
|
|
+ imgUrl: logo, // 分享图标
|
|
|
+ success: function () {
|
|
|
+ }
|
|
|
+ });
|
|
|
+ });
|
|
|
+
|
|
|
+
|
|
|
+ },"json");
|
|
|
}
|
|
|
}
|
|
|
})
|