teacherMine.vue 9.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428
  1. <template>
  2. <view class="teacherMine">
  3. <!-- 背景渐变色 -->
  4. <view class="back-img-box"></view>
  5. <!-- 信息面板 -->
  6. <view class="user-info-box">
  7. <view class="left-img-box">
  8. <img v-if="userData.avatar" class="avatar-img" :src="userData.avatar">
  9. <img v-else class="avatar-img" src="@/pages/images/icon_01.png">
  10. <img class="edit-img" src="@/pages/images/newImage/icon_wd_bj@1x.png">
  11. </view>
  12. <view class="right-name-box">
  13. <view class="right-name-top-box">
  14. <view>{{userData.userName}}</view>
  15. </view>
  16. <view class="right-name-bottom-box">{{userData.deptName}}</view>
  17. </view>
  18. </view>
  19. <!-- 信用分面板 -->
  20. <view class="points-max-box">
  21. <view class="points-big-box">
  22. <view class="num-p colorA">{{creditScore?creditScore:'-'}}</view>
  23. <view class="img-box">
  24. <img src="@/pages/images/newImage/icon_wd_xyf@1x.png">
  25. <view>信用分</view>
  26. </view>
  27. </view>
  28. <view class="border-null-p"></view>
  29. <view class="points-big-box">
  30. <view class="num-p colorB">{{bonusPoints?bonusPoints:'-'}}</view>
  31. <view class="img-box">
  32. <img src="@/pages/images/newImage/icon_wd_jlf@1x.png">
  33. <view>奖励分</view>
  34. </view>
  35. </view>
  36. <view class="border-null-p"></view>
  37. <view class="points-big-box">
  38. <view class="num-p colorC">扫一扫</view>
  39. <view class="img-box">
  40. <img style="margin-left:30rpx;" src="@/pages/images/newImage/icon_wd_dh@1x.png">
  41. <view>积分兑换</view>
  42. </view>
  43. </view>
  44. </view>
  45. <!-- 按钮部分 -->
  46. <view class="button-max-big-box">
  47. <view class="button-big-box" @click="goPage('riskEarlyWarning')">
  48. <img class="left-img" src="@/pages/images/newImage/icon_wd_fxyj@1x.png">
  49. <view class="left-text-p">风险预警</view>
  50. <view class="right-text-p"></view>
  51. <img class="right-img" src="@/pages/images/newImage/icon_wd_gd@1x.png">
  52. </view>
  53. <view class="button-big-box" @click="goPage('entryAndExitRecord')">
  54. <img class="left-img" src="@/pages/images/newImage/icon_wd_jcjl.png">
  55. <view class="left-text-p">进出记录</view>
  56. <view class="right-text-p"></view>
  57. <img class="right-img" src="@/pages/images/newImage/icon_wd_gd@1x.png">
  58. </view>
  59. </view>
  60. <view class="button-max-big-box">
  61. <view class="button-big-box" @click="goPage('accessControlAuthorization')">
  62. <img class="left-img" src="@/pages/images/newImage/icon_wd_mjsq@1x.png">
  63. <view class="left-text-p">门禁授权</view>
  64. <view class="right-text-p"></view>
  65. <img class="right-img" src="@/pages/images/newImage/icon_wd_gd@1x.png">
  66. </view>
  67. </view>
  68. <view class="button-max-big-box">
  69. <view class="button-big-box" @click="goPage('identityAuthentication')">
  70. <img class="left-img" src="@/pages/images/newImage/icon_wd_sfyz@1x.png">
  71. <view class="left-text-p">身份验证</view>
  72. <view class="right-text-p"></view>
  73. <img class="right-img" src="@/pages/images/newImage/icon_wd_gd@1x.png">
  74. </view>
  75. <view class="button-big-box" @click="goPage('electronicSignature')">
  76. <img class="left-img" src="@/pages/images/newImage/icon_wd_dzqm@1x.png">
  77. <view class="left-text-p">电子签名</view>
  78. <view class="right-text-p"></view>
  79. <img class="right-img" src="@/pages/images/newImage/icon_wd_gd@1x.png">
  80. </view>
  81. </view>
  82. <view class="out-button" @click="clickOut">退出登录</view>
  83. <tab-bar></tab-bar>
  84. </view>
  85. </template>
  86. <script>
  87. import {
  88. config
  89. } from '@/api/request/config.js'
  90. import {
  91. logout,
  92. systemUserProfile,
  93. examPointsRecordGetMyPointsLogInfo,
  94. } from '@/pages/api/index.js'
  95. import {
  96. pageRestrictVerify
  97. } from '@/utils/index'
  98. import {
  99. tabBar
  100. } from '@/pages/component/tabBar.vue'
  101. export default {
  102. name: "teacherMine",
  103. components: {
  104. tabBar,
  105. },
  106. data() {
  107. return {
  108. userData:{},
  109. bonusPoints:null,
  110. creditScore:null,
  111. }
  112. },
  113. created() {
  114. },
  115. mounted() {
  116. this.systemUserProfile();
  117. this.examPointsRecordGetMyPointsLogInfo();
  118. },
  119. methods: {
  120. goPage(type) {
  121. if (!pageRestrictVerify(type)) {
  122. uni.showToast({
  123. title: '没有相关权限,请联系管理员',
  124. icon: "none",
  125. mask: true,
  126. duration: 2000
  127. });
  128. return
  129. }
  130. if (type == 'riskEarlyWarning') {
  131. //风险预警
  132. } else if (type == 'entryAndExitRecord') {
  133. //进出记录
  134. } else if (type == 'accessControlAuthorization') {
  135. //门禁授权
  136. } else if (type == 'identityAuthentication') {
  137. //身份验证
  138. } else if (type == 'electronicSignature') {
  139. //电子签名
  140. }
  141. },
  142. //获取个人信息
  143. async systemUserProfile() {
  144. const {
  145. data
  146. } = await systemUserProfile();
  147. if (data.code == 200) {
  148. this.$set(this, 'userData', data.data)
  149. uni.setStorageSync('faceImg', data.data.faceImg);
  150. }
  151. },
  152. //查询学生-信用分/奖励分
  153. async examPointsRecordGetMyPointsLogInfo() {
  154. const {
  155. data
  156. } = await examPointsRecordGetMyPointsLogInfo();
  157. if (data.code == 200) {
  158. this.bonusPoints = data.data.bonusPoints;
  159. this.creditScore = data.data.creditScore;
  160. }
  161. },
  162. //退出按钮
  163. clickOut() {
  164. let self = this;
  165. uni.showModal({
  166. // title: '确认要退出吗?',
  167. content: '确认要退出吗',
  168. cancelColor: "#999",
  169. confirmColor: "#0183FA",
  170. success: function(res) {
  171. if (res.confirm) {
  172. self.logout();
  173. } else if (res.cancel) {}
  174. }
  175. });
  176. },
  177. //退出登录
  178. async logout() {
  179. let self = this;
  180. const {
  181. data
  182. } = await logout();
  183. if (data.code == 200) {
  184. uni.removeStorageSync('token');
  185. uni.removeStorageSync('userId');
  186. uni.removeStorageSync('userType');
  187. uni.redirectTo({
  188. url: '/pages/views/login/login',
  189. });
  190. }
  191. },
  192. // 头像上传
  193. selectImage() {
  194. let self = this;
  195. wx.chooseImage({
  196. count: 1,
  197. sizeType: ["original", "compressed"],
  198. sourceType: ["album", "camera"],
  199. success: function(res) {
  200. let tempFilePaths = res.tempFilePaths[0];
  201. self.uploadImg(tempFilePaths);
  202. }
  203. });
  204. },
  205. async uploadImg(tempFilePaths) {
  206. var self = this;
  207. uni.showLoading({
  208. title: '上传中',
  209. mask: true
  210. });
  211. uni.uploadFile({
  212. url: config.base_url + '/system/file/upload', //仅为示例,非真实的接口地址
  213. header: {
  214. 'Authorization': uni.getStorageSync('token')
  215. },
  216. filePath: tempFilePaths,
  217. name: 'file',
  218. formData: {
  219. 'user': 'test'
  220. },
  221. success: (uploadFileRes) => {
  222. let res = JSON.parse(uploadFileRes.data);
  223. if (res.code == 200) {
  224. uni.navigateTo({
  225. url: '/pages_basics/views/avatar?src=' + config.base_url + res.data.url,
  226. });
  227. } else {
  228. uni.showToast({
  229. title: res.msg,
  230. icon: "none",
  231. mask: true,
  232. duration: 2000
  233. });
  234. }
  235. },
  236. fail: err => {},
  237. complete: () => {
  238. uni.hideLoading()
  239. }
  240. });
  241. },
  242. }
  243. }
  244. </script>
  245. <style lang="stylus" scoped>
  246. .teacherMine {
  247. flex: 1;
  248. display: flex;
  249. flex-direction: column;
  250. overflow: hidden;
  251. .back-img-box{
  252. z-index:0;
  253. position: absolute;
  254. top:0;
  255. left: 0;
  256. width:750rpx;
  257. height:291rpx;
  258. background: linear-gradient(180deg, rgba(1,131,250,1) 0%, rgba(255,255,255,0) 100%);
  259. }
  260. .user-info-box{
  261. z-index:10;
  262. margin:39rpx 24rpx 0;
  263. display: flex;
  264. .left-img-box{
  265. width:132rpx;
  266. height:132rpx;
  267. position: relative;
  268. margin-right:22rpx;
  269. .avatar-img{
  270. position: absolute;
  271. top:6rpx;
  272. left:6rpx;
  273. width:116rpx;
  274. height:116rpx;
  275. border-radius:50%;
  276. border:2rpx solid #fff;
  277. }
  278. .edit-img{
  279. z-index:5;
  280. position: absolute;
  281. right:0;
  282. bottom:6rpx;
  283. width:40rpx;
  284. height:40rpx;
  285. }
  286. }
  287. .right-name-box{
  288. padding-top:6rpx;
  289. .right-name-top-box{
  290. display: flex;
  291. view:nth-child(1){
  292. height:68rpx;
  293. line-height:62rpx;
  294. font-size:32rpx;
  295. color:#fff;
  296. }
  297. view:nth-child(2){
  298. margin-top:14rpx;
  299. margin-left:30rpx;
  300. width: 120rpx;
  301. height:40rpx;
  302. line-height:40rpx;
  303. background: #FF8C00;
  304. border-radius: 50rpx;
  305. font-size:24rpx;
  306. color:#fff;
  307. text-align: center;
  308. }
  309. }
  310. .right-name-bottom-box{
  311. height:50rpx;
  312. line-height:50rpx;
  313. font-size:28rpx;
  314. color:#fff;
  315. }
  316. }
  317. }
  318. .points-max-box{
  319. z-index:10;
  320. width: 690rpx;
  321. height: 160rpx;
  322. background: #FFFFFF;
  323. border-radius: 20rpx;
  324. margin:38rpx 30rpx 0;
  325. display: flex;
  326. .points-big-box{
  327. flex:1;
  328. .num-p{
  329. margin:39rpx 0 19rpx 0;
  330. text-align: center;
  331. font-size:28rpx;
  332. line-height:39rpx;
  333. }
  334. .img-box{
  335. display: flex;
  336. img{
  337. width:30rpx;
  338. height:30rpx;
  339. display: block;
  340. margin:0 20rpx 0 42rpx;
  341. }
  342. view{
  343. color:#333333;
  344. line-height:30rpx;
  345. font-size:28rpx;
  346. }
  347. }
  348. .colorA{
  349. color:#0183FA;
  350. }
  351. .colorB{
  352. color:#26C736;
  353. }
  354. .colorC{
  355. color:#333333;
  356. }
  357. }
  358. .border-null-p{
  359. width:1rpx;
  360. height:40rpx;
  361. margin:60rpx 0 0;
  362. background-color: #e0e0e0;
  363. }
  364. }
  365. .button-max-big-box{
  366. background-color: #fff;
  367. border-radius:20rpx;
  368. margin:20rpx 30rpx 0;
  369. .button-big-box:nth-child(1){
  370. border-top:none;
  371. }
  372. .button-big-box{
  373. border-top:1px solid #E0E0E0;
  374. display: flex;
  375. padding:0 30rpx 0 26rpx;
  376. .left-img{
  377. display: block;
  378. width:36rpx;
  379. height:36rpx;
  380. margin-top:25rpx;
  381. margin-right:21rpx;
  382. }
  383. .left-text-p{
  384. flex:1;
  385. front-size:30rpx;
  386. line-height:40rpx;
  387. margin:20rpx 0;
  388. }
  389. .right-text-p{
  390. front-size:30rpx;
  391. line-height:40rpx;
  392. margin:20rpx 0;
  393. }
  394. .right-img{
  395. display: block;
  396. width:30rpx;
  397. height:30rpx;
  398. margin-top:28rpx;
  399. }
  400. }
  401. }
  402. .out-button {
  403. position absolute;
  404. bottom: 140rpx;
  405. left: 75rpx;
  406. width: 600rpx;
  407. height: 80rpx;
  408. line-height: 80rpx;
  409. border-radius: 100rpx;
  410. text-align center;
  411. background #0183FA;
  412. color: #ffffff;
  413. font-size: 30rpx;
  414. margin: 0 auto;
  415. }
  416. }
  417. </style>