| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246 |
- <template>
- <view v-if="isShow">
- <view class="con">
- <view class="cons">
- <view class="c-user ddflex">
- <image :src="params.userDTO.avatar ? params.userDTO.avatar : '../../static/images/userImg.png'" mode="scaleToFill" class="userimg" @click="toUserHomePage(params.userDTO)"></image>
- <view class="fflex" @click="toUserHomePage(params.userDTO)">
- <view class="name fflex ddflex">{{ params.userDTO.nickName }}</view>
- <view class="area" v-if="params.userDTO.cityName">{{ params.userDTO.provinceName }} {{ params.userDTO.cityName }}</view>
- </view>
- <view class="zan ddflex" @click="submitFabulous(2, params.id)">
- <image :src="'../../static/images/' + (params.isPraise == 1 ? 'like_h' : 'like') + '.png'"></image>
- {{ params.praiseNO }}
- </view>
- </view>
- <view class="c-des">{{ params.content }}</view>
- <view class="sta ddflex">
- <view class="time">{{ params.time }}</view>
- <view class="yuan" @click="jumpUrl('/office/detail/detail?contentId=' + params.momentsDto.id)">查看原动态</view>
- </view>
- <view class="replys" v-if="params.plist && params.plist.length > 0">
- <view class="lis" @click="showReply(params, itm, index)" v-for="(itm, idx) in params.plist">
- <text>{{ itm.userDTO.nickName }}</text>
- <text class="lz" v-if="itm.userDTO.isLandlord == 1">楼主</text>
- <block v-if="itm.toUserDTO && itm.toUserDTO.nickName">
- 回复
- <text>{{ itm.toUserDTO.nickName }}</text>
- <text class="lz" v-if="itm.toUserDTO.isLandlord == 1">楼主</text>
- </block>
- : {{ itm.content }}
- </view>
- </view>
- </view>
- </view>
- <view class="ceng" v-if="isShowReplys" @click="hideReply()"></view>
- <view class="bot1 ddflex" v-if="isShowReply">
- <view class="reply-sr ddflex fflex">
- <input
- v-model="commentContent"
- :placeholder="checkUserDTO ? '回复' + checkUserDTO.nickName : '输入的内容'"
- placeholder-class="placeholder"
- class="ipt fflex"
- />
- <view class="submit" @click="submitComment()">提交</view>
- </view>
- </view>
- </view>
- </template>
- <script>
- //获取应用实例
- const app = getApp();
- const req = require('../../utils/request.js');
- const api = require('../../utils/api.js');
- const utils = require('../../utils/util.js');
- export default {
- data() {
- return {
- isShow: false,
- commentId: '',
- isShowReply: true,
- isShowReplys: false,
- params: {},
- commentContent: '',
- commentType: 2, //1评论动态,2回复外层评论,3回复二级评论
- checkConmmentItem: '',
- checkUserDTO: '',
- checkPositionIndex: '' ,//选中的下标
- checkItm: '',
- commentIds: '',//二级评论id
-
- location: {},
- poiIndex: -1,
- poiList: [],
- };
- },
- onLoad(opt) {
- this.commentId = opt.commentId
- if(opt.isSecond){
- this.commentIds = opt.commentIds
- }
- this.getComments()
- this.getUpdateIsSee();
- QQMapWX.initMap();
- let location = {
- latitude: req.getStorage('loctionAddressMap').location.lat,
- longitude: req.getStorage('loctionAddressMap').location.lng
- }
- QQMapWX.reverseGeocoder(location, data => {
- this.poiList = data.pois;
- this.checkLocation(this.poiList[0],0)
- });
- },
- onShow() {
- },
- methods: {
- chooseLocation(){
- let that = this;
- uni.chooseLocation({//choosePoi不返回经纬度
- success: function (res) {
- console.log('位置名称:' , res);
- that.location = {
- poiName: res.name,
- poiAddress: res.address,
- poiLongitude: res.longitude,
- poiLatitude: res.latitude
- }
- that.reverseGeocoder(res);
- }
- });
- },
- reverseGeocoder(location) {
- QQMapWX.initMap();
- QQMapWX.reverseGeocoder(location, data => {
- this.location.poiRegionalism = data.ad_info.adcode.substring(0, 2) + "0000," + data.ad_info.adcode.substring(0, 4) +"00," + data.ad_info.adcode
- console.log('解析后的地址地址数据:', data,this.location.poiRegionalism);
- });
- },
- checkLocation(item,index){
- if(this.poiIndex == index) return false;
- this.poiIndex = index;
- this.location = {
- poiName: item.title,
- poiAddress: item.address,
- poiLongitude: item.location.lng,
- poiLatitude: item.location.lat,
- poiRegionalism: item.ad_info.adcode.substring(0, 2) + "0000," + item.ad_info.adcode.substring(0, 4) +"00," + item.ad_info.adcode
- }
- },
- getUpdateIsSee(){
- let params = {
- id: this.commentId
- }
- if(this.commentIds){
- params.id = this.commentIds
- }
- req.postRequest('/api/v3/fabulous/updateIsSee',params,res=>{})
- },
- getComments(){
- req.getRequest('/api/v3/fabulous/seeFabulousInfo',{id: this.commentId},res=>{
- this.params = res;
- this.checkConmmentItem = res;
- this.isShow = true;
- })
- },
- toUserHomePage(userObj) {
- if (userObj.isApiUser != 1) {
- //不是后台用户,则可跳转
- this.jumpUrl('/topics/home/home?userId=' + userObj.id);
- }
- },
- //提交点赞、取消点赞;收藏、取消收藏
- submitFabulous(type, pid) {
- if (!req.isLogins(true)) {
- return;
- }
- var dataP = {};
- dataP.type = type; //1,观看 ,2点赞,3评论,4分享,5收藏
- dataP.pid = pid;
- dataP.momentsId = this.params.momentsId;
-
- // 位置
- if(this.location&&this.location.poiName){
- dataP.poiName = this.location.poiName;
- dataP.poiAddress = this.location.poiAddress;
- dataP.poiLongitude = this.location.poiLongitude;
- dataP.poiLatitude = this.location.poiLatitude;
- dataP.poiRegionalism = this.location.poiRegionalism
- }
-
- req.postRequestLoding('/api/v3/fabulous/save', dataP, data => {
- this.params.isPraise = 1
- });
- },
- showReply(conmmentItem, itm, position) {
- if (!req.isLogins(true)) {
- return;
- }
- this.commentContent = '';
- this.isShowReplys = true;
- this.checkConmmentItem = conmmentItem;
- this.checkItm = itm;//二级评论
- this.checkUserDTO = itm.userDTO;
- this.checkPositionIndex = position;
- if (!conmmentItem) {
- this.commentType = 1;
- } else {
- if (!itm.userDTO) {
- this.commentType = 2;
- } else {
- this.commentType = 3;
- }
- }
- },
- hideReply() {
- this.isShowReplys = false;
- },
- //提交评论
- submitComment() {
- var dataP = {};
- dataP.type = 3;
- if (this.commentContent) {
- dataP.content = this.commentContent;
- } else {
- req.msg('请输入评论内容');
- return;
- }
- //1评论动态,2回复外层评论,3回复二级评论
- if (this.commentType == 2) {
- dataP.pid = this.checkConmmentItem.id;
- } else if (this.commentType == 3) {
- dataP.pid = this.checkConmmentItem.id;
- dataP.replyId = this.checkItm.id;
- dataP.toUserId = this.checkUserDTO.id;
- }
- dataP.momentsId = this.params.momentsId;
-
- // 位置
- if(this.location&&this.location.poiName){
- dataP.poiName = this.location.poiName;
- dataP.poiAddress = this.location.poiAddress;
- dataP.poiLongitude = this.location.poiLongitude;
- dataP.poiLatitude = this.location.poiLatitude;
- dataP.poiRegionalism = this.location.poiRegionalism
- }
-
- req.postRequestLoding('/api/v3/fabulous/save', dataP, data => {
- req.msg('评论成功');
- this.hideReply();
- this.params.plist.push(data);
- });
- },
- jumpUrl(url){
- uni.navigateTo({
- url: url
- })
- }
- }
- };
- </script>
- <style>
- @import './comments.css';
- </style>
|