index.vue 9.4 KB

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