user.vue 31 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157
  1. <template>
  2. <view class="container" ref="container">
  3. <!-- @touchmove.stop.prevent="moveStop" -->
  4. <view id="topnav" class="topnav flex-between" :style="{'height':`${topbarOffsetHeight-statusBarHeight}px`,'padding-top':`${statusBarHeight}px`,'background-color':`rgba(21, 17, 38,${topNavAlpha})`}" v-if="!cover.isFullScreen">
  5. <view class="nav-item" @click="back" v-if="backType==='back'">
  6. <image :src="`${assetsUrl}back.png`" mode="widthFix" class="nav-img"></image>
  7. </view>
  8. <view class="nav-item" @click="toHome" v-if="backType==='home'">
  9. <image :src="`${assetsUrl}home.png`" mode="widthFix" class="nav-img"></image>
  10. </view>
  11. <view class="report">
  12. <image :src="`${assetsUrl}user-report.png`" mode="widthFix" class="report-img" @click="showSettingAction()"></image>
  13. </view>
  14. </view>
  15. <uni-popup ref="popup" type="center">
  16. <Popup :content1="popup.content1" :content2="popup.content2" :tip1="popup.tip1" :tip2="popup.tip2" :btntext="popup.btntext" @closePopup="closePopup" @toService="toService" :btnEvent="'toService'"></Popup>
  17. </uni-popup>
  18. <uni-popup ref="vippopup" type="center">
  19. <VipPopup :swiperIndex="vipPopupIndex" @closePopup="closeVipPopup"></VipPopup>
  20. </uni-popup>
  21. <uni-popup ref="paypopup" type="bottom" :safe-area="false">
  22. <PayPopup :swiperIndex="payPopupIndex" @closePopup="closePayPopup"></PayPopup>
  23. </uni-popup>
  24. <view class="video-box" :style="{'height':`${cover.isFullScreen?'100vh':'680rpx'}`,'position':`${cover.isFullScreen?'fixed':'relative'}`}" @click.prevent="videoAction">
  25. <video
  26. :src="cover.url"
  27. class="m-video" autoplay loop :controls="false"
  28. muted
  29. object-fit="cover"
  30. v-if="cover.cate==='video'"
  31. :enable-progress-gesture="false"
  32. @touchstart="touchStart" @touchend="touchEnd"
  33. :style="{'height':`${cover.isFullScreen?'100vh':'680rpx'}`,'position':`${cover.isFullScreen?'fixed':'relative'}`}">
  34. <view class="video-inner flex-center" v-if="!cover.isFullScreen">
  35. <view class="head-box">
  36. <image :src="userInfo.iconThumbnail" mode="aspectFill" class="head-img"></image>
  37. <view class="head-active" style="background-color: #38E825;" v-if="userInfo.lastActiveTime<=30"></view>
  38. <view class="head-active" style="background-color: #0ABDEF;" v-else-if="userInfo.lastActiveTime>30&&userInfo.lastActiveTime<=1440"></view>
  39. </view>
  40. <view class="name-box flex-center">
  41. <view class="name fw600 font44">
  42. {{userInfo.nick}}
  43. </view>
  44. </view>
  45. <view class="age-box fw600 font28">
  46. {{userInfo.ageInfo.age}}岁&nbsp;丨&nbsp;{{userInfo.career}}
  47. </view>
  48. <view class="city-box flex-center" >
  49. <image :src="`${assetsUrl}user-pos.png`" mode="aspectFit" class="city-pos"></image>
  50. <view class="city font24 fw500">
  51. {{userInfo.currCity}}<text v-if="userInfo.distance&&userInfo.distance!=='NaNm'">&nbsp;·&nbsp;{{userInfo.distance}}</text>
  52. </view>
  53. </view>
  54. <view class="video-edit flex-start" v-if="likeNum>0" @click="likeAction">
  55. <image :src="`${assetsUrl}user-heart${isLiked?'3':'2'}.png`" mode="aspectFill" class="video-edit-img"></image>
  56. <view class="video-edit-text font22 fw400">
  57. {{likeNum}}
  58. </view>
  59. </view>
  60. </view>
  61. </video>
  62. <view class="m-video" v-else>
  63. <view class="video-inner flex-center" v-if="!cover.isFullScreen">
  64. <view class="head-box">
  65. <image :src="userInfo.iconThumbnail" mode="aspectFill" class="head-img"></image>
  66. <view class="head-active" style="background-color: #38E825;" v-if="userInfo.lastActiveTime<=30"></view>
  67. <view class="head-active" style="background-color: #0ABDEF;" v-else-if="userInfo.lastActiveTime>30&&userInfo.lastActiveTime<=1440"></view>
  68. </view>
  69. <view class="name-box flex-center">
  70. <view class="name fw600 font44" >
  71. {{userInfo.nick}}
  72. </view>
  73. </view>
  74. <view class="age-box fw600 font28">
  75. {{userInfo.ageInfo.age}}岁&nbsp;丨&nbsp;{{userInfo.career}}
  76. </view>
  77. <view class="city-box flex-center">
  78. <image :src="`${assetsUrl}user-pos.png`" mode="aspectFit" class="city-pos"></image>
  79. <view class="city font24 fw500">
  80. {{userInfo.currCity}}<text v-if="userInfo.distance&&userInfo.distance!=='NaNm'">&nbsp;·&nbsp;{{userInfo.distance}}</text>
  81. </view>
  82. </view>
  83. <view class="video-edit flex-start" v-if="likeNum>0" @click="likeAction">
  84. <image :src="`${assetsUrl}user-heart${isLiked?'3':'2'}.png`" mode="aspectFill" class="video-edit-img"></image>
  85. <view class="video-edit-text font22 fw400">
  86. {{likeNum}}
  87. </view>
  88. </view>
  89. </view>
  90. <image :src="cover.url" mode="widthFix" class="cover-inner"></image>
  91. <view class="cover-modal"></view>
  92. </view>
  93. </view>
  94. <view class="info-box" :style="{'top':`${cover.isFullScreen?'100vh':'648rpx'}`}" v-if="!cover.isFullScreen">
  95. <view class="tag-box flex-start">
  96. <view class="tag flex-center">
  97. <image :src="`${assetsUrl}user-height.png`" mode="aspectFill" class="tag-img"></image>
  98. <view class="tag-text font28 fw400">
  99. {{userInfo.height}}cm
  100. </view>
  101. </view>
  102. <view class="tag flex-center">
  103. <image :src="`${assetsUrl}user-weight.png`" mode="aspectFill" class="tag-img"></image>
  104. <view class="tag-text font28 fw400">
  105. {{userInfo.weight}}kg
  106. </view>
  107. </view>
  108. <view class="tag flex-center">
  109. <image :src="`${assetsUrl}user-constellation.png`" mode="aspectFill" class="tag-img"></image>
  110. <view class="tag-text font28 fw400">
  111. {{userInfo.ageInfo.astro}}
  112. </view>
  113. </view>
  114. <!-- <view class="tag flex-center">
  115. <image :src="`${assetsUrl}user-education.png`" mode="aspectFill" class="tag-img"></image>
  116. <view class="tag-text font28 fw400">
  117. 本科
  118. </view>
  119. </view> -->
  120. </view>
  121. <view class="live-box flex-start" v-if="userInfo.cities.length>0">
  122. <view class="live-inner flex-start">
  123. <image :src="`${assetsUrl}user-city.png`" mode="aspectFill" class="live-img"></image>
  124. <span class="live font28 fw400">常驻:</span><span class="live font28 fw400" v-for="(item,index) in userInfo.cities" :key="index">{{item}}</span>
  125. </view>
  126. </view>
  127. <view class="desc-box font28 fw400" v-if="userInfo.desc">
  128. <image :src="`${assetsUrl}user-desc.png`" mode="aspectFill" class="desc-img"></image>
  129. {{userInfo.desc}}
  130. </view>
  131. <view class="tab-box flex-start">
  132. <view class="tab-item" @click="tabClick(0)" >
  133. <view class="tab-item-text fw700" :style="{
  134. 'font-size':`${tabIndex===0?'44rpx':'36rpx'}`,
  135. 'color':`${tabIndex===0?'#ffffff':''}`,
  136. 'font-weight':`${tabIndex===0?'#ffffff':''}`}">关于{{userInfo.sex==='Famale'?'她':'他'}}</view>
  137. </view>
  138. <!-- <view class="tab-item" @click="tabClick(1)"
  139. style="margin-left: 72rpx;">
  140. <view class="tab-item-text fw700" :style="{
  141. 'font-size':`${tabIndex===1?'44rpx':'36rpx'}`,
  142. 'color':`${tabIndex===1?'#ffffff':''}`,
  143. 'font-weight':`${tabIndex===1?'#ffffff':''}`}">动态</view>
  144. </view> -->
  145. <image :src="`${assetsUrl}friends-circle.png`" mode="aspectFill" class="tab-item-bg" :style="{'left':`${tabIndex*195+15}rpx`}" ></image>
  146. </view>
  147. <view class="cup-box flex-start">
  148. <view class="cup-item flex-center" v-if="userInfo.realMan">
  149. <image :src="`${assetsUrl}friends-real.png`" mode="aspectFit" class="cup-img" style="width: 76rpx;height: 40rpx;"></image>
  150. <view class="cup-text font24" >
  151. {{userInfo.sex==='Famale'?'她':'他'}}已完成真人认证
  152. </view>
  153. </view>
  154. <view class="cup-item flex-center" v-if="userInfo.vip">
  155. <image :src="`${assetsUrl}friends-vip.png`" mode="aspectFit" class="cup-img" style="width: 76rpx;height: 40rpx;"></image>
  156. <view class="cup-text font24" >
  157. {{userInfo.sex==='Famale'?'她':'他'}}是尊贵的vip用户
  158. </view>
  159. </view>
  160. <!-- <view class="cup-item flex-center">
  161. <image :src="`${assetsUrl}user-cup.png`" mode="aspectFit" class="cup-img" style="width: 40rpx;height: 40rpx;"></image>
  162. <view class="cup-text font24">
  163. 重庆市魅力榜第3名
  164. </view>
  165. </view> -->
  166. <view class="cup-item flex-center" v-if="userInfo.goddess&&userInfo.realMan">
  167. <image :src="`${assetsUrl}user-charm.png`" mode="aspectFit" class="cup-img" style="width: 76rpx;height: 42rpx;"></image>
  168. <view class="cup-text font24">
  169. {{userInfo.sex==='Famale'?'她':'他'}}已完成真人认证且颜值较高
  170. </view>
  171. </view>
  172. <view class="cup-item flex-center" v-if="!userInfo.realMan">
  173. <image :src="`${assetsUrl}user-no-real.png`" mode="aspectFit" class="cup-img" style="width: 76rpx;height: 42rpx;"></image>
  174. <view class="cup-text font24">
  175. {{userInfo.sex==='Famale'?'她':'他'}}未完成真人认证、交友谨慎
  176. </view>
  177. </view>
  178. </view>
  179. <view class="photo-album" v-if="pics.length>0">
  180. <view class="pics-box flex-center">
  181. <image :src="currentPic.url" mode="widthFix" class="big-pic" v-if="currentPic.cate==='Img'" @click="preview"></image>
  182. <video :src="currentPic.url"
  183. class="big-pic"
  184. autoplay
  185. loop
  186. :controls="false"
  187. muted
  188. object-fit="fill"
  189. v-if="currentPic.cate==='Vdo'"
  190. :style="{'height':`${currentPic.height}px`}"
  191. @click="preview">
  192. </video>
  193. <scroll-view scroll-x="true" class="pics-list flex-start" v-if="pics.length>1">
  194. <view class="pic-item flex-center" v-for="(item,index) in pics" :key="index" @click="picItemClick(index)">
  195. <image :src="item.urlThumbnail" mode="aspectFill" class="pic-img" :class="currentIndex===index?'active-item':''"></image>
  196. </view>
  197. </scroll-view>
  198. <image :src="`${assetsUrl}user-self.png`" mode="aspectFill" class="self" v-if="currentPic.authStatus==='Succ'"></image>
  199. </view>
  200. </view>
  201. <view class="hopes-box" v-if="userInfo.hobbysStr.length>0">
  202. <view class="title">
  203. {{userInfo.sex==='Famale'?'她':'他'}}的标签
  204. </view>
  205. <view class="hopes flex-start">
  206. <view class="hopes-item font28" v-for="(item,index) in userInfo.hobbysStr" :key="index">
  207. {{item}}
  208. </view>
  209. </view>
  210. </view>
  211. <view class="hopes-box" v-if="userInfo.hopesStr.length>0">
  212. <view class="title">
  213. {{userInfo.sex==='Famale'?'她':'他'}}喜欢的
  214. </view>
  215. <view class="hopes flex-start">
  216. <view class="hopes-item font28" v-for="(item,index) in userInfo.hopesStr" :key="index">
  217. {{item}}
  218. </view>
  219. </view>
  220. </view>
  221. </view>
  222. <view class="btn-box flex-between">
  223. <view class="talk-btn flex-center" :style="{'width':`${isLiked?'100%':'320rpx'}`}" @click="toTalk">
  224. <image :src="`${assetsUrl}user-talk.png`" mode="aspectFit" class="btn-icon"></image>
  225. <text class="btn-text font32 fw600">聊一聊</text>
  226. </view>
  227. <view class="like-btn flex-center" style="width: 320rpx;" @click="likeAction" v-if="!isLiked">
  228. <image :src="`${assetsUrl}user-heart1.png`" mode="aspectFit" class="btn-icon"></image>
  229. <text class="btn-text font32 fw600">喜欢TA</text>
  230. </view>
  231. </view>
  232. <canvas type='2d' canvas-id="mycanvas" id="mycanvas" class="my-canvas"></canvas>
  233. </view>
  234. </template>
  235. <script>
  236. import TabBar from '@/components/TabBar/TabBar.vue';
  237. import wxMap from '@/static/qqmap-wx-jssdk1.2/qqmap-wx-jssdk.min.js';
  238. import Popup from '@/components/Popup/Popup.vue';
  239. import PayPopup from '@/components/Popup/PayPopup.vue';
  240. import VipPopup from '@/components/Popup/VipPopup.vue';
  241. /**
  242. * 腾讯位置服务,手机账号:18996226740
  243. */
  244. const wxMapSdk=new wxMap({key:'E5SBZ-T2YC3-CBL3F-YGFQQ-26PP2-ERFII'})
  245. export default {
  246. components:{TabBar,Popup,PayPopup,VipPopup},
  247. data() {
  248. return {
  249. scrollHeight:0,
  250. topNavAlpha:0,
  251. assetsUrl:this.$util.assetsUrl,
  252. startTime:0,
  253. startPosition:0,
  254. endPosition:0,
  255. currentPic:null,
  256. currentIndex:0,
  257. pics:[],
  258. userInfo:null,//用户信息
  259. cover:{
  260. url:'',
  261. cate:'video',
  262. isFullScreen:false
  263. },
  264. labels:[],
  265. hopes:[],
  266. liveCitys:['1','2'],
  267. tabIndex:0,
  268. id:null,
  269. latitude: 0,
  270. longitude: 0,
  271. hobbysEnums:[],
  272. hopesEnums:[],
  273. likeNum:0,
  274. isLiked:false,
  275. popup:{
  276. content1:'',
  277. content2:'',
  278. tip1:'',
  279. tip2:'',
  280. btntext:''
  281. },
  282. payPopupIndex:-1,
  283. vipPopupIndex:-1,
  284. scrollTop:0,
  285. shareImageUrl:'',
  286. inviteCode:JSON.parse(uni.getStorageSync('userInfo')).inviteCode,
  287. backType:'',//返回类型
  288. };
  289. },
  290. computed: {
  291. statusBarHeight() {
  292. return this.$store.state.statusBarHeight;
  293. },
  294. topbarOffsetHeight() {
  295. return this.$store.state.topbarOffsetHeight;
  296. },
  297. platForm(){
  298. return this.$store.state.platform
  299. },
  300. mineInfo(){
  301. return this.$store.state.userInfo||JSON.parse(uni.getStorageSync('userInfo'))
  302. }
  303. },
  304. onLoad(options) {
  305. console.log(options)
  306. if(options.invite){
  307. uni.setStorageSync('invited',options.invite);
  308. this.backType='home';
  309. }
  310. else{
  311. this.backType='back'
  312. }
  313. if(options.token){
  314. uni.setStorageSync('token',options.token);
  315. }
  316. this.getConfig();
  317. this.id=options.id;
  318. this.getUserDetail();
  319. this.likeInit();
  320. this.getLikeData();
  321. this.getMineDetail();
  322. },
  323. onPageScroll(e) {
  324. this.topNavAlpha=e.scrollTop/250;
  325. this.scrollTop=e.scrollTop;
  326. },
  327. onShareAppMessage() {
  328. return{
  329. title:this.userInfo.nick,
  330. path:`pages/friends/user?id=${this.userInfo.id}&invite=${this.inviteCode}&token=${uni.getStorageSync('token')}`,
  331. imageUrl:this.shareImageUrl
  332. }
  333. },
  334. methods:{
  335. back(){
  336. uni.navigateBack({
  337. delta:1
  338. })
  339. },
  340. toHome(){
  341. console.log('首页')
  342. uni.reLaunch({
  343. url:'/pages/friends/friends'
  344. })
  345. },
  346. showSettingAction(){
  347. //this.$refs.settingPopup.open();
  348. const that=this;
  349. uni.showActionSheet({
  350. itemList: ['举报', '拉黑'],
  351. success: (res)=>{
  352. if(res.tapIndex===0){
  353. uni.navigateTo({
  354. url:`/pagesSub/report/report?id=${this.userInfo.id}`
  355. })
  356. }
  357. if(res.tapIndex===1){
  358. uni.showModal({
  359. cancelText:'取消拉黑',
  360. confirmText:'确定拉黑',
  361. title:'温馨提示',
  362. content:'拉黑后将不会收到对方相关的内容,可在‘我的-设置-黑名单’中解除拉黑',
  363. success: (actres) => {
  364. if(actres.confirm){
  365. let user=JSON.parse(uni.getStorageSync('user'));
  366. that.$api.public.operUponUser({
  367. completeUser:user,
  368. direction:'Do',
  369. operType:'Hate',
  370. uponUserId:this.id
  371. }).then(res=>{
  372. if(res.data.succ){
  373. uni.showToast({
  374. title:'拉黑成功'
  375. });
  376. uni.setStorageSync('needFreshList','1');
  377. uni.navigateBack();
  378. }
  379. else{
  380. uni.showToast({
  381. icon:'none',
  382. title:res.data.msg
  383. });
  384. uni.navigateBack();
  385. }
  386. })
  387. }
  388. }
  389. })
  390. }
  391. },
  392. fail: res=>{
  393. console.log(res.errMsg);
  394. }
  395. });
  396. },
  397. moveStop(){
  398. return false
  399. },
  400. closePopup(){
  401. this.$refs.popup.close();
  402. },
  403. closePayPopup(){
  404. this.payPopupIndex=-1;
  405. this.$refs.paypopup.close();
  406. },
  407. closeVipPopup(){
  408. this.vipPopupIndex=-1;
  409. this.$refs.vippopup.close();
  410. },
  411. likeInit(){
  412. let user=JSON.parse(uni.getStorageSync('user'));
  413. this.$api.public.isLike({
  414. completeUser:user,
  415. opte:'Fav',
  416. rdtn:'Do',
  417. uurd:this.id
  418. }).then(res=>{
  419. if(res.data.msg==='该用户已被收藏'){
  420. this.isLiked=true;
  421. }else{
  422. this.$api.public.isLike({
  423. completeUser:user,
  424. opte:'Fav',
  425. rdtn:'Cancel',
  426. uurd:this.id
  427. }).then(result=>{})
  428. }
  429. })
  430. },
  431. toService(){
  432. this.$refs.popup.close();
  433. uni.openCustomerServiceChat({
  434. extInfo:{
  435. url:'https://work.weixin.qq.com/kfid/kfca1b21d2f7e8a18e9',//客服链接
  436. },
  437. corpId:'wwa8f2a0d8a6dc0950',//企业ID
  438. fail(res){
  439. console.log(res)
  440. wx.showToast({
  441. title: '客服联系失败',
  442. icon:'none'
  443. })
  444. }
  445. })
  446. },
  447. likeAction(){
  448. if(uni.getStorageSync('isLogin')!=='yes'){
  449. uni.showModal({
  450. title:'提示',
  451. content:'您当前未登录,请登录后开启点赞哦~',
  452. confirmText:'去登录',
  453. success: (res) => {
  454. if(res.confirm){
  455. uni.reLaunch({
  456. url:'pages/login/login'
  457. })
  458. }
  459. }
  460. })
  461. return;
  462. }
  463. let user=JSON.parse(uni.getStorageSync('user'));
  464. this.$api.public.isLike({
  465. completeUser:user,
  466. opte:'Fav',
  467. rdtn:this.isLiked?'Cancel':'Do',
  468. uurd:this.id
  469. }).then(res=>{
  470. if(res.data.succ){
  471. this.isLiked=!this.isLiked;
  472. if(this.isLiked){
  473. this.likeNum++;
  474. }else{
  475. this.likeNum--;
  476. }
  477. }
  478. else{
  479. uni.showToast({
  480. icon:'none',
  481. title:res.data.msg
  482. })
  483. }
  484. })
  485. },
  486. preview(){
  487. let arr=[],obj={};
  488. for(let i=0;i<this.pics.length;i++){
  489. console.log(this.pics[i])
  490. obj={url:'',type:'',width:'',height:''};
  491. if(this.pics[i].cate==='Img'){
  492. obj.type='image';
  493. }
  494. if(this.pics[i].cate==='Vdo'){
  495. obj.type='video';
  496. obj.width=686;
  497. obj.height=this.pics[i].h/(this.pics[i].w/343)*2
  498. }
  499. obj.url=this.pics[i].url;
  500. arr.push(obj)
  501. }
  502. console.log(arr)
  503. uni.previewMedia({
  504. sources:arr,
  505. current:this.currentIndex,
  506. showmenu:true
  507. })
  508. },
  509. tabClick(index){
  510. this.tabIndex=index;
  511. },
  512. touchStart(e){
  513. this.startTime = Date.now()
  514. this.startPosition = e.changedTouches[0].clientY
  515. },
  516. touchEnd(e){
  517. const endTime = Date.now()
  518. if (endTime - this.startTime <100){
  519. return;
  520. }
  521. if (Math.abs(this.endPosition - this.startPosition) > 10){
  522. this.endPosition = e.changedTouches[0].clientY;
  523. let elePosition = this.endPosition - this.startPosition > 0 ? "toBottom": "toTop"
  524. if(elePosition==='toBottom'){
  525. this.cover.isFullScreen=true;
  526. }
  527. else{
  528. this.cover.isFullScreen=false;
  529. }
  530. } else {
  531. return;
  532. }
  533. },
  534. videoAction(){
  535. if(this.cover.isFullScreen){
  536. this.cover.isFullScreen=false;
  537. }
  538. },
  539. drawCanvas(){
  540. let that=this;
  541. let rpx;
  542. uni.getSystemInfo({
  543. success: (res) => {
  544. rpx=res.windowWidth/375;
  545. const query=uni.createSelectorQuery();
  546. query.select('#mycanvas').fields({node:true,size:false}).exec(res=>{
  547. console.log(res)
  548. const canvas=res[0].node;
  549. const ctx=canvas.getContext('2d');
  550. canvas.width=500*rpx;
  551. canvas.height=400*rpx;
  552. new Promise(resolve=>{
  553. uni.getImageInfo({
  554. src:that.userInfo.icon,
  555. success: (res) => {
  556. const img=canvas.createImage();
  557. img.src=res.path;
  558. img.onload=()=>{
  559. ctx.drawImage(img,0,0,500*rpx,400*rpx);
  560. resolve(true);
  561. }
  562. }
  563. })
  564. }).then(()=>{
  565. return new Promise((resolve)=>{
  566. ctx.font=`500 ${30*rpx}px Arial`;
  567. ctx.fillStyle='#ffffff';
  568. ctx.fillText(`${that.userInfo.ageInfo.age}岁|${that.userInfo.career}`,28*rpx,285*rpx);
  569. resolve(true);
  570. })
  571. }).then(()=>{
  572. return new Promise((resolve)=>{
  573. ctx.font=`500 ${24*rpx}px Arial`;
  574. ctx.fillStyle='#ffffff';
  575. ctx.fillText(`${that.userInfo.height}cm · ${that.userInfo.weight}kg · ${that.userInfo.ageInfo.astro}`,28*rpx,339*rpx);
  576. resolve(true);
  577. })
  578. }).then(()=>{
  579. return new Promise((resolve)=>{
  580. uni.getImageInfo({
  581. src:'https://zhenyanapp-gen.oss-cn-qingdao.aliyuncs.com/wechat-mini-pro/share-talk.png',
  582. success: (res) => {
  583. const img=canvas.createImage();
  584. img.src=res.path;
  585. img.onload=()=>{
  586. ctx.drawImage(img,324*rpx,286*rpx,148*rpx,56*rpx);
  587. resolve(true);
  588. }
  589. }
  590. })
  591. })
  592. }).then(()=>{
  593. return new Promise((resolve)=>{
  594. uni.canvasToTempFilePath({
  595. canvas:canvas,
  596. success:result=>{
  597. that.shareImageUrl=result.tempFilePath;
  598. uni.hideLoading();
  599. resolve(true);
  600. }
  601. })
  602. })
  603. })
  604. })
  605. }
  606. });
  607. return;
  608. },
  609. getUserDetail(){
  610. uni.showLoading({
  611. title:'加载中'
  612. });
  613. let pages = getCurrentPages();
  614. let prevPage = pages[pages.length - 2];
  615. let user=JSON.parse(uni.getStorageSync('user'));
  616. this.userInfo=JSON.parse(uni.getStorageSync('otherInfo'));
  617. this.drawCanvas();
  618. this.pics=this.userInfo.medias;
  619. if(user.sex==='Male'){
  620. this.$api.public.seeMaleDetail({completeUser:user,jsjf:this.id}).then(()=>{})
  621. }else if(user.sex==='Famale'){
  622. this.$api.public.seeFamaleDetail({completeUser:user,pusd:this.id}).then(()=>{})
  623. }
  624. this.userInfo.lastActiveTime=this.$moment(new Date()).diff(this.userInfo.lastActive,'minutes');
  625. this.currentPic=this.userInfo.medias[0];
  626. if(this.userInfo.bkg.indexOf('.mp4')!==-1){
  627. this.cover.cate='video';
  628. this.cover.url=this.userInfo.bkg;
  629. }
  630. else{
  631. this.cover.cate='img';
  632. this.cover.url=this.userInfo.bkg;
  633. }
  634. wxMapSdk.calculateDistance({
  635. mode:'straight',
  636. from:{
  637. latitude: this.$store.state.latitude,
  638. longitude: this.$store.state.longitude
  639. },
  640. to:[{
  641. latitude: this.userInfo.geo.lat,
  642. longitude: this.userInfo.geo.lon
  643. }],
  644. success:dists=>{
  645. this.userInfo.distance=(dists.result.elements[0].distance>1000?`${Math.floor(dists.result.elements[0].distance/100)/10}km`:`${dists.result.elements[0].distance}m`)
  646. }
  647. });
  648. if(this.userInfo.hobbies){
  649. let arr=[];
  650. this.userInfo.hobbies.forEach((item,index)=>{
  651. this.hobbysEnums.forEach((sitem,sindex)=>{
  652. if(item===sitem.key&&!arr.includes(sitem.desc)){
  653. arr.push(sitem.desc)
  654. }
  655. })
  656. })
  657. this.userInfo.hobbysStr=arr;
  658. }
  659. if(this.userInfo.wanteds){
  660. let arr=[];
  661. this.userInfo.wanteds.forEach((item,index)=>{
  662. this.hopesEnums.forEach((sitem,sindex)=>{
  663. if(item===sitem.key&&!arr.includes(sitem.desc)){
  664. arr.push(sitem.desc)
  665. }
  666. })
  667. })
  668. this.userInfo.hopesStr=arr;
  669. }
  670. // this.$api.public.userDetail({getAlbum:true,completeUser:user,uponUserId:this.id}).then(res=>{
  671. // if(res.status==='Succ'){
  672. // }
  673. // })
  674. },
  675. picItemClick(index){
  676. this.currentIndex=index;
  677. this.currentPic=this.pics[index];
  678. this.currentPic.height=this.currentPic.h/(this.currentPic.w/343);
  679. this.$nextTick(()=>{
  680. setTimeout(() => { uni.pageScrollTo({scrollTop: this.scrollTop, duration: 0});}, 50);
  681. });
  682. },
  683. getConfig(){
  684. this.$api.public.config({tscsj:['Hobbys','Hopes']}).then(res=>{
  685. this.hobbysEnums=res.data.hobbys;
  686. this.hopesEnums=res.data.hopes;
  687. }).catch(err=>{
  688. console.log(err)
  689. })
  690. },
  691. getLikeData(){
  692. let user=JSON.parse(uni.getStorageSync('user'));
  693. this.$api.public.userData({
  694. completeUser:user,
  695. listType:'FavsForMe',
  696. page:{
  697. index:1,
  698. size:20,
  699. sortValues:[]
  700. },
  701. uponUserId:this.id
  702. }).then(res=>{
  703. this.likeNum=res.data;
  704. })
  705. },
  706. toTalk(){
  707. if(uni.getStorageSync('isLogin')!=='yes'){
  708. uni.showModal({
  709. title:'提示',
  710. content:'您当前未登录,请登录后开启聊天哦~',
  711. confirmText:'去登录',
  712. success: (res) => {
  713. if(res.confirm){
  714. uni.reLaunch({
  715. url:'pages/login/login'
  716. })
  717. }
  718. }
  719. })
  720. return;
  721. }
  722. if(this.mineInfo.sex==='Male'&&!this.mineInfo.vip){
  723. if(this.platForm==='ios'){
  724. this.vipPopupIndex=0;
  725. this.$refs.vippopup.open();
  726. }else{
  727. this.payPopupIndex=0;
  728. this.$refs.paypopup.open();
  729. }
  730. return;
  731. }
  732. if(this.mineInfo.sex==='Famale'&&!this.mineInfo.realMan){
  733. this.popup={
  734. content1:'认证后才能开启私聊哦',
  735. content2:'给客服回复关键词「真人认证」',
  736. tip1:'',
  737. tip2:'',
  738. btntext:'联系客服去认证'
  739. }
  740. this.$refs.popup.open();
  741. return;
  742. }
  743. uni.navigateTo({
  744. url:`/pagesSub/chatting/chatting?conversationid=C2C${this.userInfo.id}`
  745. })
  746. },
  747. getMineDetail(){
  748. let user=JSON.parse(uni.getStorageSync('user'));
  749. this.$api.public.mineDetail({
  750. getAlbum:true,
  751. completeUser:user
  752. }).then(res=>{
  753. this.$store.commit('setUserInfo',res.data);
  754. uni.setStorageSync('userInfo',JSON.stringify(res.data));//正式环境删除
  755. })
  756. },
  757. }
  758. }
  759. </script>
  760. <style lang="scss" scoped>
  761. .container{
  762. width: 100vw;
  763. height: 100vh;
  764. background-color: $bgcolor1;
  765. position: relative;
  766. .topnav {
  767. position: fixed;
  768. top: 0;
  769. left: 0;
  770. width: 100vw;
  771. z-index: 100;
  772. backdrop-filter: blur(10px);
  773. .nav-item {
  774. width: 40rpx;
  775. height: 40rpx;
  776. margin-left: 16rpx;
  777. .nav-img{
  778. width: 40rpx;
  779. height: 40rpx;
  780. }
  781. }
  782. .report{
  783. margin-right:200rpx;
  784. width: 40rpx;
  785. height: 40rpx;
  786. .report-img{
  787. width: 40rpx;
  788. height: 40rpx;
  789. }
  790. }
  791. .nav-edit{
  792. width:120rpx;
  793. height: 56rpx;
  794. border-radius: 56rpx;
  795. color: $fontcolor5;
  796. line-height: 56rpx;
  797. text-align: center;
  798. background-color: rgba(0, 0, 0, 0.5);
  799. }
  800. }
  801. .video-box{
  802. width: 100vw;
  803. transition: all 0.3s;
  804. .m-video{
  805. width: 100vw;
  806. position: relative;
  807. .video-inner{
  808. flex-direction: column;
  809. height: 680rpx;
  810. transform: translateY(30rpx);
  811. position: relative;
  812. z-index: 10;
  813. .head-box{
  814. position: relative;
  815. width: 168rpx;
  816. height: 168rpx;
  817. border-radius: 72rpx;
  818. .head-img{
  819. width: 168rpx;
  820. height: 168rpx;
  821. border-radius: 72rpx;
  822. border: 4rpx solid #FFFFFF;
  823. }
  824. .head-active{
  825. width: 24rpx;
  826. height: 24rpx;
  827. border-radius: 24rpx;
  828. position: absolute;
  829. bottom: 0;
  830. right: 0;
  831. }
  832. }
  833. .name-box{
  834. height: 60rpx;
  835. margin-top: 24rpx;
  836. .name{
  837. color: $fontcolor5;
  838. height: 60rpx;
  839. line-height: 60rpx;
  840. }
  841. }
  842. .age-box{
  843. color: $fontcolor5;
  844. height: 40rpx;
  845. line-height: 40rpx;
  846. }
  847. .city-box{
  848. height: 34rpx;
  849. .city-pos{
  850. width: 24rpx;
  851. height: 24rpx;
  852. margin-right: 4rpx;
  853. }
  854. .city{
  855. height: 34rpx;
  856. line-height: 34rpx;
  857. color: $fontcolor5;
  858. }
  859. }
  860. .video-edit{
  861. position: absolute;
  862. bottom: 80rpx;
  863. right: 32rpx;
  864. height: 48rpx;
  865. background-color:rgba(0, 0, 0, 0.5);
  866. padding: 0 20rpx;
  867. border-radius: 48rpx;
  868. z-index: 6;
  869. .video-edit-img{
  870. width: 24rpx;
  871. height: 24rpx;
  872. margin-right: 4rpx;
  873. }
  874. .video-edit-text{
  875. margin-left: 16rpx;
  876. line-height: 48rpx;
  877. color: $fontcolor5;
  878. }
  879. }
  880. }
  881. .cover-inner{
  882. width: 100vw;
  883. height: 680rpx;
  884. position: absolute;
  885. top: 0;
  886. z-index: 4;
  887. }
  888. .cover-modal{
  889. position: absolute;
  890. top: 0;
  891. width: 100vw;
  892. height: 680rpx;
  893. z-index: 5;
  894. background: rgba(0,0,0,0.4);
  895. backdrop-filter: blur(20rpx);
  896. }
  897. }
  898. }
  899. .info-box{
  900. position: absolute;
  901. z-index: 20;
  902. left: 0;
  903. width: 100vw;
  904. padding-bottom: 300rpx;
  905. background-color: $bgcolor1;
  906. transition: top .3s;
  907. border-radius: 40rpx 40rpx 0rpx 0rpx;
  908. .tag-box{
  909. margin: 48rpx 32rpx;
  910. .tag{
  911. width: 164rpx;
  912. height: 96rpx;
  913. background-color: $bgcolor3;
  914. border-radius: 24rpx;
  915. margin-right: 10rpx;
  916. .tag-img{
  917. width: 32rpx;
  918. height: 32rpx;
  919. }
  920. .tag-text{
  921. color: $fontcolor5;
  922. margin-left: 4rpx;
  923. }
  924. }
  925. }
  926. .live-box{
  927. margin: 24rpx 32rpx 0rpx 32rpx;
  928. .live-inner{
  929. padding: 28rpx;
  930. background-color: $bgcolor3;
  931. max-width: 100%;
  932. border-radius: 24rpx;
  933. flex-wrap: wrap;
  934. .live-img{
  935. width: 32rpx;
  936. height: 32rpx;
  937. display: inline;
  938. }
  939. .live{
  940. padding: 2rpx 16rpx;
  941. color: $fontcolor5;
  942. }
  943. }
  944. }
  945. .desc-box{
  946. padding: 56rpx 48rpx 56rpx 72rpx;
  947. margin: 56rpx 32rpx 0rpx 32rpx;
  948. position: relative;
  949. background: linear-gradient(180deg, #1F1A30 0%, #151126 100%);
  950. color: $fontcolor5;
  951. .desc-img{
  952. position: absolute;
  953. left: 0;
  954. top: -40rpx;
  955. width: 88rpx;
  956. height: 88rpx;
  957. }
  958. }
  959. .tab-box{
  960. margin: 66rpx 32rpx 0rpx 32rpx;
  961. position: relative;
  962. align-items: baseline;
  963. min-height: 76rpx;
  964. .tab-item{
  965. width: 144rpx;
  966. .tab-item-text{
  967. height: 100%;
  968. line-height: 70rpx;
  969. position: relative;
  970. z-index: 1;
  971. color: $fontcolor3;
  972. transition: all 0.3s;
  973. }
  974. }
  975. .tab-item-bg{
  976. position: absolute;
  977. left: 0;
  978. bottom: 10rpx;
  979. width: 96rpx;
  980. height: 68rpx;
  981. padding: 0rpx 5rpx;
  982. z-index: 0;
  983. transition: all .3s;
  984. }
  985. }
  986. .cup-box{
  987. flex-wrap: wrap;
  988. margin: 24rpx 32rpx 0rpx 32rpx;
  989. .cup-item{
  990. height: 56rpx;
  991. background-color: $bgcolor4;
  992. border-radius: 28rpx;
  993. margin-right: 20rpx;
  994. margin-top: 20rpx;
  995. padding: 0rpx 20rpx;
  996. .cup-img{
  997. }
  998. .cup-text{
  999. display: inline;
  1000. color: $fontcolor5;
  1001. margin-left: 8rpx;
  1002. }
  1003. }
  1004. }
  1005. .photo-album{
  1006. margin: 56rpx 32rpx 0rpx 32rpx;
  1007. .pa-box{
  1008. .pa-title{
  1009. color: $fontcolor5;
  1010. }
  1011. .pa-tip{
  1012. color: $fontcolor3;
  1013. }
  1014. }
  1015. .pics-box{
  1016. width: 100%;
  1017. border-radius: 16rpx;
  1018. margin-top: 26rpx;
  1019. position: relative;
  1020. margin-bottom: 30rpx;
  1021. max-height: 800rpx;
  1022. overflow: hidden;
  1023. .self{
  1024. position: absolute;
  1025. width: 72rpx;
  1026. height: 40rpx;
  1027. right: 24rpx;
  1028. top: 24rpx;
  1029. z-index: 100;
  1030. }
  1031. .big-pic{
  1032. width: 100%;
  1033. border-radius: 40rpx;
  1034. }
  1035. .pics-list{
  1036. width: 100%;
  1037. height: 186rpx;
  1038. position: absolute;
  1039. bottom: -35rpx;
  1040. white-space:nowrap;
  1041. transform: translateY(-20rpx);
  1042. .pic-item{
  1043. display: inline-block;
  1044. width: 96rpx;
  1045. height: 128rpx;
  1046. border-radius: 16rpx;
  1047. margin-left: 16rpx;
  1048. box-shadow:0rpx 0rpx 10rpx 1rpx #151126;
  1049. transform: translateY(10rpx);
  1050. &:nth-last-of-type(1){
  1051. margin-right: 16rpx;
  1052. }
  1053. .pic-img{
  1054. width: 96rpx;
  1055. height: 128rpx;
  1056. border-radius: 16rpx;
  1057. box-sizing: border-box;
  1058. border: 4rpx solid transparent;
  1059. transition: all 0.3s;
  1060. }
  1061. }
  1062. .active-item{
  1063. border: 4rpx solid #ffffff !important;
  1064. }
  1065. }
  1066. }
  1067. }
  1068. .hopes-box{
  1069. margin: 56rpx 32rpx;
  1070. .title{
  1071. color: $fontcolor5;
  1072. margin-bottom: 12rpx;
  1073. }
  1074. .hopes{
  1075. flex-wrap: wrap;
  1076. .hopes-item{
  1077. padding: 12rpx 20rpx;
  1078. border-radius: 16rpx;
  1079. color: $fontcolor3;
  1080. background-color: $bgcolor3;
  1081. margin-left: 20rpx;
  1082. margin-top: 20rpx;
  1083. &:nth-of-type(1){
  1084. margin-left: 0rpx;
  1085. }
  1086. }
  1087. }
  1088. }
  1089. }
  1090. .btn-box{
  1091. padding: 0rpx 32rpx;
  1092. width: 100vw;
  1093. box-sizing: border-box;
  1094. position: fixed;
  1095. z-index:20;
  1096. bottom: 100rpx;
  1097. .talk-btn{
  1098. margin-right: 12rpx;
  1099. height: 104rpx;
  1100. background: $primary;
  1101. border-radius: 52rpx;
  1102. }
  1103. .like-btn{
  1104. margin-left: 12rpx;
  1105. height: 104rpx;
  1106. background: linear-gradient(133deg, #FA5C74 0%, #BC55BF 53%, #8A4FFF 100%);
  1107. border-radius: 52rpx;
  1108. }
  1109. .btn-icon{
  1110. width: 40rpx;
  1111. height: 40rpx;
  1112. }
  1113. .btn-text{
  1114. color: $fontcolor5;
  1115. margin-left: 8rpx;
  1116. }
  1117. }
  1118. .my-canvas{
  1119. width:500px;
  1120. height: 400px;
  1121. margin: 0;
  1122. padding: 0;
  1123. position: fixed;
  1124. top: -1000px;
  1125. left: 0;
  1126. }
  1127. }
  1128. </style>