my.vue 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222
  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 {getMineUser,getMineInfo,getMineLogout} from '@/api/my.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. // import zhuapaiConfrimVue from "@/components/zhuapaiConfirm/index.vue";
  68. let myInfoData = reactive({
  69. userImg: '',
  70. realName: '',
  71. idcard: '',
  72. userName: '',
  73. kaoshiCount: '',
  74. kechengCount: '',
  75. lianxiCount: '',
  76. from:'',
  77. imgsArr: {
  78. myHeadBj: '',
  79. defaultUserImg: '',
  80. telIcon: '',
  81. idcardIcon: '',
  82. ksIcon: '',
  83. lxIcon: '',
  84. kcIcon: '',
  85. userListIcon: '',
  86. scoreListIcon: '',
  87. sxtcsListIcon: '',
  88. sxtsmListIcon: '',
  89. loginOutListIcon: '',
  90. zhengce: '',
  91. xieyi: ''
  92. },
  93. });
  94. const commonDialogRef = ref(null);
  95. const shexiangRef = ref(null);
  96. const zpRef = ref(null);
  97. const exitContent = '你确定要执行这个操作吗?';
  98. const exitTitle = '退出登录';
  99. function getMyInit() {
  100. getUserInfo();
  101. getNumInfo();
  102. }
  103. // 获取用户头像
  104. function goToPage(data){
  105. switch (data) {
  106. case 'ks':
  107. uni.navigateTo({
  108. url:'/pages/client/Kaoshi/list?from=my'
  109. })
  110. break;
  111. case 'lx':
  112. uni.navigateTo({
  113. url:'/pages/client/Lianxi/list?from=my'
  114. })
  115. break;
  116. case 'kc':
  117. uni.navigateTo({
  118. url:'/pages/client/Kecheng/list?from=my'
  119. })
  120. break;
  121. case 'cj':
  122. uni.navigateTo({
  123. url:'/pages/client/Chengji/list?from=my'
  124. })
  125. break;
  126. case 'grcj':
  127. uni.navigateTo({
  128. url:'/pages/client/my/myInfo?from=my'
  129. })
  130. break;
  131. case 'zc':
  132. uni.navigateTo({
  133. url:'/pages/client/my/zhengce?from=my'
  134. })
  135. break;
  136. case 'xy':
  137. uni.navigateTo({
  138. url:'/pages/client/my/xieyi?from=my'
  139. })
  140. break;
  141. }
  142. }
  143. function getUserInfo(){
  144. getMineUser({}).then(res => {
  145. myInfoData.userImg= res.data.icon;
  146. myInfoData.realName = res.data.realName;
  147. myInfoData.idcard = res.data.idcard;
  148. myInfoData.userName = res.data.userName;
  149. })
  150. }
  151. function getNumInfo(){
  152. getMineInfo({}).then(res => {
  153. myInfoData.kaoshiCount = res.data.kaoshiCount;
  154. myInfoData.kechengCount = res.data.kechengCount;
  155. myInfoData.lianxiCount = res.data.lianxiCount;
  156. })
  157. }
  158. function exitLogin(){
  159. commonDialogRef.value.handleShow();
  160. }
  161. function exitBtn(){
  162. getMineLogout().then(res => {
  163. toast('退出登录成功')
  164. cacheManager.clearAll();
  165. uni.reLaunch({
  166. url: '/pages/Login/clientIndex'
  167. });
  168. }).catch(err => {
  169. toast('退出登录失败,请稍后重试')
  170. })
  171. }
  172. function showMessageDl() {
  173. console.log(shexiangRef.value)
  174. shexiangRef.value.handleShow()
  175. }
  176. function showZhuaPaiConfirm() {
  177. uni.navigateTo({
  178. url: "/pages/client/my/cameraTest"
  179. })
  180. }
  181. function zpConfirmSuccess() {
  182. zpRef.value.showDialog()
  183. }
  184. function zpConfirmError() {
  185. uni.showToast({
  186. title: '摄像头唤起异常',
  187. icon: 'none'
  188. })
  189. }
  190. onLoad(() => {
  191. myInfoData.imgsArr.myHeadBj = cacheManager.get('projectImg').client_my_bj;
  192. myInfoData.imgsArr.defaultUserImg = cacheManager.get('projectImg').user_default_img;
  193. myInfoData.imgsArr.telIcon = cacheManager.get('projectImg').my_tel_icon;
  194. myInfoData.imgsArr.idcardIcon = cacheManager.get('projectImg').my_idcard_icon;
  195. myInfoData.imgsArr.ksIcon = cacheManager.get('projectImg').my_ks_icon;
  196. myInfoData.imgsArr.lxIcon = cacheManager.get('projectImg').my_lx_icon;
  197. myInfoData.imgsArr.kcIcon = cacheManager.get('projectImg').my_kc_icon;
  198. myInfoData.imgsArr.userListIcon = cacheManager.get('projectImg').my_editor_icon;
  199. myInfoData.imgsArr.scoreListIcon = cacheManager.get('projectImg').my_score_icon;
  200. myInfoData.imgsArr.sxtcsListIcon = cacheManager.get('projectImg').my_sxtcs_icon;
  201. myInfoData.imgsArr.sxtsmListIcon = cacheManager.get('projectImg').my_sxtsm_icon;
  202. myInfoData.imgsArr.loginOutListIcon = cacheManager.get('projectImg').login_out_icon;
  203. myInfoData.imgsArr.jtIcon= cacheManager.get('projectImg').nav_bar_jt_bottom;
  204. myInfoData.imgsArr.zhengce= cacheManager.get('projectImg').zhengce;
  205. myInfoData.imgsArr.xieyi= cacheManager.get('projectImg').xieyi;
  206. })
  207. onShow(() => {
  208. getMyInit()
  209. })
  210. </script>
  211. <style>
  212. </style>