myInfo.vue 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. <template>
  2. <view class="my-info">
  3. <!-- 导航区域 -->
  4. <view class="icon-title-navBar-box">
  5. <view @click="handleBack" class="nav-bar-icon"></view>
  6. <text class="nav-bar-title">个人信息</text>
  7. </view>
  8. <!-- 头像 -->
  9. <view>
  10. <uni-file-picker limit="1" :del-icon="false" disable-preview :imageStyles="imageStyles" :auto-upload="false"
  11. file-mediatype="image">选择</uni-file-picker>
  12. </view>
  13. <!-- 姓名 -->
  14. <view></view>
  15. <!-- 证件号 -->
  16. <view></view>
  17. <!-- 电话 -->
  18. <view></view>
  19. <!-- 性别 -->
  20. <view></view>
  21. <button @click="handleUpdate">更新</button>
  22. </view>
  23. </template>
  24. <script setup>
  25. import * as myApi from "@/api/my.js"
  26. import {
  27. ref,
  28. reactive
  29. } from "vue"
  30. import {
  31. onLoad
  32. } from "@dcloudio/uni-app"
  33. const imageStyles = ref({
  34. width: 64,
  35. height: 64,
  36. border: {
  37. radius: '50%'
  38. }
  39. });
  40. const data = reactive({
  41. from: 'shouye', // my | kaoshi | shouye
  42. gender: 0,
  43. icon: '',
  44. realName: '',
  45. idcard: '',
  46. userName: '',
  47. userId: null
  48. })
  49. onLoad((options) => {
  50. data.from = options.from || 'shouye';
  51. initPage();
  52. })
  53. function handleUpdate() {
  54. myApi.getUserUpdate({}).then(res => {
  55. if (res.data) {
  56. uni.showToast({
  57. title: '更新成功'
  58. })
  59. }
  60. })
  61. }
  62. function handleBack() {
  63. if (data.from == 'my') {
  64. uni.redirectTo({
  65. url: '/pages/client/my/index'
  66. })
  67. } else if (data.from == 'kaoshi') {
  68. uni.redirectTo({
  69. url: '/pages/client/ShouYe/shouye'
  70. })
  71. } else {
  72. uni.redirectTo({
  73. url: '/pages/client/ShouYe/shouye'
  74. })
  75. }
  76. }
  77. function initPage() {
  78. myApi.getMineUser().then(res => {
  79. const {
  80. gender,
  81. icon,
  82. idcard,
  83. realName,
  84. userName,
  85. userId
  86. } = res.data;
  87. })
  88. }
  89. </script>
  90. <style>
  91. </style>