index.vue 12 KB

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