teacherMine.vue 12 KB

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