index.vue 8.4 KB

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