myarticles.js 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. import common from '../../utils/util';
  2. import main from '../../utils/main';
  3. const app = getApp();
  4. Page({
  5. data: {
  6. IsShowRemind:false,
  7. },
  8. onLoad: function (options) {
  9. let that = this;
  10. that.setData({
  11. Containnerheight: main.getWindowHeight(),
  12. });
  13. that.getData(app.globalData.userInfo.UserID);
  14. },
  15. getData:function(userID){
  16. wx.showLoading({
  17. title: '请稍候',
  18. });
  19. let that=this;
  20. main.getData('GetYJBDCArticleList?UserID=' + userID, function (data) {
  21. wx.hideLoading();
  22. if (data) {
  23. for(let i=0;i<data.length;i++){
  24. let item=data[i];
  25. item.WordsStr=item.Words.split(",").join(" ");
  26. }
  27. that.setData({
  28. List:data,
  29. });
  30. }
  31. });
  32. },
  33. goto: function (e) {
  34. let that=this;
  35. var url=e.currentTarget.dataset.url;
  36. wx.navigateTo({
  37. url: url,
  38. });
  39. },
  40. setClipboard:function(e){
  41. let words=e.currentTarget.dataset.words;
  42. app.globalData.SelectedWords=words.split(",");
  43. wx.redirectTo({
  44. url: 'wordsinput',
  45. })
  46. },
  47. deleteArticle:function(e){
  48. this.setData({
  49. IsShowRemind:true,
  50. ID:e.currentTarget.dataset.id
  51. });
  52. },
  53. showRemind:function(e){
  54. let that=this;
  55. const confirm=e.currentTarget.dataset.confirm;
  56. this.setData({
  57. IsShowRemind:!this.data.IsShowRemind,
  58. });
  59. if (confirm=="1") {
  60. main.getData('DeleteYJBDCArticleList?UserID=' + app.globalData.userInfo.UserID+"&ID="+that.data.ID, function (data) {
  61. wx.showToast({
  62. title: '删除完成',
  63. });
  64. that.getData(app.globalData.userInfo.UserID);
  65. });
  66. }
  67. },
  68. setGotoID:function(e){
  69. let that=this;
  70. if (app.globalData.userInfo.UserID<4){
  71. wx.showModal({
  72. title: '输入用户ID,获得生成的文章',
  73. content: '',
  74. editable:true,
  75. complete: (res) => {
  76. if (res.confirm) {
  77. if (res.content)
  78. that.getData(res.content);
  79. }
  80. }
  81. })
  82. }
  83. },
  84. onShareAppMessage: function () {
  85. return {
  86. title: app.globalData.ShareTitle,
  87. path: app.globalData.SharePath + '?UserID=' + app.globalData.userInfo.UserID,
  88. imageUrl: app.globalData.ShareImage,
  89. }
  90. },
  91. })