|
@@ -500,29 +500,32 @@
|
|
return this.$store.state.userInfo||{};
|
|
return this.$store.state.userInfo||{};
|
|
}
|
|
}
|
|
},
|
|
},
|
|
- mounted() {
|
|
|
|
|
|
+ onLoad(options) {
|
|
|
|
+ console.log(options)
|
|
|
|
+ if(options.invite){
|
|
|
|
+ uni.setStorageSync('invited',options.invite);
|
|
|
|
+ }
|
|
uni.showLoading({
|
|
uni.showLoading({
|
|
mask:true,
|
|
mask:true,
|
|
title:'加载中'
|
|
title:'加载中'
|
|
})
|
|
})
|
|
|
|
+ this.$api.public.aliossCdn({}).then(cdnRes=>{
|
|
|
|
+ this.$store.commit('setImageCdn',cdnRes.data.pictureCdn);
|
|
|
|
+ this.$store.commit('setVideoCdn',cdnRes.data.videoCdn);
|
|
|
|
+ uni.setStorageSync('imageCdn',cdnRes.data.pictureCdn);
|
|
|
|
+ uni.setStorageSync('videoCdn',cdnRes.data.videoCdn);
|
|
|
|
+ });
|
|
|
|
+ this.login();
|
|
this.computedScollviewHeight();
|
|
this.computedScollviewHeight();
|
|
- if(!uni.getStorageSync('token')){
|
|
|
|
- this.computedLocation();
|
|
|
|
- }
|
|
|
|
- else{
|
|
|
|
- this.computedLocation();
|
|
|
|
- this.getRecommendTopsMData();
|
|
|
|
- this.getRecommendTopsHData();
|
|
|
|
- setTimeout(()=>{
|
|
|
|
- this.imInit();
|
|
|
|
- },3000)
|
|
|
|
-
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
|
|
|
|
},
|
|
},
|
|
|
|
+ onShow() {
|
|
|
|
+ if(uni.getStorageSync('needFreshList')==='1'){
|
|
|
|
+ this.recommendRefresh();
|
|
|
|
+ this.nearRefresh();
|
|
|
|
+ uni.setStorageSync('needFreshList','0');
|
|
|
|
+ }
|
|
|
|
+ },
|
|
// #ifdef MP
|
|
// #ifdef MP
|
|
onShareAppMessage(){
|
|
onShareAppMessage(){
|
|
return {
|
|
return {
|
|
@@ -532,6 +535,65 @@
|
|
},
|
|
},
|
|
// #endif
|
|
// #endif
|
|
methods: {
|
|
methods: {
|
|
|
|
+ getMineData(){
|
|
|
|
+ let user=JSON.parse(uni.getStorageSync('user'));
|
|
|
|
+ this.$api.public.mineDetail({
|
|
|
|
+ getAlbum:true,
|
|
|
|
+ completeUser:user
|
|
|
|
+ }).then(res=>{
|
|
|
|
+ this.$store.commit('setUserInfo',res.data);
|
|
|
|
+ uni.setStorageSync('userInfo',JSON.stringify(res.data));
|
|
|
|
+ if(!res.data.regDone){
|
|
|
|
+ uni.reLaunch({
|
|
|
|
+ url:'/pages/info/sex'
|
|
|
|
+ })
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ },
|
|
|
|
+ login(){
|
|
|
|
+ const that=this;
|
|
|
|
+ if(uni.getStorageSync('isLogin')==='yes'){
|
|
|
|
+ this.getMineData();
|
|
|
|
+ this.computedLocation();
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ uni.login({//免密登录
|
|
|
|
+ success:(res)=>{
|
|
|
|
+ that.$api.login.wxLogin({
|
|
|
|
+ scene: "WxMPLogin",
|
|
|
|
+ miniProgramEncryUserInfoParam:{
|
|
|
|
+ jsCode:res.code
|
|
|
|
+ }
|
|
|
|
+ }).then(result=>{
|
|
|
|
+ if(result.status==='Succ'){
|
|
|
|
+ uni.setStorageSync('openId',result.data.wxLoginInfo.openId);
|
|
|
|
+ uni.setStorageSync('unionId',result.data.wxLoginInfo.unionId);
|
|
|
|
+ this.computedLocation();
|
|
|
|
+ this.getRecommendTopsMData();
|
|
|
|
+ this.getRecommendTopsHData();
|
|
|
|
+ uni.setStorageSync('LL_Ukn',result.data.userToken.ukn);
|
|
|
|
+ uni.setStorageSync('token',result.data.userToken.token);
|
|
|
|
+ uni.setStorageSync('userInfo',JSON.stringify(result.data));
|
|
|
|
+ uni.setStorageSync('user',JSON.stringify(result.data.userToken.user));
|
|
|
|
+ uni.setStorageSync('isLogin','yes');
|
|
|
|
+ this.$api.public.aliossCdn({}).then(cdnRes=>{
|
|
|
|
+ this.$store.commit('setImageCdn',cdnRes.data.pictureCdn);
|
|
|
|
+ this.$store.commit('setVideoCdn',cdnRes.data.videoCdn);
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ })
|
|
|
|
+ },
|
|
|
|
+ fail: (err) => {
|
|
|
|
+ console.log(err)
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ },
|
|
|
|
+ closePopup(){
|
|
|
|
+ this.$refs.popup.close();
|
|
|
|
+ },
|
|
imInit(){
|
|
imInit(){
|
|
/**
|
|
/**
|
|
* IM初始化
|
|
* IM初始化
|
|
@@ -557,7 +619,10 @@
|
|
uni.$TUIKit.registerPlugin({ 'tim-upload-plugin':TIMUploadPlugin });
|
|
uni.$TUIKit.registerPlugin({ 'tim-upload-plugin':TIMUploadPlugin });
|
|
},
|
|
},
|
|
resetLoginData() {
|
|
resetLoginData() {
|
|
- let user=JSON.parse(uni.getStorageSync('userInfo'));
|
|
|
|
|
|
+ if(!uni.getStorageSync('userInfo')){
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ let user=JSON.parse(uni.getStorageSync('userInfo'));
|
|
this.$api.IM.loadSig({}).then(res=>{
|
|
this.$api.IM.loadSig({}).then(res=>{
|
|
this.$store.commit('setImLoadSig',res.data.sig);
|
|
this.$store.commit('setImLoadSig',res.data.sig);
|
|
uni.$TUIKit.login({
|
|
uni.$TUIKit.login({
|
|
@@ -565,17 +630,16 @@
|
|
userSig:this.$store.state.IMloadSig
|
|
userSig:this.$store.state.IMloadSig
|
|
})
|
|
})
|
|
})
|
|
})
|
|
-
|
|
|
|
- uni.hideLoading();
|
|
|
|
},
|
|
},
|
|
- onTIMError() {},
|
|
|
|
|
|
+ onTIMError(error) {
|
|
|
|
+ },
|
|
onSDKReady({name}) {
|
|
onSDKReady({name}) {
|
|
const isSDKReady = name === uni.$TUIKitEvent.SDK_READY ? true : false;
|
|
const isSDKReady = name === uni.$TUIKitEvent.SDK_READY ? true : false;
|
|
if(isSDKReady){
|
|
if(isSDKReady){
|
|
uni.$emit('isSDKReady', {
|
|
uni.$emit('isSDKReady', {
|
|
isSDKReady: true
|
|
isSDKReady: true
|
|
});
|
|
});
|
|
-
|
|
|
|
|
|
+ uni.hideLoading();
|
|
}
|
|
}
|
|
|
|
|
|
},
|
|
},
|
|
@@ -625,6 +689,7 @@
|
|
recommendRestore() {this.recommendTriggered = true;},
|
|
recommendRestore() {this.recommendTriggered = true;},
|
|
recommendAbort() {},
|
|
recommendAbort() {},
|
|
recommendToBottom(){
|
|
recommendToBottom(){
|
|
|
|
+ if(!uni.getStorageSync('token')){return;}
|
|
if(this.recommendList.length>=this.recommendTotal){return;}
|
|
if(this.recommendList.length>=this.recommendTotal){return;}
|
|
this.recommendListOptions.page.index++;
|
|
this.recommendListOptions.page.index++;
|
|
this.getRecommendList();
|
|
this.getRecommendList();
|
|
@@ -677,14 +742,9 @@
|
|
* 计算列表定位距离
|
|
* 计算列表定位距离
|
|
*/
|
|
*/
|
|
computedLocation(){
|
|
computedLocation(){
|
|
- // #ifdef MP
|
|
|
|
uni.getFuzzyLocation({
|
|
uni.getFuzzyLocation({
|
|
type:'gcj02',
|
|
type:'gcj02',
|
|
success:res=>{
|
|
success:res=>{
|
|
- this.latitude=res.latitude;
|
|
|
|
- this.longitude=res.longitude;
|
|
|
|
- this.$store.commit('setLatitude',this.latitude);
|
|
|
|
- this.$store.commit('setLongitude',this.longitude);
|
|
|
|
wxMapSdk.reverseGeocoder({
|
|
wxMapSdk.reverseGeocoder({
|
|
location:{
|
|
location:{
|
|
latitude:res.latitude,
|
|
latitude:res.latitude,
|
|
@@ -692,29 +752,28 @@
|
|
},
|
|
},
|
|
success:result=>{
|
|
success:result=>{
|
|
this.locationCity=result.result.ad_info.city;
|
|
this.locationCity=result.result.ad_info.city;
|
|
|
|
+ this.latitude=result.result.location.lat;
|
|
|
|
+ this.longitude=result.result.location.lng;
|
|
|
|
+ this.$store.commit('setLatitude',result.result.location.lat);
|
|
|
|
+ this.$store.commit('setLongitude',result.result.location.lng);
|
|
|
|
+ uni.setStorageSync('latitude',result.result.location.lat);
|
|
|
|
+ uni.setStorageSync('longitude',result.result.location.lng);
|
|
|
|
+ uni.setStorageSync('city',this.locationCity);
|
|
this.locationCityCode=result.result.ad_info.city_code.split(result.result.ad_info.nation_code)[1];
|
|
this.locationCityCode=result.result.ad_info.city_code.split(result.result.ad_info.nation_code)[1];
|
|
- this.getTempRecommendList();
|
|
|
|
if(!uni.getStorageSync('token')){
|
|
if(!uni.getStorageSync('token')){
|
|
this.getTempRecommendList();
|
|
this.getTempRecommendList();
|
|
}
|
|
}
|
|
else{
|
|
else{
|
|
- this.$api.public.heartBeat({
|
|
|
|
- city:this.locationCity,
|
|
|
|
- cityCode:this.locationCityCode,
|
|
|
|
- geo:{
|
|
|
|
- lat:this.latitude,
|
|
|
|
- lon:this.longitude,
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- }).then(()=>{
|
|
|
|
- this.getNearTopsMData();
|
|
|
|
- this.getNearTopsHData();
|
|
|
|
- this.getNearList();
|
|
|
|
- this.getRecommendList();
|
|
|
|
- this.showGetLocation=false;
|
|
|
|
- }).catch(err=>{
|
|
|
|
- this.getTempRecommendList();
|
|
|
|
- })
|
|
|
|
|
|
+ this.getNearTopsMData();
|
|
|
|
+ this.getNearTopsHData();
|
|
|
|
+ this.getRecommendTopsMData();
|
|
|
|
+ this.getRecommendTopsHData();
|
|
|
|
+ this.getNearList();
|
|
|
|
+ this.getRecommendList();
|
|
|
|
+ this.showGetLocation=false;
|
|
|
|
+ setTimeout(()=>{
|
|
|
|
+ this.imInit();
|
|
|
|
+ },2000)
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -742,58 +801,6 @@
|
|
})
|
|
})
|
|
}
|
|
}
|
|
})
|
|
})
|
|
- // #endif
|
|
|
|
- // #ifdef H5
|
|
|
|
- console.log('h5')
|
|
|
|
- uni.getLocation({
|
|
|
|
- type: 'wgs84',
|
|
|
|
- success: (res) => {
|
|
|
|
- console.log(res)
|
|
|
|
- this.latitude=res.latitude;
|
|
|
|
- this.longitude=res.longitude;
|
|
|
|
- this.$store.commit('setLatitude',this.latitude);
|
|
|
|
- this.$store.commit('setLongitude',this.longitude);
|
|
|
|
- this.$jsonp('https://apis.map.qq.com/ws/geocoder/v1',{
|
|
|
|
- key:'E5SBZ-T2YC3-CBL3F-YGFQQ-26PP2-ERFII',
|
|
|
|
- output:'jsonp',
|
|
|
|
- callbackName: 'QQmap',
|
|
|
|
- location:`${this.latitude},${this.longitude}`
|
|
|
|
- }).then(result=>{
|
|
|
|
- console.log(result)
|
|
|
|
- this.locationCity=result.result.ad_info.city;
|
|
|
|
- this.locationCityCode=result.result.ad_info.city_code.split(result.result.ad_info.nation_code)[1];
|
|
|
|
- this.getTempRecommendList();
|
|
|
|
- if(!uni.getStorageSync('token')){
|
|
|
|
- this.getTempRecommendList();
|
|
|
|
- }
|
|
|
|
- else{
|
|
|
|
- this.$api.public.heartBeat({
|
|
|
|
- city:this.locationCity,
|
|
|
|
- cityCode:this.locationCityCode,
|
|
|
|
- geo:{
|
|
|
|
- lat:this.latitude,
|
|
|
|
- lon:this.longitude,
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- }).then(()=>{
|
|
|
|
- this.getNearTopsMData();
|
|
|
|
- this.getNearTopsHData();
|
|
|
|
- this.getNearList();
|
|
|
|
- this.getRecommendList();
|
|
|
|
- this.showGetLocation=false;
|
|
|
|
- }).catch(err=>{
|
|
|
|
- this.getTempRecommendList();
|
|
|
|
- })
|
|
|
|
- }
|
|
|
|
- }).catch(err=>{
|
|
|
|
- console.log(err)
|
|
|
|
- })
|
|
|
|
- },
|
|
|
|
- fail:err=>{
|
|
|
|
- console.log(err);
|
|
|
|
- }
|
|
|
|
- })
|
|
|
|
- // #endif
|
|
|
|
|
|
|
|
},
|
|
},
|
|
toLogin(){
|
|
toLogin(){
|
|
@@ -874,7 +881,7 @@
|
|
this.recommendListOptions.type='FamaleReco';
|
|
this.recommendListOptions.type='FamaleReco';
|
|
this.$api.public.friendsNoAuth(this.recommendListOptions).then(res=>{
|
|
this.$api.public.friendsNoAuth(this.recommendListOptions).then(res=>{
|
|
if(res.status==='Succ'){
|
|
if(res.status==='Succ'){
|
|
-
|
|
|
|
|
|
+ uni.hideLoading();
|
|
this.recommendTotal=res.data.page.recordCount;
|
|
this.recommendTotal=res.data.page.recordCount;
|
|
this.recommendListOptions.page.sortValues=res.data.sortValues;
|
|
this.recommendListOptions.page.sortValues=res.data.sortValues;
|
|
|
|
|
|
@@ -906,7 +913,6 @@
|
|
else{
|
|
else{
|
|
this.recommendList=res.data.users;
|
|
this.recommendList=res.data.users;
|
|
}
|
|
}
|
|
- uni.hideLoading();
|
|
|
|
this.$forceUpdate();
|
|
this.$forceUpdate();
|
|
}
|
|
}
|
|
|
|
|
|
@@ -957,6 +963,7 @@
|
|
else{
|
|
else{
|
|
this.recommendList=res.data.users;
|
|
this.recommendList=res.data.users;
|
|
}
|
|
}
|
|
|
|
+ uni.hideLoading();
|
|
this.$forceUpdate();
|
|
this.$forceUpdate();
|
|
}
|
|
}
|
|
|
|
|
|
@@ -1005,6 +1012,7 @@
|
|
else{
|
|
else{
|
|
this.nearList=res.data.users;
|
|
this.nearList=res.data.users;
|
|
}
|
|
}
|
|
|
|
+ uni.hideLoading()
|
|
this.$forceUpdate();
|
|
this.$forceUpdate();
|
|
}
|
|
}
|
|
|
|
|
|
@@ -1046,7 +1054,7 @@
|
|
})
|
|
})
|
|
}
|
|
}
|
|
else{
|
|
else{
|
|
- this.otherInfo=res.data;
|
|
|
|
|
|
+ uni.setStorageSync('otherInfo',JSON.stringify(res.data));
|
|
uni.hideLoading();
|
|
uni.hideLoading();
|
|
uni.navigateTo({
|
|
uni.navigateTo({
|
|
url:`/pages/friends/user?id=${id}`
|
|
url:`/pages/friends/user?id=${id}`
|