my.vue 7.7 KB

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