index.vue 4.2 KB

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