C端小程序
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

134 regels
2.2 KiB

  1. let app = getApp();
  2. const Http = require("../../utils/HttpBasics");
  3. const bgColor = require("../../utils/bgColor.js")
  4. const config = require("../../config/config");
  5. const defaultAvatarUrl = 'https://mmbiz.qpic.cn/mmbiz/icTdbqWNOwNRna42FI242Lcia07jQodd2FJGIYQfG0LAJGFxM4FbnQP6yfMxBgJ0F3YRqJCJ1aPAK2dQagdusBZg/0'
  6. Page({
  7. /**
  8. * 页面的初始数据
  9. */
  10. data: {
  11. avatarUrl: defaultAvatarUrl,
  12. theme: wx.getSystemInfoSync().theme,
  13. typeLsit: {},
  14. },
  15. /**
  16. * 获取全局样式
  17. */
  18. getType() {
  19. Http.get({
  20. url: config.api.setType,
  21. data: {
  22. mouldType: app.globalData.mouldType
  23. }
  24. }).then(res => {
  25. const {
  26. code,
  27. data
  28. } = res
  29. if (code == 200) {
  30. app.globalData.typeLsit = data
  31. this.setData({
  32. typeLsit: data,
  33. })
  34. }
  35. })
  36. },
  37. getNickName(e) {
  38. },
  39. formSubmit(e) {
  40. const data = {
  41. avatarUrl: this.data.avatarUrl,
  42. nickName: e.detail.value.nickname
  43. }
  44. Http.post({
  45. url: "/user/updateUserInfo",
  46. data,
  47. }).then(res => {
  48. if (res.code == 200) {
  49. wx.showToast({
  50. title: '更改成功!',
  51. duration: 2000
  52. })
  53. setTimeout(() => {
  54. wx.navigateBack()
  55. }, 2000)
  56. }
  57. }).catch(err => {
  58. console.log(err);
  59. })
  60. },
  61. /**
  62. * 生命周期函数--监听页面加载
  63. */
  64. onLoad(options) {
  65. this.getType(),
  66. wx.onThemeChange((result) => {
  67. this.setData({
  68. theme: result.theme
  69. })
  70. })
  71. },
  72. /**
  73. * 生命周期函数--监听页面初次渲染完成
  74. */
  75. onReady() {
  76. },
  77. /**
  78. * 生命周期函数--监听页面显示
  79. */
  80. onShow() {
  81. },
  82. /**
  83. * 生命周期函数--监听页面隐藏
  84. */
  85. onHide() {
  86. },
  87. /**
  88. * 生命周期函数--监听页面卸载
  89. */
  90. onUnload() {
  91. },
  92. /**
  93. * 页面相关事件处理函数--监听用户下拉动作
  94. */
  95. onPullDownRefresh() {
  96. },
  97. /**
  98. * 页面上拉触底事件的处理函数
  99. */
  100. onReachBottom() {
  101. },
  102. /**
  103. * 用户点击右上角分享
  104. */
  105. onShareAppMessage() {
  106. },
  107. onChooseAvatar(e) {
  108. const { avatarUrl } = e.detail
  109. this.setData({
  110. avatarUrl,
  111. })
  112. },
  113. })