index.vue 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172
  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="ewmBtn">
  29. <icon class="list-icon code-icon"></icon>
  30. <text>二维码</text>
  31. </view>
  32. <view class="list-row" @click="exitLogin">
  33. <icon class="list-icon login-out-icon"></icon>
  34. <text>退出登录</text>
  35. </view>
  36. </view>
  37. <!-- 底部区域 -->
  38. <customTabbarClient :currentTab="2"></customTabbarClient>
  39. <common-dialog ref="commonDialogRef" :title="exitTitle" :content="exitContent" @confirm-btn="exitBtn"></common-dialog>
  40. <shexiangDialogVue ref="shexiangRef" title="摄像头说明"></shexiangDialogVue>
  41. <password-dialog ref="passwordDialogRef" @confirm-btn="passwordBtn"></password-dialog>
  42. <image-dialog ref="imageDialogRef"></image-dialog>
  43. <!-- 摄像头确认 -->
  44. <zhuapaiConfrimVue ref="zpRef" @error="zpConfirmError" title="摄像头测试"></zhuapaiConfrimVue>
  45. </view>
  46. </template>
  47. <script setup>
  48. import {toast} from "@/utils/common";
  49. import {onLoad,onShow} from '@dcloudio/uni-app';
  50. import cacheManager from '@/utils/cacheManager.js';
  51. import {getGlMineUser,getGlMineLogout,getGlPasswordUpdate} from '@/api/my.js'
  52. import {reactive,ref} from "vue";
  53. import customTabbarClient from "@/components/custom-tabbar/custom-tabbar-admin.vue"
  54. import commonDialog from '@/components/dialog/commonDialog.vue';
  55. import passwordDialog from './passwordDialog.vue';
  56. import imageDialog from './imageDialog.vue';
  57. import shexiangDialogVue from "@/components/dialog/shexiangDialog.vue";
  58. import zhuapaiConfrimVue from "@/components/zhuapaiConfirm/index.vue";
  59. import {useIsCanBack} from "@/store/isCanBack.js"
  60. let myInfoData = reactive({
  61. jzName: '',
  62. userImg: '',
  63. realName: '',
  64. idcard: '',
  65. userName: '',
  66. from:''
  67. });
  68. const commonDialogRef = ref(null);
  69. const passwordDialogRef = ref(null);
  70. const imageDialogRef = ref(null);
  71. const shexiangRef = ref(null);
  72. const zpRef = ref(null);
  73. const exitContent = '你确定要执行这个操作吗?';
  74. const exitTitle = '退出登录';
  75. const store = useIsCanBack();
  76. function getMyInit() {
  77. getUserInfo();
  78. }
  79. // 获取用户头像
  80. function goToPage(data){
  81. switch (data) {
  82. case 'grcj':
  83. uni.navigateTo({
  84. url:'/pages/admin/my/myInfo?from=my'
  85. })
  86. break;
  87. }
  88. }
  89. function getUserInfo(){
  90. getGlMineUser({}).then(res => {
  91. myInfoData.userImg= res.data.icon;
  92. myInfoData.realName = res.data.realName;
  93. myInfoData.idcard = res.data.idcard;
  94. myInfoData.userName = res.data.userName;
  95. myInfoData.jzName = res.data.jzName;
  96. })
  97. }
  98. function exitLogin(){
  99. commonDialogRef.value.handleShow();
  100. }
  101. function xgmmBtn(){
  102. passwordDialogRef.value.handleShow();
  103. }
  104. function ewmBtn(){
  105. imageDialogRef.value.handleShow();
  106. }
  107. function passwordBtn(data){
  108. console.log(data,'data');
  109. const opt = {
  110. passwordOld: data.oldPassWord,
  111. passwordNew: data.newPassWord,
  112. }
  113. getGlPasswordUpdate(opt).then(res => {
  114. if (res.data) {
  115. uni.showToast({
  116. title: '更新成功'
  117. })
  118. passwordDialogRef.value.handleClose();
  119. }
  120. })
  121. }
  122. function exitBtn(){
  123. getGlMineLogout().then(res => {
  124. toast('退出登录成功')
  125. cacheManager.clearAll();
  126. uni.reLaunch({
  127. url: '/pages/Login/index'
  128. });
  129. store.setIsCanBack(true)
  130. }).catch(err => {
  131. toast('退出登录失败,请稍后重试')
  132. store.setIsCanBack(false)
  133. })
  134. }
  135. function showMessageDl() {
  136. console.log(shexiangRef.value)
  137. shexiangRef.value.handleShow()
  138. }
  139. function showZhuaPaiConfirm() {
  140. zpRef.value.showDialog()
  141. }
  142. function zpConfirmSuccess() {
  143. zpRef.value.showDialog()
  144. }
  145. function zpConfirmError() {
  146. uni.showToast({
  147. title: '摄像头唤起异常',
  148. icon: 'none'
  149. })
  150. }
  151. onLoad(() => {
  152. })
  153. onShow(() => {
  154. getMyInit()
  155. })
  156. </script>
  157. <style>
  158. </style>