friends.js 14 KB

1
  1. (global["webpackJsonp"]=global["webpackJsonp"]||[]).push([["pages/friends/friends"],{"188f":function(t,e,n){"use strict";n.d(e,"b",(function(){return o})),n.d(e,"c",(function(){return s})),n.d(e,"a",(function(){return i}));var i={TabBar:function(){return Promise.all([n.e("common/vendor"),n.e("components/TabBar/TabBar")]).then(n.bind(null,"a31d"))},uniPopup:function(){return n.e("node-modules/@dcloudio/uni-ui/lib/uni-popup/uni-popup").then(n.bind(null,"8eb5"))},Popup:function(){return n.e("components/Popup/Popup").then(n.bind(null,"5643"))},Status:function(){return n.e("components/Status/Status").then(n.bind(null,"177c"))}},o=function(){var t=this,e=t.$createElement;t._self._c},s=[]},3603:function(t,e,n){"use strict";(function(t){n("39a3");i(n("66fd"));var e=i(n("fe92"));function i(t){return t&&t.__esModule?t:{default:t}}wx.__webpack_require_UNI_MP_PLUGIN__=n,t(e.default)}).call(this,n("543d")["createPage"])},b5fb:function(t,e,n){"use strict";var i=n("bee7"),o=n.n(i);o.a},bee7:function(t,e,n){},dd5a:function(t,e,n){"use strict";n.r(e);var i=n("ed69"),o=n.n(i);for(var s in i)"default"!==s&&function(t){n.d(e,t,(function(){return i[t]}))}(s);e["default"]=o.a},ed69:function(t,e,n){"use strict";(function(t){Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var i=a(n("dbb0")),o=a(n("9c8d")),s=a(n("bed3"));function a(t){return t&&t.__esModule?t:{default:t}}function r(t){return l(t)||d(t)||u(t)||c()}function c(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function u(t,e){if(t){if("string"===typeof t)return m(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?m(t,e):void 0}}function d(t){if("undefined"!==typeof Symbol&&Symbol.iterator in Object(t))return Array.from(t)}function l(t){if(Array.isArray(t))return m(t)}function m(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,i=new Array(e);n<e;n++)i[n]=t[n];return i}var p=function(){Promise.all([n.e("common/vendor"),n.e("components/TabBar/TabBar")]).then(function(){return resolve(n("a31d"))}.bind(null,n)).catch(n.oe)},h=function(){n.e("components/Status/Status").then(function(){return resolve(n("177c"))}.bind(null,n)).catch(n.oe)},g=function(){n.e("components/Popup/Popup").then(function(){return resolve(n("5643"))}.bind(null,n)).catch(n.oe)},f=new i.default({key:"E5SBZ-T2YC3-CBL3F-YGFQQ-26PP2-ERFII"}),y={components:{TabBar:p,Status:h,Popup:g},data:function(){return{statusType:"noPos",statusBtnText:"开启定位",statusText:"开启定位后才能帮你找到身边的TA哦",assetsUrl:this.$util.assetsUrl,tabIndex:0,navs:["推荐","附近"],navIndex:0,tops:["魅力榜","壕气榜"],topsIndex:0,scrollHeight:0,rankingOptions:{city:"",cityCode:"",number:3,type:"M"},popup:{content1:"",content2:"",tip1:"",tip2:"",btntext:""},recommendListOptions:{filterIds:[],page:{index:1,size:20,sortValues:[]},queryPre:{city:"",cityCode:"",femaleGoddess:!1,femaleNew:!1,geo:{lat:0,lon:0},maleNew:!1,maleVip:!1},showList:!0,type:{}},nearListOptions:{filterIds:[],page:{index:1,size:20,sortValues:[]},queryPre:{city:"",cityCode:"",femaleGoddess:!1,femaleNew:!1,geo:{lat:0,lon:0},maleNew:!1,maleVip:!1},showList:!0,type:{}},showGetLocation:!1,showNoData:!1,latitude:0,longitude:0,locationCity:"",locationCityCode:"",recommendTopsM:[],recommendTopsH:[],recommendList:[],recommendTotal:0,recommendRefreshing:!1,recommendTriggered:!0,nearTopsM:[],nearTopsH:[],nearList:[],nearTotal:0,nearRefreshing:!1,nearTriggered:!0,otherInfo:null}},computed:{statusBarHeight:function(){return this.$store.state.statusBarHeight},topbarOffsetHeight:function(){return this.$store.state.topbarOffsetHeight},userInfo:function(){return this.$store.state.userInfo}},mounted:function(){var e=this;t.showLoading({mask:!0,title:"加载中"}),this.computedScollviewHeight(),t.getStorageSync("token")?(this.computedLocation(),this.getRecommendTopsMData(),this.getRecommendTopsHData(),setTimeout((function(){e.imInit()}),3e3)):this.computedLocation()},onShareAppMessage:function(){return{title:"糖果公园",path:"/pages/login/login?share=".concat(this.userInfo.inviteCode)}},methods:{imInit:function(){t.$TUIKit&&t.$TUIKit.logout();var e=this.$util.IMSDKCode;t.$TUIKit=o.default.create({SDKAppID:e}),t.$TUIKitTIM=o.default,t.$TUIKitEvent=o.default.EVENT,t.$TUIKitVersion=o.default.VERSION,t.$TUIKitTypes=o.default.TYPES,t.$TUIKit.on(t.$TUIKitEvent.SDK_READY,this.onSDKReady),t.$TUIKit.on(t.$TUIKitEvent.SDK_NOT_READY,this.onSdkNotReady),t.$TUIKit.on(t.$TUIKitEvent.KICKED_OUT,this.onKickedOut),t.$TUIKit.on(t.$TUIKitEvent.ERROR,this.onTIMError),t.$TUIKit.on(t.$TUIKitEvent.NET_STATE_CHANGE,this.onNetStateChange),t.$TUIKit.on(t.$TUIKitEvent.SDK_RELOAD,this.onSDKReload),t.$resetLoginData=this.resetLoginData(),t.$TUIKit.registerPlugin({"tim-upload-plugin":s.default})},resetLoginData:function(){var e=this,n=JSON.parse(t.getStorageSync("userInfo"));this.$api.IM.loadSig({}).then((function(i){e.$store.commit("setImLoadSig",i.data.sig),t.$TUIKit.login({userID:String(n.id),userSig:e.$store.state.IMloadSig})})),t.hideLoading()},onTIMError:function(){},onSDKReady:function(e){var n=e.name,i=n===t.$TUIKitEvent.SDK_READY;i&&t.$emit("isSDKReady",{isSDKReady:!0})},onNetStateChange:function(){},onSDKReload:function(){},onSdkNotReady:function(){},onKickedOut:function(){t.showToast({title:"您被踢下线",icon:"error"}),t.reLaunch({url:"/pages/login/login"})},recommendRefresh:function(){var e=this;t.getStorageSync("token")?this.recommendRefreshing||(this.recommendRefreshing=!0,setTimeout((function(){e.recommendTriggered=!1,e.recommendRefreshing=!1}),1e3),this.recommendListOptions.page={index:1,size:20,sortValues:[]},this.getRecommendTopsMData(),this.getRecommendTopsHData(),this.getRecommendList()):setTimeout((function(){e.recommendTriggered=!1,e.recommendRefreshing=!1}),1e3)},recommendPulling:function(t){},recommendRestore:function(){this.recommendTriggered=!0},recommendAbort:function(){},recommendToBottom:function(){this.recommendList.length>=this.recommendTotal||(this.recommendListOptions.page.index++,this.getRecommendList())},nearRefresh:function(){var t=this;this.nearRefreshing||(this.nearRefreshing=!0,setTimeout((function(){t.nearTriggered=!1,t.nearRefreshing=!1}),1e3),this.nearListOptions.page={index:1,size:20,sortValues:[]},this.getNearTopsMData(),this.getNearTopsHData(),this.getNearList())},nearPulling:function(t){},nearRestore:function(){this.nearTriggered=!0},nearAbort:function(){},nearToBottom:function(){this.nearList.length>=this.nearTotal||(this.nearListOptions.page.index++,this.getNearList())},computedScollviewHeight:function(){var e=this,n=t.createSelectorQuery().in(this),i=this.$store.state.tabbarHeight/2;n.select("#topnav").boundingClientRect((function(t){i+=t.height})).exec((function(){var n=t.getSystemInfoSync();e.scrollHeight=n.windowHeight-i}))},computedLocation:function(){var e=this;t.getFuzzyLocation({type:"gcj02",success:function(n){e.latitude=n.latitude,e.longitude=n.longitude,e.$store.commit("setLatitude",e.latitude),e.$store.commit("setLongitude",e.longitude),f.reverseGeocoder({location:{latitude:n.latitude,longitude:n.longitude},success:function(n){e.locationCity=n.result.ad_info.city,e.locationCityCode=n.result.ad_info.city_code.split(n.result.ad_info.nation_code)[1],e.getTempRecommendList(),t.getStorageSync("token")?e.$api.public.heartBeat({city:e.locationCity,cityCode:e.locationCityCode,geo:{lat:e.latitude,lon:e.longitude}}).then((function(){e.getNearTopsMData(),e.getNearTopsHData(),e.getNearList(),e.getRecommendList(),e.showGetLocation=!1})).catch((function(t){e.getTempRecommendList()})):e.getTempRecommendList()}})},fail:function(n){e.showGetLocation=!0,t.showModal({content:"检测到您没打开地址信息权限,是否去设置打开?",confirmText:"确认",cancelText:"取消",success:function(n){n.confirm&&t.openSetting({success:function(t){t.authSetting&&e.computedLocation()}})}})}})},toLogin:function(){t.reLaunch({url:"/pages/login/login"})},navClick:function(e){if(!t.getStorageSync("token"))return this.popup={content1:"您还未登录",content2:"该功能登录后才能使用",tip1:"",tip2:"",btntext:"去登录"},void this.$refs.popup.open();this.rankingOptions.city=0===e?"":this.locationCity,this.rankingOptions.cityCode=0===e?"":this.locationCityCode,this.navIndex=e},toSearch:function(){if(!t.getStorageSync("token"))return this.popup={content1:"您还未登录",content2:"该功能登录后才能使用",tip1:"",tip2:"",btntext:"去登录"},void this.$refs.popup.open();t.navigateTo({url:"/pages/search/search"})},topsNavClick:function(t){this.topsIndex=t},outerSwiperChange:function(t){this.navIndex=t.detail.current},swiperChange:function(t){this.topsIndex=t.detail.current},getRecommendTopsMData:function(){var t=this;this.rankingOptions.type="M",this.$api.public.ranking(this.rankingOptions).then((function(e){t.recommendTopsM=e.data.list}))},getRecommendTopsHData:function(){var t=this;this.rankingOptions.type="H",this.$api.public.ranking(this.rankingOptions).then((function(e){t.recommendTopsH=e.data.list}))},getNearTopsMData:function(){var t=this;this.rankingOptions.type="M",this.rankingOptions.city=this.locationCity,this.rankingOptions.cityCode=this.locationCityCode,this.$api.public.ranking(this.rankingOptions).then((function(e){t.nearTopsM=e.data.list}))},getNearTopsHData:function(){var t=this;this.rankingOptions.type="H",this.rankingOptions.city=this.locationCity,this.rankingOptions.cityCode=this.locationCityCode,this.$api.public.ranking(this.rankingOptions).then((function(e){t.nearTopsH=e.data.list}))},getTempRecommendList:function(){var e=this;this.recommendListOptions.type="FamaleReco",this.$api.public.friendsNoAuth(this.recommendListOptions).then((function(n){if("Succ"===n.status){e.recommendTotal=n.data.page.recordCount,e.recommendListOptions.page.sortValues=n.data.sortValues;for(var i=[],o={latitude:0,longitude:0},s=0;s<n.data.users.length;s++)n.data.users[s].lastActiveTime=e.$moment(new Date).diff(n.data.users[s].lastActive,"minutes"),o={latitude:0,longitude:0},o.latitude=n.data.users[s].geo.lat,o.longitude=n.data.users[s].geo.lon,i.push(o);f.calculateDistance({mode:"straight",from:{latitude:e.latitude,longitude:e.longitude},to:i,success:function(i){if("query ok"===i.message){for(var o=0;o<i.result.elements.length;o++)n.data.users[o].distance=i.result.elements[o].distance>1e3?"".concat(Math.floor(i.result.elements[o].distance/100)/10,"km"):"".concat(i.result.elements[o].distance,"m");e.recommendListOptions.page.index>1?e.recommendList=[].concat(r(e.recommendList),r(n.data.users)):e.recommendList=n.data.users,t.hideLoading(),e.$forceUpdate()}}}),e.recommendList=n.data.users}}))},getRecommendList:function(){var e=this,n=JSON.parse(t.getStorageSync("user"));this.recommendListOptions.type="male"===n.sex?"MaleReco":"FamaleReco",this.recommendListOptions.queryPre.city=this.locationCity,this.recommendListOptions.queryPre.cityCode=this.locationCityCode,this.recommendListOptions.queryPre.geo.lat=this.latitude,this.recommendListOptions.queryPre.geo.lon=this.longitude,this.$api.public.friends(this.recommendListOptions).then((function(t){if("Succ"===t.status){e.recommendTotal=t.data.page.recordCount,e.recommendListOptions.page.sortValues=t.data.sortValues;for(var n=[],i={latitude:0,longitude:0},o=0;o<t.data.users.length;o++)t.data.users[o].lastActiveTime=e.$moment(new Date).diff(t.data.users[o].lastActive,"minutes"),i={latitude:0,longitude:0},i.latitude=t.data.users[o].geo.lat,i.longitude=t.data.users[o].geo.lon,n.push(i);f.calculateDistance({mode:"straight",from:{latitude:e.latitude,longitude:e.longitude},to:n,success:function(n){if("query ok"===n.message){for(var i=0;i<n.result.elements.length;i++)t.data.users[i].distance=n.result.elements[i].distance>1e3?"".concat(Math.floor(n.result.elements[i].distance/100)/10,"km"):"".concat(n.result.elements[i].distance,"m");e.recommendListOptions.page.index>1?e.recommendList=[].concat(r(e.recommendList),r(t.data.users)):e.recommendList=t.data.users,e.$forceUpdate()}}})}}))},getNearList:function(){var e=this,n=JSON.parse(t.getStorageSync("user"));this.nearListOptions.type="male"===n.sex?"MaleNearby":"FamaleNearby",this.nearListOptions.queryPre.city=this.locationCity,this.nearListOptions.queryPre.cityCode=this.locationCityCode,this.nearListOptions.queryPre.geo.lat=this.latitude,this.nearListOptions.queryPre.geo.lon=this.longitude,this.$api.public.friends(this.nearListOptions).then((function(t){if("Succ"===t.status&&t.data.users.length>0){e.nearTotal=t.data.page.recordCount,e.nearListOptions.page.sortValues=t.data.sortValues,e.showNoData=0===t.data.users.length;for(var n=[],i={latitude:0,longitude:0},o=0;o<t.data.users.length;o++)t.data.users[o].lastActiveTime=e.$moment(new Date).diff(t.data.users[o].lastActive,"minutes"),i={latitude:0,longitude:0},i.latitude=t.data.users[o].geo.lat,i.longitude=t.data.users[o].geo.lon,n.push(i);f.calculateDistance({mode:"straight",from:{latitude:e.latitude,longitude:e.longitude},to:n,success:function(n){if("query ok"===n.message){for(var i=0;i<n.result.elements.length;i++)t.data.users[i].distance=n.result.elements[i].distance>1e3?"".concat(Math.floor(n.result.elements[i].distance/100)/10,"km"):"".concat(n.result.elements[i].distance,"m");e.nearListOptions.page.index>1?e.nearList=[].concat(r(e.nearList),r(t.data.users)):e.nearList=t.data.users,e.$forceUpdate()}}})}else e.showNoData=0===e.nearList.length}))},toDetail:function(e){var n=this;if(!t.getStorageSync("token"))return this.popup={content1:"您还未登录",content2:"该功能登录后才能使用",tip1:"",tip2:"",btntext:"去登录"},void this.$refs.popup.open();t.showLoading({});var i=JSON.parse(t.getStorageSync("user"));this.$api.public.userDetail({getAlbum:!0,completeUser:i,uponUserId:e}).then((function(o){o.data.frozen?t.showToast({title:"该用户已被冻结",icon:"none"}):o.data.sex===i.sex?t.showToast({title:"同性用户不能查看主页",icon:"none"}):(n.otherInfo=o.data,t.hideLoading(),t.navigateTo({url:"/pages/friends/user?id=".concat(e)}))}))}}};e.default=y}).call(this,n("543d")["default"])},fe92:function(t,e,n){"use strict";n.r(e);var i=n("188f"),o=n("dd5a");for(var s in o)"default"!==s&&function(t){n.d(e,t,(function(){return o[t]}))}(s);n("b5fb");var a,r=n("f0c5"),c=Object(r["a"])(o["default"],i["b"],i["c"],!1,null,"86b3b4ec",null,!1,i["a"],a);e["default"]=c.exports}},[["3603","common/runtime","common/vendor"]]]);