index.vue 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614
  1. <template>
  2. <view>
  3. <!-- <view class="top" :style="'height:' + systems.barHeight + 'rpx;'">
  4. <view class="topc ddflex" :style="'line-height:' + systems.navigationHeight + 'rpx;margin-top:' + systems.ktxStatusHeight + 'rpx;'">
  5. <view :class="'li' + (currentTab == 0 ? ' active' : '')" @click="tabClick(0)">聊一聊</view>
  6. <view :class="'li' + (currentTab == 1 ? ' active' : '')" @click="tabClick(1)">树洞</view>
  7. </view>
  8. </view>
  9. <view :style="'height:' + systems.barHeight + 'rpx;'"></view> -->
  10. <block v-if="currentTab == 0">
  11. <view class="t-con">
  12. <scroll-view scroll-x="true" class="t-cons">
  13. <view class="item">
  14. <navigator url="/topics/index/index" hover-class="none" class="tits ddflex">
  15. <image src="../../static/images/hot.png" class="hot"></image>
  16. <view class="more ddflex">
  17. 更多
  18. <image src="../../static/images/rico1.png"></image>
  19. </view>
  20. </navigator>
  21. <view class="item-list">
  22. <view class="li ddflex" v-for="(item, index) in hotTopicList" :key="index" @click="jumpUrl('/topics/detail/detail?topicId=' + item.id)">
  23. <text class="num">{{ index + 1 }}</text>
  24. <view class="fflex tover">{{ item.title }}</view>
  25. <text>{{ item.participantsNO }}参与</text>
  26. </view>
  27. </view>
  28. </view>
  29. <view class="item">
  30. <navigator url="/office/voteList/voteList" hover-class="none" class="tits ddflex">
  31. <image src="../../static/images/pk_ic.png" class="hot"></image>
  32. <view class="more ddflex">
  33. 更多
  34. <image src="../../static/images/rico1.png"></image>
  35. </view>
  36. </navigator>
  37. <view class="item-list">
  38. <view class="li ddflex" v-for="(item, index) in hotPollList" :key="index" @click="jumpUrl('/office/detail/detail?contentId=' + item.momentsId)">
  39. <text class="num">{{ index + 1 }}</text>
  40. <view class="fflex tover">{{ item.title }}</view>
  41. <text>{{ item.participantsNO }}参与</text>
  42. </view>
  43. </view>
  44. </view>
  45. </scroll-view>
  46. </view>
  47. <view class="tab ddflex">
  48. <view :class="'li ' + (pType == 1 ? 'active' : '')" @click="swiPType(1)">综合</view>
  49. <view :class="'li ' + (pType == 2 ? 'active' : '')" @click="swiPType(2)">最新</view>
  50. <view :class="'li ' + (pType == 5 ? 'active' : '')" @click="swiPType(5)">热门</view>
  51. </view>
  52. <view class="list" v-if="officeList && officeList.length > 0">
  53. <view class="li" v-for="(item, index) in officeList" :key="index">
  54. <view class="user ddflex">
  55. <image :src="item.userDTO.avatar" mode="aspectFill" class="userimg" @click="jumpUrl('/topics/home/home?userId=' + item.userDTO.id)"></image>
  56. <view class="fflex">
  57. <view class="namea ddflex">
  58. <view class="name fflex ddflex" @click="jumpUrl('/topics/home/home?userId=' + item.userDTO.id)">
  59. {{ item.userDTO.nickName }}
  60. <image v-if="item.userDTO.levelGrade > 0" src="../../static/images/vip_tag.png" class="vip-tag"></image>
  61. </view>
  62. <view class="time">{{ item.time }}</view>
  63. </view>
  64. <view class="area" @click="jumpUrl('/topics/home/home?userId=' + item.userDTO.id)" v-if="item.userDTO.cityName">
  65. {{ item.userDTO.provinceName }} {{ item.userDTO.cityName }}
  66. </view>
  67. </view>
  68. </view>
  69. <!-- 分享的动态 -->
  70. <block v-if="item.source">
  71. <view class="link ddflex" @click="jumpUrlDetail(item)">
  72. <block v-if="item.url&&item.url.length>0">
  73. <image
  74. mode="aspectFill"
  75. v-if="idx == 0"
  76. v-for="(it, idx) in item.url"
  77. :src="it ? it : '../../static/images/lj_img.png'"
  78. :key="idx"
  79. ></image>
  80. </block>
  81. <view class="fflex tover"><rich-text :nodes="item.content"></rich-text></view>
  82. </view>
  83. </block>
  84. <!-- 非分享的动态 -->
  85. <block v-else>
  86. <view class="des tovers"><rich-text @click="jumpUrlDetail(item)" :nodes="item.content"></rich-text></view>
  87. <!-- //如果有投票,就不显示图片 -->
  88. <view class="imgbox ddflex" @click="jumpUrlDetail(item)" v-if="!item.qyPoll"><!-- @click="previewImgss(item.url, idx)" -->
  89. <block v-if="item.url&&item.url.length>0">
  90. <image mode="aspectFill" v-for="(it, idx) in item.url" :src="it" :key="idx"></image>
  91. </block>
  92. </view>
  93. <!-- 话题 -->
  94. <view class="ddflex" v-if="item.qyDialogu">
  95. <view class="topic ddflex" @click="jumpUrl('/topics/detail/detail?topicId=' + item.qyDialogu.id)">
  96. <image src="../../static/images/topic.png"></image>
  97. {{ item.qyDialogu.title }}
  98. </view>
  99. </view>
  100. <!-- 投票 -->
  101. <view :class="'vote-box' + (item.qyPoll.isEnd ? ' ends' : '')" v-if="item.qyPoll">
  102. <view class="vote-tit">{{ item.qyPoll.title }}</view>
  103. <block v-if="item.qyPoll.isVote == 1">
  104. <view class="vote-list end" @click="jumpUrlDetail(item)">
  105. <view :class="'lis ddflex ' + (itpy.isVote == 1 ? 'active' : '')" v-for="(itpy, idex) in JSON.parse(item.qyPoll.optionJson)" :key="idex">
  106. <view class="percent" :style="'width:' + parseFloat(itpy.proportion) + '%;'"></view>
  107. <view class="fflex">{{ itpy.name }}</view>
  108. <view>{{ parseFloat(itpy.proportion) + '%' }}</view>
  109. </view>
  110. </view>
  111. </block>
  112. <block v-else>
  113. <view class="vote-list">
  114. <view class="lis" v-for="(itpy, idex) in JSON.parse(item.qyPoll.optionJson)" :key="idex" @click="submitPoll(item, index, idex)">
  115. {{ itpy.name }}
  116. </view>
  117. </view>
  118. </block>
  119. <view class="vote-can" v-if="item.qyPoll.isEnd"><text>{{item.qyPoll.voteCount}}人参与</text>投票已结束</view>
  120. </view>
  121. </block>
  122. <view class="opt ddflex" v-if="!item.source">
  123. <view class="fflex" @click="jumpUrlDetail(item)">{{ item.count.browseCount }}次浏览</view>
  124. <view class="ddflex" @click="submitFabulous(2, item.id, index)">
  125. <image :src="'../../static/images/' + (item.isPraise == 1 ? 'like_h' : 'like') + '.png'"></image>
  126. {{ item.count.fabulousCount < 99 ? item.count.fabulousCount : '99+' }}
  127. </view>
  128. <view class="ddflex" @click="jumpUrlDetail(item)">
  129. <image src="../../static/images/comment.png"></image>
  130. {{ item.count.commentCount < 99 ? item.count.commentCount : '99+' }}
  131. </view>
  132. <button open-type="share" class="opt-share ddflex">
  133. <image src="../../static/images/share.png"></image>
  134. 分享
  135. </button>
  136. </view>
  137. </view>
  138. </view>
  139. <view class="nodata" v-else>
  140. <image :src="picUrlss + 'empty_jl.png'"></image>
  141. <text>暂无动态</text>
  142. </view>
  143. <view class="create" @click="createJump('/office/news/news?newsType=1')">
  144. <image src="../../static/images/create.png"></image>
  145. 发布
  146. </view>
  147. <!-- <view class="ceng" v-if="isShowbtn" @click="hideBtn"></view>
  148. <view class="side ddflex" v-if="isShowbtn">
  149. <navigator url="/office/news/news?newsType=1" hover-class="none" class="li">
  150. <image src="../../static/images/ll_dt.png"></image>
  151. <view>动态</view>
  152. </navigator>
  153. <navigator url="" hover-class="none" class="li">
  154. <image src="../../static/images/ll_cz.png"></image>
  155. <view>创作</view>
  156. </navigator>
  157. </view> -->
  158. </block>
  159. <block v-if="currentTab == 1">
  160. <view class="dong-t">
  161. <view class="bang">
  162. <image src="../../static/images/bang.png" class="bang-img"></image>
  163. <view class="tiwen ddflex">
  164. <view class="fflex">
  165. <view>30万+妈妈为你贴心解答</view>
  166. <view>1000+育儿导师护航</view>
  167. </view>
  168. <view @click="createJump('/office/news/news?newsType=2')" class="twbtn ddflex">
  169. 点我提问
  170. <image src="../../static/images/rico2.png"></image>
  171. </view>
  172. </view>
  173. <swiper class="bang-c" autoplay="true" vertical="true" interval="3000" v-if="hotTopHoleOfficeList && hotTopHoleOfficeList.length > 0">
  174. <swiper-item v-for="(item, index) in hotTopHoleOfficeList" :key="index">
  175. <view class="bang-wen ddflex" @click="jumpUrlDetail(item)">
  176. <image :src="item.userDTO.avatar" mode="aspectFill"></image>
  177. <view class="fflex">{{ removeHtml(item.content) }}</view>
  178. </view>
  179. </swiper-item>
  180. </swiper>
  181. <!-- <view class="bang-wen ddflex">
  182. <image src="../../static/images/userimg.png" mode="aspectFill"></image>
  183. <view class="fflex">宝贝最近学习状态持续下降,导致学习成绩下降很快,我该怎么办?</view>
  184. </view> -->
  185. </view>
  186. </view>
  187. <view class="tab ddflex">
  188. <view :class="'li ' + (holeType == 1 ? 'active' : '')" @click="swiHoleType(1)">综合</view>
  189. <view :class="'li ' + (holeType == 2 ? 'active' : '')" @click="swiHoleType(2)">最新</view>
  190. <view :class="'li ' + (holeType == 5 ? 'active' : '')" @click="swiHoleType(5)">热门</view>
  191. <!-- <view class="li">求助</view> -->
  192. <view :class="'li ' + (holeType == 6 ? 'active' : '')" @click="swiHoleType(6)">精华</view>
  193. </view>
  194. <view class="list" v-if="holeOfficeList && holeOfficeList.length > 0">
  195. <view class="li" v-for="(item, index) in holeOfficeList" :key="index">
  196. <view class="user ddflex">
  197. <image :src="item.userDTO.avatar" mode="aspectFill" class="userimg" @click="jumpUrl('/topics/home/home?userId=' + item.userDTO.id)"></image>
  198. <view class="fflex">
  199. <view class="namea ddflex">
  200. <view class="name fflex ddflex" @click="jumpUrl('/topics/home/home?userId=' + item.userDTO.id)">
  201. {{ item.userDTO.nickName }}
  202. <image v-if="item.userDTO.levelGrade > 0" src="../../static/images/vip_tag.png" class="vip-tag"></image>
  203. </view>
  204. <view class="time">{{ item.time }}</view>
  205. </view>
  206. <view class="area" @click="jumpUrl('/topics/home/home?userId=' + item.userDTO.id)" v-if="item.userDTO.cityName">
  207. {{ item.userDTO.provinceName }} {{ item.userDTO.cityName }}
  208. </view>
  209. </view>
  210. </view>
  211. <!-- 分享的动态 -->
  212. <block v-if="item.source">
  213. <view class="link ddflex" @click="jumpUrlDetail(item)">
  214. <block v-if="item.url">
  215. <image
  216. mode="aspectFill"
  217. v-if="idx == 0"
  218. v-for="(it, idx) in item.url.split(',')"
  219. :src="it ? it : '../../static/images/lj_img.png'"
  220. :key="idx"
  221. ></image>
  222. </block>
  223. <view class="fflex tover"><rich-text :nodes="item.content"></rich-text></view>
  224. </view>
  225. </block>
  226. <!-- 非分享的动态 -->
  227. <block v-else>
  228. <view class="des tovers" @click="jumpUrlDetail(item)">
  229. <view class="wen">提问</view>
  230. {{ removeHtml(item.content) }}
  231. </view>
  232. <!-- //如果有投票,就不显示图片 -->
  233. <view class="imgbox ddflex" @click="jumpUrlDetail(item)" v-if="!item.qyPoll"><!-- @click="previewImgss(item.url.split(','), idx)" -->
  234. <block v-if="item.url">
  235. <image mode="aspectFill" v-for="(it, idx) in item.url.split(',')" :src="it" :key="idx"></image>
  236. </block>
  237. </view>
  238. <!-- 话题 -->
  239. <view class="ddflex" v-if="item.qyDialogu">
  240. <view class="topic ddflex" @click="jumpUrl('/topics/detail/detail?topicId=' + item.qyDialogu.id)">
  241. <image src="../../static/images/topic.png"></image>
  242. {{ item.qyDialogu.title }}
  243. </view>
  244. </view>
  245. <!-- 投票 -->
  246. <block v-if="item.qyPoll">
  247. <view class="vote-tit">{{ item.qyPoll.title }}</view>
  248. <block v-if="item.qyPoll.isVote == 1">
  249. <view class="vote-list end" @click="jumpUrlDetail(item)">
  250. <view :class="'lis ddflex ' + (itpy.isVote == 1 ? 'active' : '')" v-for="(itpy, idex) in JSON.parse(item.qyPoll.optionJson)" :key="idex">
  251. <view class="percent" :style="'width:' + parseFloat(itpy.proportion) + '%;'"></view>
  252. <view class="fflex">{{ itpy.name }}</view>
  253. <view>{{ parseFloat(itpy.proportion) + '%' }}</view>
  254. </view>
  255. </view>
  256. </block>
  257. <block v-else>
  258. <view class="vote-list">
  259. <view class="lis" v-for="(itpy, idex) in JSON.parse(item.qyPoll.optionJson)" :key="idex" @click="submitPoll(item, index, idex)">
  260. {{ itpy.name }}
  261. </view>
  262. </view>
  263. </block>
  264. </block>
  265. </block>
  266. <view class="opt ddflex" v-if="!item.source">
  267. <view class="fflex" @click="jumpUrlDetail(item)">{{ item.count.browseCount }}次浏览</view>
  268. <view class="ddflex" @click="submitFabulous(2, item.id, index)">
  269. <image :src="'../../static/images/' + (item.isPraise == 1 ? 'like_h' : 'like') + '.png'"></image>
  270. {{ item.count.fabulousCount < 99 ? item.count.fabulousCount : '99+' }}
  271. </view>
  272. <view class="ddflex" @click="jumpUrlDetail(item)">
  273. <image src="../../static/images/comment.png"></image>
  274. {{ item.count.commentCount < 99 ? item.count.commentCount : '99+' }}
  275. </view>
  276. <button open-type="share" class="opt-share ddflex">
  277. <image src="../../static/images/share.png"></image>
  278. 分享
  279. </button>
  280. </view>
  281. </view>
  282. </view>
  283. <view class="nodata" v-else>
  284. <image :src="picUrlss + 'empty_jl.png'"></image>
  285. <text>暂无动态</text>
  286. </view>
  287. <view class="edit" @click="showBtn()"><image src="../../static/images/edit.png"></image></view>
  288. <view class="ceng" v-if="isShowbtn" @click="hideBtn"></view>
  289. <view class="side ddflex" v-if="isShowbtn">
  290. <view @click="createJump('/office/news/news?newsType=2')" class="li">
  291. <image src="../../static/images/sd_tw.png"></image>
  292. <view>提问</view>
  293. </view>
  294. <navigator url="/office/diary/diary" hover-class="none" class="li">
  295. <image src="../../static/images/sd_rj.png"></image>
  296. <view>日记</view>
  297. </navigator>
  298. </view>
  299. </block>
  300. </view>
  301. </template>
  302. <script>
  303. const app = getApp();
  304. const req = require('../../utils/request.js');
  305. const util = require('../../utils/util.js');
  306. export default {
  307. data() {
  308. return {
  309. picUrlss: req.public.picUrls,
  310. systems: {},
  311. currentTab: -1,
  312. isShowbtn: false,
  313. isLoad: true,
  314. form: {
  315. page: 1,
  316. limit: 10
  317. },
  318. pType: 1, //排序: 1综合, 2最新,3浏览最多,4评论最多,5热门
  319. isHoleLoad: true,
  320. holeForm: {
  321. page: 1,
  322. limit: 10
  323. },
  324. holeType: 1, //排序: 1综合, 2最新,3浏览最多,4评论最多,5热门
  325. hotTopicList: [],
  326. hotPollList: [],
  327. officeList: [], //聊一聊
  328. hotTopHoleOfficeList: [], //树洞滚动
  329. holeOfficeList: [] //树洞
  330. };
  331. },
  332. onLoad() {
  333. this.tabClick(0);
  334. },
  335. onHide() {
  336. this.isShowbtn = false;
  337. },
  338. onReachBottom() {
  339. if (this.currentTab == 1) {
  340. this.holeForm.page++;
  341. } else {
  342. this.form.page++;
  343. }
  344. this.getOfficeList();
  345. },
  346. methods: {
  347. tabClick(idx) {
  348. if (this.currentTab == idx) {
  349. return false;
  350. }
  351. this.currentTab = idx;
  352. if (this.currentTab == 1) {
  353. this.isHoleLoad = true;
  354. this.holeForm.page = 1;
  355. this.topHoleOfficeList();
  356. this.getOfficeList();
  357. } else {
  358. this.isLoad = true;
  359. this.form.page = 1;
  360. this.getHotTopic();
  361. this.getHotPoll();
  362. this.getOfficeList();
  363. }
  364. },
  365. //聊一聊切换排序类型
  366. swiPType(type) {
  367. this.isLoad = true;
  368. this.form.page = 1;
  369. this.pType = type;
  370. this.getOfficeList();
  371. },
  372. //树洞切换排序
  373. swiHoleType(type) {
  374. this.isHoleLoad = true;
  375. this.holeForm.page = 1;
  376. this.holeType = type;
  377. this.getOfficeList();
  378. },
  379. //预览图片
  380. previewImgss(picUrls, index) {
  381. //预览合同图片
  382. var src = picUrls[index];
  383. let imgs = picUrls;
  384. uni.previewImage({
  385. current: src, // 当前显示图片的http链接
  386. urls: imgs
  387. });
  388. },
  389. showBtn() {
  390. if (!req.isLogins(true)) {
  391. return;
  392. }
  393. this.isShowbtn = true;
  394. },
  395. hideBtn() {
  396. this.isShowbtn = false;
  397. },
  398. removeHtml(content) {
  399. return util.removeHtml(content);
  400. },
  401. createJump(url) {
  402. if (!req.isLogins(true)) {
  403. return;
  404. }
  405. this.jumpUrl(url);
  406. },
  407. jumpUrl(url) {
  408. uni.navigateTo({
  409. url: url
  410. });
  411. },
  412. jumpUrlDetail(item) {
  413. if (item.source) {
  414. this.jumpUrl('/office/detail/detail?contentId=' + item.source);
  415. } else {
  416. this.jumpUrl('/office/detail/detail?contentId=' + item.id);
  417. }
  418. },
  419. getHotTopic() {
  420. var dataPram = {
  421. page: 1,
  422. limit: 4,
  423. attr: 2
  424. };
  425. req.getRequest('/api/v3/dialogue/list', dataPram, data => {
  426. this.hotTopicList = data;
  427. });
  428. },
  429. getHotPoll() {
  430. var dataPram = {
  431. page: 1,
  432. limit: 4,
  433. attr: 2
  434. };
  435. req.getRequest('/api/v3/poll/pollList', dataPram, data => {
  436. this.hotPollList = data;
  437. });
  438. },
  439. topHoleOfficeList() {
  440. var pramData = {};
  441. //1 聊一聊 ,2 提问
  442. pramData.type = 2;
  443. pramData.page = 1;
  444. pramData.limit = 5;
  445. pramData.orderType = 5;
  446. req.getRequest('/api/v3/moments/list', pramData, data => {
  447. this.hotTopHoleOfficeList = data;
  448. });
  449. },
  450. sum(arr) {
  451. var s = 0;
  452. for (var i=arr.length-1; i>=0; i--) {
  453. if(arr[i].count){
  454. s += Number(arr[i].count);
  455. }
  456. }
  457. return s;
  458. },
  459. getOfficeList() {
  460. let that = this;
  461. var pramData = {};
  462. //1 聊一聊 ,2 提问
  463. pramData.type = parseInt(this.currentTab) + 1;
  464. if (this.currentTab == 1) {
  465. //树洞
  466. pramData.page = this.holeForm.page;
  467. pramData.limit = this.holeForm.limit;
  468. if (this.holeType == 5) {
  469. //热门
  470. pramData.isEssence = 2;
  471. } else if (this.holeType == 6) {
  472. //精华
  473. pramData.isEssence = 1;
  474. } else {
  475. pramData.orderType = this.holeType;
  476. }
  477. } else {
  478. //聊一聊
  479. pramData.page = this.form.page;
  480. pramData.limit = this.form.limit;
  481. if (this.pType == 5) {
  482. //热门
  483. pramData.isEssence = 2;
  484. } else {
  485. pramData.orderType = this.pType;
  486. }
  487. }
  488. if (this.currentTab == 1) {
  489. if (!this.isHoleLoad) return false;
  490. this.isHoleLoad = false;
  491. } else {
  492. if (!this.isLoad) return false;
  493. this.isLoad = false;
  494. }
  495. req.getRequest('/api/v3/moments/list', pramData, data => {
  496. if (this.currentTab == 1) {//树洞
  497. if (data && data.length >= 10) {
  498. this.isHoleLoad = true;
  499. }
  500. if (this.holeForm.page > 1) {
  501. data = this.holeOfficeList.concat(data);
  502. } else {
  503. this.holeOfficeList = [];
  504. }
  505. this.holeOfficeList = data;
  506. } else {//聊一聊
  507. if(data&&data.length > 0){
  508. data.map(it=>{
  509. if(it.qyPoll && it.qyPoll.isEnd){
  510. it.qyPoll.voteCount = that.sum(JSON.parse(it.qyPoll.optionJson))
  511. }
  512. if(it.url){
  513. it.url = it.url.split(',');
  514. }
  515. return it;
  516. })
  517. }
  518. if (data && data.length >= 10) {
  519. this.isLoad = true;
  520. }
  521. if (this.form.page > 1) {
  522. data = this.officeList.concat(data);
  523. } else {
  524. this.officeList = [];
  525. }
  526. this.officeList = data;
  527. }
  528. });
  529. },
  530. //提交点赞、取消点赞;收藏、取消收藏
  531. submitFabulous(type, id, index) {
  532. if (!req.isLogins(true)) {
  533. return;
  534. }
  535. var dataP = {};
  536. dataP.type = type; //1,观看 ,2点赞,3评论,4分享,5收藏
  537. dataP.momentsId = id;
  538. req.postRequestLoding('/api/v3/fabulous/save', dataP, data => {
  539. if (this.currentTab == 0) {
  540. if (type == 2) {
  541. //动态点赞
  542. if (this.officeList[index].isPraise == 1) {
  543. //已赞
  544. this.officeList[index].isPraise = 0;
  545. this.officeList[index].count.fabulousCount--;
  546. } else {
  547. this.officeList[index].isPraise = 1;
  548. this.officeList[index].count.fabulousCount++;
  549. }
  550. }
  551. } else {
  552. if (type == 2) {
  553. //动态点赞
  554. if (this.holeOfficeList[index].isPraise == 1) {
  555. //已赞
  556. this.holeOfficeList[index].isPraise = 0;
  557. this.holeOfficeList[index].count.fabulousCount--;
  558. } else {
  559. this.holeOfficeList[index].isPraise = 1;
  560. this.holeOfficeList[index].count.fabulousCount++;
  561. }
  562. }
  563. }
  564. });
  565. },
  566. //提交投票
  567. submitPoll(item, pIndex, pollIndex) {
  568. if(item.qyPoll.isEnd) return false;
  569. var dataP = {};
  570. // dataP.id = item.id;
  571. dataP.pollId = item.qyPoll.id;
  572. var pollObjList = JSON.parse(item.qyPoll.optionJson);
  573. dataP.pollOptionCode = pollObjList[pollIndex].code;
  574. req.postRequest('/api/v3/poll/saveDetails', dataP, data => {
  575. req.msg('投票成功');
  576. //图片完之后要将该投票的对象返回,便于做渲染%
  577. this.officeList[pIndex].qyPoll = data;
  578. req.saveBehaviorNew(item.id,10,5)
  579. });
  580. }
  581. },
  582. created() {
  583. const systemInfo = uni.getSystemInfoSync();
  584. // px转换到rpx的比例
  585. let pxToRpxScale = 750 / systemInfo.windowWidth;
  586. let systems = {
  587. ktxStatusHeight: systemInfo.statusBarHeight * pxToRpxScale, // 状态栏的高度
  588. navigationHeight: 44 * pxToRpxScale // 导航栏的高度
  589. };
  590. systems.barHeight = systems.ktxStatusHeight + systems.navigationHeight;
  591. this.systems = systems;
  592. }
  593. };
  594. </script>
  595. <style>
  596. @import './index.css';
  597. </style>