my.vue 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249
  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" :style="{ backgroundImage: 'url(' + myInfoData.imgsArr.yhzxListIcon + ')' }">
  50. </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. yhzxListIcon: '',
  114. zhengce: '',
  115. xieyi: ''
  116. },
  117. });
  118. const commonDialogRef = ref(null);
  119. const zhuxiaoDialogRef = ref(null);
  120. const shexiangRef = ref(null);
  121. const zpRef = ref(null);
  122. const exitContent = '你确定要执行这个操作吗?';
  123. const exitTitle = '退出登录';
  124. const zhuxiaoContent = '你确定要执行这个操作吗?';
  125. const zhuxiaoTitle = '用户注销';
  126. function getMyInit() {
  127. getUserInfo();
  128. }
  129. // 获取用户头像
  130. function goToPage(data) {
  131. switch (data) {
  132. case 'cj':
  133. uni.navigateTo({
  134. url: '/pages/kehu/hetong/hetongList?from=my'
  135. })
  136. break;
  137. case 'grcj':
  138. uni.navigateTo({
  139. url: '/pages/kehu/my/myInfo?from=my'
  140. })
  141. break;
  142. case 'zc':
  143. uni.navigateTo({
  144. url: '/pages/kehu/my/zhengce?from=my'
  145. })
  146. break;
  147. case 'xy':
  148. uni.navigateTo({
  149. url: '/pages/kehu/my/xieyi?from=my'
  150. })
  151. break;
  152. }
  153. }
  154. function getUserInfo() {
  155. getKehuUser({}).then(res => {
  156. myInfoData.userImg = res.data.icon;
  157. myInfoData.realName = res.data.realName;
  158. myInfoData.idcard = res.data.idcard;
  159. myInfoData.userName = res.data.userName;
  160. })
  161. }
  162. function exitLogin() {
  163. commonDialogRef.value.handleShow();
  164. }
  165. function exitBtn() {
  166. getKehuLogout().then(res => {
  167. toast('退出登录成功')
  168. cacheManager.clearAll();
  169. uni.reLaunch({
  170. url: '/pages/Login/clientIndex?from=my'
  171. });
  172. }).catch(err => {
  173. toast('退出登录失败,请稍后重试')
  174. })
  175. }
  176. function zhuxiaoLogin() {
  177. zhuxiaoDialogRef.value.handleShow();
  178. }
  179. function zhuxiaoBtn() {
  180. yonghuzhuxiao().then(res => {
  181. toast('用户注销成功')
  182. cacheManager.clearAll();
  183. uni.reLaunch({
  184. url: '/pages/Login/clientIndex'
  185. });
  186. }).catch(err => {
  187. toast('用户注销失败,请稍后重试')
  188. })
  189. }
  190. function showMessageDl() {
  191. shexiangRef.value.handleShow()
  192. }
  193. function showZhuaPaiConfirm() {
  194. uni.navigateTo({
  195. url: "/pages/kehu/my/cameraTest"
  196. })
  197. }
  198. function zpConfirmSuccess() {
  199. zpRef.value.showDialog()
  200. }
  201. function zpConfirmError() {
  202. uni.showToast({
  203. title: '摄像头唤起异常',
  204. icon: 'none'
  205. })
  206. }
  207. onLoad(() => {
  208. myInfoData.imgsArr.myHeadBj = cacheManager.get('projectImg').client_my_bj;
  209. myInfoData.imgsArr.defaultUserImg = cacheManager.get('projectImg').user_default_img;
  210. myInfoData.imgsArr.telIcon = cacheManager.get('projectImg').my_tel_icon;
  211. myInfoData.imgsArr.idcardIcon = cacheManager.get('projectImg').my_idcard_icon;
  212. myInfoData.imgsArr.ksIcon = cacheManager.get('projectImg').my_ks_icon;
  213. myInfoData.imgsArr.lxIcon = cacheManager.get('projectImg').my_lx_icon;
  214. myInfoData.imgsArr.kcIcon = cacheManager.get('projectImg').my_kc_icon;
  215. myInfoData.imgsArr.userListIcon = cacheManager.get('projectImg').my_editor_icon;
  216. myInfoData.imgsArr.scoreListIcon = cacheManager.get('projectImg').my_score_icon;
  217. myInfoData.imgsArr.sxtcsListIcon = cacheManager.get('projectImg').my_sxtcs_icon;
  218. myInfoData.imgsArr.sxtsmListIcon = cacheManager.get('projectImg').my_sxtsm_icon;
  219. myInfoData.imgsArr.loginOutListIcon = cacheManager.get('projectImg').login_out_icon;
  220. myInfoData.imgsArr.yhzxListIcon = cacheManager.get('projectImg').yhzx_icon;
  221. myInfoData.imgsArr.jtIcon = cacheManager.get('projectImg').nav_bar_jt_bottom;
  222. myInfoData.imgsArr.zhengce = cacheManager.get('projectImg').zhengce;
  223. myInfoData.imgsArr.xieyi = cacheManager.get('projectImg').xieyi;
  224. })
  225. onShow(() => {
  226. getMyInit()
  227. })
  228. </script>
  229. <style>
  230. </style>