detail.vue 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741
  1. <template>
  2. <view v-if="isShowView">
  3. <view class="user ddflex" @click="toUserHomePage(detail.userDTO)">
  4. <image :src="detail.userDTO.avatar?detail.userDTO.avatar:'/static/images/def_head.png'" mode="aspectFill" class="userimg"></image>
  5. <view class="fflex">
  6. <view class="namea ddflex">
  7. <view class="name fflex ddflex">
  8. {{ detail.userDTO.nickName }}
  9. <image v-if="detail.userDTO.levelGrade > 0" src="../../static/images/vip_tag.png" class="vip-tag"></image>
  10. </view>
  11. <view class="time">{{ detail.time }}</view>
  12. </view>
  13. <view class="area" v-if="detail.userDTO.cityName">{{ detail.userDTO.provinceName }} {{ detail.userDTO.cityName }}</view>
  14. </view>
  15. </view>
  16. <view class="con">
  17. <!-- //提问 -->
  18. <view v-if="detail.type == 2" class="des tovers">
  19. <view class="wen">提问</view>
  20. {{ removeHtml(detail.content) }}
  21. </view>
  22. <view class="des" v-else><rich-text :nodes="detail.content"></rich-text></view>
  23. <view class="video" v-if="detail.isHaveVideo && config.open_community_video == 1">
  24. <video :src="detail.url" :show-center-play-btn="false" :controls="detail.isControls" :autoplay="detail.isControls" id="myVideo" @pause="videoPause" @ended="videoEnded"></video>
  25. <view class="video-play ddflex" @click="videoPlay()" v-if="detail.isShowPlayBtn"><image src="../../static/images/play.png"></image></view>
  26. </view>
  27. <view class="imgbox ddflex" v-if="!detail.isHaveVideo&&detail.url">
  28. <image mode="aspectFill" v-for="(it, idx) in styleImgList(detail.url)" :src="it" @click="previewImgss(styleImgList(detail.url), idx)" :key="idx"></image>
  29. </view>
  30. <view :class="'vote-box' + (detail.qyPoll.isEnd ? ' ends' : '')" v-if="detail.qyPoll">
  31. <view class="vote-tit">{{ detail.qyPoll.title }}</view>
  32. <block v-if="detail.qyPoll.isVote == 1">
  33. <!-- 已投 -->
  34. <view class="vote-list end">
  35. <view :class="'lis ddflex ' + (itpy.isVote == 1 ? 'active' : '')" v-for="(itpy, idex) in styleList(detail.qyPoll.optionJson)" :key="idex">
  36. <view class="percent" :style="'width:' + parseFloat(itpy.proportion) + '%;'"></view>
  37. <view class="fflex">{{ itpy.name }}</view>
  38. <view>{{ parseFloat(itpy.proportion) + '%' }}</view>
  39. </view>
  40. </view>
  41. </block>
  42. <block v-else>
  43. <!-- 未投票 -->
  44. <view class="vote-list">
  45. <!-- <view class="lis" @tap="submitPolls(idex)">我是选项</view> -->
  46. <view class="lis" @click="submitPolls(idx)" v-for="(itp, idx) in styleList(detail.qyPoll.optionJson)" :key="idx">{{ itp.name }}</view>
  47. </view>
  48. </block>
  49. <view class="vote-can" v-if="detail.qyPoll.isEnd">
  50. <text>{{ detail.qyPoll.voteCount }}人参与</text>
  51. 投票已结束
  52. </view>
  53. </view>
  54. <view class="que ddflex" v-if="detail.question" @click="jumpUrl('/learn/topic/index?questId=' + detail.question.id)">
  55. <!-- <image src="../../static/images/ht_ico1.png" class="st-ico"></image> -->
  56. <view class="fflex"><rich-text :nodes="detail.question.title" class="tovers"></rich-text></view>
  57. <!-- <image src="../../static/images/ht_ico2.png" class="st-rico"></image> -->
  58. </view>
  59. <!-- <view class="cates ddflex" v-if="detail.question && detail.question.cateName">
  60. <text>{{ detail.question.cateName }}</text>
  61. </view> -->
  62. <view class="ddflex" v-if="detail.qyDialogu&&detail.qyDialogu.isExamine==1">
  63. <view class="topic ddflex" @click="jumpUrl('/topics/detail/detail?topicId=' + detail.qyDialogu.id)">
  64. <image src="../../static/images/topic.png"></image>
  65. <view class="fflex tover">{{ detail.qyDialogu.title }}</view>
  66. </view>
  67. </view>
  68. <view class="ds ddflex">
  69. <view class="loca ddflex fflex" @click="jumpUrlPoi(detail,'/office/poi/index')" v-if="detail.poiName"><image :src="picUrlss+'office_images/loca.png'"></image><text v-if="detail.poiDistance > 0">{{detail.poiDistance ? detail.poiDistance < 1000 ? detail.poiDistance+'m' : (detail.poiDistance/1000).toFixed(1)+'km' : ''}}</text>{{detail.poiName}}</view>
  70. <view class="ddflex" style="justify-content: flex-end;">
  71. <view>{{ detail.count.browseCount }}次浏览</view>
  72. <!-- #ifdef MP-WEIXIN -->
  73. <button open-type="share" hover-class="none" class="opt-share ddflex">
  74. <image src="../../static/images/share.png"></image>
  75. 分享
  76. </button>
  77. <!-- #endif -->
  78. <!-- #ifdef APP-PLUS -->
  79. <view class="opt-share ddflex" @click="appToShare()">
  80. <image src="../../static/images/share.png"></image>
  81. 分享
  82. </view>
  83. <!-- #endif -->
  84. </view>
  85. </view>
  86. <block v-if="detail.type==10||detail.type==11">
  87. <view v-if="detail.type==10" class="ddflex step-box" style="justify-content: space-between;" @click="jumpUrl('/exercise/record/record?userId=' + detail.userId)">
  88. <view>
  89. <view class="step-date">{{detail.wxRun.step}}</view>
  90. <view class="step-label">步数</view>
  91. </view>
  92. <view>
  93. <view class="step-date">{{detail.wxRun.index}}</view>
  94. <view class="step-label" style="text-align: right;">名次</view>
  95. </view>
  96. </view>
  97. <view v-if="detail.type==11" class="ddflex step-box" style="justify-content: space-between;" @click="jumpUrl('/match/activityDetail/activityDetail?id=' + detail.matchContent.id)">
  98. <image class="step-pic" :src="detail.matchContent.pic" mode="aspectFill"></image>
  99. <view class="fflex">
  100. <view class="step-title tovers">{{detail.matchContent.title}}</view>
  101. <view class="ddflex" style="justify-content: space-between;margin-top: 10rpx;">
  102. <view class="step-price">{{detail.matchContent.endTime}}</view>
  103. <view class="step-btn">查看</view>
  104. </view>
  105. </view>
  106. </view>
  107. </block>
  108. <view v-if="detail.userGroupId" class="ddflex step-box" style="padding: 25rpx 21rpx;" @click="jumpUrl('/office/team/index?id=' + detail.userGroupId)">
  109. <image style="width: 24rpx;height: 24rpx;margin-right: 13rpx;" src="../../static/images/link.png"></image>
  110. <view style="font-weight: 500;color: #999999;">Team:</view>
  111. <view>{{detail.userGroupTitle}}</view>
  112. </view>
  113. <block v-else>
  114. <view class="product" v-if="detail.products && detail.products.length > 0">
  115. <view scroll-x="true" :class="'pro-view' + (detail.products.length == 1 ? ' pro-view1' : '')">
  116. <view class="li" v-for="(item, index) in detail.products" :key="index" @click="toProductDetail(item)">
  117. <view class="ddflex">
  118. <image :src="item.pic" mode="aspectFill" class="pic"></image>
  119. <view class="fflex">
  120. <view class="title tovers">{{ item.title }}</view>
  121. <view class="opt ddflex">
  122. <view class="money">¥{{ item.salePrice }}</view>
  123. <view class="pro-btn">购买</view>
  124. </view>
  125. </view>
  126. </view>
  127. </view>
  128. </view>
  129. </view>
  130. </block>
  131. <!-- <view class="shares ddflex">
  132. <button open-type="share" class="share-btn ddflex">
  133. <image src="../static/images/wechat.png"></image>
  134. 微信好友
  135. </button>
  136. <button open-type="share" class="share-btn ddflex">
  137. <image src="../static/images/wechat_1.png"></image>
  138. 朋友圈
  139. </button>
  140. </view> -->
  141. </view>
  142. <view class="line"></view>
  143. <view class="comments">
  144. <view class="tits">
  145. 评论
  146. <text>({{ detail.count.commentCount }})</text>
  147. </view>
  148. <view class="list" v-if="commentList && commentList.length > 0">
  149. <view class="li ddflex" v-for="(item, index) in commentList" :key="index">
  150. <image
  151. :src="item.userDTO.avatar ? item.userDTO.avatar : '/static/images/def_head.png'"
  152. mode="scaleToFill"
  153. class="userimg"
  154. @click="toUserHomePage(item.userDTO)"
  155. ></image>
  156. <view class="fflex">
  157. <view class="c-user ddflex">
  158. <view class="fflex" @click="toUserHomePage(item.userDTO)">
  159. <view class="name fflex ddflex">
  160. {{ item.userDTO.nickName }}
  161. <text class="lz" v-if="item.userDTO.isLandlord == 1">楼主</text>
  162. </view>
  163. <view class="area" v-if="item.userDTO.cityName">{{ item.userDTO.provinceName }} {{ item.userDTO.cityName }}</view>
  164. </view>
  165. <view class="zan ddflex" @click="submitFabulous(2, item.id, index)">
  166. <image :src="'../../static/images/' + (item.isPraise == 1 ? 'like_h' : 'like') + '.png'"></image>
  167. {{ item.praiseNO }}
  168. </view>
  169. </view>
  170. <view class="c-des">{{ item.content }}</view>
  171. <view class="sta ddflex">
  172. <view class="reply ddflex" @click="showReply(item, '', index)">
  173. 回复
  174. <image src="../../static/images/rico1.png"></image>
  175. </view>
  176. <view class="time">{{ item.time }}</view>
  177. </view>
  178. <view class="replys" v-if="item.plist && item.plist.length > 0">
  179. <view class="lis" @click="showReply(item, itm, index)" v-for="(itm, idx) in item.plist" :key="idx">
  180. <text>{{ itm.userDTO.nickName }}</text>
  181. <text class="lz" v-if="itm.userDTO.isLandlord == 1">楼主</text>
  182. <block v-if="itm.toUserDTO && itm.toUserDTO.nickName">
  183. 回复
  184. <text>{{ itm.toUserDTO.nickName }}</text>
  185. <text class="lz" v-if="itm.toUserDTO.isLandlord == 1">楼主</text>
  186. </block>
  187. : {{ itm.content }}
  188. </view>
  189. <!-- @click="jumpUrl('/office/comments/comments')" -->
  190. <view class="check" @click="loadMoreComment(item, index)" v-if="item.commentsNo > 3 && item.plist.length < item.commentsNo">
  191. 查看全部{{ item.commentsNo - item.plist.length }}条回复
  192. </view>
  193. </view>
  194. </view>
  195. </view>
  196. </view>
  197. <view class="nodata" v-else>
  198. <image :src="picUrlss + 'empty_kt.png'"></image>
  199. <text>暂无评论</text>
  200. </view>
  201. </view>
  202. <view class="bot ddflex" v-if="!isShowReply">
  203. <view class="c-ipt fflex ddflex" @click="showReply()" v-if="config.IS_SHOW_COMMENT_HUATI==1">
  204. <image src="../static/images/pl_ico.png"></image>
  205. <view class="ipt">说点什么吧</view>
  206. </view>
  207. <view class="fflex ddflex" v-else>
  208. </view>
  209. <!-- <view class="bot-btn" @click="submitFabulous(5)">
  210. <image :src="'../static/images/' + (detail.isCollection == 1 ? 'collect_h' : 'collect') + '.png'"></image>
  211. <view>收藏</view>
  212. </view> -->
  213. <view class="bot-btn" @click="submitFabulous(2)">
  214. <image :src="'../../static/images/' + (detail.isPraise == 1 ? 'like_h' : 'like') + '.png'"></image>
  215. <view>点赞</view>
  216. <text class="num">{{ detail.count.fabulousCount < 99 ? detail.count.fabulousCount : '99+' }}</text>
  217. </view>
  218. <view class="bot-btn" @click="config.IS_SHOW_COMMENT_HUATI==1?showReply():''">
  219. <image src="../static/images/comment.png"></image>
  220. <view>评论</view>
  221. <text class="num">{{ detail.count.commentCount < 99 ? detail.count.commentCount : '99+' }}</text>
  222. </view>
  223. </view>
  224. <view class="ceng" v-if="isShowReply" @click="hideReply()"></view>
  225. <view class="bot1 ddflex" v-if="isShowReply">
  226. <view class="reply-sr ddflex fflex">
  227. <input
  228. v-model="commentContent"
  229. :placeholder="checkUserDTO ? '回复' + checkUserDTO.nickName : '输入的内容'"
  230. placeholder-class="placeholder"
  231. class="ipt fflex"
  232. focus="true"
  233. />
  234. <view class="submit" @click="submitComment()">提交</view>
  235. </view>
  236. </view>
  237. </view>
  238. </template>
  239. <script>
  240. const app = getApp();
  241. const req = require('../../utils/request.js');
  242. const util = require('../../utils/util.js');
  243. const requsetmessage = require('../../utils/requestmessage.js');
  244. const QQMapWX = require("../../utils/qqmap.js");
  245. export default {
  246. data() {
  247. return {
  248. picUrlss: req.public.picUrls,
  249. isShowView: false,
  250. isShowReply: false,
  251. isLoad: true,
  252. form: {
  253. page: 1,
  254. limit: 10
  255. },
  256. moreCommentForm: {
  257. page: 0,
  258. limit: 20
  259. },
  260. contentId: '', //动态id
  261. detail: '', //动态详情
  262. commentList: '', //评论详情
  263. commentContent: '',
  264. commentType: 1, //1评论动态,2回复外层评论,3回复二级评论
  265. checkConmmentItem: '',
  266. checkUserDTO: '',
  267. checkPositionIndex: '', //选中的下标
  268. checkItm: '',
  269. isNews: false, //是否从消息列表进入
  270. commentId: '',
  271. isSubmit: false,
  272. videoContext: '',
  273. config: {},
  274. pois: '',
  275. currentPoi: {},
  276. location: {},
  277. poiIndex: -1,
  278. poiList: [],
  279. };
  280. },
  281. onLoad(opt) {
  282. this.contentId = opt.contentId;
  283. if (opt.isNews) {
  284. this.isNews = true;
  285. this.commentId = opt.commentId;
  286. }
  287. if(req.getStorage('loctionAddressMap')){
  288. this.pois = {
  289. poiLongitude: req.getStorage('loctionAddressMap').location.lng,
  290. poiLatitude: req.getStorage('loctionAddressMap').location.lat
  291. }
  292. this.getDetail();
  293. }else{
  294. QQMapWX.initMap();
  295. req.getLocation(res => {
  296. const to = {
  297. latitude: res.latitude,
  298. longitude: res.longitude
  299. };
  300. QQMapWX.reverseGeocoder(to, resp => {
  301. if(resp){
  302. resp.pois.map(it=>{
  303. it.poiName = it.title;
  304. it.poiAddress = it.address;
  305. it.poiLongitude = it.location.lng;
  306. it.poiLatitude = it.location.lat
  307. return it;
  308. })
  309. this.pois = resp.pois[0];
  310. }
  311. this.getDetail();
  312. });
  313. });
  314. }
  315. this.getCommentList();
  316. QQMapWX.initMap();
  317. let location = {
  318. latitude: req.getStorage('loctionAddressMap').location.lat,
  319. longitude: req.getStorage('loctionAddressMap').location.lng
  320. }
  321. QQMapWX.reverseGeocoder(location, data => {
  322. this.poiList = data.pois;
  323. this.checkLocation(this.poiList[0],0)
  324. });
  325. },
  326. onShow() {
  327. this.config = JSON.parse(req.getStorage('configRes'))
  328. },
  329. onShareAppMessage() {
  330. var url = '/office/detail/detail?contentId=' + this.contentId;
  331. var img = '';
  332. if (this.detail.url) {
  333. var imgList = this.detail.url.split(',');
  334. img = imgList[0];
  335. } else {
  336. }
  337. req.saveBehaviorNew(this.detail.id, this.detail.pollId?10:11,6)
  338. return {
  339. title: util.removeHtml(this.detail.content),
  340. imageUrl: img,
  341. path: url
  342. };
  343. },
  344. onReachBottom() {
  345. this.form.page++;
  346. this.getCommentList();
  347. },
  348. methods: {
  349. chooseLocation(){
  350. let that = this;
  351. uni.chooseLocation({//choosePoi不返回经纬度
  352. success: function (res) {
  353. console.log('位置名称:' , res);
  354. that.location = {
  355. poiName: res.name,
  356. poiAddress: res.address,
  357. poiLongitude: res.longitude,
  358. poiLatitude: res.latitude
  359. }
  360. that.reverseGeocoder(res);
  361. }
  362. });
  363. },
  364. reverseGeocoder(location) {
  365. QQMapWX.initMap();
  366. QQMapWX.reverseGeocoder(location, data => {
  367. this.location.poiRegionalism = data.ad_info.adcode.substring(0, 2) + "0000," + data.ad_info.adcode.substring(0, 4) +"00," + data.ad_info.adcode
  368. console.log('解析后的地址地址数据:', data,this.location.poiRegionalism);
  369. });
  370. },
  371. checkLocation(item,index){
  372. if(this.poiIndex == index) return false;
  373. this.poiIndex = index;
  374. this.location = {
  375. poiName: item.title,
  376. poiAddress: item.address,
  377. poiLongitude: item.location.lng,
  378. poiLatitude: item.location.lat,
  379. poiRegionalism: item.ad_info.adcode.substring(0, 2) + "0000," + item.ad_info.adcode.substring(0, 4) +"00," + item.ad_info.adcode
  380. }
  381. },
  382. removeHtml(content) {
  383. return util.removeHtml(content);
  384. },
  385. styleList(json) {
  386. var obj = JSON.parse(json);
  387. return obj;
  388. },
  389. styleImgList(str) {
  390. if (str) {
  391. var imgList = str.split(',');
  392. return imgList;
  393. } else {
  394. return [];
  395. }
  396. },
  397. jumpUrl(url) {
  398. if (!req.isLogins(true)) {
  399. return;
  400. }
  401. uni.navigateTo({
  402. url: url
  403. });
  404. },
  405. jumpUrlPoi(item,url){
  406. this.currentPoi = item;
  407. uni.navigateTo({
  408. url: url
  409. })
  410. },
  411. toUserHomePage(userObj) {
  412. if (userObj.isApiUser != 1) {
  413. //不是后台用户,则可跳转
  414. this.jumpUrl('/topics/home/home?userId=' + userObj.id);
  415. }
  416. },
  417. showReply(conmmentItem, itm, position) {
  418. if (!req.isLogins(true)) {
  419. return;
  420. }
  421. this.commentContent = '';
  422. this.isShowReply = true;
  423. this.checkConmmentItem = conmmentItem;
  424. if (itm) {
  425. this.checkItm = itm; //二级评论
  426. this.checkUserDTO = itm.userDTO;
  427. }
  428. this.checkPositionIndex = position;
  429. if (!conmmentItem) {
  430. this.commentType = 1;
  431. } else {
  432. if (!itm.userDTO) {
  433. this.commentType = 2;
  434. } else {
  435. this.commentType = 3;
  436. }
  437. }
  438. },
  439. hideReply() {
  440. this.isShowReply = false;
  441. },
  442. //预览图片
  443. previewImgss(picUrls, index) {
  444. //预览合同图片
  445. var src = picUrls[index];
  446. let imgs = picUrls;
  447. uni.previewImage({
  448. current: src, // 当前显示图片的http链接
  449. urls: imgs
  450. });
  451. },
  452. toProductDetail(item) {
  453. if (!req.isLogins(true)) {
  454. return;
  455. }
  456. if (item.actId) {
  457. app.globalData.openPage('group/detail/detail?id=' + item.id + '&groupId=' + item.actId);
  458. } else {
  459. app.globalData.openPage('product/detail/detail?id=' + item.id);
  460. }
  461. },
  462. sum(arr) {
  463. var s = 0;
  464. for (var i = arr.length - 1; i >= 0; i--) {
  465. if (arr[i].count) {
  466. s += Number(arr[i].count);
  467. }
  468. }
  469. return s;
  470. },
  471. getDetail() {
  472. let params = {
  473. id: this.contentId
  474. }
  475. if(this.pois){
  476. params.poiLatitude = this.pois.poiLatitude;
  477. params.poiLongitude = this.pois.poiLongitude;
  478. }
  479. req.getRequest('/api/v3/moments/info', params, data => {
  480. if (data.qyPoll && data.qyPoll.isEnd) {
  481. data.qyPoll.voteCount = this.sum(JSON.parse(data.qyPoll.optionJson));
  482. }
  483. if(data.url){
  484. let h = data.url.substring(data.url.lastIndexOf('.') + 1)
  485. if(h.indexOf('mp4')>-1||h.indexOf('MP4')>-1){
  486. console.log('视频',h,h.indexOf('mp4'),h.indexOf('MP4'))
  487. data.isHaveVideo = true
  488. data.isControls = false
  489. data.isShowPlayBtn = true
  490. }
  491. }
  492. this.detail = data;
  493. this.isShowView = true;
  494. if (this.isNews) {
  495. this.getUpdateIsSee();
  496. }
  497. req.saveBehaviorNew(this.detail.pollId,this.detail.pollId?10:11,4)
  498. });
  499. },
  500. getUpdateIsSee() {
  501. let params = {
  502. id: this.commentId
  503. };
  504. req.postRequest('/api/v3/fabulous/updateIsSee', { id: this.commentId }, res => {});
  505. },
  506. //获取评论列表
  507. getCommentList() {
  508. if (!this.isLoad) return false;
  509. this.isLoad = false;
  510. let form = this.form;
  511. form.momentsId = this.contentId;
  512. form.type = 3;
  513. form.isQueryPid = 1;
  514. req.getRequest('/api/v3/fabulous/list', form, data => {
  515. if (data && data.length >= 10) {
  516. this.isLoad = true;
  517. }
  518. if (this.form.page > 1) {
  519. data = this.commentList.concat(data);
  520. }
  521. this.commentList = data;
  522. });
  523. },
  524. loadMoreComment(item, index) {
  525. if (!req.isLogins(true)) {
  526. return;
  527. }
  528. this.moreCommentForm.page++;
  529. var dataPram = this.moreCommentForm;
  530. dataPram.type = 3;
  531. dataPram.pid = item.id;
  532. req.getRequest('/api/v3/fabulous/listV1', dataPram, data => {
  533. if (this.moreCommentForm.page == 1) {
  534. this.commentList[index].plist = [];
  535. }
  536. this.commentList[index].plist = this.commentList[index].plist.concat(data);
  537. });
  538. },
  539. //提交点赞、取消点赞;收藏、取消收藏
  540. submitFabulous(type, pid, commentIndex) {
  541. if (!req.isLogins(true)) {
  542. return;
  543. }
  544. var dataP = {};
  545. dataP.type = type; //1,观看 ,2点赞,3评论,4分享,5收藏
  546. if (pid) {
  547. dataP.pid = pid;
  548. }
  549. dataP.momentsId = this.contentId;
  550. // 位置
  551. if(this.location&&this.location.poiName){
  552. dataP.poiName = this.location.poiName;
  553. dataP.poiAddress = this.location.poiAddress;
  554. dataP.poiLongitude = this.location.poiLongitude;
  555. dataP.poiLatitude = this.location.poiLatitude;
  556. dataP.poiRegionalism = this.location.poiRegionalism
  557. }
  558. req.postRequestLoding('/api/v3/fabulous/save', dataP, data => {
  559. if (type == 2) {
  560. //点赞
  561. if (pid) {
  562. //评论点赞点赞
  563. if (this.commentList[commentIndex].isPraise == 1) {
  564. this.commentList[commentIndex].isPraise = 0;
  565. this.commentList[commentIndex].praiseNO--;
  566. } else {
  567. this.commentList[commentIndex].isPraise = 1;
  568. this.commentList[commentIndex].praiseNO++;
  569. }
  570. } else {
  571. //动态点赞
  572. if (this.detail.isPraise == 1) {
  573. //已赞
  574. this.detail.isPraise = 0;
  575. this.detail.count.fabulousCount--;
  576. req.saveBehaviorNew(this.detail.id, this.detail.pollId?10:11,11)
  577. } else {
  578. this.detail.isPraise = 1;
  579. this.detail.count.fabulousCount++;
  580. req.saveBehaviorNew(this.detail.id, this.detail.pollId?10:11,3)
  581. }
  582. }
  583. } else if (type == 5) {
  584. //收藏
  585. if (this.detail.isCollection == 1) {
  586. this.detail.isCollection = 0;
  587. } else {
  588. this.detail.isCollection = 1;
  589. }
  590. }
  591. });
  592. },
  593. //提交评论
  594. async submitComment() {
  595. console.log('this.isSubmit==', this.isSubmit);
  596. if (this.isSubmit) return false;
  597. var dataP = {};
  598. dataP.type = 3;
  599. if (this.commentContent) {
  600. dataP.content = this.commentContent;
  601. } else {
  602. req.msg('请输入评论内容');
  603. return;
  604. }
  605. //1评论动态,2回复外层评论,3回复二级评论
  606. if (this.commentType == 2) {
  607. dataP.pid = this.checkConmmentItem.id;
  608. } else if (this.commentType == 3) {
  609. dataP.pid = this.checkConmmentItem.id;
  610. dataP.replyId = this.checkItm.id;
  611. dataP.toUserId = this.checkUserDTO.id;
  612. }
  613. //为提问时,需要加匿名参数
  614. if (this.detail.type == 2) {
  615. dataP.momentsType = 2; //匿名
  616. }
  617. dataP.momentsId = this.contentId;
  618. this.isSubmit = true;
  619. // 位置
  620. if(this.location&&this.location.poiName){
  621. dataP.poiName = this.location.poiName;
  622. dataP.poiAddress = this.location.poiAddress;
  623. dataP.poiLongitude = this.location.poiLongitude;
  624. dataP.poiLatitude = this.location.poiLatitude;
  625. dataP.poiRegionalism = this.location.poiRegionalism
  626. }
  627. // await requsetmessage.remindIntegral().then(res => {});
  628. req.postRequestLoding('/api/v3/fabulous/save', dataP, data => {
  629. this.detail.count.commentCount++;
  630. req.msg('评论成功');
  631. this.hideReply();
  632. if (this.commentType == 1) {
  633. //在评论列表首位插入
  634. this.commentList.splice(0, 0, data);
  635. } else {
  636. //在评论列表二级列表末尾处插入
  637. this.commentList[this.checkPositionIndex].plist.push(data);
  638. }
  639. setTimeout(res => {
  640. this.isSubmit = false;
  641. }, 200);
  642. });
  643. },
  644. //提交投票
  645. submitPolls(pollIndex) {
  646. if (!req.isLogins(true)) {
  647. return;
  648. }
  649. if (this.detail.qyPoll.isEnd) return req.msg('投票已结束');
  650. var dataP = {};
  651. dataP.pollId = this.detail.qyPoll.id;
  652. var pollObjList = JSON.parse(this.detail.qyPoll.optionJson);
  653. dataP.pollOptionCode = pollObjList[pollIndex].code;
  654. req.postRequest('/api/v3/poll/saveDetails', dataP, data => {
  655. req.msg('投票成功');
  656. //图片完之后要将该投票的对象返回,便于做渲染%
  657. this.detail.qyPoll = data;
  658. req.saveBehaviorNew(this.detail.id,10,5)
  659. });
  660. },
  661. appToShare() {
  662. console.log('数据>>>>');
  663. var img = '';
  664. if (this.detail.url) {
  665. var imgList = this.detail.url.split(',');
  666. img = imgList[0];
  667. } else {
  668. let config = JSON.parse(req.getStorage('configRes'));
  669. img = config.share_pic;
  670. }
  671. console.log('数据>>>>', img);
  672. var text = util.removeHtml(this.detail.content);
  673. console.log('数据>>>>', text);
  674. uni.share({
  675. provider: 'weixin',
  676. scene: 'WXSceneSession',
  677. type: 5,
  678. imageUrl: img,
  679. title: text,
  680. summary: text,
  681. miniProgram: {
  682. id: req.public.miniProgramGh_id,
  683. path: 'office/detail/detail?contentId=' + this.contentId,
  684. type: 0,
  685. webUrl: 'http://www.lemonban.com'
  686. },
  687. success: ret => {
  688. console.log(ret);
  689. },
  690. fail: ret => {
  691. console.log(ret);
  692. }
  693. });
  694. },
  695. videoPlay(){
  696. var that = this;
  697. this.detail.isControls = true
  698. this.detail.isShowPlayBtn = false
  699. var videoContext = uni.createVideoContext('myVideo') // 对应的视频id
  700. videoContext.play()
  701. },
  702. videoPause(index){
  703. this.detail.isControls = false
  704. this.detail.isShowPlayBtn = true
  705. },
  706. videoEnded(index){
  707. this.detail.isControls = false
  708. this.detail.isShowPlayBtn = true
  709. }
  710. }
  711. };
  712. </script>
  713. <style>
  714. @import './detail.css';
  715. </style>