index.vue 11 KB

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