index.vue 9.9 KB

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