Untitled diff

建立於 差異永不過期
1 刪除
583 行
18 新增
596 行
// pages/detail/detail.js
// pages/childComment/childComment.js
var WxParse = require('../../wxParse/wxParse.js');
var WxParse = require('../../wxParse/wxParse.js');
Page({
Page({
data: {
data: {
detail: {},
detail: {},
hidden: false,
hidden: false,
tags:{},
tags:{},
comments:{},
comments:{},
replyTemArray:{},
replyTemArray:{},
tittle:"",
tittle:"",
author:"",
author:"",
permlink:"",
permlink:"",
childComments:[],
childComments:[],
showState:"Show",
showState:"Show",
commentShowState:false,
commentShowState:false,
commentBoxContent:""
commentBoxContent:""
},
},
onLoad: function (options) {
onLoad: function (options) {
// The page initializes options for the parameters of the page jump.
// The page initializes options for the parameters of the page jump.
var author = options.author;
var author = options.author;
var permlink = options.permlink;
var permlink = options.permlink;
var parent_author = options.parent_author;
var parent_permlink = options.parent_permlink;
console.log(permlink);
console.log(permlink);
this.setData({author:author,permlink:permlink})
this.setData({ author: author, permlink: permlink, parent_author: parent_author, parent_permlink: parent_permlink})
this.getPostdDtail(author,permlink);
this.getPostdDtail(author,permlink);
// this.getPostComment(author,permlink);
// this.getPostComment(author,permlink);
},
},
onShareAppMessage: function () {
onShareAppMessage: function () {
return {
return {
title: this.data.title,
title: this.data.title,
desc: "Steemit",
desc: "Steemit",
path: '/detail/detail?author=' + this.data.author + '&permlink=' + this.data.permlink
path: '/detail/detail?author=' + this.data.author + '&permlink=' + this.data.permlink
}
}
},
},
onReady: function () {
onReady: function () {
//Page rendering complete
//Page rendering complete
},
},
onShow: function () {
onShow: function () {
//Page shows
//Page shows
},
},
onHide: function () {
onHide: function () {
// Page hide
// Page hide
},
},
onUnload: function () {
onUnload: function () {
// Page close
// Page close
},
},
getReputation(rep) {
getReputation(rep) {
if (rep == 0) {
if (rep == 0) {
return 25
return 25
}
}
var score = (Math.log10(Math.abs(rep)) - 9) * 9 + 25;
var score = (Math.log10(Math.abs(rep)) - 9) * 9 + 25;
if (rep < 0) {
if (rep < 0) {
score = 50 - score;
score = 50 - score;
}
}
return Math.round(score);
return Math.round(score);
},
},
getTime(time) {
getTime(time) {
var postTime = new Date(time);
var postTime = new Date(time);
// console.log(Date.parse(postTime));
// console.log(Date.parse(postTime));
var nowTime = Date.now() - 28800000;
var nowTime = Date.now() - 28800000;
// console.log(nowTime);
// console.log(nowTime);
var ago = nowTime - postTime;
var ago = nowTime - postTime;
if (ago / 1000 / 60 / 60 / 24 >= 1) {
if (ago / 1000 / 60 / 60 / 24 >= 1) {
var dayNum = parseInt(ago / 1000 / 60 / 60 / 24);
var dayNum = parseInt(ago / 1000 / 60 / 60 / 24);
var getTimeData = dayNum.toString();
var getTimeData = dayNum.toString();
getTimeData += "天前";
getTimeData += "天前";
// console.log(getTimeData);
// console.log(getTimeData);
return getTimeData;
return getTimeData;
}
}
else if (ago / 1000 / 60 / 60 >= 1) {
else if (ago / 1000 / 60 / 60 >= 1) {
var hourNum = parseInt(ago / 1000 / 60 / 60);
var hourNum = parseInt(ago / 1000 / 60 / 60);
var getTimeData = hourNum.toString();
var getTimeData = hourNum.toString();
getTimeData += "小时前";
getTimeData += "小时前";
// console.log(getTimeData);
// console.log(getTimeData);
return getTimeData;
return getTimeData;
}
}
else if (ago / 1000 / 60 >= 1) {
else if (ago / 1000 / 60 >= 1) {
var minNum = parseInt(ago / 1000 / 60);
var minNum = parseInt(ago / 1000 / 60);
var getTimeData = minNum.toString();
var getTimeData = minNum.toString();
getTimeData += "分钟前";
getTimeData += "分钟前";
// console.log(getTimeData);
// console.log(getTimeData);
return getTimeData;
return getTimeData;
}
}
else if (ago / 1000 >= 1) {
else if (ago / 1000 >= 1) {
var secNum = parseInt(ago / 1000);
var secNum = parseInt(ago / 1000);
var getTimeData = secNum.toString();
var getTimeData = secNum.toString();
getTimeData += "秒前";
getTimeData += "秒前";
// console.log(getTimeData);
// console.log(getTimeData);
return getTimeData;
return getTimeData;
}
}
else {
else {
var getTimeData = "1秒前";
var getTimeData = "1秒前";
return getTimeData;
return getTimeData;
}
}
},
},
// Get the body and other detail info of the post whose permlink was transmitted by navigating
// Get the body and other detail info of the post whose permlink was transmitted by navigating
getPostdDtail(author,permlink){
getPostdDtail(author,permlink){
var that = this;
var that = this;