index.vue 34 KB

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