myarticles.js 2.3 KB

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