myarticles.js 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. import common from '../../utils/util';
  2. import main from '../../utils/main';
  3. const app = getApp();
  4. Page({
  5. data: {
  6. },
  7. onLoad: function (options) {
  8. let that = this;
  9. that.setData({
  10. Containnerheight: main.getWindowHeight(),
  11. });
  12. that.getData();
  13. },
  14. getData:function(){
  15. const that=this;
  16. main.getData('GetYJBDCArticleList?UserID=' + app.globalData.userInfo.UserID, function (data) {
  17. if (data) {
  18. for(let i=0;i<data.length;i++){
  19. let item=data[i];
  20. item.WordsStr=item.Words.split(",").join(" ");
  21. }
  22. that.setData({
  23. List:data,
  24. });
  25. }
  26. });
  27. },
  28. goto: function (e) {
  29. let that=this;
  30. var url=e.currentTarget.dataset.url;
  31. wx.navigateTo({
  32. url: url,
  33. });
  34. },
  35. setClipboard:function(e){
  36. wx.setClipboardData({
  37. data: e.currentTarget.dataset.words,
  38. success (res) {
  39. wx.getClipboardData({
  40. success (res) {
  41. app.globalData.SelectedWords=res.data.split(",");
  42. }
  43. });
  44. }
  45. });
  46. },
  47. deleteArticle:function(e){
  48. const that=this;
  49. const id=e.currentTarget.dataset.id;
  50. wx.showModal({
  51. title: '删除',
  52. content: '确认删除这篇文章吗?',
  53. complete: (res) => {
  54. if (res.confirm) {
  55. main.getData('DeleteYJBDCArticleList?UserID=' + app.globalData.userInfo.UserID+"&ID="+id, function (data) {
  56. wx.showToast({
  57. title: '删除完成',
  58. });
  59. that.getData();
  60. });
  61. }
  62. }
  63. });
  64. },
  65. onShareAppMessage: function () {
  66. return {
  67. title: app.globalData.ShareTitle,
  68. path: app.globalData.SharePath + '?UserID=' + app.globalData.userInfo.UserID,
  69. imageUrl: app.globalData.ShareImage,
  70. }
  71. },
  72. })