index.vue 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194
  1. <template>
  2. <view class="client-my-page">
  3. <view class="my-head-box">
  4. <view class="head-img-box">
  5. <img class="head-img" :src="myInfoData.userImg" v-if="myInfoData.userImg">
  6. <icon class="head-icon" v-else></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 class="tel-icon"></icon>
  12. <text class="content-text" >{{myInfoData.userName}}</text>
  13. </view>
  14. <view class="head-content-row-box" v-if="myInfoData.idcard">
  15. <icon class="idcard-icon"></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 class="ks-icon"></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 class="lx-icon"></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 class="kc-icon"></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 user-icon"></icon>
  43. <text>修改个人信息</text>
  44. </view>
  45. <view class="list-row" @click="goToPage('cj')">
  46. <icon class="list-icon score-icon"></icon>
  47. <text>我的成绩</text>
  48. </view>
  49. <view class="list-row" @click="showZhuaPaiConfirm">
  50. <icon class="list-icon sxtcs-icon"></icon>
  51. <text>摄像头测试</text>
  52. </view>
  53. <view class="list-row" @click="showMessageDl">
  54. <icon class="list-icon sxtsm-icon"></icon>
  55. <text>摄像头说明</text>
  56. </view>
  57. <view class="list-row" @click="exitLogin">
  58. <icon class="list-icon login-out-icon"></icon>
  59. <text>退出登录</text>
  60. </view>
  61. </view>
  62. <!-- 底部区域 -->
  63. <customTabbarClient :currentTab="1"></customTabbarClient>
  64. <common-dialog ref="commonDialogRef" :title="exitTitle" :content="exitContent"@confirm-btn="exitBtn"></common-dialog>
  65. <shexiangDialogVue ref="shexiangRef" title="摄像头说明"></shexiangDialogVue>
  66. <!-- 摄像头确认 -->
  67. <zhuapaiConfrimVue ref="zpRef" @error="zpConfirmError" title="摄像头测试"></zhuapaiConfrimVue>
  68. </view>
  69. </template>
  70. <script setup>
  71. import {toast} from "@/utils/common";
  72. import {onLoad,onShow} from '@dcloudio/uni-app';
  73. import cacheManager from '@/utils/cacheManager.js';
  74. import {getMineUser,getMineInfo,getMineLogout} from '@/api/my.js'
  75. import {reactive,ref} from "vue";
  76. import customTabbarClient from "@/components/custom-tabbar/custom-tabbar-client.vue"
  77. import commonDialog from '@/components/dialog/commonDialog.vue';
  78. import shexiangDialogVue from "@/components/dialog/shexiangDialog.vue";
  79. import zhuapaiConfrimVue from "@/components/zhuapaiConfirm/index.vue";
  80. let myInfoData = reactive({
  81. userImg: '',
  82. realName: '',
  83. idcard: '',
  84. userName: '',
  85. kaoshiCount: '',
  86. kechengCount: '',
  87. lianxiCount: '',
  88. from:''
  89. });
  90. const commonDialogRef = ref(null);
  91. const shexiangRef = ref(null);
  92. const zpRef = ref(null);
  93. const exitContent = '你确定要执行这个操作吗?';
  94. const exitTitle = '退出登录';
  95. function getMyInit() {
  96. getUserInfo();
  97. getNumInfo();
  98. }
  99. // 获取用户头像
  100. function goToPage(data){
  101. switch (data) {
  102. case 'ks':
  103. uni.navigateTo({
  104. url:'/pages/client/Kaoshi/list?from=my'
  105. })
  106. break;
  107. case 'lx':
  108. uni.navigateTo({
  109. url:'/pages/client/Lianxi/list?from=my'
  110. })
  111. break;
  112. case 'kc':
  113. uni.navigateTo({
  114. url:'/pages/client/Kecheng/list?from=my'
  115. })
  116. break;
  117. case 'cj':
  118. uni.navigateTo({
  119. url:'/pages/client/Chengji/list?from=my'
  120. })
  121. break;
  122. case 'grcj':
  123. uni.navigateTo({
  124. url:'/pages/client/my/myInfo?from=my'
  125. })
  126. break;
  127. }
  128. }
  129. function getUserInfo(){
  130. getMineUser({}).then(res => {
  131. myInfoData.userImg= res.data.icon;
  132. myInfoData.realName = res.data.realName;
  133. myInfoData.idcard = res.data.idcard;
  134. myInfoData.userName = res.data.userName;
  135. })
  136. }
  137. function getNumInfo(){
  138. getMineInfo({}).then(res => {
  139. myInfoData.kaoshiCount = res.data.kaoshiCount;
  140. myInfoData.kechengCount = res.data.kechengCount;
  141. myInfoData.lianxiCount = res.data.lianxiCount;
  142. })
  143. }
  144. function exitLogin(){
  145. commonDialogRef.value.handleShow();
  146. }
  147. function exitBtn(){
  148. getMineLogout().then(res => {
  149. toast('退出登录成功')
  150. cacheManager.clearAll();
  151. uni.reLaunch({
  152. url: '/pages/Login/index'
  153. });
  154. }).catch(err => {
  155. toast('退出登录失败,请稍后重试')
  156. })
  157. }
  158. function showMessageDl() {
  159. console.log(shexiangRef.value)
  160. shexiangRef.value.handleShow()
  161. }
  162. function showZhuaPaiConfirm() {
  163. zpRef.value.showDialog()
  164. }
  165. function zpConfirmSuccess() {
  166. zpRef.value.showDialog()
  167. }
  168. function zpConfirmError() {
  169. uni.showToast({
  170. title: '摄像头唤起异常',
  171. icon: 'none'
  172. })
  173. }
  174. onLoad(() => {
  175. })
  176. onShow(() => {
  177. getMyInit()
  178. })
  179. </script>
  180. <style>
  181. </style>