index.vue 4.0 KB

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