index.vue 32 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935
  1. <template>
  2. <view>
  3. <view :class="'top ddflex'+(config.greyTheme==1?' grayTheme':'')">
  4. <view class="top-tab ddflex fflex">
  5. <view :class="'li ' + (currentTab == 1 ? 'active' : '')" @click="swiTab(1)">话题</view>
  6. <view :class="'li ' + (currentTab == 2 ? 'active' : '')" @click="swiTab(2)">投票</view>
  7. <view :class="'li ' + (currentTab == 3 ? 'active' : '')" @click="swiTab(3)">团队</view>
  8. </view>
  9. <view class="search ddflex" @click="jumpUrl('/office/search/index?currentTab='+currentTab)">
  10. <image src="../../static/images/ssico.png"></image>
  11. 搜索你感兴趣的
  12. </view>
  13. </view>
  14. <view style="height: 100rpx;"></view>
  15. <view :class="(config.greyTheme==1?' grayTheme':'')">
  16. <block v-if="currentTab == 1 || currentTab == 2">
  17. <block v-if="currentTab == 1">
  18. <view class="t-con">
  19. <view class="item">
  20. <navigator url="/topics/index/index" hover-class="none" class="tits ddflex">
  21. <image :src="picUrlss+'office_images/hot.png'" class="hot"></image>
  22. <view class="more ddflex">更多<image src="../../static/images/n_rico.png"></image>
  23. </view>
  24. </navigator>
  25. <view class="item-list">
  26. <view class="li ddflex" v-for="(item, index) in hotTopicList" :key="index"
  27. @click="jumpUrl('/topics/detail/detail?topicId=' + item.id)">
  28. <text class="num">{{ index + 1 }}</text>
  29. <view class="fflex tover">{{ item.title }}</view>
  30. <text>{{ item.participantsNO }}参与</text>
  31. </view>
  32. </view>
  33. </view>
  34. </view>
  35. <view v-if="cmsList.length>0">
  36. <view class="ddflex"
  37. style="padding:0rpx 30rpx;font-size: 32rpx;color: #1A1F30;font-weight: bold;justify-content: space-between;"
  38. @click="jumpUrl('/topic/contentList/contentList?title=官方动态')">
  39. <view>官方动态</view>
  40. <image style="width: 14rpx;height: 24rpx;" src="../../static/images/n_rico.png"></image>
  41. </view>
  42. <view class="list">
  43. <view class="li" v-for="(item, index) in cmsList" :key="index"
  44. @click="jumpUrl('/topic/content/content?id=' + item.id+'&title=官方动态')">
  45. <view class="user ddflex">
  46. <image :src="config.CONFIG_PROJECT_LOGO" style="border:1px solid #eeeeee;padding: 5rpx;"
  47. mode="aspectFill" class="userimg"></image>
  48. <view class="fflex">
  49. <view class="namea ddflex">
  50. <view class="name fflex ddflex">
  51. <!-- {{ config.CONFIG_NAME }} -->
  52. 社区管理员
  53. <view class="guanfang">官方</view>
  54. </view>
  55. <view class="time">{{ getDateTimeStamp(item.createDate) }}</view>
  56. </view>
  57. <view class="area">湖南·长沙</view>
  58. </view>
  59. </view>
  60. <view class="ddflex step-box" style="justify-content: space-between;">
  61. <image class="step-pic" style="width: 199rpx;height: 150rpx;" :src="item.pic"
  62. mode="aspectFill"></image>
  63. <view class="fflex">
  64. <view class="step-title tovers" style="font-size: 30rpx;line-height: 40rpx;">
  65. {{item.title}}</view>
  66. <view class="opt ddflex" style="justify-content: space-between;">
  67. <view class="fflex">{{fomatNumbers(item.browse)}}次浏览</view>
  68. <view class="ddflex" @click.stop="addThumbs(item,index)">
  69. <image
  70. :src="'../../static/images/' + (item.isThumbs? 'like_h' : 'like') + '.png'">
  71. </image>
  72. {{fomatNumbers(item.thumbsNumber)}}
  73. </view>
  74. </view>
  75. </view>
  76. </view>
  77. </view>
  78. </view>
  79. </view>
  80. <view class="tab ddflex" style="border-top: 20rpx solid #f7f7f7;">
  81. <view :class="'li ' + (pType == 11 ? 'active' : '')" @click="swiPType(11)">附近</view>
  82. <!-- <view :class="'li ' + (pType == 1 ? 'active' : '')" @click="swiPType(1)">综合</view> -->
  83. <!-- <view :class="'li ' + (cateIndex == index ? 'active' : '')" @click="swiTree(item,index)" v-for="(item,index) in category" :key="index">{{item.name}}</view> -->
  84. <view :class="'li ' + (pType == 12 ? 'active' : '')" @click="swiPType(12)">最新</view>
  85. <!-- <view :class="'li ' + (pType == 5 ? 'active' : '')" @click="swiPType(5)">热门</view> -->
  86. </view>
  87. <view class="loc-wz ddflex" v-if="pois&&pois.poiName&&pType==11"
  88. @click="jumpUrlPoi(pois,'/office/poi/index')">
  89. <view class="loc-wzs ddflex">
  90. <image :src="picUrlss+'office_images/loca.png'"></image>{{pois.poiName}}
  91. </view>
  92. </view>
  93. </block>
  94. <view :class="'cons-b'+(currentTab==2?' cons-b-tp':'')">
  95. <view class="list" v-if="officeList && officeList.length > 0">
  96. <view class="li" v-for="(item, index) in officeList" :key="index">
  97. <view class="user ddflex" @click="jumpUrl('/topics/home/home?userId=' + item.userDTO.id)">
  98. <image :src="item.userDTO.avatar" mode="aspectFill" class="userimg"></image>
  99. <view class="fflex">
  100. <view class="namea ddflex">
  101. <view class="name fflex ddflex">{{ item.userDTO.nickName }}
  102. <!-- <image src="../../static/images/vip_tag.png" class="vip-tag" v-if="item.userDTO.levelGrade > 0"></image> -->
  103. <image v-if="item.userDTO.isOpenWeRunData"
  104. style="width:15rpx;height:20rpx;margin-left: 10rpx;"
  105. src="../../static/images/yd.png"></image>
  106. </view>
  107. <view class="time">{{ item.time }}</view>
  108. </view>
  109. <view class="area" v-if="item.userDTO.cityName">{{ item.userDTO.provinceName }}
  110. {{ item.userDTO.cityName }}</view>
  111. </view>
  112. </view>
  113. <view class="des" @click="jumpUrlDetail(item)"><rich-text :nodes="item.content"></rich-text>
  114. </view>
  115. <!-- //如果有投票,就不显示图片 -->
  116. <block v-if="!item.qyPoll">
  117. <view class="video" v-if="item.isHaveVideo && config.open_community_video == 1">
  118. <video :src="item.url" :show-center-play-btn="false" :controls="item.isControls"
  119. :autoplay="item.isControls" :id="'myVideo'+index" @pause="videoPause(index)"
  120. @ended="videoEnded(index)"></video>
  121. <view class="video-play ddflex" @click="videoPlay(index)" v-if="item.isShowPlayBtn">
  122. <image src="../../static/images/play.png"></image>
  123. </view>
  124. </view>
  125. <view class="imgbox ddflex" @click="jumpUrlDetail(item)" v-if="!item.isHaveVideo">
  126. <!-- @click="previewImgss(item.url, idx)" -->
  127. <block v-if="item.url&&item.url.length>0">
  128. <image mode="aspectFill" v-for="(it, idx) in item.url" :src="it" :key="idx"></image>
  129. </block>
  130. </view>
  131. </block>
  132. <!-- 话题 -->
  133. <view class="ddflex" v-if="item.qyDialogu">
  134. <view class="topic ddflex"
  135. @click="jumpUrl('/topics/detail/detail?topicId=' + item.qyDialogu.id)">
  136. <image src="../../static/images/topic.png"></image>
  137. {{ item.qyDialogu.title }}
  138. </view>
  139. <!-- <view class="topic ddflex" @click="jumpUrl('/topics/detail/detail?topicId=' + item.qyDialogu.id)">
  140. <image src="../../static/images/topic.png"></image>
  141. {{ item.qyDialogu.title }}
  142. </view> -->
  143. </view>
  144. <view class="loca ddflex" @click="jumpUrlPoi(item,'/office/poi/index')" v-if="item.poiName">
  145. <image :src="picUrlss+'office_images/loca.png'"></image><text
  146. v-if="item.poiDistance > 0">{{item.poiDistance ? item.poiDistance < 1000 ? item.poiDistance+'m' : (item.poiDistance/1000).toFixed(1)+'km' : ''}}</text>{{item.poiName}}
  147. </view>
  148. <!-- 投票 -->
  149. <view :class="'vote-box' + (item.qyPoll.isEnd ? ' ends' : '')" v-if="item.qyPoll">
  150. <view class="vote-tit">{{ item.qyPoll.title }}</view>
  151. <block v-if="item.qyPoll.isVote == 1">
  152. <view class="vote-list end" @click="jumpUrlDetail(item)">
  153. <view :class="'lis ddflex ' + (itpy.isVote == 1 ? 'active' : '')"
  154. v-for="(itpy, idex) in JSON.parse(item.qyPoll.optionJson)" :key="idex">
  155. <view class="percent" :style="'width:' + parseFloat(itpy.proportion) + '%;'">
  156. </view>
  157. <view class="fflex">{{ itpy.name }}</view>
  158. <view>{{ parseFloat(itpy.proportion) + '%' }}</view>
  159. </view>
  160. </view>
  161. </block>
  162. <block v-else>
  163. <view class="vote-list">
  164. <view class="lis" v-for="(itpy, idex) in JSON.parse(item.qyPoll.optionJson)"
  165. :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">
  171. <text>{{item.qyPoll.voteCount}}人参与</text>投票已结束</view>
  172. </view>
  173. <block v-if="item.type==10||item.type==11">
  174. <view v-if="item.type==10" class="ddflex step-box" style="justify-content: space-between;"
  175. @click="jumpUrl('/exercise/record/record?userId=' + item.userId)">
  176. <view>
  177. <view class="step-date">{{item.wxRun.step}}</view>
  178. <view class="step-label">步数</view>
  179. </view>
  180. <view>
  181. <view class="step-date">{{item.wxRun.index}}</view>
  182. <view class="step-label" style="text-align: right;">名次</view>
  183. </view>
  184. </view>
  185. <view v-if="item.type==11" class="ddflex step-box" style="justify-content: space-between;"
  186. @click="jumpUrl('/match/activityDetail/activityDetail?id=' + item.matchContent.id)">
  187. <image class="step-pic" :src="item.matchContent.pic" mode="aspectFill"></image>
  188. <view class="fflex">
  189. <view class="step-title tovers">{{item.matchContent.title}}</view>
  190. <view class="ddflex" style="justify-content: space-between;margin-top: 10rpx;">
  191. <view class="step-price">{{item.matchContent.endTime}}</view>
  192. <view class="step-btn">查看</view>
  193. </view>
  194. </view>
  195. </view>
  196. </block>
  197. <view v-if="item.userGroupId" class="ddflex step-box" style="padding: 25rpx 21rpx;"
  198. @click="jumpUrl('/office/team/index?id=' + item.userGroupId)">
  199. <image style="width: 24rpx;height: 24rpx;margin-right: 13rpx;"
  200. src="../../static/images/link.png"></image>
  201. <view style="font-weight: 500;color: #999999;">Team:</view>
  202. <view>{{item.userGroupTitle}}</view>
  203. </view>
  204. <block v-else>
  205. <view class="product" v-if="item.products && item.products.length > 0">
  206. <view scroll-x="true" class="pro-view pro-view1" v-if="item.products.length == 1">
  207. <view class="lis" v-for="(it, idx) in item.products" :key="idx"
  208. @click="toProductDetail(it)">
  209. <view class="ddflex">
  210. <image :src="it.pic" mode="aspectFill"
  211. class="pic"></image>
  212. <view class="fflex">
  213. <view class="title tover">{{ it.title }}</view>
  214. <view class="opts ddflex">
  215. <view class="money"><text>¥</text>{{ it.salePrice }}</view>
  216. <view class="pro-btn">
  217. <image src="../../static/pages/images/n_cart.png"></image>
  218. </view>
  219. </view>
  220. </view>
  221. </view>
  222. </view>
  223. </view>
  224. <scroll-view scroll-x="true" class="pro-view" v-else>
  225. <view class="lis" v-for="(it, idx) in item.products" :key="idx"
  226. @click="toProductDetail(it)">
  227. <view class="ddflex">
  228. <image :src="it.pic" mode="aspectFill"
  229. class="pic"></image>
  230. <view class="fflex">
  231. <view class="title tover">{{ it.title }}</view>
  232. <view class="opts ddflex">
  233. <view class="money"><text>¥</text>{{ it.salePrice }}</view>
  234. <view class="pro-btn">
  235. <image src="../../static/pages/images/n_cart.png"></image>
  236. </view>
  237. </view>
  238. </view>
  239. </view>
  240. </view>
  241. </scroll-view>
  242. </view>
  243. </block>
  244. <view class="opt ddflex" v-if="!item.source">
  245. <view class="fflex" @click="jumpUrlDetail(item)">{{fomatNumbers(item.count.browseCount)}}次浏览
  246. </view>
  247. <view class="ddflex" @click="submitFabulous(2, item.id, index)">
  248. <image
  249. :src="'../../static/images/' + (item.isPraise == 1 ? 'like_h' : 'like') + '.png'">
  250. </image>
  251. {{fomatNumbers(item.count.fabulousCount)}}
  252. </view>
  253. <view class="ddflex" @click="jumpUrlDetail(item)" v-if="config.is_show_create_btn == 1">
  254. <image src="../../static/images/comment.png"></image>
  255. {{fomatNumbers(item.count.commentCount)}}
  256. </view>
  257. <button open-type="share" hover-class="none" class="opt-share ddflex">
  258. <image src="../../static/images/share.png"></image>
  259. 分享
  260. </button>
  261. </view>
  262. </view>
  263. </view>
  264. <view class="nodata" v-else>
  265. <image :src="picUrlss + 'empty_jl.png'"></image>
  266. <text>暂无动态</text>
  267. </view>
  268. </view>
  269. </block>
  270. <block v-if="currentTab == 3">
  271. <view class="m-team" v-if="userTeamList.length>0">
  272. <view class="m-tits ddflex" @click="jumpUrl('/office/myTeam/index')">
  273. <view class="fflex">我的团队</view>
  274. <view class="m-nums ddflex">{{userTeamTotal}}个团队<image src="../../static/pages/images/more.png">
  275. </image>
  276. </view>
  277. </view>
  278. <view class="map-team">
  279. <scroll-view scroll-x="true" class="map-teams">
  280. <view class="li" v-for="(item,index) in userTeamList" :key="index"
  281. @click="jumpUrlTeam(item,'/office/team/index?id='+item.id)">
  282. <view class="ddflex">
  283. <image :src="item.url?item.url:picUrlss+'office_images/team_default.png'"
  284. mode="aspectFill"></image>
  285. <view class="fflex">
  286. <view class="tover">{{item.title}}</view>
  287. <text>日新贴{{item.dayMomentsNum}}</text>
  288. </view>
  289. <view class="li-btn" v-if="item.auditStatus == 1">去看看</view>
  290. <view :class="'sta'+(item.auditStatus == 2 ? ' fail':'')" v-else>
  291. {{item.auditStatus == 0 ? '审核中' : '审核失败'}}</view>
  292. </view>
  293. </view>
  294. </scroll-view>
  295. </view>
  296. </view>
  297. <view class="team-list" v-if="teamList.length>0">
  298. <view v-for="(item,index) in teamList" :key="index">
  299. <view class="li ddflex" @click="jumpUrl('/office/team/index?id='+item.id)">
  300. <image :src="item.url?item.url:picUrlss+'office_images/team_default.png'" mode="aspectFill"
  301. class="team-img"></image>
  302. <view class="fflex">
  303. <view class="ddflex">
  304. <view class="team-tit tover" style="max-width: calc(100% - 80rpx);">{{item.title}}
  305. </view>
  306. <!-- <view v-if="item.relationMatch" style="margin-left: 10rpx; width: 60rpx;line-height: 29rpx;font-size: 20rpx;color: #FFFFFF;background: linear-gradient(56deg, #FF7000 0%, #FF9100 100%);border-radius: 5rpx;text-align: center;">赛事</view> -->
  307. <!-- <view v-else style="margin-left: 10rpx;width: 60rpx;line-height: 29rpx;font-size: 20rpx;color: #FFFFFF;background: linear-gradient(48deg, #5190FF 0%, #78A9FF 100%);border-radius: 5rpx;text-align: center;">社区</view> -->
  308. </view>
  309. <view class="team-sta">
  310. <text>{{item.memberNum}}成员</text>
  311. <text>{{item.momentsNum}}帖子</text>
  312. </view>
  313. </view>
  314. <view class="join-btn" @click.stop="joinTeam(item,index)">加入</view>
  315. </view>
  316. <view v-if="item.relationMatch" class="ddflex"
  317. style="background: #F7F8FC;border-radius: 10rpx;padding: 18rpx 20rpx;margin-top: 20rpx;margin-left: 96rpx;color: #999;font-size: 24rpx;"
  318. @click="jumpUrl('/match/activityDetail/activityDetail?id='+item.relationMatch.id)">
  319. 来自
  320. <view class="fflex tover" style="color: var(--main);">{{item.relationMatch.title}}</view>
  321. </view>
  322. </view>
  323. </view>
  324. <view class="nodata" v-else>
  325. <image :src="picUrlss + 'empty_jl.png'"></image>
  326. <text>暂无团队</text>
  327. </view>
  328. </block>
  329. </view>
  330. <view :class="'create'+(config.greyTheme==1?' grayTheme':'')" @click="showBtn"
  331. v-if="config.is_show_create_btn == 1">
  332. <image style="display: block;" src="/static/images/create.png"></image>发布
  333. </view>
  334. <view :class="'ceng'+(config.greyTheme==1?' grayTheme':'')" v-if="isShowbtn" @click="hideBtn"></view>
  335. <!-- @click="createJump('/office/news/news?newsType=1')" -->
  336. <view :class="'side ddflex'+(config.greyTheme==1?' grayTheme':'')" v-if="isShowbtn">
  337. <view class="li" @click="createJump('/office/createTeam/index')">
  338. <image src="/static/images/ll_dt.png"></image>
  339. <view>创建团队</view>
  340. </view>
  341. <view class="li" @click="createJump('/office/news/news?newsType=1')">
  342. <image src="/static/images/ll_cz.png"></image>
  343. <view>发帖</view>
  344. </view>
  345. </view>
  346. <foot channel="interactive" :isUpdate="false"></foot>
  347. </view>
  348. </template>
  349. <script>
  350. const app = getApp();
  351. const api = require('../../utils/api.js');
  352. const req = require('../../utils/request.js');
  353. const util = require('../../utils/util.js');
  354. const QQMapWX = require("../../utils/qqmap.js");
  355. import foot from "../../components/nav-bar/index.vue"
  356. export default {
  357. components: {
  358. foot
  359. },
  360. data() {
  361. return {
  362. systems: {},
  363. currentTab: 1,
  364. isShowbtn: false,
  365. isShowPage: false,
  366. picUrlss: req.public.picUrls,
  367. isLoad: true,
  368. form: {
  369. page: 1,
  370. limit: 5
  371. },
  372. pType: 11, //排序: 1综合, 2最新+综合,3浏览最多,4评论最多,5热门,10最新+标签,11位置,12时间
  373. isHoleLoad: true,
  374. holeForm: {
  375. page: 1,
  376. limit: 10
  377. },
  378. holeType: 1, //排序: 1综合, 2最新,3浏览最多,4评论最多,5热门
  379. hotTopicList: [],
  380. hotPollList: [],
  381. officeList: [], //聊一聊
  382. config: {},
  383. videoCurrent: null,
  384. videoContext: '',
  385. category: [],
  386. cateIndex: -1,
  387. treeId: '',
  388. pois: {},
  389. currentPoi: {},
  390. teamForm: {
  391. page: 1,
  392. limit: 10
  393. },
  394. isTeamLoad: true,
  395. teamList: [],
  396. userTeamList: [],
  397. userTeamTotal: 0,
  398. isFirst: true,
  399. isRefresh: false,
  400. cmsList: [], //官方动态
  401. }
  402. },
  403. onLoad(options) {
  404. if (req.getStorage('officeList')) {
  405. this.officeList = JSON.parse(req.getStorage('officeList'));
  406. this.isShowPage = true;
  407. }
  408. if (req.getStorage('loctionAddressMap')) {
  409. let pois = req.getStorage('loctionAddressMap').pois[0];
  410. pois.poiName = pois.title;
  411. pois.poiAddress = pois.address;
  412. pois.poiLongitude = pois.location.lng;
  413. pois.poiLatitude = pois.location.lat
  414. this.pois = pois;
  415. this.getOfficeList();
  416. console.log('this.pois==', this.pois)
  417. } else {
  418. QQMapWX.initMap();
  419. req.getLocation(res => {
  420. const to = {
  421. latitude: res.latitude,
  422. longitude: res.longitude
  423. };
  424. QQMapWX.reverseGeocoder(to, resp => {
  425. if (resp) {
  426. resp.pois.map(it => {
  427. it.poiName = it.title;
  428. it.poiAddress = it.address;
  429. it.poiLongitude = it.location.lng;
  430. it.poiLatitude = it.location.lat
  431. return it;
  432. })
  433. this.pois = resp.pois[0];
  434. }
  435. this.getOfficeList();
  436. });
  437. });
  438. }
  439. // req.silenceLogin(options.userId, '');
  440. // this.getHotPoll()
  441. },
  442. onShow() {
  443. // this.getCategory();
  444. this.getConfig();
  445. this.getHotTopic();
  446. this.getCmsList();
  447. if (this.currentTab > 2) {
  448. if (this.isRefresh) {
  449. this.teamForm.page = 1;
  450. this.isTeamLoad = true;
  451. this.getTeamPage();
  452. this.getUserTeam();
  453. this.isRefresh = false;
  454. }
  455. } else {
  456. if (!this.isFirst && this.isRefresh) {
  457. this.form.page = 1;
  458. this.isLoad = true;
  459. this.getOfficeList();
  460. this.isRefresh = false;
  461. }
  462. }
  463. },
  464. onHide() {
  465. this.isShowbtn = false;
  466. },
  467. onReachBottom() {
  468. if (this.currentTab > 1) {
  469. this.teamForm.page++;
  470. this.getTeamPage();
  471. } else {
  472. this.form.page++;
  473. this.getOfficeList();
  474. }
  475. },
  476. methods: {
  477. swiTab(index) {
  478. if (this.currentTab == index) return false;
  479. this.currentTab = index;
  480. if (index == 1) {
  481. this.pType = 11;
  482. } else {
  483. this.pType = 1;
  484. }
  485. this.teamList = [];
  486. this.officeList = [];
  487. if (index > 2) {
  488. this.isTeamLoad = true;
  489. this.teamForm.page = 1;
  490. this.getTeamPage();
  491. this.getUserTeam();
  492. } else {
  493. this.isLoad = true;
  494. this.form.page = 1;
  495. this.getOfficeList();
  496. }
  497. },
  498. //聊一聊切换排序类型
  499. swiPType(type) {
  500. this.isLoad = true;
  501. this.form.page = 1;
  502. this.pType = type;
  503. this.cateIndex = -1
  504. this.treeId = ''
  505. this.getOfficeList();
  506. },
  507. //预览图片
  508. previewImgss(picUrls, index) {
  509. //预览合同图片
  510. var src = picUrls[index];
  511. let imgs = picUrls;
  512. uni.previewImage({
  513. current: src, // 当前显示图片的http链接
  514. urls: imgs
  515. });
  516. },
  517. showBtn() {
  518. if (!req.isLogins(true)) {
  519. return;
  520. }
  521. this.isShowbtn = true;
  522. },
  523. hideBtn() {
  524. this.isShowbtn = false;
  525. },
  526. removeHtml(content) {
  527. return util.removeHtml(content);
  528. },
  529. createJump(url) {
  530. if (!req.isLogins(true)) {
  531. return;
  532. }
  533. this.jumpUrl(url);
  534. },
  535. jumpUrl(url) {
  536. uni.navigateTo({
  537. url: url
  538. })
  539. },
  540. jumpUrlPoi(item, url) {
  541. console.log('item==', item)
  542. this.currentPoi = item;
  543. uni.navigateTo({
  544. url: url
  545. })
  546. },
  547. jumpUrlTeam(item, url) {
  548. console.log('url', url)
  549. if (item.auditStatus == 1) {
  550. this.jumpUrl(url)
  551. } else {
  552. if (item.userId == req.getStorage('userInfo').id) {
  553. this.jumpUrl('/office/createTeam/index?id=' + item.id);
  554. } else {
  555. if (item.auditStatus == 0) {
  556. req.msg('团队正在审核中,暂时无法查看')
  557. } else {
  558. req.msg('团队审核不通过,无法查看')
  559. }
  560. }
  561. }
  562. },
  563. jumpToPractice(item, url) {
  564. let checkCategory = {
  565. id: item.question.cateId,
  566. name: item.question.cateName
  567. }
  568. req.setStorage('checkCategory', checkCategory)
  569. this.jumpUrl(url);
  570. },
  571. jumpUrlDetail(item) {
  572. this.jumpUrl('/office/detail/detail?contentId=' + item.id);
  573. },
  574. toProductDetail(item) {
  575. this.jumpUrl('/product/detail/detail?id=' + item.id);
  576. },
  577. getHotTopic() {
  578. var dataPram = {
  579. page: 1,
  580. limit: 4,
  581. attr: 2
  582. };
  583. req.getRequest('/api/v3/dialogue/list', dataPram, data => {
  584. this.hotTopicList = data;
  585. });
  586. },
  587. getHotPoll() {
  588. var dataPram = {
  589. page: 1,
  590. limit: 4,
  591. attr: 2,
  592. attrType: 0
  593. };
  594. req.getRequest('/api/v3/poll/pollList', dataPram, data => {
  595. this.hotPollList = data;
  596. });
  597. },
  598. getCategory() {
  599. req.getRequest('/api/v3/unified/tree/list', {
  600. type: 1
  601. }, data => {
  602. this.category = data;
  603. })
  604. },
  605. getConfig() {
  606. req.getRequest('/api/other/config', {}, data => {
  607. this.config = data;
  608. })
  609. },
  610. swiTree(item, index) {
  611. if (this.cateIndex == index) return false;
  612. this.cateIndex = index;
  613. this.pType = -1;
  614. this.treeId = item.id;
  615. this.form.page = 1;
  616. this.isLoad = true;
  617. this.getOfficeList()
  618. },
  619. sum(arr) {
  620. var s = 0;
  621. for (var i = arr.length - 1; i >= 0; i--) {
  622. if (arr[i].count) {
  623. s += Number(arr[i].count);
  624. }
  625. }
  626. return s;
  627. },
  628. fomatNumbers(num) {
  629. return util.formatNumbers(num)
  630. },
  631. getOfficeList() {
  632. let that = this;
  633. var pramData = {};
  634. pramData.page = this.form.page;
  635. pramData.limit = this.form.limit;
  636. // pramData.type = 4;
  637. if (this.pType == 5) {
  638. //热门
  639. pramData.isEssence = 2;
  640. } else {
  641. pramData.orderType = this.pType;
  642. }
  643. if (this.treeId) {
  644. pramData.treeId = this.treeId
  645. pramData.orderType = 1
  646. } else delete pramData.treeId
  647. if (this.currentTab < 3) pramData.searchType = this.currentTab; //1话题 2投票 3团队
  648. else delete pramData.searchType;
  649. pramData.poiLongitude = req.getStorage('loctionAddressMap').location.lng ? req.getStorage(
  650. 'loctionAddressMap').location.lng : this.pois.poiLongitude;
  651. pramData.poiLatitude = req.getStorage('loctionAddressMap').location.lat ? req.getStorage(
  652. 'loctionAddressMap').location.lat : this.pois.poiLatitude;
  653. if (this.pType == 11) pramData.distance = 20000;
  654. else delete pramData.distance;
  655. if (!this.isLoad) return false;
  656. this.isLoad = false;
  657. if (pramData.page == 1) {
  658. uni.showLoading({
  659. mask: true
  660. })
  661. }
  662. req.getRequest('/api/v3/moments/page', pramData, data => {
  663. if (data.list && data.list.length > 0) {
  664. data.list.map(it => {
  665. if (it.qyPoll && it.qyPoll.isEnd) {
  666. it.qyPoll.voteCount = that.sum(JSON.parse(it.qyPoll.optionJson))
  667. }
  668. if (it.url) {
  669. let h = it.url.substring(it.url.lastIndexOf('.') + 1)
  670. if (h.indexOf('mp4') < 0 && h.indexOf('MP4') < 0) {
  671. it.url = it.url.split(',');
  672. } else {
  673. it.isHaveVideo = true
  674. it.isControls = false
  675. it.isShowPlayBtn = true
  676. }
  677. }
  678. it.content =
  679. '<div style="overflow: hidden;text-overflow: ellipsis;display: -webkit-box;-webkit-line-clamp: 5;-webkit-box-orient: vertical;word-break: break-all;">' +
  680. it.content + '</div>'
  681. return it;
  682. })
  683. }
  684. if (data.list && data.list.length >= this.form.limit) {
  685. this.isLoad = true;
  686. }
  687. if (this.form.page > 1) {
  688. data.list = this.officeList.concat(data.list);
  689. } else {
  690. this.officeList = [];
  691. }
  692. this.officeList = data.list;
  693. // if(this.form.page == 1){
  694. // req.setStorage('officeList',JSON.stringify(this.officeList));
  695. // }
  696. this.isShowPage = true;
  697. this.isFirst = false;
  698. uni.hideLoading();
  699. });
  700. },
  701. getTeamPage() {
  702. if (!this.isTeamLoad) return false;
  703. this.isTeamLoad = false;
  704. let form = this.teamForm
  705. if (form.page == 1) {
  706. uni.showLoading({
  707. mask: true
  708. })
  709. }
  710. req.getRequest(api.user_team_page, form, data => {
  711. if (data.list && data.list.length >= 10) this.isTeamLoad = true;
  712. if (this.teamForm.page > 1) data.list = this.teamList.concat(data.list);
  713. this.teamList = data.list;
  714. uni.hideLoading();
  715. })
  716. },
  717. getUserTeam() {
  718. let form = {
  719. page: 1,
  720. limit: 5
  721. }
  722. req.getRequest(api.user_team_list, form, data => {
  723. this.userTeamList = data.list;
  724. this.userTeamTotal = data.total;
  725. })
  726. },
  727. //提交点赞、取消点赞;收藏、取消收藏
  728. submitFabulous(type, id, index) {
  729. if (!req.isLogins(true)) {
  730. return;
  731. }
  732. var dataP = {};
  733. dataP.type = type; //1,观看 ,2点赞,3评论,4分享,5收藏
  734. dataP.momentsId = id;
  735. req.postRequestLoding('/api/v3/fabulous/save', dataP, data => {
  736. if (type == 2) {
  737. //动态点赞
  738. if (this.officeList[index].isPraise == 1) {
  739. //已赞
  740. this.officeList[index].isPraise = 0;
  741. this.officeList[index].count.fabulousCount--;
  742. } else {
  743. this.officeList[index].isPraise = 1;
  744. this.officeList[index].count.fabulousCount++;
  745. }
  746. }
  747. });
  748. },
  749. //文章点赞
  750. addThumbs(item, index) {
  751. req.saveBehavior({
  752. behavior: 3,
  753. bindId: item.id,
  754. type: 4
  755. },
  756. (res) => {
  757. this.getCmsList()
  758. }
  759. );
  760. },
  761. //提交投票
  762. submitPoll(item, pIndex, pollIndex) {
  763. if (item.qyPoll.isEnd) {
  764. this.jumpUrlDetail(item)
  765. return false;
  766. }
  767. var dataP = {};
  768. // dataP.id = item.id;
  769. dataP.pollId = item.qyPoll.id;
  770. var pollObjList = JSON.parse(item.qyPoll.optionJson);
  771. dataP.pollOptionCode = pollObjList[pollIndex].code;
  772. req.postRequest('/api/v3/poll/saveDetails', dataP, data => {
  773. req.msg('投票成功');
  774. //图片完之后要将该投票的对象返回,便于做渲染%
  775. this.officeList[pIndex].qyPoll = data;
  776. });
  777. },
  778. goTop: function(e) {
  779. // 一键回到顶部
  780. if (uni.pageScrollTo) {
  781. uni.pageScrollTo({
  782. scrollTop: 0
  783. });
  784. } else {
  785. uni.showModal({
  786. title: '提示',
  787. content: '当前微信版本过低,无法使用该功能,请升级到最新微信版本后重试。'
  788. });
  789. }
  790. },
  791. videoPlay(index) {
  792. var that = this;
  793. var curIdx = index;
  794. this.officeList[index].isControls = true
  795. this.officeList[index].isShowPlayBtn = false
  796. // 有播放时先将prev暂停,再播放当前点击的current
  797. if (that.videoCurrent != null) {
  798. var videoContextPrev = uni.createVideoContext('myVideo' + that.videoCurrent)
  799. if (that.videoCurrent != curIdx) {
  800. this.officeList[that.videoCurrent].isControls = false
  801. this.officeList[that.videoCurrent].isShowPlayBtn = true
  802. videoContextPrev.stop()
  803. }
  804. that.videoCurrent = curIdx
  805. var videoContextCurrent = uni.createVideoContext('myVideo' + curIdx)
  806. videoContextCurrent.play()
  807. } else {
  808. // 没有播放时播放视频
  809. that.videoCurrent = curIdx
  810. var videoContext = uni.createVideoContext('myVideo' + curIdx) // 对应的视频id
  811. videoContext.play()
  812. }
  813. },
  814. videoPause(index) {
  815. this.officeList[index].isControls = false
  816. this.officeList[index].isShowPlayBtn = true
  817. },
  818. videoEnded(index) {
  819. this.officeList[index].isControls = false
  820. this.officeList[index].isShowPlayBtn = true
  821. },
  822. joinTeam(item, index) {
  823. if (item.isJoin == 1) {
  824. uni.navigateTo({
  825. url: '/office/team/index?id=' + item.id
  826. })
  827. return false;
  828. }
  829. if (item.relationMatch) {
  830. uni.navigateTo({
  831. url: '/match/activityDetail/activityDetail?id=' + item.relationMatch.id
  832. })
  833. return false;
  834. }
  835. req.postRequest(api.user_team_follow, {
  836. userGroupId: item.id
  837. }, data => {
  838. req.msg('加入团队成功');
  839. this.teamList.splice(index, 1)
  840. this.getUserTeam();
  841. })
  842. },
  843. // 获取官方动态
  844. getCmsList() {
  845. var _this = this;
  846. req.getRequest(
  847. '/api/content/list', {
  848. page: 1,
  849. limit: 1,
  850. code: req.public.gfdtCode
  851. },
  852. function(res) {
  853. _this.setData({
  854. cmsList: res
  855. });
  856. }
  857. );
  858. },
  859. getDateTimeStamp(dateStr) {
  860. return util.getDateDiff(Date.parse(dateStr.replace(/-/gi, "/")));
  861. },
  862. },
  863. created() {
  864. const systemInfo = uni.getSystemInfoSync();
  865. // px转换到rpx的比例
  866. let pxToRpxScale = 750 / systemInfo.windowWidth;
  867. let systems = {
  868. ktxStatusHeight: systemInfo.statusBarHeight * pxToRpxScale, // 状态栏的高度
  869. navigationHeight: 44 * pxToRpxScale // 导航栏的高度
  870. };
  871. systems.barHeight = systems.ktxStatusHeight + systems.navigationHeight;
  872. this.systems = systems;
  873. },
  874. onShareAppMessage: function() {
  875. let path = '/pages/interactive/index?isShare=' + true;
  876. if (req.getStorage('userInfo')) {
  877. path += '&userId=' + req.getStorage('userInfo').id;
  878. }
  879. if (req.getStorage('MERCHANT') && req.getStorage('MERCHANT').id != null) {
  880. path += '&merchantId=' + req.getStorage('MERCHANT').id;
  881. if (req.getStorage('smallShop') && req.getStorage('MERCHANT').id != null) {
  882. path += '&shopId=' + req.getStorage('smallShop').id;
  883. }
  884. }
  885. let title = '';
  886. if (this.merchant && this.merchant.title && this.merchant.title != '默认门店') {
  887. title = this.merchant.title;
  888. } else {
  889. title = this.config.CONFIG_PROJECT_TITLE;
  890. }
  891. return {
  892. title: (req.excludeSpecial(req.getStorage('userInfo').nickName) ? req.excludeSpecial(req.getStorage(
  893. 'userInfo').nickName) : '') + '为你推荐' + title,
  894. path: path
  895. };
  896. },
  897. onShareTimeline() {
  898. let path = 'isShare=' + true;
  899. if (req.getStorage('userInfo')) {
  900. path += '&userId=' + req.getStorage('userInfo').id;
  901. }
  902. if (req.getStorage('MERCHANT') && req.getStorage('MERCHANT').id != null) {
  903. path += '&merchantId=' + req.getStorage('MERCHANT').id;
  904. if (req.getStorage('smallShop') && req.getStorage('MERCHANT').id != null) {
  905. path += '&shopId=' + req.getStorage('smallShop').id;
  906. }
  907. }
  908. let title = '';
  909. if (this.merchant && this.merchant.title && this.merchant.title != '默认门店') {
  910. title = this.merchant.title;
  911. } else {
  912. title = this.config.CONFIG_PROJECT_TITLE;
  913. }
  914. return {
  915. title: (req.excludeSpecial(req.getStorage('userInfo').nickName) ? req.excludeSpecial(req.getStorage(
  916. 'userInfo').nickName) : '') + '为你推荐' + title,
  917. query: path
  918. };
  919. }
  920. }
  921. </script>
  922. <style>
  923. @import "./index.css";
  924. </style>