my.vue 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193
  1. <template>
  2. <view class="client-my-page">
  3. <view class="my-head-box" :style="{ backgroundImage: 'url(' + myInfoData.imgsArr.myHeadBj + ')' }">
  4. <view class="head-img-box">
  5. <image class="head-img" :src="myInfoData.userImg" v-if="myInfoData.userImg"></image>
  6. <icon class="phone-default-userImg" v-else :style="{ backgroundImage: 'url(' + myInfoData.imgsArr.defaultUserImg + ')' }"></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 :style="{ backgroundImage: 'url(' + myInfoData.imgsArr.telIcon + ')' }"></icon>
  12. <text class="content-text" >{{myInfoData.userName}}</text>
  13. </view>
  14. <view class="head-content-row-box" v-if="myInfoData.idcard">
  15. <icon :style="{ backgroundImage: 'url(' + myInfoData.imgsArr.idcardIcon + ')' }"></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" :style="{ backgroundImage: 'url(' + myInfoData.imgsArr.userListIcon + ')' }"></icon>
  23. <text>修改个人信息</text>
  24. <icon class="jt-icon" :style="{ backgroundImage: 'url(' + myInfoData.imgsArr.jtIcon + ')' }"></icon>
  25. </view>
  26. <view class="list-row" @click="goToPage('cj')">
  27. <icon class="list-icon" :style="{ backgroundImage: 'url(' + myInfoData.imgsArr.scoreListIcon + ')' }"></icon>
  28. <text>我的合同</text>
  29. <icon class="jt-icon" :style="{ backgroundImage: 'url(' + myInfoData.imgsArr.jtIcon + ')' }"></icon>
  30. </view>
  31. <view class="list-row" @click="goToPage('zc')">
  32. <icon class="list-icon" :style="{ backgroundImage: 'url(' + myInfoData.imgsArr.zhengce + ')' }"></icon>
  33. <text>隐私政策</text>
  34. <icon class="jt-icon" :style="{ backgroundImage: 'url(' + myInfoData.imgsArr.jtIcon + ')' }"></icon>
  35. </view>
  36. <view class="list-row" @click="goToPage('xy')">
  37. <icon class="list-icon" :style="{ backgroundImage: 'url(' + myInfoData.imgsArr.xieyi + ')' }"></icon>
  38. <text>用户服务协议</text>
  39. <icon class="jt-icon" :style="{ backgroundImage: 'url(' + myInfoData.imgsArr.jtIcon + ')' }"></icon>
  40. </view>
  41. <!-- <view class="list-row" @click="showZhuaPaiConfirm">
  42. <icon class="list-icon" :style="{ backgroundImage: 'url(' + myInfoData.imgsArr.sxtcsListIcon + ')' }"></icon>
  43. <text>摄像头测试</text>
  44. <icon class="jt-icon" :style="{ backgroundImage: 'url(' + myInfoData.imgsArr.jtIcon + ')' }"></icon>
  45. </view> -->
  46. <view class="list-row" @click="exitLogin">
  47. <icon class="list-icon" :style="{ backgroundImage: 'url(' + myInfoData.imgsArr.loginOutListIcon + ')' }"></icon>
  48. <text>退出登录</text>
  49. <icon class="jt-icon" :style="{ backgroundImage: 'url(' + myInfoData.imgsArr.jtIcon + ')' }"></icon>
  50. </view>
  51. </view>
  52. <!-- 底部区域 -->
  53. <customTabbarClient :currentTab="1"></customTabbarClient>
  54. <common-dialog ref="commonDialogRef" :title="exitTitle" :content="exitContent"@confirm-btn="exitBtn"></common-dialog>
  55. <shexiangDialogVue ref="shexiangRef" title="摄像头说明"></shexiangDialogVue>
  56. </view>
  57. </template>
  58. <script setup>
  59. import {toast} from "@/utils/common";
  60. import {onLoad,onShow} from '@dcloudio/uni-app';
  61. import cacheManager from '@/utils/cacheManager.js';
  62. import {getKehuUser,getKehuLogout} from '@/api/kehu.js'
  63. import {reactive,ref} from "vue";
  64. import customTabbarClient from "@/components/custom-tabbar/custom-tabbar-client.vue"
  65. import commonDialog from '@/components/dialog/commonDialog.vue';
  66. import shexiangDialogVue from "@/components/dialog/shexiangDialog.vue";
  67. let myInfoData = reactive({
  68. userImg: '',
  69. realName: '',
  70. idcard: '',
  71. userName: '',
  72. kaoshiCount: '',
  73. kechengCount: '',
  74. lianxiCount: '',
  75. from:'',
  76. imgsArr: {
  77. myHeadBj: '',
  78. defaultUserImg: '',
  79. telIcon: '',
  80. idcardIcon: '',
  81. ksIcon: '',
  82. lxIcon: '',
  83. kcIcon: '',
  84. userListIcon: '',
  85. scoreListIcon: '',
  86. sxtcsListIcon: '',
  87. sxtsmListIcon: '',
  88. loginOutListIcon: '',
  89. zhengce: '',
  90. xieyi: ''
  91. },
  92. });
  93. const commonDialogRef = ref(null);
  94. const shexiangRef = ref(null);
  95. const zpRef = ref(null);
  96. const exitContent = '你确定要执行这个操作吗?';
  97. const exitTitle = '退出登录';
  98. function getMyInit() {
  99. getUserInfo();
  100. }
  101. // 获取用户头像
  102. function goToPage(data){
  103. switch (data) {
  104. case 'grcj':
  105. uni.navigateTo({
  106. url:'/pages/kehu/my/myInfo?from=my'
  107. })
  108. break;
  109. case 'zc':
  110. uni.navigateTo({
  111. url:'/pages/kehu/my/zhengce?from=my'
  112. })
  113. break;
  114. case 'xy':
  115. uni.navigateTo({
  116. url:'/pages/kehu/my/xieyi?from=my'
  117. })
  118. break;
  119. }
  120. }
  121. function getUserInfo(){
  122. getKehuUser({}).then(res => {
  123. myInfoData.userImg= res.data.icon;
  124. myInfoData.realName = res.data.realName;
  125. myInfoData.idcard = res.data.idcard;
  126. myInfoData.userName = res.data.userName;
  127. })
  128. }
  129. function exitLogin(){
  130. commonDialogRef.value.handleShow();
  131. }
  132. function exitBtn(){
  133. getKehuLogout().then(res => {
  134. toast('退出登录成功')
  135. cacheManager.clearAll();
  136. uni.reLaunch({
  137. url: '/pages/Login/clientIndex'
  138. });
  139. }).catch(err => {
  140. toast('退出登录失败,请稍后重试')
  141. })
  142. }
  143. function showMessageDl() {
  144. shexiangRef.value.handleShow()
  145. }
  146. function showZhuaPaiConfirm() {
  147. uni.navigateTo({
  148. url: "/pages/kehu/my/cameraTest"
  149. })
  150. }
  151. function zpConfirmSuccess() {
  152. zpRef.value.showDialog()
  153. }
  154. function zpConfirmError() {
  155. uni.showToast({
  156. title: '摄像头唤起异常',
  157. icon: 'none'
  158. })
  159. }
  160. onLoad(() => {
  161. myInfoData.imgsArr.myHeadBj = cacheManager.get('projectImg').client_my_bj;
  162. myInfoData.imgsArr.defaultUserImg = cacheManager.get('projectImg').user_default_img;
  163. myInfoData.imgsArr.telIcon = cacheManager.get('projectImg').my_tel_icon;
  164. myInfoData.imgsArr.idcardIcon = cacheManager.get('projectImg').my_idcard_icon;
  165. myInfoData.imgsArr.ksIcon = cacheManager.get('projectImg').my_ks_icon;
  166. myInfoData.imgsArr.lxIcon = cacheManager.get('projectImg').my_lx_icon;
  167. myInfoData.imgsArr.kcIcon = cacheManager.get('projectImg').my_kc_icon;
  168. myInfoData.imgsArr.userListIcon = cacheManager.get('projectImg').my_editor_icon;
  169. myInfoData.imgsArr.scoreListIcon = cacheManager.get('projectImg').my_score_icon;
  170. myInfoData.imgsArr.sxtcsListIcon = cacheManager.get('projectImg').my_sxtcs_icon;
  171. myInfoData.imgsArr.sxtsmListIcon = cacheManager.get('projectImg').my_sxtsm_icon;
  172. myInfoData.imgsArr.loginOutListIcon = cacheManager.get('projectImg').login_out_icon;
  173. myInfoData.imgsArr.jtIcon= cacheManager.get('projectImg').nav_bar_jt_bottom;
  174. myInfoData.imgsArr.zhengce= cacheManager.get('projectImg').zhengce;
  175. myInfoData.imgsArr.xieyi= cacheManager.get('projectImg').xieyi;
  176. })
  177. onShow(() => {
  178. getMyInit()
  179. })
  180. </script>
  181. <style>
  182. </style>