myarticles.js 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. import common from '../../utils/util';
  2. import main from '../../utils/main';
  3. import animation from '../../utils/animation';
  4. const app = getApp();
  5. Page({
  6. data: {
  7. IsShowRemind:false,
  8. },
  9. onLoad: function (options) {
  10. let that = this;
  11. that.setData({
  12. Containnerheight: main.getWindowHeight(),
  13. });
  14. that.getData(app.globalData.userInfo.UserID);
  15. main.checkGenerating();
  16. },
  17. getData:function(userID){
  18. wx.showLoading({
  19. title: '请稍候',
  20. });
  21. let that=this;
  22. main.getData('GetYJBDCArticleList?UserID=' + userID, function (data) {
  23. wx.hideLoading();
  24. if (data) {
  25. for(let i=0;i<data.length;i++){
  26. let item=data[i];
  27. item.WordsStr=item.Words.split(",").join(" ");
  28. }
  29. that.setData({
  30. List:data,
  31. });
  32. }
  33. });
  34. },
  35. goto: function (e) {
  36. let that=this;
  37. var url=e.currentTarget.dataset.url;
  38. wx.navigateTo({
  39. url: url,
  40. });
  41. },
  42. setClipboard:function(e){
  43. let words=e.currentTarget.dataset.words;
  44. app.globalData.SelectedWords=words.split(",");
  45. wx.redirectTo({
  46. url: 'wordsinput',
  47. })
  48. },
  49. deleteArticle:function(e){
  50. animation.toggleRemindWithAnimation(this);
  51. this.setData({
  52. ID:e.currentTarget.dataset.id
  53. });
  54. },
  55. showRemind:function(e){
  56. let that=this;
  57. const confirm=e.currentTarget.dataset.confirm;
  58. animation.toggleRemindWithAnimation(this);
  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. })