index.vue 30 KB

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