index.vue 25 KB

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