teacherMine.vue 12 KB

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