index.vue 33 KB

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