friends.vue 48 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502
  1. <template>
  2. <view class="container">
  3. <TabBar :tabIndex="tabIndex"></TabBar>
  4. <uni-popup ref="popup" type="center">
  5. <Popup :content1="popup.content1" :content2="popup.content2" :tip1="popup.tip1" :tip2="popup.tip2"
  6. :btntext="popup.btntext" @closePopup="closePopup" @toLogin="toLogin" :btnEvent="'toLogin'"></Popup>
  7. </uni-popup>
  8. <!-- 头部推荐附近 -->
  9. <view id="topnav" class="topnav flex-start" :style="{ 'height': `${topbarOffsetHeight-statusBarHeight}px`, 'padding-top': `${statusBarHeight}px` }">
  10. <view class="nav-item" v-for="(item, index) in navs" :key="index" :style="{
  11. 'font-size': `${navIndex === index ? '40rpx' : '32rpx'}`,
  12. 'color': `${navIndex === index ? '#ffffff' : ''}`,
  13. 'font-weight': `${navIndex === index ? '#ffffff' : ''}`
  14. }" @click="navClick(index)">
  15. <view class="nav-item-text fw700">{{ item }}</view>
  16. </view>
  17. <image :src="`${assetsUrl}friends-searchicon.png`" mode="aspectFit" class="nav-search" @click="toSearch"></image>
  18. <image :src="`${assetsUrl}friends-circle.png`" mode="aspectFit" class="nav-item-bg"
  19. :style="{ 'left': `${navIndex * 158}rpx` }"></image>
  20. </view>
  21. <swiper class="outer-swiper" :current="navIndex" :style="{ 'height': `${topbarOffsetHeight}px` }"
  22. @change="outerSwiperChange">
  23. <swiper-item class="outer-swiper-item">
  24. <scroll-view class="scroll-view" v-if="scrollHeight > 0" scroll-y="true" lower-threshold="200"
  25. :style="{ 'height': `${scrollHeight}px` }" refresher-enabled="true" :refresher-triggered="recommendTriggered"
  26. :refresher-threshold="45" refresher-default-style="white" refresher-background="#151126"
  27. @refresherrefresh="recommendRefresh" @refresherpulling="recommendPulling" @refresherrestore="recommendRestore"
  28. @refresherabort="recommendAbort" @scrolltolower="recommendToBottom" show-scrollbar="false">
  29. <view slot="refresher" class="refresh-container"
  30. style="display: block; width: 100%; height: 80px; background: blue; display: flex; align-items: center;">
  31. <view class="view1" style="position: absolute; text-align: center; width: 100%;">
  32. 下拉刷新
  33. </view>
  34. </view>
  35. <image :src="`${assetsUrl}friends-bg.png`" mode="widthFix" class="tops-bg" v-if="recommendTopsM.length > 0">
  36. </image>
  37. <view class="tops-nav flex-center" v-if="recommendTopsM.length > 0">
  38. <view class="tops-nav-item" :class="topsIndex === index ? 'font32 fw600 tops-nav-item-active' : ''"
  39. v-for="(item, index) in tops" :key="index" @click="topsNavClick(index)">
  40. {{ item }}
  41. </view>
  42. <view class="tops-line" :style="{ 'left': `${topsIndex * 160 + 250}rpx` }"></view>
  43. </view>
  44. <swiper :current="topsIndex" class="swiper" @change="swiperChange" v-if="recommendTopsM.length > 0">
  45. <swiper-item class="swiper-item">
  46. <view class="tops flex-between">
  47. <view class="tops-third flex-center">
  48. <view class="tt-item flex-center" @click="toDetail(recommendTopsM[1].userId)">
  49. <view class="tt-item-bg"></view>
  50. <image :src="`${assetsUrl}friends-2.png`" mode="aspectFill" class="tt-item-img"></image>
  51. <image :src="recommendTopsM[1].icon" class="tt-item-head-box" style="border: 2rpx solid #E2E2E2;">
  52. </image>
  53. <view class="tt-item-name font28 fw600 el">
  54. {{ recommendTopsM[1].nick }}
  55. </view>
  56. <view class="tt-item-num-box flex-center">
  57. <image :src="`${assetsUrl}friends-heart.png`" mode="aspectFill" class="tt-item-num-img"></image>
  58. <view class="tt-item-num-text font22 fw600">
  59. {{ recommendTopsM[1].val }}
  60. </view>
  61. </view>
  62. </view>
  63. <view class="tt-item flex-center" style="margin: 0rpx 16rpx;"
  64. @click="toDetail(recommendTopsM[0].userId)">
  65. <view class="tt-item-bg-center" style="width: 228rpx;"></view>
  66. <image :src="`${assetsUrl}friends-1.png`" mode="aspectFill" class="tt-item-img"
  67. style="transform: translateY(0rpx);"></image>
  68. <image :src="`${assetsUrl}friends-1-bling.png`" mode="aspectFill" class="tt-item-img-border"
  69. style="transform: translateY(-60rpx);"></image>
  70. <image :src="recommendTopsM[0].icon" class="tt-item-head-box"
  71. style="border: 2rpx solid #FFEC36;transform: translateY(-18rpx);"></image>
  72. <view class="tt-item-name font28 fw600 el">
  73. {{ recommendTopsM[0].nick }}
  74. </view>
  75. <view class="tt-item-num-box flex-center">
  76. <image :src="`${assetsUrl}friends-heart.png`" mode="aspectFill" class="tt-item-num-img"></image>
  77. <view class="tt-item-num-text font22 fw600">
  78. {{ recommendTopsM[0].val }}
  79. </view>
  80. </view>
  81. </view>
  82. <view class="tt-item flex-center" @click="toDetail(recommendTopsM[2].userId)">
  83. <view class="tt-item-bg"></view>
  84. <image :src="`${assetsUrl}friends-3.png`" mode="aspectFill" class="tt-item-img"></image>
  85. <image :src="recommendTopsM[2].icon" class="tt-item-head-box" style="border: 2rpx solid #E19865;">
  86. </image>
  87. <view class="tt-item-name font28 fw600 el">
  88. {{ recommendTopsM[2].nick }}
  89. </view>
  90. <view class="tt-item-num-box flex-center">
  91. <image :src="`${assetsUrl}friends-heart.png`" mode="aspectFill" class="tt-item-num-img"></image>
  92. <view class="tt-item-num-text font22 fw600">
  93. {{ recommendTopsM[2].val }}
  94. </view>
  95. </view>
  96. </view>
  97. </view>
  98. </view>
  99. </swiper-item>
  100. <swiper-item class="swiper-item">
  101. <view class="tops flex-between">
  102. <view class="tops-third flex-center">
  103. <view class="tt-item flex-center" @click="toDetail(recommendTopsH[1].userId)">
  104. <view class="tt-item-bg"></view>
  105. <image :src="`${assetsUrl}friends-2.png`" mode="aspectFill" class="tt-item-img"></image>
  106. <image :src="recommendTopsH[1].icon" class="tt-item-head-box" style="border: 2rpx solid #E2E2E2;">
  107. </image>
  108. <view class="tt-item-name font28 fw600 el">
  109. {{ recommendTopsH[1].nick }}
  110. </view>
  111. <view class="tt-item-num-box flex-center">
  112. <image :src="`${assetsUrl}friends-sugar.png`" mode="aspectFill" class="tt-item-num-img"></image>
  113. <view class="tt-item-num-text font22 fw600">
  114. {{ recommendTopsH[1].val }}
  115. </view>
  116. </view>
  117. </view>
  118. <view class="tt-item flex-center" style="margin: 0rpx 16rpx;"
  119. @click="toDetail(recommendTopsH[0].userId)">
  120. <view class="tt-item-bg-center" style="width: 228rpx;"></view>
  121. <image :src="`${assetsUrl}friends-1.png`" mode="aspectFill" class="tt-item-img"
  122. style="transform: translateY(-5rpx);"></image>
  123. <image :src="`${assetsUrl}friends-1-bling.png`" mode="aspectFill" class="tt-item-img-border"
  124. style="transform: translateY(-60rpx);"></image>
  125. <image :src="recommendTopsH[0].icon" class="tt-item-head-box"
  126. style="border: 2rpx solid #FFEC36;transform: translateY(-18rpx);"></image>
  127. <view class="tt-item-name font28 fw600 el">
  128. {{ recommendTopsH[0].nick }}
  129. </view>
  130. <view class="tt-item-num-box flex-center">
  131. <image :src="`${assetsUrl}friends-sugar.png`" mode="aspectFill" class="tt-item-num-img"></image>
  132. <view class="tt-item-num-text font22 fw600">
  133. {{ recommendTopsH[0].val }}
  134. </view>
  135. </view>
  136. </view>
  137. <view class="tt-item flex-center" @click="toDetail(recommendTopsH[2].userId)">
  138. <view class="tt-item-bg"></view>
  139. <image :src="`${assetsUrl}friends-3.png`" mode="aspectFill" class="tt-item-img"></image>
  140. <image :src="recommendTopsH[2].icon" class="tt-item-head-box" style="border: 2rpx solid #E19865;">
  141. </image>
  142. <view class="tt-item-name font28 fw600 el">
  143. {{ recommendTopsH[2].nick }}
  144. </view>
  145. <view class="tt-item-num-box flex-center">
  146. <image :src="`${assetsUrl}friends-sugar.png`" mode="aspectFill" class="tt-item-num-img"></image>
  147. <view class="tt-item-num-text font22 fw600">
  148. {{ recommendTopsH[2].val }}
  149. </view>
  150. </view>
  151. </view>
  152. </view>
  153. </view>
  154. </swiper-item>
  155. </swiper>
  156. <!-- <view class="location flex-between" @click="computedLocation" v-if="showGetLocation">
  157. <image :src="`${assetsUrl}friends-pos.png`" mode="aspectFill" class="l-pos"></image>
  158. <text class="l-text font24 fw400">点此开启位置权限,获得更精准推荐!</text>
  159. <view class="l-open font24 fw400">开启</view>
  160. </view> -->
  161. <view class="list-item flex-start" v-for="(item, index) in recommendList" :key="index"
  162. @click="toDetail(item.id)">
  163. <view class="list-head-box">
  164. <image :src="item.iconThumbnail" mode="aspectFill" class="list-head-img"></image>
  165. <view class="list-head-dot" style="background-color: #38E825;" v-if="item.lastActiveTime <= 30"></view>
  166. <view class="list-head-dot" style="background-color: #0ABDEF;"
  167. v-else-if="item.lastActiveTime > 30 && item.lastActiveTime <= 1440"></view>
  168. </view>
  169. <view class="list-info-box">
  170. <view class="name-box flex-between">
  171. <view class="name flex-start">
  172. <view class="name-text font28 fw600">
  173. {{ item.nick }}
  174. </view>
  175. <image :src="`${assetsUrl}friends-vip.png`" mode="aspectFill" class="name-img" v-if="item.vip"></image>
  176. <image :src="`${assetsUrl}friends-godness.png`" mode="aspectFill" class="name-img-godness"
  177. v-if="item.goddess"></image>
  178. <image :src="`${assetsUrl}friends-real.png`" mode="aspectFill" class="name-img"
  179. v-else-if="item.realMan"></image>
  180. </view>
  181. <view class="distance font22 fw400" v-if="item.distance && item.distance !== 'NaNm'">
  182. {{ item.distance }}
  183. </view>
  184. </view>
  185. <view class="sex-box flex-center"
  186. :style="{ 'background-color': `${item.sex === 'Male' ? 'rgba(108,82,244,0.21)' : ''}` }">
  187. <image :src="`${assetsUrl}friends-female.png`" mode="aspectFill" class="sex-img"
  188. v-if="item.sex === 'Famale'"></image>
  189. <image :src="`${assetsUrl}friends-male.png`" mode="aspectFill" class="sex-img" v-if="item.sex === 'Male'">
  190. </image>
  191. <view class="el font20 fw500 sex-text1" v-if="item.sex === 'Famale'">
  192. {{ item.ageInfo.age }}
  193. </view>
  194. <view class="el font20 fw500 sex-text2" v-if="item.sex === 'Male'">
  195. {{ item.ageInfo.age }}
  196. </view>
  197. </view>
  198. <view class="tip-box font28 fw400 el" v-if="item.desc">
  199. 签名:{{ item.desc }}
  200. </view>
  201. <view class="tip-box font28 fw400 el" v-else>
  202. 签名:暂无介绍
  203. </view>
  204. </view>
  205. <view class="img-box flex-between" v-if="item.lastNews">
  206. <image :src="item.lastNews.mediaUrls[0]" mode="aspectFill" class="ib1"></image>
  207. <image :src="item.lastNews.mediaUrls[1]" mode="aspectFill" class="ib2"></image>
  208. <image :src="item.lastNews.mediaUrls[2]" mode="aspectFill" class="ib3"></image>
  209. </view>
  210. </view>
  211. <!-- <view class="no-more font24 fw400" v-if="recommendList.length !== 0 && recommendList.length >= recommendTotal">没有更多了
  212. </view> -->
  213. </scroll-view>
  214. </swiper-item>
  215. <swiper-item class="outer-swiper-item">
  216. <scroll-view class="scroll-view" v-if="scrollHeight > 0" scroll-y="true" lower-threshold="200"
  217. :style="{ 'height': `${scrollHeight}px` }" refresher-enabled="true" :refresher-triggered="nearTriggered"
  218. :refresher-threshold="45" refresher-default-style="white" refresher-background="#151126"
  219. @refresherrefresh="nearRefresh" @refresherpulling="nearPulling" @refresherrestore="nearRestore"
  220. @refresherabort="nearAbort" @scrolltolower="nearToBottom" :show-scrollbar="false">
  221. <image :src="`${assetsUrl}friends-bg.png`" mode="widthFix" class="tops-bg" v-if="!showGetLocation"></image>
  222. <view class="tops-nav flex-center" v-if="!showGetLocation">
  223. <view class="tops-nav-item" :class="topsIndex === index ? 'font32 fw600 tops-nav-item-active' : ''"
  224. v-for="(item, index) in tops" :key="index" @click="topsNavClick(index)">
  225. {{ item }}
  226. </view>
  227. <view class="tops-line" :style="{ 'left': `${topsIndex * 160 + 250}rpx` }"></view>
  228. </view>
  229. <swiper :current="topsIndex" class="swiper" @change="swiperChange" v-if="!showGetLocation">
  230. <swiper-item class="swiper-item">
  231. <view class="tops flex-between">
  232. <view class="tops-third flex-center">
  233. <view class="tt-item flex-center" @click="toDetail(nearTopsM[1].userId)">
  234. <view class="tt-item-bg"></view>
  235. <image :src="`${assetsUrl}friends-2.png`" mode="aspectFill" class="tt-item-img"></image>
  236. <image :src="nearTopsM[1].icon" class="tt-item-head-box" style="border: 2rpx solid #E2E2E2;"></image>
  237. <view class="tt-item-name font28 fw600 el">
  238. {{ nearTopsM[1].nick }}
  239. </view>
  240. <view class="tt-item-num-box flex-center">
  241. <image :src="`${assetsUrl}friends-heart.png`" mode="aspectFill" class="tt-item-num-img"></image>
  242. <view class="tt-item-num-text font22 fw600">
  243. {{ nearTopsM[1].val }}
  244. </view>
  245. </view>
  246. </view>
  247. <view class="tt-item flex-center" style="margin: 0rpx 16rpx;" @click="toDetail(nearTopsM[0].userId)">
  248. <view class="tt-item-bg-center" style="width: 228rpx;"></view>
  249. <image :src="`${assetsUrl}friends-1.png`" mode="aspectFill" class="tt-item-img"
  250. style="transform: translateY(-5rpx);"></image>
  251. <image :src="`${assetsUrl}friends-1-bling.png`" mode="aspectFill" class="tt-item-img-border"
  252. style="transform: translateY(-60rpx);"></image>
  253. <image :src="nearTopsM[0].icon" class="tt-item-head-box"
  254. style="border: 2rpx solid #FFEC36;transform: translateY(-18rpx);"></image>
  255. <view class="tt-item-name font28 fw600 el">
  256. {{ nearTopsM[0].nick }}
  257. </view>
  258. <view class="tt-item-num-box flex-center">
  259. <image :src="`${assetsUrl}friends-heart.png`" mode="aspectFill" class="tt-item-num-img"></image>
  260. <view class="tt-item-num-text font22 fw600">
  261. {{ nearTopsM[0].val }}
  262. </view>
  263. </view>
  264. </view>
  265. <view class="tt-item flex-center" @click="toDetail(nearTopsM[2].userId)">
  266. <view class="tt-item-bg"></view>
  267. <image :src="`${assetsUrl}friends-3.png`" mode="aspectFill" class="tt-item-img"></image>
  268. <image :src="nearTopsM[2].icon" class="tt-item-head-box" style="border: 2rpx solid #E19865;"></image>
  269. <view class="tt-item-name font28 fw600 el">
  270. {{ nearTopsM[2].nick }}
  271. </view>
  272. <view class="tt-item-num-box flex-center">
  273. <image :src="`${assetsUrl}friends-heart.png`" mode="aspectFill" class="tt-item-num-img"></image>
  274. <view class="tt-item-num-text font22 fw600">
  275. {{ nearTopsM[2].val }}
  276. </view>
  277. </view>
  278. </view>
  279. </view>
  280. </view>
  281. </swiper-item>
  282. <swiper-item class="swiper-item">
  283. <view class="tops flex-between">
  284. <view class="tops-third flex-center">
  285. <view class="tt-item flex-center" @click="toDetail(nearTopsH[1].userId)">
  286. <view class="tt-item-bg"></view>
  287. <image :src="`${assetsUrl}friends-2.png`" mode="aspectFill" class="tt-item-img"></image>
  288. <image :src="nearTopsH[1].icon" class="tt-item-head-box" style="border: 2rpx solid #E2E2E2;"></image>
  289. <view class="tt-item-name font28 fw600 el">
  290. {{ nearTopsH[1].nick }}
  291. </view>
  292. <view class="tt-item-num-box flex-center">
  293. <image :src="`${assetsUrl}friends-sugar.png`" mode="aspectFill" class="tt-item-num-img"></image>
  294. <view class="tt-item-num-text font22 fw600">
  295. {{ nearTopsH[1].val }}
  296. </view>
  297. </view>
  298. </view>
  299. <view class="tt-item flex-center" style="margin: 0rpx 16rpx;" @click="toDetail(nearTopsH[0].userId)">
  300. <view class="tt-item-bg-center" style="width: 228rpx;"></view>
  301. <image :src="`${assetsUrl}friends-1.png`" mode="aspectFill" class="tt-item-img"
  302. style="transform: translateY(-5rpx);"></image>
  303. <image :src="`${assetsUrl}friends-1-bling.png`" mode="aspectFill" class="tt-item-img-border"
  304. style="transform: translateY(-60rpx);"></image>
  305. <image :src="nearTopsH[0].icon" class="tt-item-head-box"
  306. style="border: 2rpx solid #FFEC36;transform: translateY(-18rpx);"></image>
  307. <view class="tt-item-name font28 fw600 el">
  308. {{ nearTopsH[0].nick }}
  309. </view>
  310. <view class="tt-item-num-box flex-center">
  311. <image :src="`${assetsUrl}friends-sugar.png`" mode="aspectFill" class="tt-item-num-img"></image>
  312. <view class="tt-item-num-text font22 fw600">
  313. {{ nearTopsH[0].val }}
  314. </view>
  315. </view>
  316. </view>
  317. <view class="tt-item flex-center" @click="toDetail(nearTopsH[2].userId)">
  318. <view class="tt-item-bg"></view>
  319. <image :src="`${assetsUrl}friends-3.png`" mode="aspectFill" class="tt-item-img"></image>
  320. <image :src="nearTopsH[2].icon" class="tt-item-head-box" style="border: 2rpx solid #E19865;"></image>
  321. <view class="tt-item-name font28 fw600 el">
  322. {{ nearTopsH[2].nick }}
  323. </view>
  324. <view class="tt-item-num-box flex-center">
  325. <image :src="`${assetsUrl}friends-sugar.png`" mode="aspectFill" class="tt-item-num-img"></image>
  326. <view class="tt-item-num-text font22 fw600">
  327. {{ nearTopsH[2].val }}
  328. </view>
  329. </view>
  330. </view>
  331. </view>
  332. </view>
  333. </swiper-item>
  334. </swiper>
  335. <view class="list-item flex-start" v-for="(item, index) in nearList" :key="index" @click="toDetail(item.id)">
  336. <view class="list-head-box">
  337. <image :src="item.iconThumbnail" mode="aspectFill" class="list-head-img"></image>
  338. <view class="list-head-dot" style="background-color: #38E825;" v-if="item.lastActiveTime <= 30"></view>
  339. <view class="list-head-dot" style="background-color: #0ABDEF;"
  340. v-else-if="item.lastActiveTime > 30 && item.lastActiveTime <= 1440"></view>
  341. </view>
  342. <view class="list-info-box">
  343. <view class="name-box flex-between">
  344. <view class="name flex-start">
  345. <view class="name-text font28 fw600">
  346. {{ item.nick }}
  347. </view>
  348. <image :src="`${assetsUrl}friends-vip.png`" mode="aspectFill" class="name-img" v-if="item.vip"></image>
  349. <image :src="`${assetsUrl}friends-godness.png`" mode="aspectFill" class="name-img-godness"
  350. v-if="item.goddess"></image>
  351. <image :src="`${assetsUrl}friends-real.png`" mode="aspectFill" class="name-img"
  352. v-else-if="item.realMan"></image>
  353. </view>
  354. <view class="distance font22 fw400" v-if="item.distance && item.distance !== 'NaNm'">
  355. {{ item.distance }}
  356. </view>
  357. </view>
  358. <view class="sex-box flex-center"
  359. :style="{ 'background-color': `${item.sex === 'Male' ? 'rgba(108,82,244,0.21)' : ''}` }">
  360. <image :src="`${assetsUrl}friends-female.png`" mode="aspectFill" class="sex-img"
  361. v-if="item.sex === 'Famale'"></image>
  362. <image :src="`${assetsUrl}friends-male.png`" mode="aspectFill" class="sex-img" v-if="item.sex === 'Male'">
  363. </image>
  364. <view class="el font20 fw500 sex-text1" v-if="item.sex === 'Famale'">
  365. {{ item.ageInfo.age }}
  366. </view>
  367. <view class="el font20 fw500 sex-text2" v-if="item.sex === 'Male'">
  368. {{ item.ageInfo.age }}
  369. </view>
  370. </view>
  371. <view class="tip-box font28 fw400 el" v-if="item.desc">
  372. 签名:{{ item.desc }}
  373. </view>
  374. <view class="tip-box font28 fw400 el" v-else>
  375. 签名:暂无介绍
  376. </view>
  377. </view>
  378. <view class="img-box flex-between" v-if="item.lastNews">
  379. <image :src="item.lastNews.mediaUrls[0]" mode="aspectFill" class="ib1"></image>
  380. <image :src="item.lastNews.mediaUrls[1]" mode="aspectFill" class="ib2"></image>
  381. <image :src="item.lastNews.mediaUrls[2]" mode="aspectFill" class="ib3"></image>
  382. </view>
  383. </view>
  384. <view class="no-more font24 fw400" v-if="nearList.length !== 0 && nearList.length >= nearTotal">没有更多了</view>
  385. <!-- <Status :type="statusType" :btnText="statusBtnText" :text="statusText" @btnEvent="computedLocation" v-if="showGetLocation"></Status> -->
  386. <Status type="noData" text="暂无数据" v-if="showNoData"></Status>
  387. </scroll-view>
  388. </swiper-item>
  389. </swiper>
  390. </view>
  391. </template>
  392. <script>
  393. import TabBar from '@/components/TabBar/TabBar.vue';
  394. import Status from '@/components/Status/Status.vue';
  395. import wxMap from '@/static/qqmap-wx-jssdk1.2/qqmap-wx-jssdk.min.js';
  396. import TIM from 'tim-wx-sdk';
  397. import Popup from '@/components/Popup/Popup.vue';
  398. // import COS from 'cos-wx-sdk-v5';
  399. import TIMUploadPlugin from 'tim-upload-plugin';
  400. // 腾讯位置服务,手机账号:18996226740
  401. const wxMapSdk = new wxMap({ key: 'E5SBZ-T2YC3-CBL3F-YGFQQ-26PP2-ERFII' });
  402. import { get } from '@/util/index.js'
  403. export default {
  404. components: {
  405. TabBar, Status, Popup
  406. },
  407. data() {
  408. return {
  409. statusType: 'noPos',
  410. statusBtnText: '开启定位',
  411. statusText: '开启定位后才能帮你找到身边的TA哦',
  412. assetsUrl: this.$util.assetsUrl,
  413. tabIndex: 0,
  414. navs: ['推荐', '附近'],
  415. navIndex: 0,
  416. tops: ['魅力榜', '壕气榜'],
  417. topsIndex: 0,
  418. scrollHeight: 0,
  419. rankingOptions: {
  420. city: '',
  421. cityCode: '',
  422. number: 3,
  423. type: 'M'
  424. },
  425. popup: {
  426. content1: '',
  427. content2: '',
  428. tip1: '',
  429. tip2: '',
  430. btntext: ''
  431. },
  432. recommendListOptions: {
  433. filterIds: [],
  434. page: {
  435. index: 1,
  436. size: 20,
  437. sortValues: []
  438. },
  439. queryPre: {
  440. city: '',
  441. cityCode: '',
  442. femaleGoddess: false,
  443. femaleNew: false,
  444. geo: {
  445. lat: 0,
  446. lon: 0
  447. },
  448. maleNew: false,
  449. maleVip: false
  450. },
  451. showList: true,
  452. type: {}
  453. },
  454. nearListOptions: {
  455. filterIds: [],
  456. page: {
  457. index: 1,
  458. size: 20,
  459. sortValues: []
  460. },
  461. queryPre: {
  462. city: '',
  463. cityCode: '',
  464. femaleGoddess: false,
  465. femaleNew: false,
  466. geo: {
  467. lat: 0,
  468. lon: 0
  469. },
  470. maleNew: false,
  471. maleVip: false
  472. },
  473. showList: true,
  474. type: {}
  475. },
  476. showGetLocation: false,
  477. showNoData: false,
  478. latitude: 0,
  479. longitude: 0,
  480. locationCity: '',
  481. locationCityCode: '',
  482. recommendTopsM: [],
  483. recommendTopsH: [],
  484. recommendList: [],
  485. recommendTotal: 0,
  486. recommendRefreshing: false,
  487. recommendTriggered: true,
  488. nearTopsM: [],
  489. nearTopsH: [],
  490. nearList: [],
  491. nearTotal: 0,
  492. nearRefreshing: false,
  493. nearTriggered: true,
  494. otherInfo: null
  495. };
  496. },
  497. computed: {
  498. statusBarHeight() {
  499. return this.$store.state.statusBarHeight || 20;
  500. },
  501. topbarOffsetHeight() {
  502. return this.$store.state.topbarOffsetHeight || 40;
  503. },
  504. userInfo() {
  505. return this.$store.state.userInfo || {};
  506. }
  507. },
  508. onLoad(options) {
  509. console.log('options', options)
  510. // if(options.invite){
  511. // uni.setStorageSync('invited',options.invite);
  512. // }
  513. // uni.showLoading({
  514. // mask:true,
  515. // title:'加载中1'
  516. // })
  517. // this.$api.public.aliossCdn({}).then(cdnRes=>{
  518. // console.log('cdnRes',cdnRes)
  519. // this.$store.commit('setImageCdn',cdnRes.data.pictureCdn);
  520. // this.$store.commit('setVideoCdn',cdnRes.data.videoCdn);
  521. // uni.setStorageSync('imageCdn',cdnRes.data.pictureCdn);
  522. // uni.setStorageSync('videoCdn',cdnRes.data.videoCdn);
  523. // }).catch((error)=>{
  524. // console.log('error---aliossCdn',error)
  525. // });
  526. console.log('----onLoad---')
  527. this.login();
  528. // this.computedScollviewHeight();
  529. // this.getNearTopsMData();
  530. // this.getNearTopsHData();
  531. // this.getRecommendTopsMData();
  532. // this.getRecommendTopsHData();
  533. // this.getNearList();
  534. // this.getRecommendList();
  535. this.showGetLocation = false;
  536. },
  537. created(){
  538. this.$nextTick(() => {
  539. this.computedScollviewHeight();
  540. this.getNearTopsMData();
  541. this.getNearTopsHData();
  542. this.getRecommendTopsMData();
  543. this.getRecommendTopsHData();
  544. this.getNearList();
  545. this.getRecommendList();
  546. })
  547. // this.computedScollviewHeight();
  548. // this.getNearTopsMData();
  549. // this.getNearTopsHData();
  550. // this.getRecommendTopsMData();
  551. // this.getRecommendTopsHData();
  552. },
  553. onShow() {
  554. if (uni.getStorageSync('needFreshList') === '1') {
  555. this.recommendRefresh();
  556. this.nearRefresh();
  557. uni.setStorageSync('needFreshList', '0');
  558. }
  559. },
  560. // #ifdef MP
  561. onShareAppMessage() {
  562. return {
  563. title: '糖果公园',
  564. path: `/pages/login/login?share=${this.userInfo.inviteCode}`,
  565. }
  566. },
  567. // #endif
  568. methods: {
  569. getMineData(z = {}) {
  570. let user = uni.getStorageSync('user');
  571. console.log('user', user)
  572. // let user=JSON.parse(uni.getStorageSync('user'));
  573. this.$api.public.mineDetail({
  574. getAlbum: true,
  575. completeUser: z
  576. }).then(res => {
  577. console.log('res---mineDetail', res)
  578. this.$store.commit('setUserInfo', res.data);
  579. uni.setStorageSync('userInfo', JSON.stringify(res.data));
  580. if (!res.data.regDone) {
  581. uni.reLaunch({
  582. url: '/pages/info/sex'
  583. })
  584. return;
  585. }
  586. }).catch((error) => {
  587. console.log('error---mineDetail', error)
  588. });
  589. },
  590. login() {
  591. const that = this;
  592. // if(uni.getStorageSync('isLogin')==='yes'){
  593. // console.log('uni.getStorageSync(isLogin)',uni.getStorageSync('isLogin'))
  594. // this.getMineData();
  595. // this.computedLocation();
  596. // return;
  597. // }
  598. this.$api.login.wxLogin({
  599. scene: "VerCodeLogin",
  600. verCodeLogin: {
  601. phone: '18086848344',
  602. verCode: '230414'
  603. }
  604. }).then(result => {
  605. console.log('result--------', result)
  606. if (result.status === 'Succ') {
  607. console.log('进来了--------')
  608. uni.setStorageSync('openId', result.data.wxLoginInfo.openId);
  609. uni.setStorageSync('unionId', result.data.wxLoginInfo.unionId);
  610. // this.computedLocation();
  611. // this.getRecommendTopsMData();
  612. // this.getRecommendTopsHData();
  613. uni.setStorageSync('LL_Ukn', result.data.wxLoginInfo.unionId);
  614. uni.setStorageSync('LL_Okn', result.data.wxLoginInfo.openId);
  615. uni.setStorageSync('LL_Tkn', result.data.wxLoginInfo.token);
  616. uni.setStorageSync('isLogin', 'yes');
  617. // uni.setStorageSync('LL_Csi',JSON.stringify({
  618. // "id":result.data.userToken.user.id,
  619. // "phone":result.data.userToken.user.phone,
  620. // "nick":result.data.userToken.user.nick,
  621. // "sex":result.data.userToken.user.sex
  622. // }));
  623. // this.getMineData(result.data.userToken.user);
  624. } else {
  625. uni.showToast({
  626. title: result.message,
  627. icon: 'none'
  628. })
  629. }
  630. }).catch((error) => {
  631. console.log('error---wxLogin', error)
  632. });
  633. // uni.login({//免密登录
  634. // success:(res)=>{
  635. // that.$api.login.wxLogin({
  636. // scene: "WxMPLogin",
  637. // miniProgramEncryUserInfoParam:{
  638. // jsCode:res.code
  639. // }
  640. // }).then(result=>{
  641. // console.log('result',result)
  642. // if(result.status==='Succ'){
  643. // uni.setStorageSync('openId',result.data.wxLoginInfo.openId);
  644. // uni.setStorageSync('unionId',result.data.wxLoginInfo.unionId);
  645. // this.computedLocation();
  646. // this.getRecommendTopsMData();
  647. // this.getRecommendTopsHData();
  648. // uni.setStorageSync('LL_Ukn',result.data.userToken.ukn);
  649. // uni.setStorageSync('token',result.data.userToken.token);
  650. // uni.setStorageSync('userInfo',JSON.stringify(result.data));
  651. // uni.setStorageSync('user',JSON.stringify(result.data.userToken.user));
  652. // uni.setStorageSync('isLogin','yes');
  653. // this.$api.public.aliossCdn({}).then(cdnRes=>{
  654. // this.$store.commit('setImageCdn',cdnRes.data.pictureCdn);
  655. // this.$store.commit('setVideoCdn',cdnRes.data.videoCdn);
  656. // })
  657. // }
  658. // }).catch((error)=>{
  659. // console.log('uni.login',error)
  660. // })
  661. // },
  662. // fail: (err) => {
  663. // console.log('免密登录11',err)
  664. // }
  665. // });
  666. },
  667. closePopup() {
  668. this.$refs.popup.close();
  669. },
  670. imInit() {
  671. /**
  672. * IM初始化
  673. */
  674. // if(uni.$TUIKit){
  675. // uni.$TUIKit.logout();
  676. // }
  677. const SDKAppID = this.$util.IMSDKCode, that = this;
  678. uni.$TUIKit = TIM.create({
  679. SDKAppID: SDKAppID
  680. });
  681. uni.$TUIKitTIM = TIM;
  682. uni.$TUIKitEvent = TIM.EVENT;
  683. uni.$TUIKitVersion = TIM.VERSION;
  684. uni.$TUIKitTypes = TIM.TYPES; // 监听系统级事件
  685. uni.$TUIKit.on(uni.$TUIKitEvent.SDK_READY, this.onSDKReady);
  686. uni.$TUIKit.on(uni.$TUIKitEvent.SDK_NOT_READY, this.onSdkNotReady);
  687. uni.$TUIKit.on(uni.$TUIKitEvent.KICKED_OUT, this.onKickedOut);
  688. uni.$TUIKit.on(uni.$TUIKitEvent.ERROR, this.onTIMError);
  689. uni.$TUIKit.on(uni.$TUIKitEvent.NET_STATE_CHANGE, this.onNetStateChange);
  690. uni.$TUIKit.on(uni.$TUIKitEvent.SDK_RELOAD, this.onSDKReload);
  691. uni.$resetLoginData = this.resetLoginData();
  692. uni.$TUIKit.registerPlugin({ 'tim-upload-plugin': TIMUploadPlugin });
  693. },
  694. resetLoginData() {
  695. if (!uni.getStorageSync('userInfo')) {
  696. return;
  697. }
  698. let user = JSON.parse(uni.getStorageSync('userInfo'));
  699. this.$api.IM.loadSig({}).then(res => {
  700. this.$store.commit('setImLoadSig', res.data.sig);
  701. uni.$TUIKit.login({
  702. userID: String(user.id),
  703. userSig: this.$store.state.IMloadSig
  704. })
  705. }).catch((err) => {
  706. console.log('IM.loadSig', err)
  707. })
  708. },
  709. onTIMError(error) {
  710. },
  711. onSDKReady({ name }) {
  712. const isSDKReady = name === uni.$TUIKitEvent.SDK_READY ? true : false;
  713. if (isSDKReady) {
  714. uni.$emit('isSDKReady', {
  715. isSDKReady: true
  716. });
  717. uni.hideLoading();
  718. }
  719. },
  720. onNetStateChange() { },
  721. onSDKReload() { },
  722. onSdkNotReady() { },
  723. onKickedOut() {
  724. uni.showToast({
  725. title: '您被踢下线',
  726. icon: 'error'
  727. });
  728. uni.reLaunch({
  729. url: '/pages/login/login'
  730. })
  731. },
  732. /**
  733. * 推荐下拉刷新、加载更多
  734. */
  735. recommendRefresh() {
  736. if (!uni.getStorageSync('token')) {
  737. setTimeout(() => {
  738. this.recommendTriggered = false;
  739. this.recommendRefreshing = false;
  740. }, 1000)
  741. return;
  742. }
  743. if (this.recommendRefreshing) {
  744. return;
  745. }
  746. this.recommendRefreshing = true;
  747. setTimeout(() => {
  748. this.recommendTriggered = false;
  749. this.recommendRefreshing = false;
  750. }, 1000)
  751. this.recommendListOptions.page = {
  752. index: 1,
  753. size: 20,
  754. sortValues: []
  755. }
  756. this.getRecommendTopsMData();
  757. this.getRecommendTopsHData();
  758. // this.getRecommendList();
  759. },
  760. recommendPulling(e) { },
  761. recommendRestore() { this.recommendTriggered = true; },
  762. recommendAbort() { },
  763. recommendToBottom() {
  764. if (!uni.getStorageSync('token')) { return; }
  765. if (this.recommendList.length >= this.recommendTotal) { return; }
  766. this.recommendListOptions.page.index++;
  767. // this.getRecommendList();
  768. },
  769. /**
  770. * 附近下拉刷新、加载更多
  771. */
  772. nearRefresh() {
  773. console.log('----附近下拉刷新、加载更多')
  774. if (this.nearRefreshing) {
  775. return;
  776. }
  777. this.nearRefreshing = true;
  778. setTimeout(() => {
  779. this.nearTriggered = false;
  780. this.nearRefreshing = false;
  781. }, 1000)
  782. this.nearListOptions.page = {
  783. index: 1,
  784. size: 20,
  785. sortValues: []
  786. }
  787. this.getNearTopsMData();
  788. this.getNearTopsHData();
  789. // this.getNearList();
  790. },
  791. nearPulling(e) { },
  792. nearRestore() { this.nearTriggered = true; },
  793. nearAbort() { },
  794. nearToBottom() {
  795. if (this.nearList.length >= this.nearTotal) { return; }
  796. this.nearListOptions.page.index++;
  797. // this.getNearList();
  798. },
  799. /**
  800. * 计算scroll高度
  801. */
  802. computedScollviewHeight() {
  803. this.scrollHeight = uni.getSystemInfoSync().windowHeight - this.$store.state.tabbarHeight;
  804. console.log(this.scrollHeight)
  805. // let query = uni.createSelectorQuery().in(this);
  806. // let heightLeaf = this.$store.state.tabbarHeight/2;
  807. // query.select('#topnav').boundingClientRect(data => {
  808. // heightLeaf += data.height;
  809. // }).exec(() => {
  810. // let sysInfo = uni.getSystemInfoSync();
  811. // this.scrollHeight = sysInfo.windowHeight - heightLeaf;
  812. // });
  813. },
  814. /**
  815. * 计算列表定位距离
  816. */
  817. computedLocation() {
  818. uni.getFuzzyLocation({
  819. type: 'gcj02',
  820. success: res => {
  821. wxMapSdk.reverseGeocoder({
  822. location: {
  823. latitude: res.latitude,
  824. longitude: res.longitude
  825. },
  826. success: result => {
  827. this.locationCity = result.result.ad_info.city;
  828. this.latitude = result.result.location.lat;
  829. this.longitude = result.result.location.lng;
  830. this.$store.commit('setLatitude', result.result.location.lat);
  831. this.$store.commit('setLongitude', result.result.location.lng);
  832. uni.setStorageSync('latitude', result.result.location.lat);
  833. uni.setStorageSync('longitude', result.result.location.lng);
  834. uni.setStorageSync('city', this.locationCity);
  835. this.locationCityCode = result.result.ad_info.city_code.split(result.result.ad_info.nation_code)[1];
  836. if (!uni.getStorageSync('token')) {
  837. this.getTempRecommendList();
  838. }
  839. else {
  840. this.getNearTopsMData();
  841. this.getNearTopsHData();
  842. this.getRecommendTopsMData();
  843. this.getRecommendTopsHData();
  844. // this.getNearList();
  845. // this.getRecommendList();
  846. this.showGetLocation = false;
  847. setTimeout(() => {
  848. this.imInit();
  849. }, 2000)
  850. }
  851. }
  852. })
  853. },
  854. fail: err => {
  855. this.showGetLocation = true;
  856. uni.showModal({
  857. content: '检测到您没打开地址信息权限,是否去设置打开?',
  858. confirmText: "确认",
  859. cancelText: '取消',
  860. success: res => {
  861. if (res.confirm) {
  862. uni.openSetting({
  863. success: ress => {
  864. if (ress.authSetting) {
  865. this.computedLocation();
  866. }
  867. }
  868. })
  869. }
  870. }
  871. })
  872. }
  873. })
  874. },
  875. toLogin() {
  876. uni.reLaunch({
  877. url: '/pages/login/login'
  878. })
  879. },
  880. navClick(index) {
  881. if (!uni.getStorageSync('token')) {
  882. this.popup = {
  883. content1: '您还未登录',
  884. content2: '该功能登录后才能使用',
  885. tip1: '',
  886. tip2: '',
  887. btntext: '去登录'
  888. }
  889. this.$refs.popup.open();
  890. return;
  891. }
  892. this.rankingOptions.city = (index === 0 ? '' : this.locationCity);
  893. this.rankingOptions.cityCode = (index === 0 ? '' : this.locationCityCode);
  894. this.navIndex = index;
  895. },
  896. toSearch() {
  897. if (!uni.getStorageSync('token')) {
  898. this.popup = {
  899. content1: '您还未登录',
  900. content2: '该功能登录后才能使用',
  901. tip1: '',
  902. tip2: '',
  903. btntext: '去登录'
  904. }
  905. this.$refs.popup.open();
  906. return;
  907. }
  908. uni.navigateTo({
  909. url: '/pages/search/search'
  910. })
  911. },
  912. topsNavClick(index) {
  913. this.topsIndex = index;
  914. },
  915. outerSwiperChange(e) {
  916. this.navIndex = e.detail.current;
  917. },
  918. swiperChange(e) {
  919. this.topsIndex = e.detail.current;
  920. },
  921. getRecommendTopsMData() {
  922. this.rankingOptions.type = 'M';
  923. this.$api.public.ranking(this.rankingOptions).then(res => {
  924. console.log('recommendTopsM',res)
  925. // console.log('--------getRecommendTopsMData------mmm',res)
  926. this.recommendTopsM = res.data.list;
  927. }).catch(err => {
  928. console.log('getRecommendTopsMData---', err)
  929. })
  930. },
  931. getRecommendTopsHData() {
  932. this.rankingOptions.type = 'H';
  933. this.$api.public.ranking(this.rankingOptions).then(res => {
  934. console.log('recommendTopsH', res)
  935. this.recommendTopsH = res.data.list;
  936. })
  937. },
  938. getNearTopsMData() {
  939. this.rankingOptions.type = 'M';
  940. this.rankingOptions.city = this.locationCity;
  941. this.rankingOptions.cityCode = this.locationCityCode;
  942. this.$api.public.ranking(this.rankingOptions).then(res => {
  943. console.log('nearTopsM', res)
  944. this.nearTopsM = res.data.list;
  945. })
  946. },
  947. getNearTopsHData() {
  948. this.rankingOptions.type = 'H';
  949. this.rankingOptions.city = this.locationCity;
  950. this.rankingOptions.cityCode = this.locationCityCode;
  951. this.$api.public.ranking(this.rankingOptions).then(res => {
  952. console.log('-------getNearTopsHData', res)
  953. this.nearTopsH = res.data.list;
  954. })
  955. },
  956. getTempRecommendList() {//获取免登录体验数据
  957. this.recommendListOptions.type = 'FamaleReco';
  958. this.$api.public.friendsNoAuth(this.recommendListOptions).then(res => {
  959. if (res.status === 'Succ') {
  960. uni.hideLoading();
  961. this.recommendTotal = res.data.page.recordCount;
  962. this.recommendListOptions.page.sortValues = res.data.sortValues;
  963. let arr = [], obj = { latitude: 0, longitude: 0 };
  964. for (let i = 0; i < res.data.users.length; i++) {
  965. res.data.users[i].lastActiveTime = this.$moment(new Date()).diff(res.data.users[i].lastActive, 'minutes');
  966. obj = { latitude: 0, longitude: 0 };
  967. obj.latitude = res.data.users[i].geo.lat;
  968. obj.longitude = res.data.users[i].geo.lon;
  969. arr.push(obj)
  970. }
  971. wxMapSdk.calculateDistance({
  972. mode: 'straight',
  973. from: {
  974. latitude: this.latitude,
  975. longitude: this.longitude
  976. },
  977. to: arr,
  978. success: dists => {
  979. if (dists.message === "query ok") {
  980. for (let j = 0; j < dists.result.elements.length; j++) {
  981. 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`)
  982. }
  983. if (this.recommendListOptions.page.index > 1) {
  984. this.recommendList = [...this.recommendList, ...res.data.users];
  985. }
  986. else {
  987. this.recommendList = res.data.users;
  988. }
  989. this.$forceUpdate();
  990. }
  991. }
  992. })
  993. this.recommendList = res.data.users;
  994. }
  995. })
  996. },
  997. getRecommendList() {
  998. // let user = JSON.parse(uni.getStorageSync('user'));
  999. // this.recommendListOptions.type = user.sex === 'male' ? 'MaleReco' : 'FamaleReco';
  1000. this.recommendListOptions.type = 'FamaleReco'
  1001. this.recommendListOptions.queryPre.city = this.locationCity;
  1002. this.recommendListOptions.queryPre.cityCode = this.locationCityCode;
  1003. this.recommendListOptions.queryPre.geo.lat = this.latitude;
  1004. this.recommendListOptions.queryPre.geo.lon = this.longitude;
  1005. this.$api.public.friends(this.recommendListOptions).then(res => {
  1006. if (res.status === 'Succ') {
  1007. this.recommendTotal = res.data.page.recordCount;
  1008. this.recommendListOptions.page.sortValues = res.data.sortValues;
  1009. let arr = [], obj = { latitude: 0, longitude: 0 };
  1010. for (let i = 0; i < res.data.users.length; i++) {
  1011. res.data.users[i].lastActiveTime = this.$moment(new Date()).diff(res.data.users[i].lastActive, 'minutes');
  1012. obj = { latitude: 0, longitude: 0 };
  1013. obj.latitude = res.data.users[i].geo.lat;
  1014. obj.longitude = res.data.users[i].geo.lon;
  1015. arr.push(obj)
  1016. }
  1017. wxMapSdk.calculateDistance({
  1018. mode: 'straight',
  1019. from: {
  1020. latitude: this.latitude,
  1021. longitude: this.longitude
  1022. },
  1023. to: arr,
  1024. success: dists => {
  1025. if (dists.message === "query ok") {
  1026. for (let j = 0; j < dists.result.elements.length; j++) {
  1027. 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`)
  1028. }
  1029. if (this.recommendListOptions.page.index > 1) {
  1030. this.recommendList = [...this.recommendList, ...res.data.users];
  1031. }
  1032. else {
  1033. this.recommendList = res.data.users;
  1034. }
  1035. uni.hideLoading();
  1036. this.$forceUpdate();
  1037. }
  1038. }
  1039. })
  1040. }
  1041. })
  1042. },
  1043. getNearList() {
  1044. // console.log('------------------------------------------------------------gggg')
  1045. // let user=JSON.parse(uni.getStorageSync('user'));
  1046. // this.nearListOptions.type=user.sex==='male'?'MaleNearby':'FamaleNearby';
  1047. this.nearListOptions.type = 'FamaleNearby'
  1048. this.nearListOptions.queryPre.city = this.locationCity;
  1049. this.nearListOptions.queryPre.cityCode = this.locationCityCode;
  1050. this.nearListOptions.queryPre.geo.lat = this.latitude;
  1051. this.nearListOptions.queryPre.geo.lon = this.longitude;
  1052. console.log('---1046', this.nearListOptions)
  1053. this.$api.public.friends(this.nearListOptions).then(res => {
  1054. console.log('--------getNearList', res)
  1055. if (res.status === 'Succ' && res.data.users.length > 0) {
  1056. this.nearTotal = res.data.page.recordCount;
  1057. this.nearListOptions.page.sortValues = res.data.sortValues;
  1058. this.showNoData = res.data.users.length === 0 ? true : false;
  1059. let arr = [], obj = { latitude: 0, longitude: 0 };
  1060. for (let i = 0; i < res.data.users.length; i++) {
  1061. res.data.users[i].lastActiveTime = this.$moment(new Date()).diff(res.data.users[i].lastActive, 'minutes');
  1062. obj = { latitude: 0, longitude: 0 };
  1063. obj.latitude = res.data.users[i].geo.lat;
  1064. obj.longitude = res.data.users[i].geo.lon;
  1065. arr.push(obj)
  1066. }
  1067. wxMapSdk.calculateDistance({
  1068. mode: 'straight',
  1069. from: {
  1070. latitude: this.latitude,
  1071. longitude: this.longitude
  1072. },
  1073. to: arr,
  1074. success: dists => {
  1075. if (dists.message === "query ok") {
  1076. for (let j = 0; j < dists.result.elements.length; j++) {
  1077. 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`)
  1078. }
  1079. if (this.nearListOptions.page.index > 1) {
  1080. this.nearList = [...this.nearList, ...res.data.users];
  1081. }
  1082. else {
  1083. this.nearList = res.data.users;
  1084. }
  1085. uni.hideLoading()
  1086. this.$forceUpdate();
  1087. }
  1088. }
  1089. })
  1090. }
  1091. else {
  1092. this.showNoData = this.nearList.length === 0 ? true : false;
  1093. }
  1094. }).catch(err => {
  1095. // this.showNoData=this.nearList.length===0?true:false;
  1096. console.log('err1094', err)
  1097. })
  1098. },
  1099. toDetail(id) {
  1100. if (!uni.getStorageSync('token')) {
  1101. this.popup = {
  1102. content1: '您还未登录',
  1103. content2: '该功能登录后才能使用',
  1104. tip1: '',
  1105. tip2: '',
  1106. btntext: '去登录'
  1107. }
  1108. this.$refs.popup.open();
  1109. return;
  1110. }
  1111. uni.showLoading({})
  1112. let user = JSON.parse(uni.getStorageSync('user'));
  1113. this.$api.public.userDetail({ getAlbum: true, completeUser: user, uponUserId: id }).then(res => {
  1114. if (res.data.frozen) {
  1115. uni.showToast({
  1116. title: '该用户已被冻结',
  1117. icon: 'none'
  1118. });
  1119. return;
  1120. }
  1121. if (res.data.sex === user.sex) {
  1122. uni.showToast({
  1123. title: '同性用户不能查看主页',
  1124. icon: 'none'
  1125. })
  1126. }
  1127. else {
  1128. uni.setStorageSync('otherInfo', JSON.stringify(res.data));
  1129. uni.hideLoading();
  1130. uni.navigateTo({
  1131. url: `/pages/friends/user?id=${id}`
  1132. })
  1133. }
  1134. })
  1135. },
  1136. }
  1137. }
  1138. </script>
  1139. <style lang="scss" scoped>
  1140. .container {
  1141. width: 100vw;
  1142. min-height: 100vh;
  1143. background-color: $bgcolor1;
  1144. overflow: hidden;
  1145. .topnav {
  1146. margin: 0 60rpx;
  1147. align-items: center;
  1148. position: relative;
  1149. .nav-item {
  1150. color: $fontcolor3;
  1151. margin-right: 72rpx;
  1152. transition: all 0.3s;
  1153. padding: 0 10rpx;
  1154. .nav-item-text {
  1155. position: relative;
  1156. z-index: 1;
  1157. }
  1158. }
  1159. .nav-search {
  1160. width: 56rpx;
  1161. height: 56rpx;
  1162. margin-left: 110rpx;
  1163. }
  1164. .nav-item-bg {
  1165. position: absolute;
  1166. left: 0;
  1167. bottom: 10rpx;
  1168. width: 92rpx;
  1169. height: 68rpx;
  1170. z-index: 0;
  1171. transition: all .3s;
  1172. }
  1173. }
  1174. .location {
  1175. margin-top: 40rpx;
  1176. padding: 12rpx;
  1177. background-color: $bgcolor3;
  1178. border-radius: 36rpx;
  1179. .l-pos {
  1180. width: 32rpx;
  1181. height: 32rpx;
  1182. }
  1183. .l-text {
  1184. color: $fontcolor2;
  1185. flex: 1;
  1186. text-align: left;
  1187. margin-left: 8rpx;
  1188. }
  1189. .l-open {
  1190. width: 88rpx;
  1191. height: 48rpx;
  1192. border-radius: 24rpx;
  1193. line-height: 48rpx;
  1194. text-align: center;
  1195. background-color: $primary;
  1196. color: $fontcolor5;
  1197. }
  1198. }
  1199. .scroll-view {
  1200. padding: 24rpx 32rpx 0rpx 32rpx;
  1201. box-sizing: border-box;
  1202. .tops-bg {
  1203. width: 100%;
  1204. height: 100%;
  1205. position: absolute;
  1206. left: 0;
  1207. top: 0;
  1208. z-index: 0;
  1209. }
  1210. .tops-nav {
  1211. position: relative;
  1212. height: 86rpx;
  1213. z-index: 1;
  1214. .tops-nav-item {
  1215. width: 160rpx;
  1216. text-align: center;
  1217. color: $fontcolor3;
  1218. }
  1219. .tops-nav-item-active {
  1220. color: $fontcolor5 !important;
  1221. }
  1222. .tops-line {
  1223. width: 24rpx;
  1224. height: 4rpx;
  1225. background: $fontcolor5;
  1226. border-radius: 2rpx;
  1227. position: absolute;
  1228. bottom: 0;
  1229. transition: all 0.3s;
  1230. }
  1231. }
  1232. .swiper {
  1233. height: 396rpx;
  1234. .swiper-item {
  1235. height: 100%;
  1236. .tops {
  1237. position: relative;
  1238. height: 100%;
  1239. flex-direction: column;
  1240. .tops-third {
  1241. height: 100%;
  1242. .tt-item {
  1243. position: relative;
  1244. flex-direction: column;
  1245. height: 100%;
  1246. width: 208rpx;
  1247. .tt-item-bg {
  1248. width: 196rpx;
  1249. height: 208rpx;
  1250. background: linear-gradient(180deg, rgba(226, 226, 226, 0.1000) 0%, rgba(226, 226, 226, 0) 100%);
  1251. border-radius: 16rpx 16rpx 0rpx 0rpx;
  1252. position: absolute;
  1253. bottom: 0;
  1254. }
  1255. .tt-item-bg-center {
  1256. width: 196rpx;
  1257. height: 248rpx;
  1258. background: linear-gradient(180deg, rgba(255, 236, 54, 0.1000) 0%, rgba(255, 236, 54, 0) 100%);
  1259. border-radius: 16rpx 16rpx 0rpx 0rpx;
  1260. position: absolute;
  1261. bottom: 0;
  1262. }
  1263. .tt-item-img {
  1264. width: 92rpx;
  1265. height: 40rpx;
  1266. transform: translateY(20rpx);
  1267. position: relative;
  1268. z-index: 20;
  1269. }
  1270. .tt-item-img-border {
  1271. width: 196rpx;
  1272. height: 192rpx;
  1273. position: absolute;
  1274. left: 0;
  1275. right: 0;
  1276. margin: auto;
  1277. transform: translateY(-30rpx);
  1278. }
  1279. .tt-item-head-box {
  1280. width: 136rpx;
  1281. height: 136rpx;
  1282. border-radius: 68rpx;
  1283. position: relative;
  1284. z-index: 10;
  1285. }
  1286. .tt-item-name {
  1287. width: 136rpx;
  1288. height: 40rpx;
  1289. text-align: center;
  1290. line-height: 40rpx;
  1291. color: $fontcolor5;
  1292. margin-bottom: 16rpx;
  1293. margin-top: 14rpx;
  1294. }
  1295. .tt-item-num-box {
  1296. .tt-item-num-img {
  1297. width: 32rpx;
  1298. height: 32rpx;
  1299. }
  1300. .tt-item-num-text {
  1301. color: $fontcolor5;
  1302. margin-left: 8rpx;
  1303. }
  1304. }
  1305. }
  1306. }
  1307. }
  1308. }
  1309. }
  1310. .list-item {
  1311. flex-wrap: wrap;
  1312. padding: 40rpx 0rpx;
  1313. .list-head-box {
  1314. width: 136rpx;
  1315. height: 136rpx;
  1316. position: relative;
  1317. .list-head-img {
  1318. width: 136rpx;
  1319. height: 136rpx;
  1320. background-color: #ffffff;
  1321. border-radius: 136rpx;
  1322. }
  1323. .list-head-dot {
  1324. width: 24rpx;
  1325. height: 24rpx;
  1326. border-radius: 24rpx;
  1327. position: absolute;
  1328. background-color: aqua;
  1329. bottom: 2rpx;
  1330. right: 2rpx;
  1331. border: 2rpx solid $bgcolor2;
  1332. }
  1333. }
  1334. .list-info-box {
  1335. box-sizing: border-box;
  1336. width: 544rpx;
  1337. padding-left: 32rpx;
  1338. height: 136rpx;
  1339. flex-direction: column;
  1340. display: flex;
  1341. justify-content: flex-start;
  1342. align-items: flex-start;
  1343. .name-box {
  1344. width: 100%;
  1345. .name {
  1346. .name-text {
  1347. color: $fontcolor5;
  1348. }
  1349. .name-img {
  1350. width: 68rpx;
  1351. height: 32rpx;
  1352. margin-left: 8rpx;
  1353. }
  1354. .name-img-godness {
  1355. width: 76rpx;
  1356. height: 40rpx;
  1357. margin-left: 8rpx;
  1358. transform: translateY(-5rpx);
  1359. }
  1360. }
  1361. .distance {
  1362. color: $fontcolor3;
  1363. }
  1364. }
  1365. .sex-box {
  1366. padding: 0 15rpx;
  1367. height: 32rpx;
  1368. background: rgba(226, 53, 104, 0.2);
  1369. border-radius: 25rpx;
  1370. margin-top: 12rpx;
  1371. .sex-img {
  1372. width: 24rpx;
  1373. height: 24rpx;
  1374. }
  1375. .sex-text1 {
  1376. color: #E23568;
  1377. margin-left: 4rpx;
  1378. }
  1379. .sex-text2 {
  1380. color: #6C52F4;
  1381. margin-left: 4rpx;
  1382. }
  1383. }
  1384. .tip-box {
  1385. color: $fontcolor3;
  1386. width: 100%;
  1387. margin-top: 10rpx;
  1388. }
  1389. }
  1390. .img-box {
  1391. width: 544rpx;
  1392. height: 168rpx;
  1393. margin-left: 168rpx;
  1394. margin-top: 24rpx;
  1395. .ib1 {
  1396. width: 168rpx;
  1397. height: 168rpx;
  1398. border-radius: 16rpx 0rpx 0rpx 16rpx;
  1399. background: $fontcolor5;
  1400. }
  1401. .ib2 {
  1402. width: 168rpx;
  1403. height: 168rpx;
  1404. background: $fontcolor5;
  1405. }
  1406. .ib3 {
  1407. width: 168rpx;
  1408. height: 168rpx;
  1409. border-radius: 0rpx 16rpx 16rpx 0rpx;
  1410. background: $fontcolor5;
  1411. }
  1412. }
  1413. }
  1414. }
  1415. }</style>