sortRule.js 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. import common from '../../utils/util';
  2. import main from '../../utils/main';
  3. const app = getApp();
  4. Page({
  5. data: {
  6. List: [
  7. {
  8. Name: "智能规划",
  9. Remark: "对时间早晚没有要求,交由系统根据学习情况安排。",
  10. SelectedCSS: "",
  11. },
  12. {
  13. Name: "最早优先",
  14. Remark: "想优先做完以往积压的题卡可选此项。从到期时间较早的往较近的安排题卡。",
  15. SelectedCSS: "",
  16. },
  17. {
  18. Name: "今天优先",
  19. Remark: "想优先做完近期添加的,和最适合当天回想的知识可选此项。从到期时间较近的(如当日)往积压较早的安排题卡。",
  20. SelectedCSS: "",
  21. },
  22. ],
  23. },
  24. onLoad: function (options) {
  25. var that = this;
  26. that.setData({
  27. Containnerheight: main.getWindowHeight(),
  28. });
  29. that.init();
  30. },
  31. init: function () {
  32. var that = this;
  33. common.getStorageValue(this, "SortTypeIndex", 0, function () {
  34. for (var i = 0; i < that.data.List.length; i++) {
  35. if (i == that.data.SortTypeIndex)
  36. that.data.List[i].SelectedCSS = "panelItemSelected";
  37. }
  38. that.setData({
  39. List: that.data.List,
  40. });
  41. });
  42. },
  43. selectType: function (e) {
  44. var that = this;
  45. var index = e.currentTarget.dataset.index;
  46. for (var i = 0; i < that.data.List.length; i++) {
  47. that.data.List[i].SelectedCSS = "";
  48. if (i == index) {
  49. if (that.data.List[i].SelectedCSS == "")
  50. that.data.List[i].SelectedCSS = "panelItemSelected";
  51. else
  52. that.data.List[i].SelectedCSS = "";
  53. }
  54. }
  55. that.setData({
  56. List: that.data.List,
  57. });
  58. wx.setStorageSync("SortTypeIndex", index);
  59. main.UploadUserConfig();
  60. },
  61. onShareAppMessage: function () {
  62. return {
  63. title: app.globalData.ShareTitle,
  64. path: app.globalData.SharePath + '?UserID=' + app.globalData.userInfo.UserID,
  65. imageUrl: app.globalData.ShareImage,
  66. }
  67. },
  68. })