myEdit.js 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. import httpRequestApi from '../../../utils/APIClient';
  2. Page({
  3. /**
  4. * 页面的初始数据
  5. */
  6. data: {
  7. sexs: [
  8. { value: '女',checked: true },
  9. { value: '男', checked: false }
  10. ],
  11. occupations: [
  12. { value: '家长', checked: false },
  13. { value: '老师', checked: false },
  14. { value: '学生', checked: true }
  15. ],
  16. date: '2001年12月12日',
  17. msg: '',
  18. nickname: ''
  19. },
  20. saveNickName: function(e){
  21. let nickname = e.detail.value;
  22. this.setData({
  23. nicename: nickname
  24. }, () => {
  25. console.log(nickname);
  26. });
  27. },
  28. saveAddress: function(e){
  29. let msg = e.detail.value;
  30. this.setData({
  31. msg: msg
  32. },() => {
  33. console.log(msg);
  34. });
  35. },
  36. bindDateChange: function(e) {
  37. console.log(e.detail.value)
  38. this.setData({
  39. date: e.detail.value
  40. });
  41. },
  42. optionAction:function(e){
  43. console.log(e.detail.value);
  44. },
  45. optionSetting: function (e) {
  46. console.log(e.detail.value);
  47. },
  48. formSubmit: function(e){
  49. let { nickname, picker, radioGroup1, radioGroup2, address } = e.detail.value;
  50. console.log(nickname);
  51. let wechatName = nickname, mobile = '18295785982', gender = 3, schoolProvince = 11, schoolCity = '运城市', schoolName = '康杰中学', profession = radioGroup2, birthday = picker;
  52. httpRequestApi.settingUserInfo(wechatName, mobile, gender, schoolProvince, schoolCity, schoolName, profession, birthday).success(res => {
  53. console.log(res.data.data.wechatName);//修改资料成功后 调用 getUserInfo
  54. wx.redirectTo({
  55. url: '/pages/index/index?index=3'
  56. });
  57. // wx.navigateBack({
  58. //
  59. // });
  60. });
  61. },
  62. /**
  63. * 生命周期函数--监听页面加载
  64. */
  65. onLoad: function (option) {
  66. console.log(option.title);
  67. if (option.title) {
  68. wx.setNavigationBarTitle({
  69. title: option.title//页面标题为路由参数
  70. });
  71. this.setData({
  72. title: option.title
  73. });
  74. }
  75. },
  76. /**
  77. * 生命周期函数--监听页面初次渲染完成
  78. */
  79. onReady: function () {
  80. },
  81. /**
  82. * 生命周期函数--监听页面显示
  83. */
  84. onShow: function () {
  85. },
  86. /**
  87. * 生命周期函数--监听页面隐藏
  88. */
  89. onHide: function () {
  90. },
  91. /**
  92. * 生命周期函数--监听页面卸载
  93. */
  94. onUnload: function () {
  95. },
  96. /**
  97. * 页面相关事件处理函数--监听用户下拉动作
  98. */
  99. onPullDownRefresh: function () {
  100. },
  101. /**
  102. * 页面上拉触底事件的处理函数
  103. */
  104. onReachBottom: function () {
  105. },
  106. /**
  107. * 用户点击右上角分享
  108. */
  109. onShareAppMessage: function () {
  110. }
  111. })