12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139 |
- const app = getApp();
- const webSocket = require('../../utils/websocket.js');
- Page({
-
- data: {
- multiArray: [],
- step: 0,
- multiIndex: [0, 0, 0],
-
- CityRecord: '',
- areaRecord: '',
- CityRecordid: [],
- UsedRecord: false,
-
- provincename:'',
- cityname: '',
- areaname: '',
-
-
- heightid: 0,
- heightArray: [],
- heightindex: [0, 0],
-
-
- Ageid: 0,
- AgeArray: [],
- AgeIndex: [0, 0],
-
- MarriageArray: [],
- Marriageindex: '',
-
- EducationArray: [],
- Educationindex: '',
-
- nickname: '',
- sex: 0,
- age: 0,
- agezx:0,
- height: 0,
- heightzx:0,
-
- province: 0,
- city: 0,
- area: 0,
-
- education: 0,
- educationid:0,
- marry: 0,
- idmarry:0,
- income:0,
-
-
-
-
-
-
-
- home: [],
-
-
- page: 1,
- limit: 10,
- morehide: false,
- moreTxt: '',
-
-
-
- code:'',
- },
-
- onLoad: function (options) {
- webSocket.connectSocket();
- },
-
-
- onShow: function (options) {
- var that = this;
-
- that.setData({
- page: 1,
- })
-
-
- getApp().showLoading();
-
-
-
-
-
-
-
-
- var _Selection = app.globalData.Selection
-
- var _income = app.globalData.income
-
-
- if (app.globalData.idmarry ){
-
- that.setData({
- idmarry: app.globalData.idmarry
- })
- }
-
- if (app.globalData.educationid) {
-
- that.setData({
- educationid: app.globalData.educationid
- })
- }
-
-
- that.setData({
- UsedRecord: false,
- CityRecord: '',
- areaRecord:'',
- multiIndex: [0, 0, 0],
- step: 0,
-
- })
-
-
- if (app.globalData.income){
- that.setData({
- income: _income,
- })
- } else if (app.globalData.income == 0 && _Selection == 1) {
- that.setData({
- income: _income,
- })
- }
-
-
-
-
-
- var _province = app.globalData.province
- var _city = app.globalData.city
- var _area = app.globalData.area
-
- if (_province && _city && _area) {
- that.setData({
- province: _province,
- city: _city,
- area: _area,
- })
-
-
-
-
- } else if (_city == 0 && _Selection == 1) {
- that.setData({
- province: _province,
- city: _city,
- area: _area,
- })
- }
-
-
- var _provincename = app.globalData.provincename
- var _cityname = app.globalData.cityname
- var _areaname = app.globalData.areaname
-
- if (_provincename && _cityname && _areaname) {
- that.setData({
- provincename: _provincename,
- cityname: _cityname,
- areaname: _areaname,
- step : 0,
- })
-
-
-
-
- } else if (_cityname == 0 && _Selection == 1) {
- that.setData({
- provincename: _provincename,
- cityname: _cityname,
- areaname: _areaname,
- step: 0,
- })
- }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- let Age_url = 'public/paramsgather?type=age';
- let Age_data = {};
-
- if (app.globalData.age){
-
- var _age = app.globalData.age
- var _agezx = app.globalData.agezx
-
-
- if (_agezx == 0) {
- var agenewArry = _age.split("-");
- var _age_min = agenewArry[0]
- var _age_max = agenewArry[1]
- } else {
- var agenewArry = _agezx.split("-");
- var _age_min = agenewArry[0]
- var _age_max = agenewArry[1]
- }
-
-
-
- that.setData({
- Ageid: 0,
- age: _age,
- agezx: _agezx,
- })
- } else if (app.globalData.age == 0 && _Selection == 1) {
- var _age = app.globalData.age
- that.setData({
- age: _age,
- Ageid :0,
- AgeIndex: ['', '']
- })
- }
-
- app.postRequest(Age_url, Age_data, function (res) {
- if (res.code == 201) {
- if (app.globalData.age){
-
- let createArr1 = res.data;
- let newarray1 = ['不限'];
- createArr1 = newarray1.concat(createArr1);
-
-
- for (let i = 0; i < createArr1.length; i++) {
-
- if (createArr1[i] == _age_min) { var _min = i; }
-
- if (createArr1[i] == _age_max) { var _max = i; }
-
- that.setData({
- AgeIndex: [_min, _max]
- })
- }
- }
-
- let dictObject = res.data;
-
- var createArr = []
- for (let i in dictObject) {
- createArr.push(dictObject[i] + "岁");
- }
-
-
-
- let newarray = ['不限'];
- createArr = newarray.concat(createArr);
-
-
-
-
-
- that.setData({
- AgeArray: [createArr, createArr],
- })
-
-
- }
-
- })
-
-
-
- let height_url = 'public/paramsgather?type=height';
- let height_data = {
- pid: '0'
- };
-
- if (app.globalData.height) {
-
- var _height = app.globalData.height
- var _heightzx = app.globalData.heightzx
-
- if (_heightzx == 0) {
-
- var heightnewArry = _height.split("-");
- var heightSmall = heightnewArry[0]
- var heightlarge = heightnewArry[1]
-
- } else {
-
- var heightnewArry = _heightzx.split("-");
- var heightSmall = heightnewArry[0]
- var heightlarge = heightnewArry[1]
-
- }
-
-
-
-
- that.setData({
- height: _height,
- heightid:0,
- heightzx: _heightzx,
- })
- } else if (app.globalData.height == 0 && _Selection == 1) {
- var _height = app.globalData.height
- that.setData({
- height: _height,
- heightid: 0,
- heightindex: ['', ''],
- })
- }
-
- app.postRequest(height_url, height_data, function (res) {
- if (res.code == 201) {
-
- if (app.globalData.height) {
-
- let createArr1 = res.data;
- let newarray1 = ['不限'];
- createArr1 = newarray1.concat(createArr1);
-
-
- for (let i = 0; i < createArr1.length; i++) {
-
- if (createArr1[i] == heightSmall) { var _min = i; }
-
- if (createArr1[i] == heightlarge) { var _max = i; }
-
- that.setData({
- heightindex: [_min, _max]
- })
- }
- }
-
-
- let dictObject = res.data;
-
- var createArr = []
- for (let i in dictObject) {
- createArr.push(dictObject[i] + "cm");
- }
-
- let newarray = ['不限'];
- createArr = newarray.concat(createArr);
-
- that.setData({
- heightArray: [createArr, createArr],
- })
-
- }
-
- })
-
-
-
- let Marriage_url = 'public/paramsgather?type=marriage';
- let Marriage_data = {};
-
- if (app.globalData.marry) {
-
- var _marry = app.globalData.marry
-
- that.setData({
- marry: _marry
- })
- } else if (app.globalData.marry == 0 && _Selection == 1) {
- var _marry = app.globalData.marry
- that.setData({
- marry: _marry,
- Marriageindex: "",
- })
- }
-
- app.postRequest(Marriage_url, Marriage_data, function (res) {
- if (res.code == 201) {
- if (app.globalData.marry) {
-
- let createArr1 = res.data;
- let newarray1 = ['不限'];
- createArr1 = newarray1.concat(createArr1);
-
- for (let i = 0; i < createArr1.length; i++) {
- if (i == _marry) {
- that.setData({
- Marriageindex: i,
- })
- }
- }
- }
-
- let createArr = res.data;
- let newarray = ['不限'];
- createArr = newarray.concat(createArr);
-
- that.setData({
- MarriageArray: createArr,
- idmarry: that.data.idmarry,
- })
- }
- })
-
-
-
- let Education_url = 'public/paramsgather?type=xueli';
- let Education_data = {};
-
- if (app.globalData.education) {
- console.log('执行');
- var _education = app.globalData.education
-
- that.setData({
- education: _education
- })
- } else if (app.globalData.education == 0 && _Selection == 1) {
- var _education = app.globalData.education
- that.setData({
- education: _education,
- Educationindex: "",
- })
- }
-
- app.postRequest(Education_url, Education_data, function (res) {
- if (res.code == 201) {
-
- var obj = { id: 0, name: '不限' };
- var datares = res.data;
- datares.unshift(obj)
-
- if (app.globalData.education) {
-
- for (let i = 0; i < datares.length; i++) {
- if (datares[i].id == _education) {
- that.setData({
- Educationindex: i,
- })
- }
- }
- }
-
-
-
-
- that.setData({
- EducationArray: datares,
- educationid: that.data.educationid,
- })
- }
- })
-
-
-
-
- that.getProvince();
-
- that.list();
- },
-
-
-
-
- getPhone: function (e) {
- var nickname = e.detail.value;
- console.log(nickname);
- this.setData({
- nickname: nickname
- });
-
- },
-
- Code: function (e) {
- var that = this;
-
- if (that.data.nickname){
-
- that.showLoading();
-
- let home_url = 'circle/friend/home';
- let home_data = {
- page: that.data.page,
- limit: that.data.limit,
- number: that.data.nickname,
- };
- app.postRequest(home_url, home_data, function (res) {
- if (res.code == 201) {
-
- that.setData({
- home: res.data,
- })
-
- that.cancelLoading();
-
- return;
- }
-
- that.cancelLoading();
-
- that.setData({
- home_code: res.code,
- morehide: true,
- moreTxt: '暂无更多数据。'
- })
-
- })
-
- }else{
- var fail = '请输入会员编号'
- getApp().Tips(fail)
- }
-
-
- },
-
-
-
- heightEvent: function (e) {
- var that = this;
-
-
-
-
- var _value = e.detail.value;
- var heightSmall = this.data.heightArray[0][e.detail.value[0]].substring(0, 3);
- var heightlarge = this.data.heightArray[1][e.detail.value[1]].substring(0, 3);
-
-
- if (heightSmall > heightlarge && heightSmall != '不限' && heightlarge != '不限') {
-
- var heightdata = heightlarge + '-' + heightSmall;
- that.Exchange(_value);
-
- that.setData({
- heightzx: 0,
- })
-
- } else if (heightSmall == '不限' && heightlarge != '不限') {
-
- var heightdata = heightlarge + '以下';
- var heightdatazx = '不限' + '-' + heightlarge;
- that.setData({
- heightzx: heightdatazx,
- })
-
- } else if (heightlarge == '不限' && heightSmall != '不限') {
-
- var heightdata = heightSmall + '以上';
- var heightdatazx = heightSmall + '-' + '不限';
- that.setData({
- heightzx: heightdatazx,
- })
-
-
- } else if (heightSmall == '不限' && heightlarge == '不限') {
-
- var heightdata = '不限';
-
- var heightdatazx = '不限' + '-' + '不限';
- that.setData({
- heightzx: heightdatazx,
- })
-
- } else {
-
- var heightdata = heightSmall + '-' + heightlarge;
- that.setData({
- heightzx: 0,
- })
- }
-
-
-
- that.setData({
- heightindex: _value,
- height: heightdata,
- heightid: 1,
- })
-
- that.list();
- },
-
-
-
-
- AgeEvent: function (e) {
- var that = this;
-
- var _value = e.detail.value;
-
- var Small = this.data.AgeArray[0][e.detail.value[0]].substring(0, 2);
- var large = this.data.AgeArray[1][e.detail.value[1]].substring(0, 2);
-
-
-
- if (Small > large && Small != '不限' && large != '不限'){
-
- var Agedata = large + '-' + Small;
- that.Exchange(_value);
- that.setData({
- agezx: 0,
- })
- } else if (Small == '不限' && large != '不限') {
-
- var Agedata = large + '以下';
- var Agedataxz = '不限' + '-' + large;
- that.setData({
- agezx: Agedataxz,
- })
-
- } else if (large == '不限' && Small != '不限') {
-
- var Agedata = Small + '以上';
- var Agedataxz = Small + '-' + '不限';
- that.setData({
- agezx: Agedataxz,
- })
-
- } else if (Small == '不限' && large == '不限') {
-
- var Agedata = '不限';
- var Agedataxz = '不限' + '-' + '不限';
- that.setData({
- agezx: Agedataxz,
- })
- }else {
-
- var Agedata = Small + '-' + large;
- that.setData({
- agezx: 0,
- })
- }
-
-
-
- that.setData({
- AgeIndex: _value,
- age: Agedata,
- Ageid: 1,
- page:1,
- })
-
- that.list();
- },
-
-
- Exchange: function (data) {
- for (var i = 0; i < data.length / 2; i++) {
- var data_i = data[i];
- data[i] = data[data.length - 1 - i];
- data[data.length - 1 - i] = data_i;
- }
- return;
- },
-
-
- MarriageEvent: function (e) {
- var that = this;
-
-
-
-
- this.setData({
- Marriageindex: e.detail.value,
- marry: e.detail.value,
- page: 1,
- idmarry:1,
- })
-
- that.list();
- },
-
- EducationEvent: function (e) {
- var that = this;
-
-
-
-
- this.setData({
- Educationindex: e.detail.value,
- education: this.data.EducationArray[e.detail.value].id,
- page: 1,
- educationid:1,
- })
-
- that.list();
-
- },
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- getProvince() {
-
- let _this = this;
- let d_url = 'public/citypid';
- app.postRequest(d_url, { pid: '0' }, function (res) {
-
- if (res.code == '201') {
- var provinceList = res.data;
- var provinceArr = [];
- provinceArr = _this.mapArray(res.data);
- _this.setData({
- multiArray: [provinceArr, [], []],
- provinceList,
- provinceArr,
- })
-
-
-
-
-
-
- if (_this.data.CityRecord) {
-
- var defaultCode = _this.data.CityRecord
- if (defaultCode) {
- _this.setData({
- currnetProvinceKey: defaultCode
- })
- _this.getCity(defaultCode)
- }
-
- } else {
-
- var defaultCode = provinceList[0]['area_id']
-
- if (defaultCode) {
- _this.setData({
- currnetProvinceKey: defaultCode
- })
- _this.getCity(defaultCode)
- }
-
- }
-
-
-
- }
-
-
- })
-
-
- },
-
- getCity(codes) {
-
- let _this = this;
- let d_url = 'public/citypid';
- app.postRequest(d_url, { pid: codes }, function (res) {
- var cityList = res.data;
- var cityArr = [];
- if (res.code == '201') {
- cityArr = _this.mapArray(res.data);
- _this.setData({
- multiArray: [_this.data.provinceArr, cityArr, []],
- cityArr,
- cityList
-
- })
-
-
-
- if (_this.data.areaRecord && _this.data.cancelID == false) {
-
- var defaultCode = _this.data.areaRecord
-
- if (defaultCode) {
- _this.setData({
- currnetProvinceKey: defaultCode
- })
- _this.getArea(defaultCode)
- }
-
-
- } else {
-
- var defaultCode = cityList[0]['area_id']
-
- if (defaultCode) {
- _this.setData({
- currnetProvinceKey: defaultCode
- })
- _this.getArea(defaultCode)
- }
-
- }
-
-
- }
-
- })
- },
- getArea(codes) {
-
- let _this = this;
- let d_url = 'public/citypid';
- app.postRequest(d_url, { pid: codes }, function (res) {
- var areaList = res.data;
- var areaArr = [];
- if (res.code == '201') {
- areaArr = _this.mapArray(res.data);
- }
-
-
-
-
-
- _this.setData({
- multiArray: [_this.data.provinceArr, _this.data.cityArr, areaArr],
- areaList,
- areaArr,
- })
-
- _this.setData({
- cancelID: true,
- })
- })
- },
- mapArray: function (data) {
- let cityArray = []
- if (data) {
- for (let i = 0; i < data.length; i++) {
- if (data[i].area_name) {
- cityArray[i] = data[i].area_name;
-
- }
- }
- }
-
-
-
- return cityArray;
- },
-
- columnchange(e) {
- var column = e.detail.column
-
-
-
-
- var data = {
- multiIndex: this.data.multiIndex,
- multiArray: this.data.multiArray
- }
- data.multiIndex[column] = e.detail.value;
- switch (column) {
- case 0:
- var currentProvinceKey = this.data.provinceList[e.detail.value].area_id
- if (currentProvinceKey != this.data.currnetProvinceKey) {
- this.getCity(currentProvinceKey)
- }
- data.multiIndex[1] = 0
- break;
- case 1:
- var currentCitykey = this.data.cityList[e.detail.value].area_id
- if (currentCitykey != this.data.currnetCityKey) {
- this.getArea(currentCitykey)
- }
- data.multiIndex[2] = 0
- break;
- }
- this.setData(data)
-
-
-
- },
- pickchange(e) {
- var that =this;
-
-
-
-
-
- that.setData({
- step: 1,
- multiIndex: e.detail.value,
- province: that.data.provinceList[e.detail.value[0]].area_id,
- city: that.data.cityList[e.detail.value[1]].area_id,
- area: that.data.areaList[e.detail.value[2]].area_id,
-
- provincename: that.data.provinceList[e.detail.value[0]].area_name,
- cityname: that.data.cityList[e.detail.value[1]].area_name,
- areaname: that.data.areaList[e.detail.value[2]].area_name,
-
- CityRecord: that.data.provinceList[e.detail.value[0]].area_id,
- areaRecord: that.data.cityList[e.detail.value[1]].area_id,
- CityRecordid: that.data.multiIndex,
-
- UsedRecord: true,
- })
-
- that.list();
-
-
- },
-
- cancel: function (e) {
- var _this = this;
- if (_this.data.UsedRecord == true) {
-
- _this.setData({
- multiIndex: _this.data.CityRecordid,
- cancelID: false
- })
-
-
- _this.getProvince();
-
-
- }
-
-
- },
-
-
- onReachBottom() {
- var that = this;
- that.showLoading();
-
- let home_url = 'circle/friend/home';
- let home_data = {
- page: (that.data.page++) + 1,
- limit: that.data.limit,
- height: that.data.height,
- age: that.data.age,
- marry: that.data.marry,
- education: that.data.education,
-
- city: that.data.city,
-
- };
- app.postRequest(home_url, home_data, function (res) {
-
- if (res.code == 201) {
-
- var home = that.data.home
-
- var moreTxt = '';
- if (0 < (res.data.length < 10)) {
- moreTxt = '暂无更多数据。'
- console.log('无')
- } else {
- moreTxt = ''
- console.log('有')
- }
-
-
- for (var i = 0; i < res.data.length; i++) {
- home.push(res.data[i]);
- }
-
- that.setData({
- home: home,
- morehide: true,
- moreTxt: moreTxt,
- })
-
- that.cancelLoading();
- return;
- }
-
-
- that.cancelLoading();
-
- that.setData({
- home_code: res.code,
- morehide: true,
- moreTxt:"暂无更多数据。"
- })
-
-
-
- })
- },
-
- More:function(){
- var that = this;
-
- wx.navigateTo({
- url: '/pages/index_screen/index_screen?age=' + that.data.age + '&agezx=' + that.data.agezx + '&heightzx=' + that.data.heightzx + '&height=' + that.data.height + '&marry=' + that.data.marry + '&idmarry=' + that.data.idmarry + '&education=' + that.data.education + '&educationid=' + that.data.educationid + '&income=' + that.data.income + '&province=' + that.data.province + '&city=' + that.data.city + '&area=' + that.data.area + '&provincename=' + that.data.provincename + '&cityname=' + that.data.cityname + '&areaname=' + that.data.areaname + ''
- })
-
-
- },
-
-
-
- list: function () {
- var that = this;
- that.showLoading();
-
- let home_url = 'circle/friend/home';
- let home_data = {
- page: that.data.page,
- limit: that.data.limit,
- age: that.data.age,
- height: that.data.height,
- marry: that.data.marry,
- education: that.data.education,
- income: that.data.income,
-
- city: that.data.city,
-
-
-
- };
- app.postRequest(home_url, home_data, function (res) {
- if (res.code == 201) {
-
- var moreTxt = '';
- if (res.data.length < 10) {
- moreTxt = '暂无更多数据。'
- } else {
- moreTxt = ''
- }
-
-
-
- that.setData({
- home: res.data,
- moreTxt: moreTxt,
- home_code: res.code,
- })
-
- that.cancelLoading();
-
- return;
- }
-
- that.cancelLoading();
-
- that.setData({
- home: res.data,
- morehide: true,
- moreTxt: '暂无更多数据。'
- })
-
- })
-
- },
-
-
- showLoading: function () {
-
- wx.showToast({
-
- title: '加载中',
-
- icon: 'loading'
-
- });
-
- },
-
- cancelLoading: function () {
- wx.hideToast();
- },
-
-
-
- onShareAppMessage: function (res) {
-
- var that = this;
- var code ='';
-
-
-
- let datum_url = 'my/other/share';
- let datum_data = {
- };
- app.postRequest(datum_url, datum_data, function (res) {
- if (res.code == 201) {
- console.log(res.data.code);
- that.setData({
- code: res.data.code,
- })
- }
- })
-
-
- if (res.from === 'button') {
- console.log("来自页面内转发按钮");
- console.log(res.target);
-
- }
- else {
- console.log("来自右上角转发菜单")
- }
- return {
- title: '妹子图片',
- path: '/pages/share/share?code=' + _that.data.code +'',
- success: (res) => {
- console.log("转发成功", res);
- },
- fail: (res) => {
- console.log("转发失败", res);
- }
- }
-
- }
-
-
-
-
-
-
-
-
-
-
- })
-
|