home.vue 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605
  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" 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. req.saveBehaviorNew(id, this.pageList[index].pollId?10:11,11)
  427. } else {
  428. this.pageList[index].isPraise = 1;
  429. this.pageList[index].count.fabulousCount++;
  430. req.saveBehaviorNew(id, this.pageList[index].pollId?10:11,3)
  431. }
  432. }
  433. });
  434. },
  435. //提交投票
  436. submitPoll(item, pIndex, pollIndex) {
  437. if(item.qyPoll.isEnd) return false;
  438. var dataP = {};
  439. // dataP.id = item.id;
  440. dataP.pollId = item.qyPoll.id;
  441. var pollObjList = JSON.parse(item.qyPoll.optionJson);
  442. dataP.pollOptionCode = pollObjList[pollIndex].code;
  443. req.postRequest('/api/v3/poll/saveDetails', dataP, data => {
  444. req.msg('投票成功');
  445. //图片完之后要将该投票的对象返回,便于做渲染%
  446. this.pageList[pIndex].qyPoll = data;
  447. req.saveBehaviorNew(item.id,10,5)
  448. });
  449. },
  450. videoPlay(index){
  451. var that = this;
  452. var curIdx = index;
  453. this.pageList[index].isControls = true
  454. this.pageList[index].isShowPlayBtn = false
  455. // 有播放时先将prev暂停,再播放当前点击的current
  456. if (that.videoCurrent != null) {
  457. var videoContextPrev = uni.createVideoContext('myVideo' + that.videoCurrent)
  458. if (that.videoCurrent != curIdx) {
  459. this.pageList[that.videoCurrent].isControls = false
  460. this.pageList[that.videoCurrent].isShowPlayBtn = true
  461. videoContextPrev.stop()
  462. }
  463. that.videoCurrent = curIdx
  464. var videoContextCurrent = uni.createVideoContext('myVideo' + curIdx)
  465. videoContextCurrent.play()
  466. } else {
  467. // 没有播放时播放视频
  468. that.videoCurrent = curIdx
  469. var videoContext = uni.createVideoContext('myVideo' + curIdx) // 对应的视频id
  470. videoContext.play()
  471. }
  472. },
  473. videoPause(index){
  474. this.pageList[index].isControls = false
  475. this.pageList[index].isShowPlayBtn = true
  476. },
  477. videoEnded(index){
  478. this.pageList[index].isControls = false
  479. this.pageList[index].isShowPlayBtn = true
  480. },
  481. behaviorOpt(){
  482. if(this.isFocus){
  483. this.delFocus()
  484. }else{
  485. this.focusOn()
  486. }
  487. },
  488. focusOn(){
  489. let params = {
  490. behavior: 1,
  491. bindId: this.userId,
  492. type: 11
  493. }
  494. req.postRequest(api.behavior_save,params,data=>{
  495. req.msg('已关注');
  496. setTimeout(()=>{
  497. this.getFocusState();
  498. },1000)
  499. this.getUserDetail();
  500. })
  501. },
  502. delFocus(){
  503. let params = {
  504. behavior: 1,
  505. bindId: this.userId,
  506. type: 11
  507. }
  508. req.postRequest(api.behavior_save,params,data=>{
  509. req.msg('已取消关注');
  510. setTimeout(()=>{
  511. this.getFocusState();
  512. },1000)
  513. this.getUserDetail();
  514. })
  515. },
  516. getFocusState(){
  517. let params = {
  518. behavior: 1,
  519. bindId: this.userId,
  520. type: 11,
  521. uid:req.getStorage('userInfo').id
  522. }
  523. req.getRequest(api.behavior_get,params,data=>{
  524. this.isFocus = data;
  525. })
  526. },
  527. // 用户加入的团队
  528. getUserTeam(){
  529. let form = {
  530. teamType:3,
  531. userId:this.userId
  532. };
  533. req.getRequest(api.user_team_list,form,data=>{
  534. this.myTeamList = data.list
  535. })
  536. },
  537. // 获取运动统计数据
  538. getExreciseData(){
  539. req.getRequest('/api/v3/wxRun/todayInfo', {userId:this.userId}, data => {
  540. this.exreciseData = data
  541. })
  542. },
  543. // 获取用户已参加活动
  544. getUserMatchList(){
  545. req.getRequest('/api/match/user', {uid:this.userId,type:'ycs'}, data => {
  546. this.userMatchList = data
  547. })
  548. },
  549. // 数字格式化
  550. unitConverter(num){
  551. return util.unitConverter(num)
  552. },
  553. joinTeam(item,index){
  554. if(item.isJoin == 1) {
  555. uni.navigateTo({
  556. url: '/office/team/index?id='+item.id
  557. })
  558. return false;
  559. }
  560. if(item.relationMatch){
  561. uni.navigateTo({
  562. url: '/match/activityDetail/activityDetail?id='+item.relationMatch.id
  563. })
  564. return false;
  565. }
  566. req.postRequest(api.user_team_follow,{userGroupId: item.id},data=>{
  567. req.msg('加入团队成功');
  568. item.isJoin=1
  569. })
  570. }
  571. },
  572. created() {
  573. const systemInfo = uni.getSystemInfoSync();
  574. // px转换到rpx的比例
  575. let pxToRpxScale = 750 / systemInfo.windowWidth;
  576. let systems = {
  577. ktxStatusHeight: systemInfo.statusBarHeight * pxToRpxScale, // 状态栏的高度
  578. navigationHeight: 44 * pxToRpxScale // 导航栏的高度
  579. };
  580. systems.barHeight = systems.ktxStatusHeight + systems.navigationHeight;
  581. this.systems = systems;
  582. }
  583. };
  584. </script>
  585. <style>
  586. @import './home.css';
  587. </style>