myarticles.js 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  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();
  14. },
  15. getData:function(){
  16. wx.showLoading({
  17. title: '请稍候',
  18. });
  19. let that=this;
  20. main.getData('GetYJBDCArticleList?UserID=' + app.globalData.userInfo.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();
  65. });
  66. }
  67. },
  68. onShareAppMessage: function () {
  69. return {
  70. title: app.globalData.ShareTitle,
  71. path: app.globalData.SharePath + '?UserID=' + app.globalData.userInfo.UserID,
  72. imageUrl: app.globalData.ShareImage,
  73. }
  74. },
  75. })