1055 lines
26 KiB
JavaScript
1055 lines
26 KiB
JavaScript
// packageC/micro_communities/microCommentDetails/microCommentDetails.js
|
||
var yz_pay = require("../../../mycomponent/yz_pay/yz_pay");
|
||
var app = getApp();
|
||
Page({
|
||
behaviors: [yz_pay],
|
||
/**
|
||
* 页面的初始数据
|
||
*/
|
||
data: {
|
||
showRich: false,
|
||
language: '',
|
||
bannerindex: 1,
|
||
mainCommentShow: false,
|
||
replyshow: false,
|
||
adminOperationshow: false,
|
||
releaseOperationshow: false,
|
||
amountRewardshow: false,
|
||
rewardPayshow: false,
|
||
stickid: '',
|
||
detailsData: {},
|
||
StickCommentData: [],
|
||
replyName: '',
|
||
replyContent: '',
|
||
host_comment_id: '',
|
||
second_comment_id: '',
|
||
maincomment: '',
|
||
readertype: 1, // 1普通看帖人 2发帖人 3管理人
|
||
is_praise: true,
|
||
//打赏金额选项
|
||
rewardArr: [{
|
||
value: 1,
|
||
name: "5"
|
||
},
|
||
{
|
||
value: 2,
|
||
name: "10"
|
||
},
|
||
{
|
||
value: 3,
|
||
name: "20"
|
||
},
|
||
{
|
||
value: 4,
|
||
name: "50"
|
||
},
|
||
{
|
||
value: 5,
|
||
name: "100"
|
||
}
|
||
],
|
||
iPnoneBottomBol: false,
|
||
rewardArrselect: 99999,
|
||
rewardArrmoney: '',
|
||
rewardArrmoneytype: 2,
|
||
btnData: [],
|
||
rewardMoney: 0,
|
||
commentManagement: false,
|
||
is_own: false,
|
||
commend_id: '',
|
||
mulcommentsshow: true,
|
||
Height: 0,
|
||
LastHeight: 0,
|
||
//more
|
||
isLoadMore: true,
|
||
page: 1,
|
||
total_page: 0,
|
||
loading: false,
|
||
replyheight: 0,
|
||
|
||
stick_flag: 0,
|
||
recommend_flag: 0,
|
||
reward_button: 1,
|
||
|
||
rewardTypes: 0,
|
||
reward_commend_id: 0,
|
||
imgList: [],
|
||
|
||
RewardMember: {} //打赏人信息
|
||
},
|
||
|
||
/**
|
||
* 生命周期函数--监听页面加载
|
||
*/
|
||
onLoad: function (options) {
|
||
if (options.stickId) {
|
||
this.data.stickid = options.stickId;
|
||
} else {
|
||
wx.navigateBack({
|
||
delta: 1
|
||
});
|
||
}
|
||
this.getMicroDetails();
|
||
this.getStickComment();
|
||
try {
|
||
var value = wx.getStorageSync('iPhoneBottom');
|
||
if (value) {
|
||
this.setData({
|
||
iPnoneBottomBol: true
|
||
});
|
||
// Do something with return value
|
||
}
|
||
} catch (e) {
|
||
// Do something when catch error
|
||
}
|
||
},
|
||
|
||
/**
|
||
* 生命周期函数--监听页面初次渲染完成
|
||
*/
|
||
onReady: function () {
|
||
let language = wx.getStorageSync('langIndex');
|
||
this.setData({
|
||
'language': language.en
|
||
});
|
||
},
|
||
|
||
bindChangeBannerIndex(evt) {
|
||
this.setData({
|
||
bannerindex: (evt.detail.current + 1)
|
||
});
|
||
},
|
||
|
||
/**
|
||
* 生命周期函数--监听页面显示
|
||
*/
|
||
onShow: function () {
|
||
|
||
},
|
||
|
||
adminBtn(evt) {
|
||
let typenum = evt.currentTarget.dataset.typenum;
|
||
let dataJson = {};
|
||
dataJson.tid = this.data.stickid;
|
||
if (typenum == 1) {
|
||
dataJson.state = this.data.recommend_flag == 1 ? 0 : 1;
|
||
dataJson.operation = 1;
|
||
} else if (typenum == 2) {
|
||
dataJson.state = this.data.stick_flag == 1 ? 0 : 1;
|
||
dataJson.operation = 2;
|
||
}
|
||
let urlStr = app.getNetAddresss("plugin.micro-communities.api.trick.changeOperation");
|
||
app._postNetWork({
|
||
url: urlStr,
|
||
showToastIn: false,
|
||
data: dataJson,
|
||
success: (resdata) => {
|
||
let res = resdata.data;
|
||
wx.showToast({
|
||
icon: 'none',
|
||
title: res.msg,
|
||
duration: 1500
|
||
});
|
||
if (res.result == 1) {
|
||
if (typenum == 1) {
|
||
let flag = this.data.recommend_flag == 1 ? 0 : 1;
|
||
this.setData({
|
||
recommend_flag: flag
|
||
});
|
||
} else if (typenum == 2) {
|
||
let flag = this.data.recommend_flag == 1 ? 0 : 1;
|
||
this.setData({
|
||
stick_flag: flag
|
||
});
|
||
}
|
||
}
|
||
this.setData({
|
||
adminOperationshow: false
|
||
});
|
||
}
|
||
});
|
||
|
||
},
|
||
|
||
/**
|
||
* 朋友圈
|
||
*/
|
||
onShareTimeline: function () {
|
||
return {
|
||
title: this.data.detailsData.title ? this.data.detailsData.title : '',
|
||
};
|
||
},
|
||
|
||
/**
|
||
* 用户点击右上角分享
|
||
*/
|
||
onShareAppMessage: function () {
|
||
return {
|
||
title: this.data.detailsData.title ? this.data.detailsData.title : '',
|
||
path: '/packageC/micro_communities/microCommentDetails/microCommentDetails?stickId=' + this.options.stickId
|
||
};
|
||
},
|
||
amountRewardshowbtn() {
|
||
this.setData({
|
||
amountRewardshow: false
|
||
});
|
||
},
|
||
getMicroDetails() {
|
||
let that = this;
|
||
let dataJson = {
|
||
tid: this.data.stickid
|
||
};
|
||
let urlStr = app.getNetAddresss("plugin.micro-communities.api.trick.getStrickDetail");
|
||
app._postNetWork({
|
||
url: urlStr,
|
||
showToastIn: false,
|
||
data: dataJson,
|
||
success: function (resdata) {
|
||
var res = resdata.data;
|
||
if (res.result == 1) {
|
||
that.setData({
|
||
detailsData: res.data,
|
||
stick_flag: res.data.is_top,
|
||
recommend_flag: res.data.is_recommend,
|
||
reward_button: res.data.reward_button
|
||
});
|
||
if (that.data.detailsData) {
|
||
if (that.data.detailsData.is_manager == 1) {
|
||
that.setData({
|
||
readertype: 3
|
||
});
|
||
} else if (that.data.detailsData.is_own == 1) {
|
||
that.setData({
|
||
readertype: 2
|
||
});
|
||
}
|
||
if (that.data.detailsData.is_manager == 1) {
|
||
that.setData({
|
||
is_praise: true
|
||
});
|
||
} else {
|
||
that.setData({
|
||
is_praise: false
|
||
});
|
||
}
|
||
}
|
||
if (that.data.detailsData.contents.indexOf('micro-panel-body') > -1 || that.data.detailsData.contents.indexOf('</p>') > -1) {
|
||
// 判断是否富文本
|
||
that.setData({
|
||
showRich: true
|
||
});
|
||
} else {
|
||
let contents = that.data.detailsData.contents.split('\n');
|
||
that.setData({
|
||
showRich: false,
|
||
['detailsData.contents']: contents
|
||
});
|
||
}
|
||
|
||
} else {
|
||
wx.showToast({
|
||
icon: 'none',
|
||
title: res.msg,
|
||
duration: 1500
|
||
});
|
||
}
|
||
},
|
||
fail: function (res) {}
|
||
});
|
||
},
|
||
pageInit() {
|
||
this.data.page = 1;
|
||
this.data.total_page = 0;
|
||
this.data.isLoadMore = true;
|
||
this.data.loading = false;
|
||
},
|
||
getStickComment() {
|
||
let that = this;
|
||
that.pageInit();
|
||
let dataJson = {
|
||
tid: this.data.stickid
|
||
};
|
||
let urlStr = app.getNetAddresss("plugin.micro-communities.api.trick.getStickComment");
|
||
app._postNetWork({
|
||
url: urlStr,
|
||
showToastIn: false,
|
||
data: dataJson,
|
||
success: function (resdata) {
|
||
var res = resdata.data;
|
||
if (res.result == 1) {
|
||
that.data.total_page = res.data.last_page;
|
||
that.setData({
|
||
StickCommentData: res.data.data
|
||
});
|
||
} else {
|
||
wx.showToast({
|
||
icon: 'none',
|
||
title: res.msg,
|
||
duration: 1500
|
||
});
|
||
}
|
||
},
|
||
fail: function (res) {}
|
||
});
|
||
},
|
||
gotoCart() {
|
||
wx.reLaunch({
|
||
url: '/packageG/index/index'
|
||
});
|
||
},
|
||
toShop(e) {
|
||
let id = e.currentTarget.dataset.id;
|
||
wx.navigateTo({
|
||
url: '/packageC/o2o/o2oStore/o2oStore?store_id=' + id
|
||
});
|
||
},
|
||
toGood(e) {
|
||
let good_id = e.currentTarget.dataset.good_id;
|
||
wx.navigateTo({
|
||
url: '/packageA/detail_v2/detail_v2?id=' + good_id
|
||
});
|
||
},
|
||
attentionBtn() {
|
||
if (this.data.detailsData.is_follow) {
|
||
this.cancelAttention();
|
||
} else {
|
||
this.addAttention();
|
||
}
|
||
},
|
||
cancelAttention() {
|
||
let that = this;
|
||
let dataJson = {
|
||
uid: this.data.detailsData.user_id
|
||
};
|
||
let urlStr = app.getNetAddresss("plugin.micro-communities.api.user.delFollow");
|
||
app._postNetWork({
|
||
url: urlStr,
|
||
showToastIn: false,
|
||
data: dataJson,
|
||
success: function (resdata) {
|
||
var res = resdata.data;
|
||
if (res.result == 1) {
|
||
that.setData({
|
||
'detailsData.is_follow': false
|
||
});
|
||
wx.showToast({
|
||
icon: 'none',
|
||
title: res.msg,
|
||
duration: 1500
|
||
});
|
||
} else {
|
||
wx.showToast({
|
||
icon: 'none',
|
||
title: res.msg,
|
||
duration: 1500
|
||
});
|
||
}
|
||
},
|
||
fail: function (res) {}
|
||
});
|
||
},
|
||
addAttention() {
|
||
let that = this;
|
||
let dataJson = {
|
||
user_id: this.data.detailsData.user_id
|
||
};
|
||
let urlStr = app.getNetAddresss("plugin.micro-communities.api.user.addFollow");
|
||
app._postNetWork({
|
||
url: urlStr,
|
||
showToastIn: false,
|
||
data: dataJson,
|
||
success: function (resdata) {
|
||
var res = resdata.data;
|
||
if (res.result == 1) {
|
||
that.setData({
|
||
'detailsData.is_follow': true
|
||
});
|
||
wx.showToast({
|
||
icon: 'none',
|
||
title: res.msg,
|
||
duration: 1500
|
||
});
|
||
} else {
|
||
wx.showToast({
|
||
icon: 'none',
|
||
title: res.msg,
|
||
duration: 1500
|
||
});
|
||
}
|
||
},
|
||
fail: function (res) {}
|
||
});
|
||
},
|
||
managementBtn() {
|
||
if (this.data.readertype == 1) {
|
||
// 。。。
|
||
} else if (this.data.readertype == 2) {
|
||
this.setData({
|
||
releaseOperationshow: true
|
||
});
|
||
} else if (this.data.readertype == 3) {
|
||
this.setData({
|
||
adminOperationshow: true
|
||
});
|
||
}
|
||
},
|
||
replyCommentsBtn(e) {
|
||
let host_comment_id = e.currentTarget.dataset.hostcommentid;
|
||
let second_comment_id = e.currentTarget.dataset.secondcommentid;
|
||
let uname = e.currentTarget.dataset.uname;
|
||
let content = e.currentTarget.dataset.content;
|
||
let is_own = e.currentTarget.dataset.isown;
|
||
this.setData({
|
||
host_comment_id: host_comment_id,
|
||
second_comment_id: second_comment_id,
|
||
replyContent: '',
|
||
replyName: uname,
|
||
replyshowcontent: content
|
||
});
|
||
console.log(this.data.replyContent);
|
||
if (is_own == 1) {
|
||
this.setData({
|
||
is_own: true
|
||
});
|
||
} else {
|
||
this.setData({
|
||
is_own: false
|
||
});
|
||
}
|
||
this.setData({
|
||
commentManagement: true
|
||
});
|
||
},
|
||
praiseBtn(e) {
|
||
let host_comment_id = e.currentTarget.dataset.hostcommentid;
|
||
let second_comment_id = e.currentTarget.dataset.secondcommentid;
|
||
let index = e.currentTarget.dataset.index;
|
||
let chilindex = e.currentTarget.dataset.chilindex;
|
||
let is_praise = e.currentTarget.dataset.ispraise;
|
||
if (is_praise == 1) {
|
||
wx.showToast({
|
||
icon: 'none',
|
||
title: '你已赞过该贴',
|
||
duration: 1500
|
||
});
|
||
return false;
|
||
}
|
||
this.getPraiseData(host_comment_id, second_comment_id, index, chilindex, '');
|
||
},
|
||
getPraiseData(host_comment_id, second_comment_id, index, chilindex, type) {
|
||
let that = this;
|
||
let dataJson = {};
|
||
let urlStr = app.getNetAddresss("plugin.micro-communities.api.trick.givePraise");
|
||
if (!host_comment_id) {
|
||
dataJson.tid = that.data.stickid;
|
||
}
|
||
if (host_comment_id && second_comment_id) {
|
||
dataJson.comment_id = second_comment_id;
|
||
} else {
|
||
dataJson.comment_id = host_comment_id;
|
||
}
|
||
app._postNetWork({
|
||
url: urlStr,
|
||
showToastIn: false,
|
||
data: dataJson,
|
||
success: function (resdata) {
|
||
var res = resdata.data;
|
||
if (res.result == 1) {
|
||
if ('main' == type) {
|
||
that.setData({
|
||
'detailsData.praise_num': (that.data.detailsData.praise_num ? (that.data.detailsData.praise_num + 1) : 1)
|
||
});
|
||
} else {
|
||
if (host_comment_id && second_comment_id) {
|
||
that.setData({
|
||
['StickCommentData.[' + index + '].child[' + chilindex + '].is_praise']: 1,
|
||
['StickCommentData.[' + index + '].child[' + chilindex + '].praise_num']: (that.data.StickCommentData[
|
||
index].child[chilindex].praise_num ? (that.data.StickCommentData[index].child[chilindex].praise_num +
|
||
1) : 1),
|
||
});
|
||
} else {
|
||
that.setData({
|
||
['StickCommentData[' + index + '].is_praise']: 1,
|
||
['StickCommentData[' + index + '].praise_num']: (that.data.StickCommentData[index].praise_num ? (that.data
|
||
.StickCommentData[index].praise_num + 1) : 1),
|
||
});
|
||
}
|
||
}
|
||
wx.showToast({
|
||
icon: 'none',
|
||
title: res.msg,
|
||
duration: 1500
|
||
});
|
||
} else {
|
||
wx.showToast({
|
||
icon: 'none',
|
||
title: res.msg,
|
||
duration: 1500
|
||
});
|
||
}
|
||
},
|
||
fail: function (res) {}
|
||
});
|
||
},
|
||
mulchMeatsShowBtn() {
|
||
this.setData({
|
||
mulcommentsshow: false
|
||
});
|
||
this.getMoreData();
|
||
},
|
||
subMainCommentBtn() {
|
||
this.setData({
|
||
maincomment: '',
|
||
mainCommentShow: true
|
||
});
|
||
},
|
||
moneyShow(e) {
|
||
this.setData({
|
||
rewardArrmoney: '',
|
||
rewardArrselect: 9999,
|
||
rewardMoney: 0,
|
||
amountRewardshow: true,
|
||
rewardTypes: e.currentTarget.dataset.type,
|
||
reward_commend_id: e.currentTarget.dataset.id || 0,
|
||
['RewardMember.img']: e.currentTarget.dataset.memberimg || this.data.detailsData.has_one_stick_user.avatar,
|
||
['RewardMember.name']: e.currentTarget.dataset.name || this.data.detailsData.has_one_stick_user.nickname
|
||
});
|
||
},
|
||
isPraiseBtn() {
|
||
if (this.data.detailsData.is_praise == 1) {
|
||
wx.showToast({
|
||
icon: 'none',
|
||
title: '你已赞过该贴',
|
||
duration: 1500
|
||
});
|
||
return false;
|
||
}
|
||
this.getPraiseData('', '', '', '', 'main');
|
||
},
|
||
subMainBtn() {
|
||
if (!this.data.maincomment) {
|
||
wx.showToast({
|
||
icon: 'none',
|
||
title: '请输入你的精彩评论',
|
||
duration: 1500
|
||
});
|
||
return;
|
||
}
|
||
this.setData({
|
||
mainCommentShow: false
|
||
});
|
||
this.getReplyComments('main');
|
||
},
|
||
getReplyComments(getType) {
|
||
let that = this;
|
||
let dataJson = {
|
||
image: this.data.imgList
|
||
};
|
||
let urlStr = app.getNetAddresss("plugin.micro-communities.api.trick.comments");
|
||
dataJson.tid = that.data.stickid;
|
||
if (getType == 'main') {
|
||
dataJson.content = that.data.maincomment;
|
||
} else {
|
||
dataJson.content = that.data.replyContent;
|
||
}
|
||
if (getType == 'reply') {
|
||
if (this.data.host_comment_id) {
|
||
dataJson.host_comment_id = this.data.host_comment_id;
|
||
}
|
||
if (this.data.second_comment_id) {
|
||
dataJson.second_comment_id = this.data.second_comment_id;
|
||
}
|
||
}
|
||
app._postNetWork({
|
||
url: urlStr,
|
||
showToastIn: false,
|
||
data: dataJson,
|
||
success: function (resdata) {
|
||
var res = resdata.data;
|
||
if (res.result == 1) {
|
||
that.setData({
|
||
imgList: [],
|
||
['detailsData.comments_num']: that.data.detailsData.comments_num + 1
|
||
});
|
||
that.getStickComment();
|
||
wx.showToast({
|
||
icon: 'none',
|
||
title: res.msg,
|
||
duration: 1500
|
||
});
|
||
} else {
|
||
wx.showToast({
|
||
icon: 'none',
|
||
title: res.msg,
|
||
duration: 1500
|
||
});
|
||
}
|
||
},
|
||
fail: function (res) {}
|
||
});
|
||
},
|
||
replySubmitBtn() {
|
||
if (!this.data.replyContent) {
|
||
wx.showToast({
|
||
icon: 'none',
|
||
title: '请输入回复内容',
|
||
duration: 1500
|
||
});
|
||
return;
|
||
}
|
||
this.setData({
|
||
replyshow: false
|
||
});
|
||
this.getReplyComments('reply');
|
||
},
|
||
dminBtn(typenum) {
|
||
let that = this;
|
||
let dataJson = {};
|
||
dataJson.tid = that.stickid;
|
||
if (typenum == 1) {
|
||
dataJson.operation = 1;
|
||
} else if (typenum == 2) {
|
||
dataJson.operation = 2;
|
||
}
|
||
let urlStr = app.getNetAddresss("plugin.micro-communities.api.trick.changeOperation");
|
||
app._postNetWork({
|
||
url: urlStr,
|
||
showToastIn: false,
|
||
data: dataJson,
|
||
success: function (resdata) {
|
||
var res = resdata.data;
|
||
if (res.result == 1) {
|
||
that.setData({
|
||
adminOperationshow: false
|
||
});
|
||
wx.showToast({
|
||
icon: 'none',
|
||
title: res.msg,
|
||
duration: 1500
|
||
});
|
||
} else {
|
||
that.setData({
|
||
adminOperationshow: false
|
||
});
|
||
wx.showToast({
|
||
icon: 'none',
|
||
title: res.msg,
|
||
duration: 1500
|
||
});
|
||
}
|
||
},
|
||
fail: function (res) {}
|
||
});
|
||
},
|
||
deleteBtn() {
|
||
let that = this;
|
||
let dataJson = {};
|
||
let urlStr = app.getNetAddresss("plugin.micro-communities.api.trick.delTrick");
|
||
dataJson.tid = that.data.stickid;
|
||
app._postNetWork({
|
||
url: urlStr,
|
||
showToastIn: false,
|
||
data: dataJson,
|
||
success: function (resdata) {
|
||
var res = resdata.data;
|
||
if (res.result == 1) {
|
||
wx.showToast({
|
||
icon: 'none',
|
||
title: res.msg,
|
||
duration: 1500
|
||
});
|
||
that.setData({
|
||
releaseOperationshow: false,
|
||
adminOperationshow: false
|
||
});
|
||
wx.redirectTo({
|
||
url: '/packageC/micro_communities/microIndex/microIndex',
|
||
});
|
||
} else {
|
||
that.setData({
|
||
releaseOperationshow: false,
|
||
adminOperationshow: false
|
||
});
|
||
wx.showToast({
|
||
icon: 'none',
|
||
title: res.msg,
|
||
duration: 1500
|
||
});
|
||
}
|
||
},
|
||
fail: function (res) {}
|
||
});
|
||
},
|
||
adCancel() {
|
||
this.setData({
|
||
adminOperationshow: false
|
||
});
|
||
},
|
||
reEditBtn() {
|
||
if (this.data.detailsData.is_pc == 1) {
|
||
app.tips("PC端发布的帖子只能在PC端修改!");
|
||
return;
|
||
}
|
||
wx.navigateTo({
|
||
url: '/packageC/micro_communities/microEdit/microEdit?stickid=' + this.data.stickid
|
||
});
|
||
},
|
||
reCancelBtn() {
|
||
this.setData({
|
||
releaseOperationshow: false
|
||
});
|
||
},
|
||
shorewardArrBtn(e) {
|
||
let index = e.currentTarget.dataset.index;
|
||
this.setData({
|
||
rewardArrmoneytype: 1,
|
||
rewardArrselect: index,
|
||
rewardArrmoney: ''
|
||
});
|
||
},
|
||
confirmRewardBtn() {
|
||
this.setData({
|
||
amountRewardshow: false
|
||
});
|
||
console.log(this.data.rewardArrmoneytype);
|
||
if (this.data.rewardArrmoneytype == 1) {
|
||
this.setData({
|
||
rewardMoney: parseInt(this.data.rewardArr[this.data.rewardArrselect].name)
|
||
});
|
||
} else if (this.data.rewardArrmoneytype == 2) {
|
||
this.setData({
|
||
rewardMoney: this.data.rewardArrmoney
|
||
});
|
||
}
|
||
if (app._isTextEmpty(this.data.rewardMoney)) {
|
||
wx.showToast({
|
||
icon: 'none',
|
||
title: '请输入或选择打赏金额',
|
||
duration: 1500
|
||
});
|
||
return;
|
||
}
|
||
if (this.data.rewardMoney <= 0) {
|
||
wx.showToast({
|
||
icon: 'none',
|
||
title: '打赏金额必须大于0',
|
||
duration: 1500
|
||
});
|
||
return;
|
||
}
|
||
this.getPayData();
|
||
},
|
||
//获取支付类型参数
|
||
getPayData() {
|
||
let that = this;
|
||
let urlStr = app.getNetAddresss("plugin.micro-communities.api.reward-log.get-payment-buttons");
|
||
app._getNetWork({
|
||
url: urlStr,
|
||
success: function (resdata) {
|
||
var res = resdata.data;
|
||
if (res.result == 1) {
|
||
let btnData = res.data.buttons;
|
||
that.setData({
|
||
btnData: btnData,
|
||
rewardPayshow: true
|
||
});
|
||
} else {
|
||
// 。。。
|
||
}
|
||
},
|
||
fail: function (res) {
|
||
console.log(res);
|
||
}
|
||
});
|
||
},
|
||
payBtn(e) {
|
||
let type, name, btn = null;
|
||
if (e.currentTarget) {
|
||
type = e.currentTarget.dataset.info.value;
|
||
name = e.currentTarget.dataset.info.name;
|
||
btn = e.currentTarget.dataset.info;
|
||
} else {
|
||
type = e.value;
|
||
name = e.name;
|
||
btn = e;
|
||
}
|
||
|
||
let urlStr = app.getNetAddresss("plugin.micro-communities.api.reward-log.index");
|
||
let dataJson = {
|
||
pay_method: type,
|
||
amount: this.data.rewardMoney,
|
||
pay_name: name,
|
||
client_type: '2'
|
||
};
|
||
if (this.data.rewardTypes == 0) {
|
||
// 帖子打赏
|
||
dataJson.trick_id = this.data.stickid;
|
||
} else {
|
||
// 评论打赏
|
||
urlStr = app.getNetAddresss("plugin.micro-communities.api.reward-log.commentPay");
|
||
dataJson.comment_id = this.data.reward_commend_id;
|
||
}
|
||
app._postNetWork({
|
||
url: urlStr,
|
||
showToastIn: false,
|
||
data: dataJson,
|
||
success: (resdata) => {
|
||
let res = resdata.data;
|
||
if (res.result == 1) {
|
||
this.setData({
|
||
rewardPayshow: false
|
||
});
|
||
this.handleOtherPay(btn, type, res.data);
|
||
} else {
|
||
wx.showToast({
|
||
icon: 'none',
|
||
title: res.msg,
|
||
duration: 1500
|
||
});
|
||
}
|
||
},
|
||
});
|
||
},
|
||
openImgPreview(e) {
|
||
console.log(e);
|
||
wx.previewImage({
|
||
current: e.currentTarget.dataset.activeImg, // 当前显示图片的http链接
|
||
urls: e.currentTarget.dataset.imgs // 需要预览的图片http链接列表
|
||
});
|
||
},
|
||
rewardPayCancelBtn() {
|
||
this.setData({
|
||
rewardPayshow: false
|
||
});
|
||
},
|
||
replyBtn() {
|
||
this.setData({
|
||
replyshow: true,
|
||
commentManagement: false
|
||
});
|
||
},
|
||
delBtn() {
|
||
if (this.data.host_comment_id && this.data.second_comment_id) {
|
||
this.setData({
|
||
commend_id: this.data.second_comment_id
|
||
});
|
||
} else {
|
||
this.setData({
|
||
commend_id: this.data.host_comment_id
|
||
});
|
||
}
|
||
this.setData({
|
||
commentManagement: false
|
||
});
|
||
this.delReply();
|
||
},
|
||
delReply() {
|
||
let that = this;
|
||
let dataJson = {};
|
||
let urlStr = app.getNetAddresss("plugin.micro-communities.api.trick.delComment");
|
||
dataJson.commend_id = this.data.commend_id;
|
||
app._postNetWork({
|
||
url: urlStr,
|
||
showToastIn: false,
|
||
data: dataJson,
|
||
success: function (resdata) {
|
||
var res = resdata.data;
|
||
if (res.result == 1) {
|
||
that.getStickComment();
|
||
wx.showToast({
|
||
icon: 'none',
|
||
title: res.msg,
|
||
duration: 1500
|
||
});
|
||
} else {
|
||
wx.showToast({
|
||
icon: 'none',
|
||
title: res.msg,
|
||
duration: 1500
|
||
});
|
||
}
|
||
},
|
||
fail: function (res) {}
|
||
});
|
||
},
|
||
replyCancelBtn() {
|
||
this.setData({
|
||
commentManagement: false
|
||
});
|
||
},
|
||
imgHeight: function (e) {
|
||
var winWid = wx.getSystemInfoSync().windowWidth; //获取当前屏幕的宽度
|
||
var imgh = e.detail.height; //图片高度
|
||
var imgw = e.detail.width; //图片宽度
|
||
var swiperH = winWid * imgh / imgw + "px"; //等比设置swiper的高度。 即 屏幕宽度 / swiper高度 = 图片宽度 / 图片高度 ==》swiper高度 = 屏幕宽度 * 图片高度 / 图片宽度
|
||
if (parseInt(swiperH) > this.data.LastHeight) {
|
||
this.setData({
|
||
Height: swiperH, //设置高度
|
||
});
|
||
this.data.LastHeight = parseInt(swiperH);
|
||
}
|
||
},
|
||
maincommentinp(e) {
|
||
let val = e.detail.value;
|
||
this.setData({
|
||
maincomment: val
|
||
});
|
||
},
|
||
rewardArrmoneyinp(e) {
|
||
let val = e.detail.value;
|
||
this.setData({
|
||
rewardArrmoney: val
|
||
});
|
||
},
|
||
replyContentinp(e) {
|
||
let val = e.detail.value;
|
||
this.setData({
|
||
replyContent: val
|
||
});
|
||
},
|
||
replyfocus(e) {
|
||
let height = e.detail.height;
|
||
this.setData({
|
||
replyheight: height
|
||
});
|
||
},
|
||
replyblur(e) {
|
||
this.setData({
|
||
replyheight: 0
|
||
});
|
||
},
|
||
replyshowClose() {
|
||
this.setData({
|
||
replyshow: false
|
||
});
|
||
},
|
||
mainCommentShowClose() {
|
||
this.setData({
|
||
mainCommentShow: false
|
||
});
|
||
},
|
||
adminOperationshowClose() {
|
||
this.setData({
|
||
adminOperationshow: false
|
||
});
|
||
},
|
||
releaseOperationshowClose() {
|
||
this.setData({
|
||
releaseOperationshow: false
|
||
});
|
||
},
|
||
amountRewardshowClose() {
|
||
this.setData({
|
||
amountRewardshow: false
|
||
});
|
||
},
|
||
rewardPayshowClose() {
|
||
this.setData({
|
||
rewardPayshow: false
|
||
});
|
||
},
|
||
commentManagementClose() {
|
||
this.setData({
|
||
commentManagement: false
|
||
});
|
||
},
|
||
getMoreData() {
|
||
if (this.data.mulcommentsshow) {
|
||
return false;
|
||
}
|
||
const that = this;
|
||
let json = {
|
||
tid: this.data.stickid
|
||
};
|
||
that.data.isLoadMore = false; // 防止多次请求分页数据
|
||
let urlStr = app.getNetAddresss("plugin.micro-communities.api.trick.getStickComment");
|
||
if (this.data.page >= this.data.total_page) {
|
||
that.setData({
|
||
loading: true
|
||
});
|
||
} else {
|
||
that.data.page = this.data.page + 1;
|
||
json.page = this.data.page;
|
||
app._postNetWork({
|
||
url: urlStr,
|
||
showToastIn: false,
|
||
data: json,
|
||
success: function (resdata) {
|
||
var res = resdata.data;
|
||
if (res.result == 1) {
|
||
var myData = res.data.data;
|
||
that.setData({
|
||
StickCommentData: that.data.StickCommentData.concat(myData)
|
||
});
|
||
} else {
|
||
that.data.page = that.data.page - 1;
|
||
that.data.isLoadMore = false;
|
||
}
|
||
},
|
||
fail: function (res) {}
|
||
});
|
||
}
|
||
},
|
||
helpPay() {
|
||
var value = wx.getStorageSync('yz_uid');
|
||
var path = '';
|
||
if (value) {
|
||
path = value;
|
||
}
|
||
//跳转代付
|
||
wx.navigateTo({
|
||
url: '/packageD/buy/payanotherDetail/payanotherDetail?order_id=' + this.data.detailsData.order_id + '&mid=' + path + '&pid=' + this.data.detailsData.has_one_stick_user.uid
|
||
});
|
||
},
|
||
uploaderFun(e) {
|
||
wx.showLoading({
|
||
title: '加载中',
|
||
});
|
||
|
||
let that = this;
|
||
let urlStr = app.getNetAddresss('upload.uploadPic');
|
||
wx.chooseImage({
|
||
count: 1,
|
||
sizeType: ['original', 'compressed'],
|
||
sourceType: ['album', 'camera'],
|
||
success(res) {
|
||
const tempFilePaths = res.tempFilePaths;
|
||
let photourl = tempFilePaths[0];
|
||
wx.uploadFile({
|
||
url: urlStr,
|
||
filePath: photourl,
|
||
name: 'file',
|
||
success(resdata) {
|
||
var res = JSON.parse(resdata.data);
|
||
wx.hideLoading();
|
||
if (res.result == 1) {
|
||
let imgList = that.data.imgList;
|
||
imgList.push(res.data.img_url);
|
||
that.setData({
|
||
imgList
|
||
});
|
||
} else {
|
||
wx.showToast({
|
||
icon: 'none',
|
||
title: res.msg,
|
||
duration: 1500
|
||
});
|
||
}
|
||
}
|
||
});
|
||
},
|
||
});
|
||
},
|
||
delCommentIMg(e) {
|
||
let val = e.target.dataset.index||e.currentTarget.dataset.index;
|
||
this.data.imgList.splice(val, 1);
|
||
this.setData({
|
||
imgList: this.data.imgList
|
||
});
|
||
},
|
||
|
||
gotoHome(e){
|
||
let uid = e.currentTarget.dataset.id;
|
||
wx.navigateTo({url: '/packageC/micro_communities/microhomepage/microhomepage?micuid=' + uid });
|
||
}
|
||
}); |