previewMenu.js 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. import common from '../../utils/util';
  2. import main from '../../utils/main';
  3. const app = getApp();
  4. Page({
  5. data: {
  6. MenuArr: [
  7. { CardType: 0, Name: "日常练习", Remark: "需要长期记忆不能遗忘的题卡" },
  8. { CardType: 1, Name: "紧急练习", Remark: "紧急或临时要练习的题卡,需要近期强化巩固的题卡" },
  9. { CardType: -1, Name: "留白题卡", Remark: "提前制作的、他人分享的、暂时无需练习的题卡" },
  10. ]
  11. },
  12. onLoad: function (options) {
  13. var that = this;
  14. that.setData({
  15. Containnerheight: main.getWindowHeight(),
  16. CardType:options.CardType,
  17. MiaoguoCardID:options.ID,
  18. });
  19. },
  20. changeCardType:function(e){
  21. var that = this;
  22. var cardType=e.currentTarget.dataset.cardtype;
  23. if (cardType!=that.data.CardType){
  24. var url ='UpdateMiaoguoCardType?UserID=' + app.globalData.userInfo.UserID;
  25. url += "&CardType=" + cardType;
  26. url += "&ID=" + that.data.MiaoguoCardID;
  27. main.getData(url, function (data) {
  28. var list = app.globalData.CardList;
  29. for (var i = 0; i < list.length; i++) {
  30. if (list[i].MiaoguoCardID==that.data.MiaoguoCardID)
  31. list[i].CardType=cardType;
  32. }
  33. app.globalData.CardList = list;
  34. wx.navigateBack({
  35. delta: 1,
  36. });
  37. });
  38. }
  39. },
  40. onShareAppMessage: function () {
  41. return {
  42. title: app.globalData.ShareTitle,
  43. path: app.globalData.SharePath + '?UserID=' + app.globalData.userInfo.UserID,
  44. imageUrl: app.globalData.ShareImage,
  45. }
  46. },
  47. })