my.vue 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. <template>
  2. <view>
  3. <view class="con">
  4. <view class="flex item">
  5. <view>用户名:</view>
  6. <input v-model="person.name" />
  7. </view>
  8. <view class="flex item">
  9. <view>手机号:</view>
  10. <input v-model="person.phone" />
  11. </view>
  12. </view>
  13. </view>
  14. </template>
  15. <script>
  16. export default {
  17. data() {
  18. return {
  19. person: {}
  20. }
  21. },
  22. onLoad() {
  23. this.getSelfInfo()
  24. },
  25. methods: {
  26. // 查看个人信息
  27. getSelfInfo() {
  28. this.http.request({
  29. url: '/sp-admin/app/AppUser/getSelfInfo',
  30. success: res => {
  31. this.person = res.data.data
  32. }
  33. });
  34. },
  35. // 修改个人信息
  36. updateUser(){
  37. this.http.request({
  38. url: '/sp-admin/app/AppUser/update',
  39. success: res => {
  40. uni.showModal({
  41. content: '修改成功',
  42. showCancel: false
  43. }),
  44. this.getSelfInfo()
  45. }
  46. });
  47. }
  48. }
  49. }
  50. </script>
  51. <style lang="scss">
  52. page {
  53. background-color: $pg;
  54. }
  55. .con{
  56. background-color: #fff;
  57. margin: 20px;
  58. padding: 10px;
  59. border-radius: 10px;
  60. height: 200px;
  61. border: 1px #fff solid;
  62. }
  63. .item{
  64. height: 50px;
  65. display: flex;
  66. align-items: center;
  67. border-bottom: 1px #dcdcdc solid;
  68. }
  69. </style>