myEdit.js 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  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. let uid = 1, wechatName = nickname, mobile = '13994969642', gender = 3, schoolProvince = 11, schoolCity = '运城市', schoolName = '康杰中学', profession = radioGroup2, birthday = picker;
  51. httpRequestApi.settingUserInfo(uid, wechatName, mobile, gender, schoolProvince, schoolCity, schoolName, profession, birthday).success(res => {
  52. console.log(res.data.data.wechatName);//修改资料成功后 调用 getUserInfo
  53. wx.redirectTo({
  54. url: '/pages/index/index?index=3'
  55. });
  56. // wx.navigateBack({
  57. //
  58. // });
  59. });
  60. },
  61. /**
  62. * 生命周期函数--监听页面加载
  63. */
  64. onLoad: function (option) {
  65. console.log(option.title);
  66. if (option.title) {
  67. wx.setNavigationBarTitle({
  68. title: option.title//页面标题为路由参数
  69. });
  70. this.setData({
  71. title: option.title
  72. });
  73. }
  74. },
  75. /**
  76. * 生命周期函数--监听页面初次渲染完成
  77. */
  78. onReady: function () {
  79. },
  80. /**
  81. * 生命周期函数--监听页面显示
  82. */
  83. onShow: function () {
  84. },
  85. /**
  86. * 生命周期函数--监听页面隐藏
  87. */
  88. onHide: function () {
  89. },
  90. /**
  91. * 生命周期函数--监听页面卸载
  92. */
  93. onUnload: function () {
  94. },
  95. /**
  96. * 页面相关事件处理函数--监听用户下拉动作
  97. */
  98. onPullDownRefresh: function () {
  99. },
  100. /**
  101. * 页面上拉触底事件的处理函数
  102. */
  103. onReachBottom: function () {
  104. },
  105. /**
  106. * 用户点击右上角分享
  107. */
  108. onShareAppMessage: function () {
  109. }
  110. })