index.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364
  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.yhzxListIcon + ')' }"></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. yhzxListIcon: '',
  165. loginOutListIcon: '',
  166. zhengce: '',
  167. xieyi: ''
  168. },
  169. status: 0,
  170. StatusList: []
  171. });
  172. const commonDialogRef = ref(null);
  173. const zhuxiaoDialogRef = ref(null);
  174. const shexiangRef = ref(null);
  175. const zpRef = ref(null);
  176. const exitContent = '你确定要执行这个操作吗?';
  177. const zhuxiaoContent = '你确定要执行这个操作吗?';
  178. const exitTitle = '退出登录';
  179. const zhuxiaoTitle = '用户注销';
  180. function onSelectStatusChange(dd) {
  181. myInfoData.status = dd.detail.value;
  182. const targetId = myInfoData.StatusList[myInfoData.status].id;
  183. updateZhuangtai({
  184. zhuangtai: targetId
  185. }).then(res => {
  186. if (res.data) {
  187. toast('更新成功')
  188. }
  189. })
  190. }
  191. function getMyOpsZhuangtaidata() {
  192. Promise.all([getMyOpsZhuangtai(), getZhuangtaiInfo()]).then(([res, res2]) => {
  193. myInfoData.StatusList = res.data;
  194. myInfoData.status = myInfoData.StatusList.findIndex(item => item.id == (res2.data || 1))
  195. })
  196. }
  197. function getMyInit() {
  198. getUserInfo();
  199. getNumInfo();
  200. }
  201. // 获取用户头像
  202. function goToPage(data) {
  203. switch (data) {
  204. case 'ks':
  205. uni.navigateTo({
  206. url: '/pages/client/Kaoshi/list?from=my'
  207. })
  208. break;
  209. case 'lx':
  210. uni.navigateTo({
  211. url: '/pages/client/Lianxi/list?from=my'
  212. })
  213. break;
  214. case 'kc':
  215. uni.navigateTo({
  216. url: '/pages/client/Kecheng/list?from=my'
  217. })
  218. break;
  219. case 'cj':
  220. uni.navigateTo({
  221. url: '/pages/client/Chengji/list?from=my'
  222. })
  223. break;
  224. case 'grcj':
  225. uni.navigateTo({
  226. url: '/pages/client/my/myInfo?from=my'
  227. })
  228. break;
  229. case 'ht':
  230. uni.navigateTo({
  231. url: '/pages/client/hetong/hetongList'
  232. })
  233. break;
  234. case 'zc':
  235. uni.navigateTo({
  236. url: '/pages/client/my/zhengce?from=my'
  237. })
  238. break;
  239. case 'xy':
  240. uni.navigateTo({
  241. url: '/pages/client/my/xieyi?from=my'
  242. })
  243. break;
  244. }
  245. }
  246. function getUserInfo() {
  247. getMineUser({}).then(res => {
  248. myInfoData.userImg = res.data.icon;
  249. myInfoData.realName = res.data.realName;
  250. myInfoData.idcard = res.data.idcard;
  251. myInfoData.userName = res.data.userName;
  252. })
  253. }
  254. function getNumInfo() {
  255. getMineInfo({}).then(res => {
  256. myInfoData.kaoshiCount = res.data.kaoshiCount;
  257. myInfoData.kechengCount = res.data.kechengCount;
  258. myInfoData.lianxiCount = res.data.lianxiCount;
  259. })
  260. }
  261. function exitLogin() {
  262. commonDialogRef.value.handleShow();
  263. }
  264. function exitBtn() {
  265. getMineLogout().then(res => {
  266. toast('退出登录成功')
  267. cacheManager.clearAll();
  268. uni.reLaunch({
  269. url: '/pages/Login/clientIndex'
  270. });
  271. }).catch(err => {
  272. toast('退出登录失败,请稍后重试')
  273. })
  274. }
  275. function zhuxiaoLogin() {
  276. zhuxiaoDialogRef.value.handleShow();
  277. }
  278. function zhuxiaoBtn() {
  279. yonghuzhuxiao().then(res => {
  280. toast('用户注销成功')
  281. cacheManager.clearAll();
  282. uni.reLaunch({
  283. url: '/pages/Login/clientIndex'
  284. });
  285. }).catch(err => {
  286. toast('用户注销失败,请稍后重试')
  287. })
  288. }
  289. function showMessageDl() {
  290. console.log(shexiangRef.value)
  291. shexiangRef.value.handleShow()
  292. }
  293. function showZhuaPaiConfirm() {
  294. // zpRef.value.showDialog()
  295. uni.navigateTo({
  296. url: "/pages/client/my/cameraTest"
  297. })
  298. }
  299. function zpConfirmSuccess() {
  300. zpRef.value.showDialog()
  301. }
  302. function zpConfirmError() {
  303. uni.showToast({
  304. title: '摄像头唤起异常',
  305. icon: 'none'
  306. })
  307. }
  308. onLoad(() => {
  309. myInfoData.imgsArr.myHeadBj = cacheManager.get('projectImg').client_my_bj;
  310. myInfoData.imgsArr.defaultUserImg = cacheManager.get('projectImg').user_default_img;
  311. myInfoData.imgsArr.telIcon = cacheManager.get('projectImg').my_tel_icon;
  312. myInfoData.imgsArr.idcardIcon = cacheManager.get('projectImg').my_idcard_icon;
  313. myInfoData.imgsArr.ksIcon = cacheManager.get('projectImg').my_ks_icon;
  314. myInfoData.imgsArr.lxIcon = cacheManager.get('projectImg').my_lx_icon;
  315. myInfoData.imgsArr.kcIcon = cacheManager.get('projectImg').my_kc_icon;
  316. myInfoData.imgsArr.userListIcon = cacheManager.get('projectImg').my_editor_icon;
  317. myInfoData.imgsArr.htListIcon = cacheManager.get('projectImg').zjht_icon;
  318. myInfoData.imgsArr.scoreListIcon = cacheManager.get('projectImg').my_score_icon;
  319. myInfoData.imgsArr.sxtcsListIcon = cacheManager.get('projectImg').my_sxtcs_icon;
  320. myInfoData.imgsArr.sxtsmListIcon = cacheManager.get('projectImg').my_sxtsm_icon;
  321. myInfoData.imgsArr.yhzxListIcon = cacheManager.get('projectImg').yhzx_icon;
  322. myInfoData.imgsArr.loginOutListIcon = cacheManager.get('projectImg').login_out_icon;
  323. myInfoData.imgsArr.jtIcon = cacheManager.get('projectImg').nav_bar_jt_bottom;
  324. myInfoData.imgsArr.zhengce = cacheManager.get('projectImg').zhengce;
  325. myInfoData.imgsArr.xieyi = cacheManager.get('projectImg').xieyi;
  326. })
  327. onShow(() => {
  328. getMyInit()
  329. getMyOpsZhuangtaidata();
  330. })
  331. </script>
  332. <style>
  333. </style>