home.vue 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602
  1. <template>
  2. <view v-if="isShowView">
  3. <view class="top" :style="'height:' + systems.barHeight + 'rpx;'">
  4. <navigator open-type="navigateBack" hover-class="none" class="back" :style="'height:' + systems.navigationHeight + 'rpx;top:' + systems.ktxStatusHeight + 'rpx;'">
  5. <image src="../static/images/back_black.png"></image>
  6. </navigator>
  7. </view>
  8. <view class="c-top">
  9. <view class="top-img">
  10. <image :src="config.COMMENT_TOP_IMG?config.COMMENT_TOP_IMG:'../static/images/topimg.png'" class="pic"></image>
  11. <!-- <image src="../static/images/topbg.png" class="topbg"></image> -->
  12. </view>
  13. <view class="t-user ddflex">
  14. <image :src="userDetail.avatar ? userDetail.avatar : '/static/images/def_head.png'" class="t-userimg"></image>
  15. <navigator v-if="userId == userInfo.id" url="/mine/userinfo/userinfo" hover-class="none" class="edit ddflex">
  16. <image src="../static/images/edit.png"></image>
  17. 编辑资料
  18. </navigator>
  19. <view v-else class="guanzhu ddflex" @click="behaviorOpt()">
  20. {{isFocus ? '取消关注':'+关注'}}
  21. </view>
  22. </view>
  23. <view class="t-name ddflex">
  24. <view>{{ userDetail.nickName }}</view>
  25. <image v-if="isOpenWeRunData" style="width:22rpx;height:26rpx;margin-left: 10rpx;" src="../../static/images/yd.png"></image>
  26. <!-- <text>详细资料</text>
  27. <image src="../static/images/rico.png" class="rico"></image> -->
  28. </view>
  29. <view class="bri ddflex">
  30. <view>简介:</view>
  31. <rich-text :nodes="userDetail.brief ? userDetail.brief : '暂无~'" class="fflex"></rich-text>
  32. </view>
  33. <view class="tuan ddflex" v-if="userDetail.levelGrade == 2 || userDetail.levelGrade == 4">
  34. <image v-if="userDetail.levelGrade == 2" src="../static/images/tuan.png"></image>
  35. <image v-if="userDetail.levelGrade == 4" src="../../static/images/tuan.png"></image>
  36. {{ userDetail.levelName }}
  37. </view>
  38. <view class="datas ddflex">
  39. <view class="fflex" @click="jumpFans()">
  40. <text>{{ userDetail.count.fansNo }}</text>
  41. <view>关注</view>
  42. </view>
  43. <view @click="jumpCollection()" class="fflex">
  44. <text>{{ userDetail.count.collectionNo }}</text>
  45. <view>收藏</view>
  46. </view>
  47. <view class="fflex">
  48. <text>{{ userDetail.count.praiseNo }}</text>
  49. <view>获赞</view>
  50. </view>
  51. </view>
  52. </view>
  53. <!-- 加入团队 -->
  54. <view class="m-team" v-if="myTeamList.length>0">
  55. <view class="m-tits ddflex" @click="jumpUrl('/office/myTeam/index')">
  56. <view class="fflex">加入的团队</view>
  57. </view>
  58. <view class="map-team">
  59. <scroll-view scroll-x="true" class="map-teams">
  60. <view class="li" v-for="(item,index) in myTeamList" :key="index" @click="jumpUrl('/office/team/index?id='+item.id)">
  61. <view class="ddflex">
  62. <image :src="item.url?item.url:picUrlss+'office_images/team_default.png'" mode="aspectFill"></image>
  63. <view class="fflex">
  64. <view class="tover">{{item.title?item.title:'cessss'}}</view>
  65. <text>{{item.memberNum}}成员</text>
  66. </view>
  67. <view class="li-btn" @click.stop="joinTeam(item,index)">{{item.isJoin == 1 ? '已加入':'加入'}}</view>
  68. </view>
  69. </view>
  70. </scroll-view>
  71. </view>
  72. </view>
  73. <!-- 参与活动 -->
  74. <view class="ac-team" v-if="userMatchList.length>0">
  75. <view class="ac-tits ddflex">
  76. <view class="fflex">参与活动</view>
  77. <!-- <view>
  78. <text style="color: #999;">更多</text>
  79. <image src="/static/images/moreico.png" class="rico"></image>
  80. </view> -->
  81. </view>
  82. <view class="map-ac">
  83. <scroll-view scroll-x="true" class="map-acs" >
  84. <view class="li" v-for="(item,index) in userMatchList" :key="index" @click="jumpUrl('/match/activityDetail/activityDetail?id='+item.id)">
  85. <view style="position: relative;border-radius: 20rpx;overflow: hidden;">
  86. <image :src="item.pic ? item.pic : '/static/images/def_zw1.png'" mode="aspectFill"></image>
  87. <view class="ac-type" v-if="item.categoryName">{{ item.categoryName }}</view>
  88. </view>
  89. <view class="ac-title tover">{{ item.title }}</view>
  90. <view class="ac-date">赛事日期:{{ item.time }}</view>
  91. </view>
  92. </scroll-view>
  93. </view>
  94. </view>
  95. <!-- 自己 -->
  96. <!-- <view class="tab ddflex" v-if="userId == userInfo.id">
  97. <view :class="'li ' + (type == 1 ? 'active' : '')" @click="swiType(1)">动态</view>
  98. <view :class="'li ' + (type == 2 ? 'active' : '')" @click="swiType(2)">提问</view>
  99. <view :class="'li ' + (type == 3 ? 'active' : '')" @click="swiType(3)">日记</view>
  100. </view> -->
  101. <view class="list" v-if="pageList && pageList.length > 0">
  102. <view style="font-size: 28rpx;font-weight: bold;padding: 30rpx 30rpx 0;color: #333;">全部动态({{total}})</view>
  103. <view class="li" v-for="(item, index) in pageList" :key="index">
  104. <view class="user ddflex">
  105. <image :src="item.userDTO.avatar" mode="aspectFill" class="userimg" @click="toUserHomePage(item.userDTO.id)"></image>
  106. <view class="fflex">
  107. <view class="namea ddflex">
  108. <view class="name fflex ddflex" @click="toUserHomePage(item.userDTO.id)">
  109. {{ item.userDTO.nickName }}
  110. <image v-if="item.userDTO.levelGrade > 0" src="../../static/images/vip_tag.png" class="vip-tag"></image>
  111. </view>
  112. <view class="time">{{ item.time }}</view>
  113. </view>
  114. <view class="area" @click="toUserHomePage(item.userDTO.id)" v-if="item.userDTO.cityName">{{ item.userDTO.provinceName }} {{ item.userDTO.cityName }}</view>
  115. </view>
  116. </view>
  117. <!-- 分享的动态 -->
  118. <block v-if="item.source">
  119. <view class="link ddflex" @click="jumpUrlDetail(item)">
  120. <block v-if="item.url&&item.url.length>0"><image mode="aspectFill" v-if="idx == 0" v-for="(it, idx) in item.url" :src="it" :key="idx"></image></block>
  121. <view class="fflex tover"><rich-text :nodes="item.content"></rich-text></view>
  122. </view>
  123. </block>
  124. <!-- 非分享的动态 -->
  125. <block v-else>
  126. <view v-if="item.type == 2" class="des tovers" @click="jumpUrlDetail(item)">
  127. <view class="wen">提问</view>
  128. {{ removeHtml(item.content) }}
  129. </view>
  130. <view class="des" v-else @click="jumpUrlDetail(item)"><rich-text :nodes="item.content"></rich-text></view>
  131. <!-- //如果有投票,就不显示图片 -->
  132. <block v-if="!item.qyPoll">
  133. <view class="video" v-if="item.isHaveVideo && config.open_community_video == 1">
  134. <video :src="item.url" :show-center-play-btn="false" :controls="item.isControls" :autoplay="item.isControls" :id="'myVideo'+index" @pause="videoPause(index)" @ended="videoEnded(index)"></video>
  135. <view class="video-play ddflex" @click="videoPlay(index)" v-if="item.isShowPlayBtn"><image src="../../static/images/play.png"></image></view>
  136. </view>
  137. <view class="imgbox ddflex" @click="jumpUrlDetail(item)" v-if="!item.isHaveVideo"><!-- @click="previewImgss(item.url, idx)" -->
  138. <block v-if="item.url&&item.url.length>0">
  139. <image mode="aspectFill" v-for="(it, idx) in item.url" :src="it" :key="idx"></image>
  140. </block>
  141. </view>
  142. </block>
  143. <!-- 话题 -->
  144. <view class="ddflex" v-if="item.qyDialogu">
  145. <view class="topic ddflex" @click="jumpUrl('/topics/detail/detail?topicId=' + item.qyDialogu.id)">
  146. <image src="../../static/images/topic.png"></image>
  147. {{ item.qyDialogu.title }}
  148. </view>
  149. </view>
  150. <view class="loca ddflex" @click="jumpUrlPoi(item,'/office/poi/index')" v-if="item.poiName"><image :src="picUrlss+'office_images/loca.png'"></image><text v-if="item.poiDistance > 0">{{item.poiDistance ? item.poiDistance < 1000 ? item.poiDistance+'m' : (item.poiDistance/1000).toFixed(1)+'km' : ''}}</text>{{item.poiName}}</view>
  151. <!-- 投票 -->
  152. <view :class="'vote-box' + (item.qyPoll.isEnd ? ' ends' : '')" v-if="item.qyPoll">
  153. <view class="vote-tit">{{ item.qyPoll.title }}</view>
  154. <block v-if="item.qyPoll.isVote == 1">
  155. <view class="vote-list end" @click="jumpUrlDetail(item)">
  156. <view :class="'lis ddflex ' + (itpy.isVote == 1 ? 'active' : '')" v-for="(itpy, idex) in JSON.parse(item.qyPoll.optionJson)" :key="idex">
  157. <view class="percent" :style="'width:' + parseFloat(itpy.proportion) + '%;'"></view>
  158. <view class="fflex">{{ itpy.name }}</view>
  159. <view>{{ parseFloat(itpy.proportion) + '%' }}</view>
  160. </view>
  161. </view>
  162. </block>
  163. <block v-else>
  164. <view class="vote-list">
  165. <view class="lis" v-for="(itpy, idex) in JSON.parse(item.qyPoll.optionJson)" :key="idex" @click="submitPoll(item, index, idex)">
  166. {{ itpy.name }}
  167. </view>
  168. </view>
  169. </block>
  170. <view class="vote-can" v-if="item.qyPoll.isEnd"><text>{{item.qyPoll.voteCount}}人参与</text>投票已结束</view>
  171. </view>
  172. <block v-if="item.type==10||item.type==11">
  173. <view v-if="item.type==10" class="ddflex step-box" style="justify-content: space-between;" @click="jumpUrl('/exercise/record/record?userId=' + item.userId)">
  174. <view>
  175. <view class="step-date">{{item.wxRun.step}}</view>
  176. <view class="step-label">步数</view>
  177. </view>
  178. <view>
  179. <view class="step-date">{{item.wxRun.index}}</view>
  180. <view class="step-label" style="text-align: right;">名次</view>
  181. </view>
  182. </view>
  183. <view v-if="item.type==11" class="ddflex step-box" style="justify-content: space-between;" @click="jumpUrl('/match/activityDetail/activityDetail?id=' + item.matchContent.id)">
  184. <image class="step-pic" :src="item.matchContent.pic" mode="aspectFill"></image>
  185. <view class="fflex">
  186. <view class="step-title tovers">{{item.matchContent.title}}</view>
  187. <view class="ddflex" style="justify-content: space-between;margin-top: 10rpx;">
  188. <view class="step-price">{{item.matchContent.endTime}}</view>
  189. <view class="step-btn">查看</view>
  190. </view>
  191. </view>
  192. </view>
  193. </block>
  194. <view v-if="item.userGroupId" class="ddflex step-box" style="padding: 25rpx 21rpx;" @click="jumpUrl('/office/team/index?id=' + item.userGroupId)">
  195. <image style="width: 24rpx;height: 24rpx;margin-right: 13rpx;" src="../../static/images/link.png"></image>
  196. <view style="font-weight: 500;color: #999999;">Team:</view>
  197. <view>{{item.userGroupTitle}}</view>
  198. </view>
  199. <block v-else>
  200. <view class="product" v-if="item.products && item.products.length > 0">
  201. <view scroll-x="true" :class="'pro-view' + (item.products.length == 1 ? ' pro-view1' : '')">
  202. <view class="li" v-for="(it, idx) in item.products" :key="idx" @click="toProductDetail(it)">
  203. <view class="ddflex">
  204. <image :src="it.pic + '?x-oss-process=style/w375'" mode="aspectFill" class="pro-pic"></image>
  205. <view class="fflex">
  206. <view class="title tovers">{{ it.title }}</view>
  207. <view class="opts ddflex">
  208. <view class="money">¥{{ it.salePrice }}</view>
  209. <view class="pro-btn">购买</view>
  210. </view>
  211. </view>
  212. </view>
  213. </view>
  214. </view>
  215. </view>
  216. </block>
  217. </block>
  218. <view class="opt ddflex" v-if="!item.source && type != 3">
  219. <view class="fflex" @click="jumpUrlDetail(item)">{{ item.count.browseCount }}次浏览</view>
  220. <view class="ddflex" @click="submitFabulous(2, item.id, index)">
  221. <image :src="'../../static/images/' + (item.isPraise == 1 ? 'like_h' : 'like') + '.png'"></image>
  222. {{ item.count.fabulousCount < 99 ? item.count.fabulousCount : '99+' }}
  223. </view>
  224. <view class="ddflex" @click="jumpUrlDetail(item)">
  225. <image src="../../static/images/comment.png"></image>
  226. {{ item.count.commentCount < 99 ? item.count.commentCount : '99+' }}
  227. </view>
  228. <button open-type="share" class="opt-share ddflex">
  229. <image src="../../static/images/share.png"></image>
  230. 分享
  231. </button>
  232. </view>
  233. </view>
  234. </view>
  235. <view class="nodata" v-else>
  236. <image :src="picUrlss + 'empty_jl.png'"></image>
  237. <text>{{ type == 1 ? '暂无动态' : type == 2 ? '暂无提问' : type == 3 ? '暂无日记' : '' }}</text>
  238. </view>
  239. </view>
  240. </template>
  241. <script>
  242. //获取应用实例
  243. const app = getApp();
  244. const req = require('../../utils/request.js');
  245. const api = require('../../utils/api.js');
  246. const util = require('../../utils/util.js');
  247. export default {
  248. data() {
  249. return {
  250. picUrlss: req.public.picUrls,
  251. systems: {},
  252. userInfo: '',
  253. isLoad: true,
  254. form: {
  255. page: 1,
  256. limit: 10
  257. },
  258. type: 1, //1 聊一聊,2提问 3日记
  259. pageList: [],
  260. isShowView: false,
  261. userId: '',
  262. userDetail: '',
  263. videoCurrent: null,
  264. videoContext: '',
  265. config: {},
  266. currentPoi: {},
  267. total:0,
  268. isFocus: false,//是否已关注
  269. myTeamList:[],
  270. exreciseData:{},
  271. isOpenWeRunData:false,
  272. userMatchList:[]
  273. };
  274. },
  275. onLoad(opt) {
  276. this.userId = opt.userId;
  277. this.userInfo = req.getStorage('userInfo');
  278. this.getOfficeList();
  279. this.getUserTeam()
  280. this.getUserMatchList()
  281. },
  282. onShow() {
  283. this.getUserDetail();
  284. this.getFocusState();
  285. this.config = JSON.parse(req.getStorage('configRes'))
  286. },
  287. onReachBottom() {
  288. this.form.page++;
  289. this.getOfficeList();
  290. },
  291. methods: {
  292. jumpUrl(url) {
  293. uni.navigateTo({
  294. url: url
  295. });
  296. },
  297. jumpUrlPoi(item,url){
  298. this.currentPoi = item;
  299. uni.navigateTo({
  300. url: url
  301. })
  302. },
  303. removeHtml(content) {
  304. return util.removeHtml(content);
  305. },
  306. jumpCollection() {
  307. if (this.userId == this.userInfo.id) {
  308. this.jumpUrl('/topics/release/release?type=2');
  309. }
  310. },
  311. jumpFans() {
  312. if (this.userId == this.userInfo.id) {
  313. this.jumpUrl('/topics/fans/fans?type=2');
  314. }
  315. },
  316. //预览图片
  317. previewImgss(picUrls, index) {
  318. //预览合同图片
  319. var src = picUrls[index];
  320. let imgs = picUrls;
  321. uni.previewImage({
  322. current: src, // 当前显示图片的http链接
  323. urls: imgs
  324. });
  325. },
  326. jumpUrlDetail(item) {
  327. //日记,不做跳转
  328. if(this.type==3){
  329. return;
  330. }
  331. if (item.source) {
  332. this.jumpUrl('/office/detail/detail?contentId=' + item.source);
  333. } else {
  334. this.jumpUrl('/office/detail/detail?contentId=' + item.id);
  335. }
  336. },
  337. toProductDetail(it) {
  338. if (!req.isLogins(true)) {
  339. return;
  340. }
  341. if(it.actId){
  342. app.globalData.openPage('group/detail/detail?id=' + it.id + '&groupId=' + it.actId);
  343. }else{
  344. app.globalData.openPage('product/detail/detail?id=' + it.id);
  345. }
  346. },
  347. toUserHomePage(userId) {
  348. this.jumpUrl('/topics/home/home?userId=' + userId);
  349. },
  350. //切换类型
  351. swiType(type) {
  352. this.isLoad = true;
  353. this.form.page = 1;
  354. this.type = type;
  355. this.getOfficeList();
  356. },
  357. getUserDetail() {
  358. req.getRequest('/api/v3/moments/getUser', { userId: this.userId }, data => {
  359. this.userDetail = data;
  360. this.isShowView = true;
  361. });
  362. },
  363. sum(arr) {
  364. var s = 0;
  365. for (var i=arr.length-1; i>=0; i--) {
  366. if(arr[i].count){
  367. s += Number(arr[i].count);
  368. }
  369. }
  370. return s;
  371. },
  372. getOfficeList() {
  373. let that = this;
  374. var pramData = this.form;
  375. // pramData.type = this.type;
  376. pramData.orderType = 2;
  377. pramData.userId = this.userId;
  378. if (!this.isLoad) return false;
  379. this.isLoad = false;
  380. req.getRequest('/api/v3/moments/page', pramData, data => {
  381. if(data.list&&data.list.length > 0){
  382. this.total = data.total
  383. data.list.map(it=>{
  384. if(it.qyPoll && it.qyPoll.isEnd){
  385. it.qyPoll.voteCount = that.sum(JSON.parse(it.qyPoll.optionJson))
  386. }
  387. if(it.url){
  388. let h = it.url.substring(it.url.lastIndexOf('.') + 1)
  389. if(h.indexOf('mp4')<0&&h.indexOf('MP4')<0){
  390. it.url = it.url.split(',');
  391. }else{
  392. it.isHaveVideo = true
  393. it.isControls = false
  394. it.isShowPlayBtn = true
  395. }
  396. }
  397. it.content = '<div style="overflow: hidden;text-overflow: ellipsis;display: -webkit-box;-webkit-line-clamp: 5;-webkit-box-orient: vertical;word-break: break-all;">' + it.content + '</div>'
  398. return it;
  399. })
  400. }
  401. if (data.list && data.list.length >= this.form.limit) {
  402. this.isLoad = true;
  403. }
  404. if (this.form.page > 1) {
  405. data.list = this.pageList.concat(data.list);
  406. }
  407. this.pageList = data.list;
  408. this.isShowView = true;
  409. });
  410. },
  411. //提交点赞、取消点赞;收藏、取消收藏
  412. submitFabulous(type, id, index) {
  413. if (!req.isLogins(true)) {
  414. return;
  415. }
  416. var dataP = {};
  417. dataP.type = type; //1,观看 ,2点赞,3评论,4分享,5收藏
  418. dataP.momentsId = id;
  419. req.postRequestLoding('/api/v3/fabulous/save', dataP, data => {
  420. if (type == 2) {
  421. //动态点赞
  422. if (this.pageList[index].isPraise == 1) {
  423. //已赞
  424. this.pageList[index].isPraise = 0;
  425. this.pageList[index].count.fabulousCount--;
  426. } else {
  427. this.pageList[index].isPraise = 1;
  428. this.pageList[index].count.fabulousCount++;
  429. }
  430. }
  431. });
  432. },
  433. //提交投票
  434. submitPoll(item, pIndex, pollIndex) {
  435. if(item.qyPoll.isEnd) return false;
  436. var dataP = {};
  437. // dataP.id = item.id;
  438. dataP.pollId = item.qyPoll.id;
  439. var pollObjList = JSON.parse(item.qyPoll.optionJson);
  440. dataP.pollOptionCode = pollObjList[pollIndex].code;
  441. req.postRequest('/api/v3/poll/saveDetails', dataP, data => {
  442. req.msg('投票成功');
  443. //图片完之后要将该投票的对象返回,便于做渲染%
  444. this.pageList[pIndex].qyPoll = data;
  445. });
  446. },
  447. videoPlay(index){
  448. var that = this;
  449. var curIdx = index;
  450. this.pageList[index].isControls = true
  451. this.pageList[index].isShowPlayBtn = false
  452. // 有播放时先将prev暂停,再播放当前点击的current
  453. if (that.videoCurrent != null) {
  454. var videoContextPrev = uni.createVideoContext('myVideo' + that.videoCurrent)
  455. if (that.videoCurrent != curIdx) {
  456. this.pageList[that.videoCurrent].isControls = false
  457. this.pageList[that.videoCurrent].isShowPlayBtn = true
  458. videoContextPrev.stop()
  459. }
  460. that.videoCurrent = curIdx
  461. var videoContextCurrent = uni.createVideoContext('myVideo' + curIdx)
  462. videoContextCurrent.play()
  463. } else {
  464. // 没有播放时播放视频
  465. that.videoCurrent = curIdx
  466. var videoContext = uni.createVideoContext('myVideo' + curIdx) // 对应的视频id
  467. videoContext.play()
  468. }
  469. },
  470. videoPause(index){
  471. this.pageList[index].isControls = false
  472. this.pageList[index].isShowPlayBtn = true
  473. },
  474. videoEnded(index){
  475. this.pageList[index].isControls = false
  476. this.pageList[index].isShowPlayBtn = true
  477. },
  478. behaviorOpt(){
  479. if(this.isFocus){
  480. this.delFocus()
  481. }else{
  482. this.focusOn()
  483. }
  484. },
  485. focusOn(){
  486. let params = {
  487. behavior: 1,
  488. bindId: this.userId,
  489. type: 11
  490. }
  491. req.postRequest(api.behavior_save,params,data=>{
  492. req.msg('已关注');
  493. setTimeout(()=>{
  494. this.getFocusState();
  495. },1000)
  496. this.getUserDetail();
  497. })
  498. },
  499. delFocus(){
  500. let params = {
  501. behavior: 1,
  502. bindId: this.userId,
  503. type: 11
  504. }
  505. req.postRequest(api.behavior_save,params,data=>{
  506. req.msg('已取消关注');
  507. setTimeout(()=>{
  508. this.getFocusState();
  509. },1000)
  510. this.getUserDetail();
  511. })
  512. },
  513. getFocusState(){
  514. let params = {
  515. behavior: 1,
  516. bindId: this.userId,
  517. type: 11,
  518. uid:req.getStorage('userInfo').id
  519. }
  520. req.getRequest(api.behavior_get,params,data=>{
  521. this.isFocus = data;
  522. })
  523. },
  524. // 用户加入的团队
  525. getUserTeam(){
  526. let form = {
  527. teamType:3,
  528. userId:this.userId
  529. };
  530. req.getRequest(api.user_team_list,form,data=>{
  531. this.myTeamList = data.list
  532. })
  533. },
  534. // 获取运动统计数据
  535. getExreciseData(){
  536. req.getRequest('/api/v3/wxRun/todayInfo', {userId:this.userId}, data => {
  537. this.exreciseData = data
  538. })
  539. },
  540. // 获取用户已参加活动
  541. getUserMatchList(){
  542. req.getRequest('/api/match/user', {uid:this.userId,type:'ycs'}, data => {
  543. this.userMatchList = data
  544. })
  545. },
  546. // 数字格式化
  547. unitConverter(num){
  548. return util.unitConverter(num)
  549. },
  550. joinTeam(item,index){
  551. if(item.isJoin == 1) {
  552. uni.navigateTo({
  553. url: '/office/team/index?id='+item.id
  554. })
  555. return false;
  556. }
  557. if(item.relationMatch){
  558. uni.navigateTo({
  559. url: '/match/activityDetail/activityDetail?id='+item.relationMatch.id
  560. })
  561. return false;
  562. }
  563. req.postRequest(api.user_team_follow,{userGroupId: item.id},data=>{
  564. req.msg('加入团队成功');
  565. item.isJoin=1
  566. })
  567. }
  568. },
  569. created() {
  570. const systemInfo = uni.getSystemInfoSync();
  571. // px转换到rpx的比例
  572. let pxToRpxScale = 750 / systemInfo.windowWidth;
  573. let systems = {
  574. ktxStatusHeight: systemInfo.statusBarHeight * pxToRpxScale, // 状态栏的高度
  575. navigationHeight: 44 * pxToRpxScale // 导航栏的高度
  576. };
  577. systems.barHeight = systems.ktxStatusHeight + systems.navigationHeight;
  578. this.systems = systems;
  579. }
  580. };
  581. </script>
  582. <style>
  583. @import './home.css';
  584. </style>