123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290 |
- <template>
- <view class="container flex-between">
- <!-- <TabBar :tabIndex="tabIndex" ></TabBar> -->
- <uni-popup ref="popup" type="center">
- <Popup :content1="popup.content1" :content2="popup.content2" :tip1="popup.tip1" :tip2="popup.tip2" :btntext="popup.btntext" @closePopup="closePopup" @toLogin="toLogin" :btnEvent="'toLogin'"></Popup>
- </uni-popup>
- <view id="topnav" class="topnav flex-between">
- <div class="top-left flex-start">
- <view class="nav-item" v-for="(item,index) in navs" :key="index" :style="{
- 'font-size':`${navIndex===index?'40rpx':'32rpx'}`,
- 'color':`${navIndex===index?'#ffffff':''}`,
- 'font-weight':`${navIndex===index?'#ffffff':''}`}"
- @click="navClick(index)">
-
- <view class="nav-item-text fw700">{{item}}</view>
- </view>
- </div>
-
- <image :src="`${assetsUrl}friends-searchicon.png`" mode="aspectFit" class="nav-search" @click="toSearch"></image>
- <img :src="`${assetsUrl}friends-circle.png`" mode="aspectFit" class="nav-item-bg" :style="{'left':`${navIndex*156+32}rpx`}" ></img>
- </view>
-
- <swiper class="outer-swiper" :current="navIndex" @change="outerSwiperChange">
- <swiper-item class="outer-swiper-item">
- <scroll-view class="scroll-view"
- scroll-y="true"
- lower-threshold="200"
- refresher-enabled="false"
- :refresher-triggered="recommendTriggered"
- :refresher-threshold="45"
- refresher-default-style="white"
- refresher-background="#151126"
- @refresherrefresh="recommendRefresh"
- @refresherpulling="recommendPulling"
- @refresherrestore="recommendRestore"
- @refresherabort="recommendAbort"
- @scrolltolower="recommendToBottom"
- show-scrollbar="false"
- >
- <view slot="refresher" class="refresh-container" style="display: block; width: 100%; height: 80px; background: blue; display: flex; align-items: center;">
- <view class="view1" style="position: absolute; text-align: center; width: 100%;">
- 下拉刷新
- </view>
- </view>
- <image :src="`${assetsUrl}friends-bg.png`" mode="widthFix" class="tops-bg" v-if="recommendTopsM.length>0"></image>
- <view class="tops-nav flex-center" v-if="recommendTopsM.length>0">
- <view class="tops-nav-item" :class="topsIndex===index?'font32 fw600 tops-nav-item-active':''" v-for="(item,index) in tops" :key="index" @click="topsNavClick(index)">
- {{item}}
- </view>
- <view class="tops-line" :style="{'left':`${topsIndex*160+250}rpx`}"></view>
- </view>
- <swiper :current="topsIndex" class="swiper" @change="swiperChange" v-if="recommendTopsM.length>0">
- <swiper-item class="swiper-item">
- <view class="tops flex-between">
- <view class="tops-third flex-center">
- <view class="tt-item flex-center" @click="toDetail(recommendTopsM[1].userId)">
- <view class="tt-item-bg"></view>
- <image :src="`${assetsUrl}friends-2.png`" mode="aspectFill" class="tt-item-img"></image>
- <image :src="recommendTopsM[1].icon" class="tt-item-head-box" style="border: 2rpx solid #E2E2E2;"></image>
- <view class="tt-item-name font28 fw600 el">
- {{recommendTopsM[1].nick}}
- </view>
- <view class="tt-item-num-box flex-center">
- <image :src="`${assetsUrl}friends-heart.png`" mode="aspectFill" class="tt-item-num-img"></image>
- <view class="tt-item-num-text font22 fw600">
- {{recommendTopsM[1].val}}
- </view>
- </view>
- </view>
- <view class="tt-item flex-center" style="margin: 0rpx 16rpx;" @click="toDetail(recommendTopsM[0].userId)">
- <view class="tt-item-bg-center" style="width: 228rpx;"></view>
- <image :src="`${assetsUrl}friends-1.png`" mode="aspectFill" class="tt-item-img" style="transform: translateY(0rpx);"></image>
- <image :src="`${assetsUrl}friends-1-bling.png`" mode="aspectFill" class="tt-item-img-border" style="transform: translateY(-60rpx);"></image>
- <image :src="recommendTopsM[0].icon" class="tt-item-head-box" style="border: 2rpx solid #FFEC36;transform: translateY(-18rpx);"></image>
- <view class="tt-item-name font28 fw600 el">
- {{recommendTopsM[0].nick}}
- </view>
- <view class="tt-item-num-box flex-center">
- <image :src="`${assetsUrl}friends-heart.png`" mode="aspectFill" class="tt-item-num-img"></image>
- <view class="tt-item-num-text font22 fw600">
- {{recommendTopsM[0].val}}
- </view>
- </view>
- </view>
- <view class="tt-item flex-center" @click="toDetail(recommendTopsM[2].userId)">
- <view class="tt-item-bg"></view>
- <image :src="`${assetsUrl}friends-3.png`" mode="aspectFill" class="tt-item-img"></image>
- <image :src="recommendTopsM[2].icon" class="tt-item-head-box" style="border: 2rpx solid #E19865;"></image>
- <view class="tt-item-name font28 fw600 el">
- {{recommendTopsM[2].nick}}
- </view>
- <view class="tt-item-num-box flex-center">
- <image :src="`${assetsUrl}friends-heart.png`" mode="aspectFill" class="tt-item-num-img"></image>
- <view class="tt-item-num-text font22 fw600">
- {{recommendTopsM[2].val}}
- </view>
- </view>
- </view>
- </view>
- </view>
- </swiper-item>
- <swiper-item class="swiper-item">
- <view class="tops flex-between">
- <view class="tops-third flex-center">
- <view class="tt-item flex-center" @click="toDetail(recommendTopsH[1].userId)">
- <view class="tt-item-bg"></view>
- <image :src="`${assetsUrl}friends-2.png`" mode="aspectFill" class="tt-item-img"></image>
- <image :src="recommendTopsH[1].icon" class="tt-item-head-box" style="border: 2rpx solid #E2E2E2;"></image>
- <view class="tt-item-name font28 fw600 el">
- {{recommendTopsH[1].nick}}
- </view>
- <view class="tt-item-num-box flex-center">
- <image :src="`${assetsUrl}friends-sugar.png`" mode="aspectFill" class="tt-item-num-img"></image>
- <view class="tt-item-num-text font22 fw600">
- {{recommendTopsH[1].val}}
- </view>
- </view>
- </view>
- <view class="tt-item flex-center" style="margin: 0rpx 16rpx;" @click="toDetail(recommendTopsH[0].userId)">
- <view class="tt-item-bg-center" style="width: 228rpx;"></view>
- <image :src="`${assetsUrl}friends-1.png`" mode="aspectFill" class="tt-item-img" style="transform: translateY(-5rpx);"></image>
- <image :src="`${assetsUrl}friends-1-bling.png`" mode="aspectFill" class="tt-item-img-border" style="transform: translateY(-60rpx);"></image>
- <image :src="recommendTopsH[0].icon" class="tt-item-head-box" style="border: 2rpx solid #FFEC36;transform: translateY(-18rpx);"></image>
- <view class="tt-item-name font28 fw600 el">
- {{recommendTopsH[0].nick}}
- </view>
- <view class="tt-item-num-box flex-center">
- <image :src="`${assetsUrl}friends-sugar.png`" mode="aspectFill" class="tt-item-num-img"></image>
- <view class="tt-item-num-text font22 fw600">
- {{recommendTopsH[0].val}}
- </view>
- </view>
- </view>
- <view class="tt-item flex-center" @click="toDetail(recommendTopsH[2].userId)">
- <view class="tt-item-bg"></view>
- <image :src="`${assetsUrl}friends-3.png`" mode="aspectFill" class="tt-item-img"></image>
- <image :src="recommendTopsH[2].icon" class="tt-item-head-box" style="border: 2rpx solid #E19865;"></image>
- <view class="tt-item-name font28 fw600 el">
- {{recommendTopsH[2].nick}}
- </view>
- <view class="tt-item-num-box flex-center">
- <image :src="`${assetsUrl}friends-sugar.png`" mode="aspectFill" class="tt-item-num-img"></image>
- <view class="tt-item-num-text font22 fw600">
- {{recommendTopsH[2].val}}
- </view>
- </view>
- </view>
- </view>
- </view>
- </swiper-item>
- </swiper>
- <view class="location flex-between" @click="computedLocation" v-if="showGetLocation">
- <image :src="`${assetsUrl}friends-pos.png`" mode="aspectFill" class="l-pos"></image>
- <text class="l-text font24 fw400">点此开启位置权限,获得更精准推荐!</text>
- <view class="l-open font24 fw400">开启</view>
- </view>
- <view class="list-item flex-start" v-for="(item,index) in recommendList" :key="index" @click="toDetail(item.id)">
- <view class="list-head-box">
- <image :src="item.iconThumbnail" mode="aspectFill" class="list-head-img"></image>
- <view class="list-head-dot" style="background-color: #38E825;" v-if="item.lastActiveTime<=30"></view>
- <view class="list-head-dot" style="background-color: #0ABDEF;" v-else-if="item.lastActiveTime>30&&item.lastActiveTime<=1440"></view>
- </view>
- <view class="list-info-box">
- <view class="name-box flex-between">
- <view class="name flex-start">
- <view class="name-text font28 fw600">
- {{item.nick}}
- </view>
- <image :src="`${assetsUrl}friends-vip.png`" mode="aspectFill" class="name-img" v-if="item.vip"></image>
- <image :src="`${assetsUrl}friends-godness.png`" mode="aspectFill" class="name-img-godness" v-if="item.goddess"></image>
- <image :src="`${assetsUrl}friends-real.png`" mode="aspectFill" class="name-img" v-else-if="item.realMan"></image>
- </view>
- <view class="distance font22 fw400" v-if="item.distance&&item.distance!=='NaNm'">
- {{item.distance}}
- </view>
- </view>
- <view class="sex-box flex-center" :style="{'background-color':`${item.sex==='Male'?'rgba(108,82,244,0.21)':''}`}">
- <image :src="`${assetsUrl}friends-female.png`" mode="aspectFill" class="sex-img" v-if="item.sex==='Famale'"></image>
- <image :src="`${assetsUrl}friends-male.png`" mode="aspectFill" class="sex-img" v-if="item.sex==='Male'"></image>
- <view class="el font20 fw500 sex-text1" v-if="item.sex==='Famale'">
- {{item.ageInfo.age}}
- </view>
- <view class="el font20 fw500 sex-text2" v-if="item.sex==='Male'">
- {{item.ageInfo.age}}
- </view>
- </view>
- <view class="tip-box font28 fw400 el" v-if="item.desc">
- 签名:{{item.desc}}
- </view>
- <view class="tip-box font28 fw400 el" v-else>
- 签名:暂无介绍
- </view>
-
- </view>
- <view class="img-box flex-between" v-if="item.lastNews">
- <image :src="item.lastNews.mediaUrls[0]" mode="aspectFill" class="ib1"></image>
- <image :src="item.lastNews.mediaUrls[1]" mode="aspectFill" class="ib2"></image>
- <image :src="item.lastNews.mediaUrls[2]" mode="aspectFill" class="ib3"></image>
- </view>
- </view>
- <view class="no-more font24 fw400" v-if="recommendList.length!==0&&recommendList.length>=recommendTotal">没有更多了</view>
- </scroll-view>
- </swiper-item>
- <swiper-item class="outer-swiper-item">
- <scroll-view class="scroll-view"
- scroll-y="true"
- lower-threshold="200"
- refresher-enabled="true"
- :refresher-triggered="nearTriggered"
- :refresher-threshold="45"
- refresher-default-style="white"
- refresher-background="#151126"
- @refresherrefresh="nearRefresh"
- @refresherpulling="nearPulling"
- @refresherrestore="nearRestore"
- @refresherabort="nearAbort"
- @scrolltolower="nearToBottom"
- :show-scrollbar="false"
- >
- <image :src="`${assetsUrl}friends-bg.png`" mode="widthFix" class="tops-bg" v-if="!showGetLocation"></image>
- <view class="tops-nav flex-center" v-if="!showGetLocation">
- <view class="tops-nav-item" :class="topsIndex===index?'font32 fw600 tops-nav-item-active':''" v-for="(item,index) in tops" :key="index" @click="topsNavClick(index)">
- {{item}}
- </view>
- <view class="tops-line" :style="{'left':`${topsIndex*160+250}rpx`}"></view>
- </view>
- <swiper :current="topsIndex" class="swiper" @change="swiperChange" v-if="!showGetLocation">
- <swiper-item class="swiper-item">
- <view class="tops flex-between">
- <view class="tops-third flex-center">
- <view class="tt-item flex-center" @click="toDetail(nearTopsM[1].userId)">
- <view class="tt-item-bg"></view>
- <image :src="`${assetsUrl}friends-2.png`" mode="aspectFill" class="tt-item-img"></image>
- <image :src="nearTopsM[1].icon" class="tt-item-head-box" style="border: 2rpx solid #E2E2E2;"></image>
- <view class="tt-item-name font28 fw600 el">
- {{nearTopsM[1].nick}}
- </view>
- <view class="tt-item-num-box flex-center">
- <image :src="`${assetsUrl}friends-heart.png`" mode="aspectFill" class="tt-item-num-img"></image>
- <view class="tt-item-num-text font22 fw600">
- {{nearTopsM[1].val}}
- </view>
- </view>
- </view>
- <view class="tt-item flex-center" style="margin: 0rpx 16rpx;" @click="toDetail(nearTopsM[0].userId)">
- <view class="tt-item-bg-center" style="width: 228rpx;"></view>
- <image :src="`${assetsUrl}friends-1.png`" mode="aspectFill" class="tt-item-img" style="transform: translateY(-5rpx);"></image>
- <image :src="`${assetsUrl}friends-1-bling.png`" mode="aspectFill" class="tt-item-img-border" style="transform: translateY(-60rpx);"></image>
- <image :src="nearTopsM[0].icon" class="tt-item-head-box" style="border: 2rpx solid #FFEC36;transform: translateY(-18rpx);"></image>
- <view class="tt-item-name font28 fw600 el">
- {{nearTopsM[0].nick}}
- </view>
- <view class="tt-item-num-box flex-center">
- <image :src="`${assetsUrl}friends-heart.png`" mode="aspectFill" class="tt-item-num-img"></image>
- <view class="tt-item-num-text font22 fw600">
- {{nearTopsM[0].val}}
- </view>
- </view>
- </view>
- <view class="tt-item flex-center" @click="toDetail(nearTopsM[2].userId)">
- <view class="tt-item-bg"></view>
- <image :src="`${assetsUrl}friends-3.png`" mode="aspectFill" class="tt-item-img"></image>
- <image :src="nearTopsM[2].icon" class="tt-item-head-box" style="border: 2rpx solid #E19865;"></image>
- <view class="tt-item-name font28 fw600 el">
- {{nearTopsM[2].nick}}
- </view>
- <view class="tt-item-num-box flex-center">
- <image :src="`${assetsUrl}friends-heart.png`" mode="aspectFill" class="tt-item-num-img"></image>
- <view class="tt-item-num-text font22 fw600">
- {{nearTopsM[2].val}}
- </view>
- </view>
- </view>
- </view>
- </view>
- </swiper-item>
- <swiper-item class="swiper-item">
- <view class="tops flex-between">
- <view class="tops-third flex-center">
- <view class="tt-item flex-center" @click="toDetail(nearTopsH[1].userId)">
- <view class="tt-item-bg"></view>
- <image :src="`${assetsUrl}friends-2.png`" mode="aspectFill" class="tt-item-img"></image>
- <image :src="nearTopsH[1].icon" class="tt-item-head-box" style="border: 2rpx solid #E2E2E2;"></image>
- <view class="tt-item-name font28 fw600 el">
- {{nearTopsH[1].nick}}
- </view>
- <view class="tt-item-num-box flex-center">
- <image :src="`${assetsUrl}friends-sugar.png`" mode="aspectFill" class="tt-item-num-img"></image>
- <view class="tt-item-num-text font22 fw600">
- {{nearTopsH[1].val}}
- </view>
- </view>
- </view>
- <view class="tt-item flex-center" style="margin: 0rpx 16rpx;" @click="toDetail(nearTopsH[0].userId)">
- <view class="tt-item-bg-center" style="width: 228rpx;"></view>
- <image :src="`${assetsUrl}friends-1.png`" mode="aspectFill" class="tt-item-img" style="transform: translateY(-5rpx);"></image>
- <image :src="`${assetsUrl}friends-1-bling.png`" mode="aspectFill" class="tt-item-img-border" style="transform: translateY(-60rpx);"></image>
- <image :src="nearTopsH[0].icon" class="tt-item-head-box" style="border: 2rpx solid #FFEC36;transform: translateY(-18rpx);"></image>
- <view class="tt-item-name font28 fw600 el">
- {{nearTopsH[0].nick}}
- </view>
- <view class="tt-item-num-box flex-center">
- <image :src="`${assetsUrl}friends-sugar.png`" mode="aspectFill" class="tt-item-num-img"></image>
- <view class="tt-item-num-text font22 fw600">
- {{nearTopsH[0].val}}
- </view>
- </view>
- </view>
- <view class="tt-item flex-center" @click="toDetail(nearTopsH[2].userId)">
- <view class="tt-item-bg"></view>
- <image :src="`${assetsUrl}friends-3.png`" mode="aspectFill" class="tt-item-img"></image>
- <image :src="nearTopsH[2].icon" class="tt-item-head-box" style="border: 2rpx solid #E19865;"></image>
- <view class="tt-item-name font28 fw600 el">
- {{nearTopsH[2].nick}}
- </view>
- <view class="tt-item-num-box flex-center">
- <image :src="`${assetsUrl}friends-sugar.png`" mode="aspectFill" class="tt-item-num-img"></image>
- <view class="tt-item-num-text font22 fw600">
- {{nearTopsH[2].val}}
- </view>
- </view>
- </view>
- </view>
- </view>
- </swiper-item>
- </swiper>
- <view class="list-item flex-start" v-for="(item,index) in nearList" :key="index" @click="toDetail(item.id)">
- <view class="list-head-box">
- <image :src="item.iconThumbnail" mode="aspectFill" class="list-head-img"></image>
- <view class="list-head-dot" style="background-color: #38E825;" v-if="item.lastActiveTime<=30"></view>
- <view class="list-head-dot" style="background-color: #0ABDEF;" v-else-if="item.lastActiveTime>30&&item.lastActiveTime<=1440"></view>
- </view>
- <view class="list-info-box">
- <view class="name-box flex-between">
- <view class="name flex-start">
- <view class="name-text font28 fw600">
- {{item.nick}}
- </view>
- <image :src="`${assetsUrl}friends-vip.png`" mode="aspectFill" class="name-img" v-if="item.vip"></image>
- <image :src="`${assetsUrl}friends-godness.png`" mode="aspectFill" class="name-img-godness" v-if="item.goddess"></image>
- <image :src="`${assetsUrl}friends-real.png`" mode="aspectFill" class="name-img" v-else-if="item.realMan"></image>
- </view>
- <view class="distance font22 fw400" v-if="item.distance&&item.distance!=='NaNm'">
- {{item.distance}}
- </view>
- </view>
- <view class="sex-box flex-center" :style="{'background-color':`${item.sex==='Male'?'rgba(108,82,244,0.21)':''}`}">
- <image :src="`${assetsUrl}friends-female.png`" mode="aspectFill" class="sex-img" v-if="item.sex==='Famale'"></image>
- <image :src="`${assetsUrl}friends-male.png`" mode="aspectFill" class="sex-img" v-if="item.sex==='Male'"></image>
- <view class="el font20 fw500 sex-text1" v-if="item.sex==='Famale'">
- {{item.ageInfo.age}}
- </view>
- <view class="el font20 fw500 sex-text2" v-if="item.sex==='Male'">
- {{item.ageInfo.age}}
- </view>
- </view>
- <view class="tip-box font28 fw400 el" v-if="item.desc">
- 签名:{{item.desc}}
- </view>
- <view class="tip-box font28 fw400 el" v-else>
- 签名:暂无介绍
- </view>
- </view>
- <view class="img-box flex-between" v-if="item.lastNews">
- <image :src="item.lastNews.mediaUrls[0]" mode="aspectFill" class="ib1"></image>
- <image :src="item.lastNews.mediaUrls[1]" mode="aspectFill" class="ib2"></image>
- <image :src="item.lastNews.mediaUrls[2]" mode="aspectFill" class="ib3"></image>
- </view>
- </view>
- <view class="no-more font24 fw400" v-if="nearList.length!==0&&nearList.length>=nearTotal">没有更多了</view>
- <Status :type="statusType" :btnText="statusBtnText" :text="statusText" @btnEvent="computedLocation" v-if="showGetLocation"></Status>
- <Status type="noData" text="暂无数据" v-if="showNoData"></Status>
- </scroll-view>
- </swiper-item>
- </swiper>
-
- </view>
- </template>
- <script>
- // import TabBar from '@/components/TabBar/TabBar.vue';
- import Status from '@/components/Status/Status.vue';
- import wxMap from '@/static/qqmap-wx-jssdk1.2/qqmap-wx-jssdk.min.js';
- import TIM from 'tim-wx-sdk';
- import Popup from '@/components/Popup/Popup.vue';
- // import COS from 'cos-wx-sdk-v5';
- import TIMUploadPlugin from 'tim-upload-plugin';
- // 腾讯位置服务,手机账号:18996226740
- const wxMapSdk=new wxMap({key:'E5SBZ-T2YC3-CBL3F-YGFQQ-26PP2-ERFII'});
- import {get} from '@/util/index.js'
- export default {
- components: {
- Status,Popup
- },
- data() {
- 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:false,
- femaleNew:false,
- geo:{
- lat:0,
- lon:0
- },
- maleNew:false,
- maleVip:false
-
- },
- showList: true,
- type: {}
- },
- nearListOptions:{
- filterIds:[],
- page:{
- index:1,
- size:20,
- sortValues:[]
- },
- queryPre:{
- city:'',
- cityCode:'',
- femaleGoddess:false,
- femaleNew:false,
- geo:{
- lat:0,
- lon:0
- },
- maleNew:false,
- maleVip:false
-
- },
- showList: true,
- type: {}
- },
- showGetLocation:false,
- showNoData:false,
- latitude:0,
- longitude:0,
- locationCity:'',
- locationCityCode:'',
- recommendTopsM:[],
- recommendTopsH:[],
- recommendList:[],
- recommendTotal:0,
- recommendRefreshing:false,
- recommendTriggered:true,
-
- nearTopsM:[],
- nearTopsH:[],
- nearList:[],
- nearTotal:0,
- nearRefreshing:false,
- nearTriggered:true,
- otherInfo:null
- };
- },
- computed: {
- statusBarHeight() {
- return this.$store.state.statusBarHeight||20;
- },
- topbarOffsetHeight() {
- return this.$store.state.topbarOffsetHeight||40;
- },
- userInfo(){
- return this.$store.state.userInfo||{};
- }
- },
- mounted() {
- uni.showLoading({
- mask:true,
- title:'加载中'
- })
- this.computedScollviewHeight();
- if(!uni.getStorageSync('token')){
- this.computedLocation();
- }
- else{
- this.computedLocation();
- this.getRecommendTopsMData();
- this.getRecommendTopsHData();
- setTimeout(()=>{
- this.imInit();
- },3000)
-
- }
-
-
-
-
- },
- // #ifdef MP
- onShareAppMessage(){
- return {
- title: '糖果公园',
- path: `/pages/login/login?share=${this.userInfo.inviteCode}`,
- }
- },
- // #endif
- methods: {
- closePopup(){
- this.$refs.popup.close()
- },
- imInit(){
- /**
- * IM初始化
- */
- if(uni.$TUIKit){
- uni.$TUIKit.logout();
- }
- const SDKAppID = this.$util.IMSDKCode,that=this;
- uni.$TUIKit = TIM.create({
- SDKAppID: SDKAppID
- });
- uni.$TUIKitTIM = TIM;
- uni.$TUIKitEvent = TIM.EVENT;
- uni.$TUIKitVersion = TIM.VERSION;
- uni.$TUIKitTypes = TIM.TYPES; // 监听系统级事件
- uni.$TUIKit.on(uni.$TUIKitEvent.SDK_READY, this.onSDKReady);
- uni.$TUIKit.on(uni.$TUIKitEvent.SDK_NOT_READY, this.onSdkNotReady);
- uni.$TUIKit.on(uni.$TUIKitEvent.KICKED_OUT, this.onKickedOut);
- uni.$TUIKit.on(uni.$TUIKitEvent.ERROR, this.onTIMError);
- uni.$TUIKit.on(uni.$TUIKitEvent.NET_STATE_CHANGE, this.onNetStateChange);
- uni.$TUIKit.on(uni.$TUIKitEvent.SDK_RELOAD, this.onSDKReload);
- uni.$resetLoginData = this.resetLoginData();
- uni.$TUIKit.registerPlugin({ 'tim-upload-plugin':TIMUploadPlugin });
- },
- resetLoginData() {
- let user=JSON.parse(uni.getStorageSync('userInfo'));
- this.$api.IM.loadSig({}).then(res=>{
- this.$store.commit('setImLoadSig',res.data.sig);
- uni.$TUIKit.login({
- userID:String(user.id),
- userSig:this.$store.state.IMloadSig
- })
- })
-
- uni.hideLoading();
- },
- onTIMError() {},
- onSDKReady({name}) {
- const isSDKReady = name === uni.$TUIKitEvent.SDK_READY ? true : false;
- if(isSDKReady){
- uni.$emit('isSDKReady', {
- isSDKReady: true
- });
-
- }
-
- },
-
- onNetStateChange() {},
- onSDKReload() {},
- onSdkNotReady() {},
- onKickedOut() {
- uni.showToast({
- title: '您被踢下线',
- icon: 'error'
- });
- uni.reLaunch({
- url: '/pages/login/login'
- })
- },
- /**
- * 推荐下拉刷新、加载更多
- */
- recommendRefresh(){
- if(!uni.getStorageSync('token')){
- setTimeout(() => {
- this.recommendTriggered = false;
- this.recommendRefreshing = false;
- }, 1000)
- return;
- }
- if (this.recommendRefreshing)
- {
- return;
- }
- this.recommendRefreshing = true;
- setTimeout(() => {
- this.recommendTriggered = false;
- this.recommendRefreshing = false;
- }, 1000)
- this.recommendListOptions.page={
- index:1,
- size:20,
- sortValues:[]
- }
- this.getRecommendTopsMData();
- this.getRecommendTopsHData();
- this.getRecommendList();
- },
- recommendPulling(e) {},
- recommendRestore() {this.recommendTriggered = true;},
- recommendAbort() {},
- recommendToBottom(){
- if(this.recommendList.length>=this.recommendTotal){return;}
- this.recommendListOptions.page.index++;
- this.getRecommendList();
- },
- /**
- * 附近下拉刷新、加载更多
- */
- nearRefresh(){
- if (this.nearRefreshing)
- {
- return;
- }
- this.nearRefreshing = true;
- setTimeout(() => {
- this.nearTriggered = false;
- this.nearRefreshing = false;
- }, 1000)
- this.nearListOptions.page={
- index:1,
- size:20,
- sortValues:[]
- }
- this.getNearTopsMData();
- this.getNearTopsHData();
- this.getNearList();
- },
- nearPulling(e) {},
- nearRestore() {this.nearTriggered = true;},
- nearAbort() {},
- nearToBottom(){
- if(this.nearList.length>=this.nearTotal){return;}
- this.nearListOptions.page.index++;
- this.getNearList();
- },
- /**
- * 计算scroll高度
- */
- computedScollviewHeight() {
- let query = uni.createSelectorQuery().in(this);
- let heightLeaf = this.$store.state.tabbarHeight/2;
- query.select('#topnav').boundingClientRect(data => {
- heightLeaf += data.height;
- }).exec(() => {
- let sysInfo = uni.getSystemInfoSync();
- this.scrollHeight = sysInfo.windowHeight - heightLeaf;
- });
- },
- /**
- * 计算列表定位距离
- */
- computedLocation(){
- 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];
- 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);
- }
- })
-
- },
- toLogin(){
- uni.reLaunch({
- url:'/pages/login/login'
- })
- },
- navClick(index){
- if(!uni.getStorageSync('token')){
- this.popup={
- content1:'您还未登录',
- content2:'该功能登录后才能使用',
- tip1:'',
- tip2:'',
- btntext:'去登录'
- }
- this.$refs.popup.open();
- return;
- }
- this.rankingOptions.city=(index===0?'':this.locationCity);
- this.rankingOptions.cityCode=(index===0?'':this.locationCityCode);
- this.navIndex=index;
- },
- toSearch(){
- if(!uni.getStorageSync('token')){
- this.popup={
- content1:'您还未登录',
- content2:'该功能登录后才能使用',
- tip1:'',
- tip2:'',
- btntext:'去登录'
- }
- this.$refs.popup.open();
- return;
- }
- uni.navigateTo({
- url:'/pages/search/search'
- })
- },
- topsNavClick(index){
- this.topsIndex=index;
- },
- outerSwiperChange(e){
- this.navIndex=e.detail.current;
- },
- swiperChange(e){
- this.topsIndex=e.detail.current;
- },
- getRecommendTopsMData(){
- this.rankingOptions.type='M';
- this.$api.public.ranking(this.rankingOptions).then(res=>{
- this.recommendTopsM=res.data.list;
- })
- },
- getRecommendTopsHData(){
- this.rankingOptions.type='H';
- this.$api.public.ranking(this.rankingOptions).then(res=>{
- this.recommendTopsH=res.data.list;
- })
- },
- getNearTopsMData(){
- this.rankingOptions.type='M';
- this.rankingOptions.city=this.locationCity;
- this.rankingOptions.cityCode=this.locationCityCode;
- this.$api.public.ranking(this.rankingOptions).then(res=>{
- this.nearTopsM=res.data.list;
- })
- },
- getNearTopsHData(){
- this.rankingOptions.type='H';
- this.rankingOptions.city=this.locationCity;
- this.rankingOptions.cityCode=this.locationCityCode;
- this.$api.public.ranking(this.rankingOptions).then(res=>{
- this.nearTopsH=res.data.list;
- })
- },
- getTempRecommendList(){//获取免登录体验数据
- this.recommendListOptions.type='FamaleReco';
- this.$api.public.friendsNoAuth(this.recommendListOptions).then(res=>{
- if(res.status==='Succ'){
-
- this.recommendTotal=res.data.page.recordCount;
- this.recommendListOptions.page.sortValues=res.data.sortValues;
-
- let arr=[],obj={latitude:0,longitude:0};
- for(let i=0;i<res.data.users.length;i++){
- res.data.users[i].lastActiveTime=this.$moment(new Date()).diff(res.data.users[i].lastActive,'minutes');
- obj={latitude:0,longitude:0};
- obj.latitude=res.data.users[i].geo.lat;
- obj.longitude=res.data.users[i].geo.lon;
- arr.push(obj)
- }
-
- wxMapSdk.calculateDistance({
- mode:'straight',
- from:{
- latitude: this.latitude,
- longitude: this.longitude
- },
- to:arr,
- success:dists=>{
- if(dists.message==="query ok"){
- for(let j=0;j<dists.result.elements.length;j++){
- res.data.users[j].distance=(dists.result.elements[j].distance>1000?`${Math.floor(dists.result.elements[j].distance/100)/10}km`:`${dists.result.elements[j].distance}m`)
-
- }
- if(this.recommendListOptions.page.index>1){
- this.recommendList=[...this.recommendList,...res.data.users];
- }
- else{
- this.recommendList=res.data.users;
- }
- uni.hideLoading();
- this.$forceUpdate();
- }
-
- }
- })
- this.recommendList=res.data.users;
- }
- })
- },
- getRecommendList(){
- let user=JSON.parse(uni.getStorageSync('user'));
- this.recommendListOptions.type=user.sex==='male'?'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(res=>{
- if(res.status==='Succ'){
-
- this.recommendTotal=res.data.page.recordCount;
- this.recommendListOptions.page.sortValues=res.data.sortValues;
-
- let arr=[],obj={latitude:0,longitude:0};
- for(let i=0;i<res.data.users.length;i++){
- res.data.users[i].lastActiveTime=this.$moment(new Date()).diff(res.data.users[i].lastActive,'minutes');
- obj={latitude:0,longitude:0};
- obj.latitude=res.data.users[i].geo.lat;
- obj.longitude=res.data.users[i].geo.lon;
- arr.push(obj)
- }
- if(this.recommendListOptions.page.index>1){
- this.recommendList=[...this.recommendList,...res.data.users];
- }
- else{
- this.recommendList=res.data.users;
- }
- wxMapSdk.calculateDistance({
- mode:'straight',
- from:{
- latitude: this.latitude,
- longitude: this.longitude
- },
- to:arr,
- success:dists=>{
- if(dists.message==="query ok"){
- for(let j=0;j<dists.result.elements.length;j++){
- res.data.users[j].distance=(dists.result.elements[j].distance>1000?`${Math.floor(dists.result.elements[j].distance/100)/10}km`:`${dists.result.elements[j].distance}m`)
-
- }
-
- this.$forceUpdate();
- }
-
- }
- })
- }
- })
- },
- getNearList(){
- let user=JSON.parse(uni.getStorageSync('user'));
- this.nearListOptions.type=user.sex==='male'?'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(res=>{
- if(res.status==='Succ'&&res.data.users.length>0){
-
- this.nearTotal=res.data.page.recordCount;
- this.nearListOptions.page.sortValues=res.data.sortValues;
-
- this.showNoData=res.data.users.length===0?true:false;
- let arr=[],obj={latitude:0,longitude:0};
- for(let i=0;i<res.data.users.length;i++){
- res.data.users[i].lastActiveTime=this.$moment(new Date()).diff(res.data.users[i].lastActive,'minutes');
- obj={latitude:0,longitude:0};
- obj.latitude=res.data.users[i].geo.lat;
- obj.longitude=res.data.users[i].geo.lon;
- arr.push(obj)
- }
- wxMapSdk.calculateDistance({
- mode:'straight',
- from:{
- latitude: this.latitude,
- longitude: this.longitude
- },
- to:arr,
- success:dists=>{
- if(dists.message==="query ok"){
- for(let j=0;j<dists.result.elements.length;j++){
- res.data.users[j].distance=(dists.result.elements[j].distance>1000?`${Math.floor(dists.result.elements[j].distance/100)/10}km`:`${dists.result.elements[j].distance}m`)
- }
- if(this.nearListOptions.page.index>1){
- this.nearList=[...this.nearList,...res.data.users];
- }
- else{
- this.nearList=res.data.users;
- }
- this.$forceUpdate();
- }
-
- }
- })
-
- }
- else{
- this.showNoData=this.nearList.length===0?true:false;
- }
- })
- },
- toDetail(id){
- if(!uni.getStorageSync('token')){
- this.popup={
- content1:'您还未登录',
- content2:'该功能登录后才能使用',
- tip1:'',
- tip2:'',
- btntext:'去登录'
- }
- this.$refs.popup.open();
- return;
- }
- uni.showLoading({})
- let user=JSON.parse(uni.getStorageSync('user'));
- this.$api.public.userDetail({getAlbum:true,completeUser:user,uponUserId:id}).then(res=>{
- if(res.data.frozen){
- uni.showToast({
- title:'该用户已被冻结',
- icon:'none'
- });
- return;
- }
- if(res.data.sex===user.sex){
- uni.showToast({
- title:'同性用户不能查看主页',
- icon:'none'
- })
- }
- else{
- this.otherInfo=res.data;
- uni.hideLoading();
- uni.navigateTo({
- url:`/pages/friends/user?id=${id}`
- })
- }
- })
-
- },
- }
- }
- </script>
- <style lang="scss" scoped>
- .container {
- width: 100vw;
- height: 100%;
- background-color: $bgcolor1;
- overflow: hidden;
- flex-direction: column;
- .topnav {
- padding: 0 32rpx;
- align-items: center;
- width: 100%;
- box-sizing: border-box;
- z-index: 999;
- height:100rpx;
- position: relative;
- background-color: $bgcolor1;
- .nav-item {
- color: $fontcolor3;
- margin-right: 72rpx;
- transition: all 0.3s;
- padding: 0 10rpx;
- .nav-item-text{
- position: relative;
- z-index: 1;
- }
- }
- .nav-search{
- width:56rpx;
- height: 56rpx;
- margin-left: 110rpx;
-
- }
- .nav-item-bg{
- position: absolute;
- left: 0;
- top: 20rpx;
- width: 92rpx;
- height: 68rpx;
- z-index: 0;
- transition: all .3s;
- }
- }
- .location{
- margin-top: 40rpx;
- padding: 12rpx;
- background-color: $bgcolor3;
- border-radius: 36rpx;
- .l-pos{
- width: 32rpx;
- height: 32rpx;
- }
- .l-text{
- color: $fontcolor2;
- flex: 1;
- text-align: left;
- margin-left: 8rpx;
- }
- .l-open{
- width: 88rpx;
- height: 48rpx;
- border-radius: 24rpx;
- line-height: 48rpx;
- text-align: center;
- background-color: $primary;
- color: $fontcolor5;
- }
- }
- .outer-swiper{
- width: 100vw;
- flex: 1;
- }
- .scroll-view{
- position: absolute;
- padding: 0rpx 32rpx 0rpx 32rpx;
- box-sizing: border-box;
- height: 100%;
- .tops-bg{
- width: 100%;
- height: 100%;
- position: absolute;
- left: 0;
- top: 0;
- z-index: -1;
- }
- .tops-nav{
- position: relative;
- height: 86rpx;
- z-index: 1;
- .tops-nav-item{
- width: 160rpx;
- text-align: center;
- color: $fontcolor3;
- }
- .tops-nav-item-active{
- color: $fontcolor5 !important;
- }
- .tops-line{
- width: 24rpx;
- height: 4rpx;
- background: $fontcolor5;
- border-radius: 2rpx;
- position: absolute;
- bottom: 0;
- transition: all 0.3s;
- }
- }
- .swiper{
- height: 396rpx;
- .swiper-item{
- height: 100%;
- .tops{
- position: relative;
- height: 100%;
- flex-direction: column;
-
- .tops-third{
- height: 100%;
- .tt-item{
- position: relative;
- flex-direction: column;
- height: 100%;
- width: 208rpx;
- .tt-item-bg{
- width: 196rpx;
- height: 208rpx;
- background: linear-gradient(180deg, rgba(226,226,226,0.1000) 0%, rgba(226,226,226,0) 100%);
- border-radius: 16rpx 16rpx 0rpx 0rpx;
- position: absolute;
- bottom: 0;
- }
- .tt-item-bg-center{
- width: 196rpx;
- height: 248rpx;
- background: linear-gradient(180deg, rgba(255,236,54,0.1000) 0%, rgba(255,236,54,0) 100%);
- border-radius: 16rpx 16rpx 0rpx 0rpx;
- position: absolute;
- bottom: 0;
- }
- .tt-item-img{
- width: 92rpx;
- height: 40rpx;
- transform: translateY(20rpx);
- position: relative;
- z-index:20;
- }
- .tt-item-img-border{
- width: 196rpx;
- height: 192rpx;
- position: absolute;
- left: 0;
- right: 0;
- margin: auto;
- transform: translateY(-30rpx);
- }
- .tt-item-head-box{
- width: 136rpx;
- height: 136rpx;
- border-radius: 68rpx;
- position: relative;
- z-index: 10;
-
- }
- .tt-item-name{
- width: 136rpx;
- height: 40rpx;
- text-align: center;
- line-height: 40rpx;
- color: $fontcolor5;
- margin-bottom: 16rpx;
- margin-top: 14rpx;
- }
- .tt-item-num-box{
- .tt-item-num-img{
- width: 32rpx;
- height: 32rpx;
- }
- .tt-item-num-text{
- color: $fontcolor5;
- margin-left: 8rpx;
- }
- }
- }
- }
- }
- }
- }
- .list-item{
- flex-wrap: wrap;
- padding: 40rpx 0rpx;
- .list-head-box{
- width: 136rpx;
- height: 136rpx;
- position: relative;
- .list-head-img{
- width: 136rpx;
- height: 136rpx;
- background-color: #ffffff;
- border-radius: 136rpx;
- }
- .list-head-dot{
- width: 24rpx;
- height: 24rpx;
- border-radius: 24rpx;
- position: absolute;
- background-color: aqua;
- bottom: 2rpx;
- right: 2rpx;
- border: 2rpx solid $bgcolor2;
- }
- }
- .list-info-box{
- box-sizing: border-box;
- width: 544rpx;
- padding-left: 32rpx;
- height: 136rpx;
- flex-direction: column;
- display: flex;
- justify-content: flex-start;
- align-items: flex-start;
- .name-box{
- width: 100%;
- .name{
- .name-text{
- color: $fontcolor5;
- }
- .name-img{
- width: 68rpx;
- height: 32rpx;
- margin-left: 8rpx;
-
- }
- .name-img-godness{
- width: 76rpx;
- height: 40rpx;
- margin-left: 8rpx;
- transform: translateY(-5rpx);
- }
- }
- .distance{
- color: $fontcolor3;
- }
- }
- .sex-box{
- padding: 0 15rpx;
- height: 32rpx;
- background: rgba(226, 53, 104, 0.2);
- border-radius: 25rpx;
- margin-top: 12rpx;
- .sex-img{
- width: 24rpx;
- height: 24rpx;
- }
- .sex-text1{
- color:#E23568;
- margin-left: 4rpx;
- }
- .sex-text2{
- color:#6C52F4;
- margin-left: 4rpx;
- }
- }
- .tip-box{
- color: $fontcolor3;
- width: 100%;
- margin-top: 10rpx;
- }
-
- }
- .img-box{
- width: 544rpx;
- height: 168rpx;
- margin-left: 168rpx;
- margin-top: 24rpx;
- .ib1{
- width: 168rpx;
- height: 168rpx;
- border-radius: 16rpx 0rpx 0rpx 16rpx;
- background: $fontcolor5;
- }
- .ib2{
- width: 168rpx;
- height: 168rpx;
- background: $fontcolor5;
- }
- .ib3{
- width: 168rpx;
- height: 168rpx;
- border-radius: 0rpx 16rpx 16rpx 0rpx;
- background: $fontcolor5;
- }
- }
- }
-
-
- }
- }
- </style>
|