mywords.js 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. import common from '../../utils/util';
  2. import main from '../../utils/main';
  3. const app = getApp();
  4. Page({
  5. data: {
  6. IsShowSelect:false,
  7. Sort1:"panel112",
  8. Sort2:"",
  9. },
  10. onLoad: function (options) {
  11. let that = this;
  12. that.setData({
  13. Containnerheight: main.getWindowHeight(),
  14. List:app.globalData.UserCollect,
  15. Count:0,
  16. });
  17. },
  18. sortWord:function(e){
  19. let isSort=e.currentTarget.dataset.issort;
  20. let list=[];
  21. let sort1="",sort2="";
  22. if (isSort=="1"){
  23. list=common.sort(this.data.List,"ASC","Word","String");
  24. sort1="";
  25. sort2="panel112";
  26. }
  27. else{
  28. list=common.sort(this.data.List,"DESC","ID","Number");
  29. sort1="panel112";
  30. sort2="";
  31. }
  32. //debugger;
  33. this.setData({
  34. List:list,
  35. Sort1:sort1,
  36. Sort2:sort2,
  37. });
  38. },
  39. selecItem:function(e){
  40. let index=e.currentTarget.dataset.index;
  41. let list=this.data.List;
  42. for(let i=0;i<list.length;i++){
  43. if (index=="all")
  44. list[i].Selected=1;
  45. else if (index==i)
  46. list[i].Selected=list[i].Selected==1?0:1;
  47. }
  48. let count=0;
  49. for(let i=0;i<list.length;i++){
  50. if (list[i].Selected==1)
  51. count++;
  52. }
  53. this.setData({
  54. List:list,
  55. Count:count,
  56. });
  57. },
  58. setDataBoolean:function(e){
  59. if (this.data.IsShowSelect){
  60. let list=this.data.List;
  61. for(let i=0;i<list.length;i++)
  62. list[i].Selected=0;
  63. this.setData({
  64. List:list,
  65. });
  66. }
  67. this.setData({
  68. IsShowSelect:!this.data.IsShowSelect,
  69. });
  70. },
  71. goto: function (e) {
  72. let that=this;
  73. var url=e.currentTarget.dataset.url;
  74. wx.navigateTo({
  75. url: url,
  76. });
  77. },
  78. onShareAppMessage: function () {
  79. return {
  80. title: app.globalData.ShareTitle,
  81. path: app.globalData.SharePath + '?UserID=' + app.globalData.userInfo.UserID,
  82. imageUrl: app.globalData.ShareImage,
  83. }
  84. },
  85. })