index.vue 11 KB

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