index.vue 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  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. import {useIsCanBack} from "@/store/isCanBack.js"
  54. let myInfoData = reactive({
  55. userImg: '',
  56. realName: '',
  57. idcard: '',
  58. userName: '',
  59. from:''
  60. });
  61. const commonDialogRef = ref(null);
  62. const passwordDialogRef = ref(null);
  63. const shexiangRef = ref(null);
  64. const zpRef = ref(null);
  65. const exitContent = '你确定要执行这个操作吗?';
  66. const exitTitle = '退出登录';
  67. const store = useIsCanBack();
  68. function getMyInit() {
  69. getUserInfo();
  70. }
  71. // 获取用户头像
  72. function goToPage(data){
  73. switch (data) {
  74. case 'grcj':
  75. uni.navigateTo({
  76. url:'/pages/admin/my/myInfo?from=my'
  77. })
  78. break;
  79. }
  80. }
  81. function getUserInfo(){
  82. getMineUser({}).then(res => {
  83. myInfoData.userImg= res.data.icon;
  84. myInfoData.realName = res.data.realName;
  85. myInfoData.idcard = res.data.idcard;
  86. myInfoData.userName = res.data.userName;
  87. })
  88. }
  89. function exitLogin(){
  90. commonDialogRef.value.handleShow();
  91. }
  92. function xgmmBtn(){
  93. passwordDialogRef.value.handleShow();
  94. }
  95. function passwordBtn(data){
  96. console.log(data,'data');
  97. const opt = {
  98. passwordOld: data.oldPassWord,
  99. passwordNew: data.newPassWord,
  100. }
  101. getPasswordUpdate(opt).then(res => {
  102. if (res.data) {
  103. uni.showToast({
  104. title: '更新成功'
  105. })
  106. passwordDialogRef.value.handleClose();
  107. }
  108. })
  109. }
  110. function exitBtn(){
  111. getMineLogout().then(res => {
  112. toast('退出登录成功')
  113. cacheManager.clearAll();
  114. uni.reLaunch({
  115. url: '/pages/Login/index'
  116. });
  117. store.setIsCanBack(true)
  118. }).catch(err => {
  119. toast('退出登录失败,请稍后重试')
  120. store.setIsCanBack(false)
  121. })
  122. }
  123. function showMessageDl() {
  124. console.log(shexiangRef.value)
  125. shexiangRef.value.handleShow()
  126. }
  127. function showZhuaPaiConfirm() {
  128. zpRef.value.showDialog()
  129. }
  130. function zpConfirmSuccess() {
  131. zpRef.value.showDialog()
  132. }
  133. function zpConfirmError() {
  134. uni.showToast({
  135. title: '摄像头唤起异常',
  136. icon: 'none'
  137. })
  138. }
  139. onLoad(() => {
  140. })
  141. onShow(() => {
  142. getMyInit()
  143. })
  144. </script>
  145. <style>
  146. </style>