teacherMine.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485
  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" @click="scanCode()">
  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. studentinfoFacemy,
  94. examPointsRecordGetMyPointsLogInfo,
  95. } from '@/pages/api/index.js'
  96. import {
  97. pageRestrictVerify
  98. } from '@/utils/index'
  99. import {
  100. tabBar
  101. } from '@/pages/component/tabBar.vue'
  102. export default {
  103. name: "teacherMine",
  104. components: {
  105. tabBar,
  106. },
  107. data() {
  108. return {
  109. userData:{},
  110. bonusPoints:null,
  111. creditScore:null,
  112. ifFaceFeature:false,
  113. isUpload:false,
  114. }
  115. },
  116. created() {
  117. },
  118. mounted() {
  119. this.systemUserProfile();
  120. this.studentinfoFacemy();
  121. this.examPointsRecordGetMyPointsLogInfo();
  122. },
  123. methods: {
  124. scanCode(){
  125. uni.scanCode({
  126. onlyFromCamera: true,
  127. success: function(res) {
  128. if(res.result.indexOf('mid') != -1 &&
  129. res.result.indexOf('sid') != -1 &&
  130. res.result.indexOf('pid') != -1 &&
  131. res.result.indexOf('pri') != -1 ){
  132. uni.navigateTo({
  133. url: '/pages_student/views/integralManage/codeSuccess?q=' +
  134. encodeURIComponent(JSON.stringify(res.result))
  135. });
  136. }else{
  137. uni.showToast({
  138. title: '请扫描正确的二维码',
  139. icon: "none",
  140. mask: true,
  141. duration: 2000
  142. });
  143. }
  144. }
  145. });
  146. },
  147. goPage(type) {
  148. if(!type){
  149. uni.showToast({
  150. title: '暂未开放',
  151. icon: "none",
  152. mask: true,
  153. duration: 2000
  154. });
  155. return
  156. }
  157. if (!pageRestrictVerify(type)) {
  158. uni.showToast({
  159. title: '没有相关权限,请联系管理员',
  160. icon: "none",
  161. mask: true,
  162. duration: 2000
  163. });
  164. return
  165. }
  166. if (type == 'riskEarlyWarning') {
  167. //风险预警
  168. uni.navigateTo({
  169. url: "/pages_basics/views/earlyWarningManage/earlyWarningList",
  170. });
  171. } else if (type == 'entryAndExitRecord') {
  172. //进出记录
  173. uni.navigateTo({
  174. url: "/pages_basics/views/record/index",
  175. });
  176. } else if (type == 'accessControlAuthorization') {
  177. //门禁授权
  178. uni.navigateTo({
  179. url: "/pages_manage/views/accessControl/empowerOpen",
  180. });
  181. } else if (type == 'identityAuthentication') {
  182. //身份验证
  183. uni.navigateTo({
  184. url: "/pages_basics/views/faceImage",
  185. });
  186. } else if (type == 'electronicSignature') {
  187. //电子签名
  188. uni.navigateTo({
  189. url: "/pages_basics/views/signature/signature",
  190. });
  191. }
  192. },
  193. //获取个人信息
  194. async systemUserProfile() {
  195. const {
  196. data
  197. } = await systemUserProfile();
  198. if (data.code == 200) {
  199. this.$set(this, 'userData', data.data)
  200. uni.setStorageSync('faceImg', data.data.faceImg);
  201. }
  202. },
  203. //查询学生-信用分/奖励分
  204. async examPointsRecordGetMyPointsLogInfo() {
  205. const {
  206. data
  207. } = await examPointsRecordGetMyPointsLogInfo();
  208. if (data.code == 200) {
  209. this.bonusPoints = data.data.bonusPoints;
  210. this.creditScore = data.data.creditScore;
  211. }
  212. },
  213. //获取当前身份人脸验证状态与学生卡上传状态
  214. async studentinfoFacemy(){
  215. let obj = {
  216. studentsId:uni.getStorageSync('userId')
  217. }
  218. const {data} = await studentinfoFacemy(obj)
  219. if(data.code == 200){
  220. this.certification = data.data;
  221. this.ifFaceFeature = data.data.ifFaceFeature;
  222. }
  223. },
  224. //退出按钮
  225. clickOut() {
  226. let self = this;
  227. uni.showModal({
  228. // title: '确认要退出吗?',
  229. content: '确认要退出吗',
  230. cancelColor: "#999",
  231. confirmColor: "#0183FA",
  232. success: function(res) {
  233. if (res.confirm) {
  234. self.logout();
  235. } else if (res.cancel) {}
  236. }
  237. });
  238. },
  239. //退出登录
  240. async logout() {
  241. let self = this;
  242. const {
  243. data
  244. } = await logout();
  245. if (data.code == 200) {
  246. uni.removeStorageSync('token');
  247. uni.removeStorageSync('userId');
  248. uni.removeStorageSync('userType');
  249. uni.redirectTo({
  250. url: '/pages/views/login/login',
  251. });
  252. }
  253. },
  254. // 头像上传
  255. selectImage() {
  256. let self = this;
  257. wx.chooseImage({
  258. count: 1,
  259. sizeType: ["original", "compressed"],
  260. sourceType: ["album", "camera"],
  261. success: function(res) {
  262. let tempFilePaths = res.tempFilePaths[0];
  263. self.uploadImg(tempFilePaths);
  264. }
  265. });
  266. },
  267. async uploadImg(tempFilePaths) {
  268. var self = this;
  269. uni.showLoading({
  270. title: '上传中',
  271. mask: true
  272. });
  273. uni.uploadFile({
  274. url: config.base_url + '/system/file/upload', //仅为示例,非真实的接口地址
  275. header: {
  276. 'Authorization': uni.getStorageSync('token')
  277. },
  278. filePath: tempFilePaths,
  279. name: 'file',
  280. formData: {
  281. 'user': 'test'
  282. },
  283. success: (uploadFileRes) => {
  284. let res = JSON.parse(uploadFileRes.data);
  285. if (res.code == 200) {
  286. uni.navigateTo({
  287. url: '/pages_basics/views/avatar?src=' + config.base_url + res.data.url,
  288. });
  289. } else {
  290. uni.showToast({
  291. title: res.msg,
  292. icon: "none",
  293. mask: true,
  294. duration: 2000
  295. });
  296. }
  297. },
  298. fail: err => {},
  299. complete: () => {
  300. uni.hideLoading()
  301. }
  302. });
  303. },
  304. }
  305. }
  306. </script>
  307. <style lang="stylus" scoped>
  308. .teacherMine {
  309. flex: 1;
  310. display: flex;
  311. flex-direction: column;
  312. overflow: hidden;
  313. .back-img-box{
  314. z-index:0;
  315. position: absolute;
  316. top:0;
  317. left: 0;
  318. width:750rpx;
  319. height:291rpx;
  320. background: linear-gradient(180deg, rgba(1,131,250,1) 0%, rgba(255,255,255,0) 100%);
  321. }
  322. .user-info-box{
  323. z-index:10;
  324. margin:39rpx 24rpx 0;
  325. display: flex;
  326. .left-img-box{
  327. width:132rpx;
  328. height:132rpx;
  329. position: relative;
  330. margin-right:22rpx;
  331. .avatar-img{
  332. position: absolute;
  333. top:6rpx;
  334. left:6rpx;
  335. width:116rpx;
  336. height:116rpx;
  337. border-radius:50%;
  338. border:2rpx solid #fff;
  339. }
  340. .edit-img{
  341. z-index:5;
  342. position: absolute;
  343. right:0;
  344. bottom:6rpx;
  345. width:40rpx;
  346. height:40rpx;
  347. }
  348. }
  349. .right-name-box{
  350. padding-top:6rpx;
  351. .right-name-top-box{
  352. display: flex;
  353. view:nth-child(1){
  354. height:68rpx;
  355. line-height:62rpx;
  356. font-size:32rpx;
  357. color:#fff;
  358. }
  359. view:nth-child(2){
  360. margin-top:14rpx;
  361. margin-left:30rpx;
  362. width: 120rpx;
  363. height:40rpx;
  364. line-height:40rpx;
  365. background: #FF8C00;
  366. border-radius: 50rpx;
  367. font-size:24rpx;
  368. color:#fff;
  369. text-align: center;
  370. }
  371. }
  372. .right-name-bottom-box{
  373. height:50rpx;
  374. line-height:50rpx;
  375. font-size:28rpx;
  376. color:#fff;
  377. }
  378. }
  379. }
  380. .points-max-box{
  381. z-index:10;
  382. width: 690rpx;
  383. height: 160rpx;
  384. background: #FFFFFF;
  385. border-radius: 20rpx;
  386. margin:38rpx 30rpx 0;
  387. display: flex;
  388. .points-big-box{
  389. flex:1;
  390. .num-p{
  391. margin:39rpx 0 19rpx 0;
  392. text-align: center;
  393. font-size:28rpx;
  394. line-height:39rpx;
  395. }
  396. .img-box{
  397. display: flex;
  398. img{
  399. width:30rpx;
  400. height:30rpx;
  401. display: block;
  402. margin:0 20rpx 0 42rpx;
  403. }
  404. view{
  405. color:#333333;
  406. line-height:30rpx;
  407. font-size:28rpx;
  408. }
  409. }
  410. .colorA{
  411. color:#0183FA;
  412. }
  413. .colorB{
  414. color:#26C736;
  415. }
  416. .colorC{
  417. color:#333333;
  418. }
  419. }
  420. .border-null-p{
  421. width:1rpx;
  422. height:40rpx;
  423. margin:60rpx 0 0;
  424. background-color: #e0e0e0;
  425. }
  426. }
  427. .button-max-big-box{
  428. background-color: #fff;
  429. border-radius:20rpx;
  430. margin:20rpx 30rpx 0;
  431. .button-big-box:nth-child(1){
  432. border-top:none;
  433. }
  434. .button-big-box{
  435. border-top:1px solid #E0E0E0;
  436. display: flex;
  437. padding:0 30rpx 0 26rpx;
  438. .left-img{
  439. display: block;
  440. width:36rpx;
  441. height:36rpx;
  442. margin-top:25rpx;
  443. margin-right:21rpx;
  444. }
  445. .left-text-p{
  446. flex:1;
  447. front-size:30rpx;
  448. line-height:40rpx;
  449. margin:20rpx 0;
  450. }
  451. .right-text-p{
  452. front-size:30rpx;
  453. line-height:40rpx;
  454. margin:20rpx 0;
  455. }
  456. .right-img{
  457. display: block;
  458. width:30rpx;
  459. height:30rpx;
  460. margin-top:28rpx;
  461. }
  462. }
  463. }
  464. .out-button {
  465. position absolute;
  466. bottom: 140rpx;
  467. left: 75rpx;
  468. width: 600rpx;
  469. height: 80rpx;
  470. line-height: 80rpx;
  471. border-radius: 100rpx;
  472. text-align center;
  473. background #0183FA;
  474. color: #ffffff;
  475. font-size: 30rpx;
  476. margin: 0 auto;
  477. }
  478. }
  479. </style>