jzInfo.vue 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. <template>
  2. <view class="my-info-page">
  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 class="form-label-input">
  10. <view class="phone-form-label">社会信用代码</view>
  11. <input v-model="data.xinyongdaima" placeholder="请输入社会信用代码" />
  12. <icon></icon>
  13. </view>
  14. <!-- 服务监督热线 -->
  15. <view class="form-label-input">
  16. <view class="phone-form-label">服务监督热线</view>
  17. <input v-model="data.jiandurexian" placeholder="请输入服务监督热线" />
  18. <icon></icon>
  19. </view>
  20. <button type="default" class="phone-green-btn info-btn" @click="handleUpdate">修改资料</button>
  21. </view>
  22. </template>
  23. <script setup>
  24. import * as myApi from "@/api/my.js";
  25. import {ref,reactive} from "vue"
  26. import {onLoad} from "@dcloudio/uni-app"
  27. const data = reactive({
  28. xinyongdaima: '',
  29. jiandurexian: '',
  30. userId: null
  31. })
  32. onLoad((options) => {
  33. initPage();
  34. })
  35. function handleUpdate() {
  36. let arr = [];
  37. const opt = {
  38. xinyongdaima: data.xinyongdaima,
  39. // userId: data.userId,
  40. jiandurexian: data.jiandurexian,
  41. }
  42. myApi.getDaimaUpdate(opt).then(res => {
  43. if (res.data) {
  44. uni.showToast({
  45. title: '更新成功'
  46. })
  47. handleBack();
  48. }
  49. })
  50. }
  51. function handleBack() {
  52. const pages = getCurrentPages();
  53. if (pages.length>1) {
  54. uni.navigateBack()
  55. } else {
  56. history.back();
  57. }
  58. }
  59. function initPage() {
  60. myApi.getDaimaInfo().then(res => {
  61. const {xinyongdaima,jiandurexian,userId} = res.data;
  62. data.xinyongdaima = res.data.xinyongdaima;
  63. data.jiandurexian = res.data.jiandurexian;
  64. // data.userId = res.data.userId;
  65. })
  66. }
  67. </script>
  68. <style>
  69. </style>