post.js 624 B

12345678910111213141516171819202122232425262728293031323334
  1. const app = getApp()
  2. Page({
  3. data: {
  4. postId:0,
  5. info:{},
  6. content:''
  7. },
  8. onLoad: function (options) {
  9. let postId = +options.postId||7356;
  10. this.setData({postId})
  11. },
  12. onShow: function(){
  13. this.loadData()
  14. },
  15. loadData(){
  16. let postId = this.data.postId
  17. app.formPost( "Post.getPostInfo", {postId}).then( res=>{
  18. if( res.code == 200 ){
  19. let info = res.data
  20. this.setData({info})
  21. }
  22. })
  23. },
  24. onShareAppMessage: function () {
  25. let {postId, title} = this.data.info;
  26. return {
  27. title: title,
  28. path: `/pages/post/post?postId=${postId}`
  29. }
  30. }
  31. })