index.vue 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  1. <template>
  2. <view class="client-my-page">
  3. <view class="jzgs-name-box">
  4. <text>家政公司名称</text>
  5. </view>
  6. <view class="admin-head-box">
  7. <view class="head-img-box">
  8. <img class="head-img" :src="myInfoData.userImg" v-if="myInfoData.userImg">
  9. <icon class="phone-default-userImg" v-else></icon>
  10. </view>
  11. <view class="head-content-box">
  12. <text>{{myInfoData.realName}}</text>
  13. <view class="head-content-row-box" v-if="myInfoData.userName">
  14. <icon class="tel-icon"></icon>
  15. <text class="content-text" >{{myInfoData.userName}}</text>
  16. </view>
  17. </view>
  18. </view>
  19. <view class="my-list-box">
  20. <view class="list-row" @click="goToPage('grcj')">
  21. <icon class="list-icon user-icon"></icon>
  22. <text>修改个人信息</text>
  23. </view>
  24. <view class="list-row" @click="xgmmBtn">
  25. <icon class="list-icon mm-icon"></icon>
  26. <text>修改密码</text>
  27. </view>
  28. <view class="list-row" @click="exitLogin">
  29. <icon class="list-icon login-out-icon"></icon>
  30. <text>退出登录</text>
  31. </view>
  32. </view>
  33. <!-- 底部区域 -->
  34. <customTabbarClient :currentTab="2"></customTabbarClient>
  35. <common-dialog ref="commonDialogRef" :title="exitTitle" :content="exitContent" @confirm-btn="exitBtn"></common-dialog>
  36. <shexiangDialogVue ref="shexiangRef" title="摄像头说明"></shexiangDialogVue>
  37. <password-dialog ref="passwordDialogRef" @confirm-btn="passwordBtn"></password-dialog>
  38. <!-- 摄像头确认 -->
  39. <zhuapaiConfrimVue ref="zpRef" @error="zpConfirmError" title="摄像头测试"></zhuapaiConfrimVue>
  40. </view>
  41. </template>
  42. <script setup>
  43. import {toast} from "@/utils/common";
  44. import {onLoad,onShow} from '@dcloudio/uni-app';
  45. import cacheManager from '@/utils/cacheManager.js';
  46. import {getMineUser,getMineLogout,getPasswordUpdate} from '@/api/my.js'
  47. import {reactive,ref} from "vue";
  48. import customTabbarClient from "@/components/custom-tabbar/custom-tabbar-admin.vue"
  49. import commonDialog from '@/components/dialog/commonDialog.vue';
  50. import passwordDialog from './passwordDialog.vue';
  51. import shexiangDialogVue from "@/components/dialog/shexiangDialog.vue";
  52. import zhuapaiConfrimVue from "@/components/zhuapaiConfirm/index.vue";
  53. let myInfoData = reactive({
  54. userImg: '',
  55. realName: '',
  56. idcard: '',
  57. userName: '',
  58. from:''
  59. });
  60. const commonDialogRef = ref(null);
  61. const passwordDialogRef = ref(null);
  62. const shexiangRef = ref(null);
  63. const zpRef = ref(null);
  64. const exitContent = '你确定要执行这个操作吗?';
  65. const exitTitle = '退出登录';
  66. function getMyInit() {
  67. getUserInfo();
  68. }
  69. // 获取用户头像
  70. function goToPage(data){
  71. switch (data) {
  72. case 'grcj':
  73. uni.navigateTo({
  74. url:'/pages/admin/my/myInfo?from=my'
  75. })
  76. break;
  77. }
  78. }
  79. function getUserInfo(){
  80. getMineUser({}).then(res => {
  81. myInfoData.userImg= res.data.icon;
  82. myInfoData.realName = res.data.realName;
  83. myInfoData.idcard = res.data.idcard;
  84. myInfoData.userName = res.data.userName;
  85. })
  86. }
  87. function exitLogin(){
  88. commonDialogRef.value.handleShow();
  89. }
  90. function xgmmBtn(){
  91. passwordDialogRef.value.handleShow();
  92. }
  93. function passwordBtn(data){
  94. console.log(data,'data');
  95. const opt = {
  96. passwordOld: data.oldPassWord,
  97. passwordNew: data.newPassWord,
  98. }
  99. getPasswordUpdate(opt).then(res => {
  100. if (res.data) {
  101. uni.showToast({
  102. title: '更新成功'
  103. })
  104. passwordDialogRef.value.handleClose();
  105. }
  106. })
  107. }
  108. function exitBtn(){
  109. getMineLogout().then(res => {
  110. toast('退出登录成功')
  111. cacheManager.clearAll();
  112. uni.reLaunch({
  113. url: '/pages/Login/index'
  114. });
  115. }).catch(err => {
  116. toast('退出登录失败,请稍后重试')
  117. })
  118. }
  119. function showMessageDl() {
  120. console.log(shexiangRef.value)
  121. shexiangRef.value.handleShow()
  122. }
  123. function showZhuaPaiConfirm() {
  124. zpRef.value.showDialog()
  125. }
  126. function zpConfirmSuccess() {
  127. zpRef.value.showDialog()
  128. }
  129. function zpConfirmError() {
  130. uni.showToast({
  131. title: '摄像头唤起异常',
  132. icon: 'none'
  133. })
  134. }
  135. onLoad(() => {
  136. })
  137. onShow(() => {
  138. getMyInit()
  139. })
  140. </script>
  141. <style>
  142. </style>