my.vue 6.7 KB

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