my.js 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. export const myInit = (that) => {
  2. that.setData({
  3. myData: {
  4. title: '修改资料',
  5. concern: '我的关注',
  6. course: '我的课程',
  7. read: '我的朗读',
  8. keep: '我的收藏',
  9. collage: '我的拼团',
  10. wallet: '我的钱包',
  11. address:['北京海淀','中关村','三小'],
  12. schoolCity: '青岛市',
  13. schoolName: '黄岛区志贤中学',
  14. playNum: 31549,
  15. attentionCount: 10254,
  16. point: 6317,
  17. flowerNum: 56245,
  18. user: {}
  19. }
  20. });
  21. that.toMyEdit = (e) => {
  22. let title = e.currentTarget.dataset.title;
  23. wx.navigateTo({
  24. url: `../user/myEdit/myEdit?title=${title}`
  25. });
  26. },
  27. that.toMyConcern = e => {
  28. let title = e.currentTarget.dataset.title;
  29. wx.navigateTo({
  30. url: `../user/myconcern/myconcern?title=${title}`
  31. });
  32. }
  33. that.toMyWallet = e => {
  34. let title = e.currentTarget.dataset.title;
  35. wx.navigateTo({
  36. url: `../user/myWallet/myWallet?title=${title}`
  37. });
  38. },
  39. that.toMyCourse = e => {
  40. let title = e.currentTarget.dataset.title;
  41. wx.navigateTo({
  42. url: `../user/mycourse/mycourse?title=${title}`
  43. });
  44. },
  45. that.toMyRead = e => {
  46. let title = e.currentTarget.dataset.title;
  47. wx.navigateTo({
  48. url: `../user/myread/myread?title=${title}`
  49. });
  50. },
  51. that.toMyKeep = e => {
  52. let title = e.currentTarget.dataset.title;
  53. wx.navigateTo({
  54. url: `../user/mycollection/mycollection?title=${title}`
  55. });
  56. },
  57. that.toMyCollage = e => {
  58. let title = e.currentTarget.dataset.title;
  59. wx.navigateTo({
  60. url: `../../pages/groupPage/my-group/my-group?title=${title}`
  61. });
  62. debugger
  63. APIClient.myWallet().success(res => {
  64. debugger
  65. console.log(res.data.data.data);
  66. });
  67. },
  68. that.userInfo = function () {
  69. const userInfo = wx.getStorageSync('user');
  70. console.log(userInfo.data.data.data);
  71. that.data.myData.user = userInfo.data.data.data;//直接赋值 给 myData的user对象。
  72. that.setData({
  73. myData: that.data.myData,
  74. },()=>{
  75. console.log('myData的user对象,赋值成功')
  76. console.log(that.data.myData);
  77. });
  78. // APIClient.getOpenidSessionKey(res => {
  79. // console.log(res.data.data.data);
  80. // that.data.myData.user = res.data.data.data;//挂载user对象。
  81. // that.setData({
  82. // myData: that.data.myData
  83. // },() => {
  84. // console.log(that.data.myData)
  85. // });
  86. // });
  87. }()
  88. }