index.vue 32 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946
  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.saveBehaviorNew('',13,4)
  440. // req.silenceLogin(options.userId, '');
  441. // this.getHotPoll()
  442. },
  443. onShow() {
  444. // this.getCategory();
  445. this.getConfig();
  446. this.getHotTopic();
  447. this.getCmsList();
  448. if (this.currentTab > 2) {
  449. if (this.isRefresh) {
  450. this.teamForm.page = 1;
  451. this.isTeamLoad = true;
  452. this.getTeamPage();
  453. this.getUserTeam();
  454. this.isRefresh = false;
  455. }
  456. } else {
  457. if (!this.isFirst && this.isRefresh) {
  458. this.form.page = 1;
  459. this.isLoad = true;
  460. this.getOfficeList();
  461. this.isRefresh = false;
  462. }
  463. }
  464. },
  465. onHide() {
  466. this.isShowbtn = false;
  467. },
  468. onReachBottom() {
  469. if (this.currentTab > 1) {
  470. this.teamForm.page++;
  471. this.getTeamPage();
  472. } else {
  473. this.form.page++;
  474. this.getOfficeList();
  475. }
  476. },
  477. methods: {
  478. swiTab(index) {
  479. if (this.currentTab == index) return false;
  480. this.currentTab = index;
  481. if (index == 1) {
  482. this.pType = 11;
  483. } else {
  484. this.pType = 1;
  485. }
  486. this.teamList = [];
  487. this.officeList = [];
  488. if (index > 2) {
  489. this.isTeamLoad = true;
  490. this.teamForm.page = 1;
  491. this.getTeamPage();
  492. this.getUserTeam();
  493. } else {
  494. this.isLoad = true;
  495. this.form.page = 1;
  496. this.getOfficeList();
  497. }
  498. if(index==1){
  499. req.saveBehaviorNew('',17,4)
  500. }else if(index==2){
  501. req.saveBehaviorNew('',18,4)
  502. }else if(index==3){
  503. req.saveBehaviorNew('',19,4)
  504. }
  505. },
  506. //聊一聊切换排序类型
  507. swiPType(type) {
  508. this.isLoad = true;
  509. this.form.page = 1;
  510. this.pType = type;
  511. this.cateIndex = -1
  512. this.treeId = ''
  513. this.getOfficeList();
  514. },
  515. //预览图片
  516. previewImgss(picUrls, index) {
  517. //预览合同图片
  518. var src = picUrls[index];
  519. let imgs = picUrls;
  520. uni.previewImage({
  521. current: src, // 当前显示图片的http链接
  522. urls: imgs
  523. });
  524. },
  525. showBtn() {
  526. if (!req.isLogins(true)) {
  527. return;
  528. }
  529. this.isShowbtn = true;
  530. },
  531. hideBtn() {
  532. this.isShowbtn = false;
  533. },
  534. removeHtml(content) {
  535. return util.removeHtml(content);
  536. },
  537. createJump(url) {
  538. if (!req.isLogins(true)) {
  539. return;
  540. }
  541. this.jumpUrl(url);
  542. },
  543. jumpUrl(url) {
  544. uni.navigateTo({
  545. url: url
  546. })
  547. },
  548. jumpUrlPoi(item, url) {
  549. console.log('item==', item)
  550. this.currentPoi = item;
  551. uni.navigateTo({
  552. url: url
  553. })
  554. },
  555. jumpUrlTeam(item, url) {
  556. console.log('url', url)
  557. if (item.auditStatus == 1) {
  558. this.jumpUrl(url)
  559. } else {
  560. if (item.userId == req.getStorage('userInfo').id) {
  561. this.jumpUrl('/office/createTeam/index?id=' + item.id);
  562. } else {
  563. if (item.auditStatus == 0) {
  564. req.msg('团队正在审核中,暂时无法查看')
  565. } else {
  566. req.msg('团队审核不通过,无法查看')
  567. }
  568. }
  569. }
  570. },
  571. jumpToPractice(item, url) {
  572. let checkCategory = {
  573. id: item.question.cateId,
  574. name: item.question.cateName
  575. }
  576. req.setStorage('checkCategory', checkCategory)
  577. this.jumpUrl(url);
  578. },
  579. jumpUrlDetail(item) {
  580. this.jumpUrl('/office/detail/detail?contentId=' + item.id);
  581. },
  582. toProductDetail(item) {
  583. this.jumpUrl('/product/detail/detail?id=' + item.id);
  584. },
  585. getHotTopic() {
  586. var dataPram = {
  587. page: 1,
  588. limit: 4,
  589. attr: 2
  590. };
  591. req.getRequest('/api/v3/dialogue/list', dataPram, data => {
  592. this.hotTopicList = data;
  593. });
  594. },
  595. getHotPoll() {
  596. var dataPram = {
  597. page: 1,
  598. limit: 4,
  599. attr: 2,
  600. attrType: 0
  601. };
  602. req.getRequest('/api/v3/poll/pollList', dataPram, data => {
  603. this.hotPollList = data;
  604. });
  605. },
  606. getCategory() {
  607. req.getRequest('/api/v3/unified/tree/list', {
  608. type: 1
  609. }, data => {
  610. this.category = data;
  611. })
  612. },
  613. getConfig() {
  614. req.getRequest('/api/other/config', {}, data => {
  615. this.config = data;
  616. })
  617. },
  618. swiTree(item, index) {
  619. if (this.cateIndex == index) return false;
  620. this.cateIndex = index;
  621. this.pType = -1;
  622. this.treeId = item.id;
  623. this.form.page = 1;
  624. this.isLoad = true;
  625. this.getOfficeList()
  626. },
  627. sum(arr) {
  628. var s = 0;
  629. for (var i = arr.length - 1; i >= 0; i--) {
  630. if (arr[i].count) {
  631. s += Number(arr[i].count);
  632. }
  633. }
  634. return s;
  635. },
  636. fomatNumbers(num) {
  637. return util.formatNumbers(num)
  638. },
  639. getOfficeList() {
  640. let that = this;
  641. var pramData = {};
  642. pramData.page = this.form.page;
  643. pramData.limit = this.form.limit;
  644. // pramData.type = 4;
  645. if (this.pType == 5) {
  646. //热门
  647. pramData.isEssence = 2;
  648. } else {
  649. pramData.orderType = this.pType;
  650. }
  651. if (this.treeId) {
  652. pramData.treeId = this.treeId
  653. pramData.orderType = 1
  654. } else delete pramData.treeId
  655. if (this.currentTab < 3) pramData.searchType = this.currentTab; //1话题 2投票 3团队
  656. else delete pramData.searchType;
  657. pramData.poiLongitude = req.getStorage('loctionAddressMap').location.lng ? req.getStorage(
  658. 'loctionAddressMap').location.lng : this.pois.poiLongitude;
  659. pramData.poiLatitude = req.getStorage('loctionAddressMap').location.lat ? req.getStorage(
  660. 'loctionAddressMap').location.lat : this.pois.poiLatitude;
  661. if (this.pType == 11) pramData.distance = 20000;
  662. else delete pramData.distance;
  663. if (!this.isLoad) return false;
  664. this.isLoad = false;
  665. if (pramData.page == 1) {
  666. uni.showLoading({
  667. mask: true
  668. })
  669. }
  670. req.getRequest('/api/v3/moments/page', pramData, data => {
  671. if (data.list && data.list.length > 0) {
  672. data.list.map(it => {
  673. if (it.qyPoll && it.qyPoll.isEnd) {
  674. it.qyPoll.voteCount = that.sum(JSON.parse(it.qyPoll.optionJson))
  675. }
  676. if (it.url) {
  677. let h = it.url.substring(it.url.lastIndexOf('.') + 1)
  678. if (h.indexOf('mp4') < 0 && h.indexOf('MP4') < 0) {
  679. it.url = it.url.split(',');
  680. } else {
  681. it.isHaveVideo = true
  682. it.isControls = false
  683. it.isShowPlayBtn = true
  684. }
  685. }
  686. it.content =
  687. '<div style="overflow: hidden;text-overflow: ellipsis;display: -webkit-box;-webkit-line-clamp: 5;-webkit-box-orient: vertical;word-break: break-all;">' +
  688. it.content + '</div>'
  689. return it;
  690. })
  691. }
  692. if (data.list && data.list.length >= this.form.limit) {
  693. this.isLoad = true;
  694. }
  695. if (this.form.page > 1) {
  696. data.list = this.officeList.concat(data.list);
  697. } else {
  698. this.officeList = [];
  699. }
  700. this.officeList = data.list;
  701. // if(this.form.page == 1){
  702. // req.setStorage('officeList',JSON.stringify(this.officeList));
  703. // }
  704. this.isShowPage = true;
  705. this.isFirst = false;
  706. uni.hideLoading();
  707. });
  708. },
  709. getTeamPage() {
  710. if (!this.isTeamLoad) return false;
  711. this.isTeamLoad = false;
  712. let form = this.teamForm
  713. if (form.page == 1) {
  714. uni.showLoading({
  715. mask: true
  716. })
  717. }
  718. req.getRequest(api.user_team_page, form, data => {
  719. if (data.list && data.list.length >= 10) this.isTeamLoad = true;
  720. if (this.teamForm.page > 1) data.list = this.teamList.concat(data.list);
  721. this.teamList = data.list;
  722. uni.hideLoading();
  723. })
  724. },
  725. getUserTeam() {
  726. let form = {
  727. page: 1,
  728. limit: 5
  729. }
  730. req.getRequest(api.user_team_list, form, data => {
  731. this.userTeamList = data.list;
  732. this.userTeamTotal = data.total;
  733. })
  734. },
  735. //提交点赞、取消点赞;收藏、取消收藏
  736. submitFabulous(type, id, index) {
  737. if (!req.isLogins(true)) {
  738. return;
  739. }
  740. var dataP = {};
  741. dataP.type = type; //1,观看 ,2点赞,3评论,4分享,5收藏
  742. dataP.momentsId = id;
  743. req.postRequestLoding('/api/v3/fabulous/save', dataP, data => {
  744. if (type == 2) {
  745. //动态点赞
  746. if (this.officeList[index].isPraise == 1) {
  747. //已赞
  748. this.officeList[index].isPraise = 0;
  749. this.officeList[index].count.fabulousCount--;
  750. req.saveBehaviorNew(id, this.officeList[index].pollId?10:11,11)
  751. } else {
  752. this.officeList[index].isPraise = 1;
  753. this.officeList[index].count.fabulousCount++;
  754. req.saveBehaviorNew(id, this.officeList[index].pollId?10:11,3)
  755. }
  756. }
  757. });
  758. },
  759. //文章点赞
  760. addThumbs(item, index) {
  761. req.saveBehavior({
  762. behavior: 3,
  763. bindId: item.id,
  764. type: 4
  765. },
  766. (res) => {
  767. this.getCmsList()
  768. }
  769. );
  770. },
  771. //提交投票
  772. submitPoll(item, pIndex, pollIndex) {
  773. if (item.qyPoll.isEnd) {
  774. this.jumpUrlDetail(item)
  775. return false;
  776. }
  777. var dataP = {};
  778. // dataP.id = item.id;
  779. dataP.pollId = item.qyPoll.id;
  780. var pollObjList = JSON.parse(item.qyPoll.optionJson);
  781. dataP.pollOptionCode = pollObjList[pollIndex].code;
  782. req.postRequest('/api/v3/poll/saveDetails', dataP, data => {
  783. req.msg('投票成功');
  784. //图片完之后要将该投票的对象返回,便于做渲染%
  785. this.officeList[pIndex].qyPoll = data;
  786. req.saveBehaviorNew(item.id,10,5)
  787. });
  788. },
  789. goTop: function(e) {
  790. // 一键回到顶部
  791. if (uni.pageScrollTo) {
  792. uni.pageScrollTo({
  793. scrollTop: 0
  794. });
  795. } else {
  796. uni.showModal({
  797. title: '提示',
  798. content: '当前微信版本过低,无法使用该功能,请升级到最新微信版本后重试。'
  799. });
  800. }
  801. },
  802. videoPlay(index) {
  803. var that = this;
  804. var curIdx = index;
  805. this.officeList[index].isControls = true
  806. this.officeList[index].isShowPlayBtn = false
  807. // 有播放时先将prev暂停,再播放当前点击的current
  808. if (that.videoCurrent != null) {
  809. var videoContextPrev = uni.createVideoContext('myVideo' + that.videoCurrent)
  810. if (that.videoCurrent != curIdx) {
  811. this.officeList[that.videoCurrent].isControls = false
  812. this.officeList[that.videoCurrent].isShowPlayBtn = true
  813. videoContextPrev.stop()
  814. }
  815. that.videoCurrent = curIdx
  816. var videoContextCurrent = uni.createVideoContext('myVideo' + curIdx)
  817. videoContextCurrent.play()
  818. } else {
  819. // 没有播放时播放视频
  820. that.videoCurrent = curIdx
  821. var videoContext = uni.createVideoContext('myVideo' + curIdx) // 对应的视频id
  822. videoContext.play()
  823. }
  824. },
  825. videoPause(index) {
  826. this.officeList[index].isControls = false
  827. this.officeList[index].isShowPlayBtn = true
  828. },
  829. videoEnded(index) {
  830. this.officeList[index].isControls = false
  831. this.officeList[index].isShowPlayBtn = true
  832. },
  833. joinTeam(item, index) {
  834. if (item.isJoin == 1) {
  835. uni.navigateTo({
  836. url: '/office/team/index?id=' + item.id
  837. })
  838. return false;
  839. }
  840. if (item.relationMatch) {
  841. uni.navigateTo({
  842. url: '/match/activityDetail/activityDetail?id=' + item.relationMatch.id
  843. })
  844. return false;
  845. }
  846. req.postRequest(api.user_team_follow, {
  847. userGroupId: item.id
  848. }, data => {
  849. req.msg('加入团队成功');
  850. this.teamList.splice(index, 1)
  851. this.getUserTeam();
  852. })
  853. },
  854. // 获取官方动态
  855. getCmsList() {
  856. var _this = this;
  857. req.getRequest(
  858. '/api/content/list', {
  859. page: 1,
  860. limit: 1,
  861. code: req.public.gfdtCode
  862. },
  863. function(res) {
  864. _this.setData({
  865. cmsList: res
  866. });
  867. }
  868. );
  869. },
  870. getDateTimeStamp(dateStr) {
  871. return util.getDateDiff(Date.parse(dateStr.replace(/-/gi, "/")));
  872. },
  873. },
  874. created() {
  875. const systemInfo = uni.getSystemInfoSync();
  876. // px转换到rpx的比例
  877. let pxToRpxScale = 750 / systemInfo.windowWidth;
  878. let systems = {
  879. ktxStatusHeight: systemInfo.statusBarHeight * pxToRpxScale, // 状态栏的高度
  880. navigationHeight: 44 * pxToRpxScale // 导航栏的高度
  881. };
  882. systems.barHeight = systems.ktxStatusHeight + systems.navigationHeight;
  883. this.systems = systems;
  884. },
  885. onShareAppMessage: function() {
  886. let path = '/pages/interactive/index?isShare=' + true;
  887. if (req.getStorage('userInfo')) {
  888. path += '&userId=' + req.getStorage('userInfo').id;
  889. }
  890. if (req.getStorage('MERCHANT') && req.getStorage('MERCHANT').id != null) {
  891. path += '&merchantId=' + req.getStorage('MERCHANT').id;
  892. if (req.getStorage('smallShop') && req.getStorage('MERCHANT').id != null) {
  893. path += '&shopId=' + req.getStorage('smallShop').id;
  894. }
  895. }
  896. let title = '';
  897. if (this.merchant && this.merchant.title && this.merchant.title != '默认门店') {
  898. title = this.merchant.title;
  899. } else {
  900. title = this.config.CONFIG_PROJECT_TITLE;
  901. }
  902. return {
  903. title: (req.excludeSpecial(req.getStorage('userInfo').nickName) ? req.excludeSpecial(req.getStorage(
  904. 'userInfo').nickName) : '') + '为你推荐' + title,
  905. path: path
  906. };
  907. },
  908. onShareTimeline() {
  909. let path = 'isShare=' + true;
  910. if (req.getStorage('userInfo')) {
  911. path += '&userId=' + req.getStorage('userInfo').id;
  912. }
  913. if (req.getStorage('MERCHANT') && req.getStorage('MERCHANT').id != null) {
  914. path += '&merchantId=' + req.getStorage('MERCHANT').id;
  915. if (req.getStorage('smallShop') && req.getStorage('MERCHANT').id != null) {
  916. path += '&shopId=' + req.getStorage('smallShop').id;
  917. }
  918. }
  919. let title = '';
  920. if (this.merchant && this.merchant.title && this.merchant.title != '默认门店') {
  921. title = this.merchant.title;
  922. } else {
  923. title = this.config.CONFIG_PROJECT_TITLE;
  924. }
  925. return {
  926. title: (req.excludeSpecial(req.getStorage('userInfo').nickName) ? req.excludeSpecial(req.getStorage(
  927. 'userInfo').nickName) : '') + '为你推荐' + title,
  928. query: path
  929. };
  930. }
  931. }
  932. </script>
  933. <style>
  934. @import "./index.css";
  935. </style>